Tutorial - Get CO2 Timeseries for a room
AIRICA measures air quality data on a continous basis. The measured data is stored as a timeseries, a series of data points indexed in time order. To retrieve this data, the field timeseries on the object Device can be used.
The field accepts the parameters ids and startDate and endDate. Please note that the maximum number of data fields you can request is limited and you might get a QUERY_TOO_COMPLEX error.
Request#
In the following query, we retrieve CO2 data and Healthscore data for 15 minutes for the first 5 buildings and the first 5 rooms of each building.
query { client { buildings(first: 5) { edges { node { name rooms(first: 5) { edges { node { name mainIaqSensor { timeseries ( ids: [CO2, HEALTHSCORE] startDate: "2021-09-06T06:45:30Z" endDate: "2021-09-06T07:00:30Z" ){ id data { time value } } } } } } } } } }}Response#
In the response you get a time sorted time series for both CO2 and Healthscore. Please note that the time difference between each measurement can vary and the number of data entries in a timeseries is not fixed.
{ "data": { "client": { "buildings": { "edges": [ { "node": { "name": "Building 1", "rooms": { "edges": [ { "node": { "name": "Room Mont Blanc", "mainIaqSensor": { "timeseries": [ { "id": "CO2", "data": [ { "time": "2021-09-06T06:45:30.000Z", "value": 652.7403749270534 }, { "time": "2021-09-06T06:47:10.000Z", "value": 694.2818137174095 }, { "time": "2021-09-06T06:48:50.000Z", "value": 732.3046172095087 }, { "time": "2021-09-06T06:50:30.000Z", "value": 769.3782301873831 }, { "time": "2021-09-06T06:52:10.000Z", "value": 800.6639164870526 }, { "time": "2021-09-06T06:53:50.000Z", "value": 822.5198392844362 }, { "time": "2021-09-06T06:55:30.000Z", "value": 832.8381842843864 }, { "time": "2021-09-06T06:57:10.000Z", "value": 811.0226489627958 }, { "time": "2021-09-06T06:58:50.000Z", "value": 760.5222388237733 }, { "time": "2021-09-06T07:00:30.000Z", "value": 735.0287410862004 } ] }, { "id": "HEALTHSCORE", "data": [ { "time": "2021-09-06T06:45:30.000Z", "value": 7.2 }, { "time": "2021-09-06T06:47:10.000Z", "value": 7.0 }, { "time": "2021-09-06T06:48:50.000Z", "value": 6.9 }, { "time": "2021-09-06T06:50:30.000Z", "value": 6.6 }, { "time": "2021-09-06T06:52:10.000Z", "value": 6.4 }, { "time": "2021-09-06T06:53:50.000Z", "value": 6.3 }, { "time": "2021-09-06T06:55:30.000Z", "value": 6.2 }, { "time": "2021-09-06T06:57:10.000Z", "value": 6.3 }, { "time": "2021-09-06T06:58:50.000Z", "value": 6.6 }, { "time": "2021-09-06T07:00:30.000Z", "value": 6.9 } ] } ] } } } ] } } } ] } } }}