AQI Sensor LoRaWAN

Get device data

Request URL:

POST /provider/fetch

Headers:

Content-Type: application/json
Authorization: Bearer {access_token}

Body:

{
"serial_number" : "{AQI-Sensor Serial Number}"
}

Response:

{
"provider": {
"network_provider": "the_things_network",
"rssi": -73,
"spf": "SF7BW125",
"sAQI": 48,
"AQI": 48,
"CO2eq": 608,
"VOC": 0,
"relative_humidity": 27.6,
"pressure": 983.6,
"temperature": 23.5,
"accuracy_aqi": 3,
"voltage": 3.432,
"uplinkType": "01",
"keepAliveTime": 3,
"joinRetryPeriod": 2,
"deviceVersions": {
"hardware": 16,
"software": 16
},
"createdAt": "2021-02-24T21:34:44.698Z",
"lastActive": "2021-02-24T22:12:40.343Z",
"watchDogParams": {
"wdpC": 17,
"wdpUc": 24
},
"online": true,
"mac": "363936367A396B18"
},
"_links": {
"self": {
"href": "/v1/provider/fetch"
}
}
}

Set KeepAlive Time

Request URL:

POST /provider/send

Headers:

Content-Type: application/json
Authorization: Bearer {access_token}

Body:

{
"serial_number": “{AQI-Sensor Serial Number}”,
"command" : "set_keepalive_time",
"time" : 3 // in minutes
}

Response:

{
"provider": {
"status": "pending",
"_id": "6036c743994ab35c7c701b8f",
"commandName": "SetKeepAlive",
"commandParams": {
"time": 3
},
"deviceId": "36*************8",
"createdAt": "2021-02-24T21:38:11.155Z",
"__v": 0
},
"_links": {
"self": {
"href": "/v1/provider/send"
}
}
}

Get KeepAlive Time

Request URL:

POST /provider/send

Headers:

Content-Type: application/json
Authorization: Bearer {access_token}

Body:

{
"serial_number": “{AQI-Sensor Serial Number}”,
"command" : "get_keepalive_time"
}

Response:

{
"provider": {
"status": "pending",
"_id": "6036c795994ab35c7c701b95",
"commandName": "GetKeepAliveTime",
"commandParams": [],
"deviceId": "36*************8",
"createdAt": "2021-02-24T21:39:33.922Z",
"__v": 0
},
"_links": {
"self": {
"href": "/v1/provider/send"
}
}
}

Get Device Version

Request URL:

POST /provider/fetch

Headers:

Content-Type: application/json
Authorization: Bearer {access_token}

Body:

{
"serial_number" : "{AQI-Sensor Serial Number}",
"command" : "get_device_version"
}

Response:

{
"provider": {
"status": "pending",
"_id": "6036c987994ab35c7c701bac",
"commandName": "GetDeviceVersion",
"commandParams": [],
"deviceId": "36*************8",
"createdAt": "2021-02-24T21:47:51.812Z",
"__v": 0
},
"_links": {
"self": {
"href": "/v1/provider/send"
}
}
}

Set Join Retry Period

Request URL:

POST /provider/send

Headers:

Content-Type: application/json
Authorization: Bearer {access_token}

Body:

{
"serial_number": “{AQI-Sensor Serial Number}”,
"command" : "set_join_retry_period",
"period" : 2, //minutes, cannot be 0
}

Response:

{
"provider": {
"status": "pending",
"_id": "6036c9c3994ab35c7c701bb1",
"commandName": "SetJoinRetryPeriod",
"commandParams": {
"period": 2
},
"deviceId": "36*************8",
"createdAt": "2021-02-24T21:48:51.970Z",
"__v": 0
},
"_links": {
"self": {
"href": "/v1/provider/send"
}
}
}

Get Join Retry Period

Request URL:

POST /provider/send

Headers:

Content-Type: application/json
Authorization: Bearer {access_token}

Body:

{
"serial_number": “{HT-Sensor Serial Number}”,
"command" : "get_join_retry_period"
}

Response:

{
"provider": {
"status": "pending",
"_id": "6036caaf994ab35c7c701bbe",
"commandName": "GetJoinRetryPeriod",
"commandParams": [],
"deviceId": "36*************8",
"createdAt": "2021-02-24T21:52:47.045Z",
"__v": 0
},
"_links": {
"self": {
"href": "/v1/provider/send"
}
}
}

Request URL:

POST /provider/send

Headers:

Content-Type: application/json
Authorization: Bearer {access_token}

Body:

{
"serial_number": “{AQI-Sensor Serial Number}”,
"command" : "set_uplink_type",
"type" : "01" // string, "00" - unconfirmed, "01" - confirmed
}

Response:

{
"provider": {
"status": "pending",
"_id": "6036cb0a994ab35c7c701bc4",
"commandName": "SetUplinkType",
"commandParams": {
"type": "01"
},
"deviceId": "36*************8",
"createdAt": "2021-02-24T21:54:18.528Z",
"__v": 0
},
"_links": {
"self": {
"href": "/v1/provider/send"
}
}
}

Request URL:

POST /provider/send

Headers:

Content-Type: application/json
Authorization: Bearer {access_token}

Body:

{
"serial_number": “{HT-Sensor Serial Number}”,
"command" : "get_uplink_type"
}

Response:

{
"provider": {
"status": "pending",
"_id": "6036cb66994ab35c7c701bcb",
"commandName": "GetUplinkType",
"commandParams": [],
"deviceId": "36*************8",
"createdAt": "2021-02-24T21:55:50.153Z",
"__v": 0
},
"_links": {
"self": {
"href": "/v1/provider/send"
}
}
}

Set Buzzer

Request URL:

POST /provider/send

Headers:

Content-Type: application/json
Authorization: Bearer {access_token}

Body:

{
"serial_number": “{AQI Serial Number}”,
"command" : "set_buzzer",
"volume" : 0, // Volume 15 - off, 0 - min... 14 - max
"frequency" : 1, // range 0 - 10
"active_time" : 2, // seconds; 0 - untill volume 15 is received
"on_time" : 1, // ms; min 10ms
"off_time" : 2 // ms; min 10ms
}

Response:

{
"provider": {
"status": "pending",
"_id": "602fba020a9764116d41b563",
"commandName": "SetBuzzer",
"commandParams": {
"volume": 0,
"frequency": 1,
"activeTime": 2,
"onTime": 1,
"offTime": 2
},
"deviceId": "36*************8",
"createdAt": "2021-02-19T13:15:46.578Z",
"__v": 0
},
"_links": {
"self": {
"href": "/v1/provider/send"
}
}
}

Set AQI Led

Request URL:

POST /provider/send

Headers:

Content-Type: application/json
Authorization: Bearer {access_token}

Body:

{
"serial_number": “{AQI Serial Number}”,
"command" : "set_aqi_led",
"red_behavior": 3, // 1- turn on, 2- blink fast, 3-blik slow, 4-turn off
"red_duration": 80, // in seconds, if it`s 0 -until it’s changed from new radio
// command or the device button is pressed
"green_behavior": 4,
"green_duration": 0,
"blue_behavior": 3,
"blue_duration": 80
}

Response:

{
"provider": {
"status": "pending",
"_id": "6037a0aa87c54b23ecebf846",
"commandName": "SetAqiLed",
"commandParams": {
"redBehavior": 3,
"redDuration": 80,
"greenBehavior": 0,
"greenDuration": 0,
"blueBehavior": 3,
"blueDuration": 70
},
"deviceId": "36*************8",
"createdAt": "2021-02-25T13:05:46.224Z",
"__v": 0
},
"_links": {
"self": {
"href": "/v1/provider/send"
}
}
}

Set Watch Dog Params

Request URL:

POST /provider/send

Headers:

Content-Type: application/json
Authorization: Bearer {access_token}

Body:

{
"serial_number": “{AQI Serial Number}”,
"command" : "set_watch_dog_params",
"period_confirmen_uplinks": 17, // in minutes, if it is disabled "0"
//period_confirmen_uplinks !MUST! BE DIVIDABLE BY DEVICE KEEPALIVE PERIOD+ 7
"period_unconfirmen_uplinks":24, // in hours, if it is disabled "0"
"device_keepalive":3 // in minutes
}

Response:

{
"provider": {
"status": "pending",
"_id": "6035505708f81715fffd19c0",
"commandName": "SetWatchDogParams",
"commandParams": {
"periodConfirmenUplinks": 17,
"periodUnconfirmenUplinks": 24,
"deviceKeepAlive": 3
},
"deviceId": "36*************8",
"createdAt": "2021-02-23T18:58:31.945Z",
"__v": 0
},
"_links": {
"self": {
"href": "/v1/provider/send"
}
}
}

Get Watch Dog Params

Request URL:

POST /provider/send

Headers:

Content-Type: application/json
Authorization: Bearer {access_token}

Body:

{
"serial_number": “{AQI Serial Number}”,
"command" : "get_watch_dog_params"
}

Response:

{
"provider": {
"status": "pending",
"_id": "6036ce5bf6c1b85f22d280cc",
"commandName": "GetWatchDogParams",
"commandParams": [],
"deviceId": "36*************8",
"createdAt": "2021-02-24T22:08:27.116Z",
"__v": 0
},
"_links": {
"self": {
"href": "/v1/provider/send"
}
}
}