improved

Webhooks - Improved occupancy feed

✨ Improvements

The purpose of our webhook event types is to deliver data as soon as it's generated in the Airthings platform with minimal latency and maximum performance. For this reason, the "occupancy-sample-feed" currently provides only the most recent occupancy data points. The algorithm providing the occupancy data does however calculate occupancy for the past two hours every time it runs - the reason for this being that the accuracy of the sensor improves over time when it has more data to digest. This means that webhook clients currently rely on using the API to collect the most accurate occupancy data from the history endpoint.

Since some of our webhook clients don't have an active API connection, we'd like to offer all the available data from the occupancy sensor in the webhook feed. This means that you will now receive 24 datapoints (2 hours of data with a 5 minute interval) from each device's occupancy sensor instead of 1 when subscribing to the occupancy data feed. The format of the data remains the same, with additional data objects added in the data array:

{
	"id": "fd28e5b5-a1c6-4c99-82fc-b7c73072e852",
	"type": "airthings-webhook-cloudevent-occupancy-sample-feed",
	"source": "https://dashboard.airthings.com/integrations/webhooks/3ae27258-314e-41ae-98ca-ae1702eea68d?version=v2",
	"dataContentType": "application/json",
	"labels": {},
	"data": [
		{
			"serialNumber": "2969000446",
			"recorded": "2023-07-06T07:15",
			"occupants": 2,
			"occupantsUpper": 4,
			"occupantsLower": 0,
			"sensorUnits": {
				"occupants": "occ"
			}
		}
	],
	"time": "2023-07-06T07:19:36.632024",
	"specVersion": "0.2"
}
{
	"id": "fd28e5b5-a1c6-4c99-82fc-b7c73072e852",
	"type": "airthings-webhook-cloudevent-occupancy-sample-feed",
	"source": "https://dashboard.airthings.com/integrations/webhooks/3ae27258-314e-41ae-98ca-ae1702eea68d?version=v2",
	"dataContentType": "application/json",
	"labels": {},
	"data": [
		{
			"serialNumber": "2969000446",
			"recorded": "2023-07-06T07:15",
			"occupants": 2,
			"occupantsUpper": 4,
			"occupantsLower": 0,
			"sensorUnits": {
				"occupants": "occ"
			}
		},
		{
			"serialNumber": "2969000446",
			"recorded": "2023-07-06T07:20",
			"occupants": 2,
			"occupantsUpper": 4,
			"occupantsLower": 0,
			"sensorUnits": {
				"occupants": "occ"
			}
		},
		{
			"serialNumber": "2969000446",
			"recorded": "2023-07-06T07:25",
			"occupants": 2,
			"occupantsUpper": 4,
			"occupantsLower": 0,
			"sensorUnits": {
				"occupants": "occ"
			}
		},
    // ... (next 21 objects)
	],
	"time": "2023-07-06T07:19:36.632024",
	"specVersion": "0.2"
}

"occupantsUpper" and "occupantsLower" data points will still only be available if room size information has been added to the space containing the device.