Flood Sensor LoRaWAN
Get device data
Request URL:
POST /provider/fetch
Headers:
Content-Type: application/json
Authorization: Bearer {access_token}
Body:
{
"serial_number" : "{Flood Serial Number}"
}
Response:
{
"provider": {
"network_provider": "the_things_network",
"rssi": 0,
"boxTamper": false,
"flood": false,
"temperature": 24,
"battery": 3.088,
"createdAt": "2021-02-08T15:15:22.516Z",
"lastActive": "2021-02-19T15:36:44.731Z",
"online": false
},
"_links": {
"self": {
"href": "/v1/provider/fetch"
}
}
}
Get Temperature
Request URL:
POST /provider/fetch
Headers:
Content-Type: application/json
Authorization: Bearer {access_token}
Body:
{
"serial_number" : "{Flood Serial Number}",
"command" : "get_temperature"
}
Response:
{
"provider": {
"status": "pending",
"_id": "603114ad0355950a25d5175e",
"commandName": "GetTemperature",
"commandParams": "",
"deviceId": "313638353E387F18",
"createdAt": "2021-02-20T13:54:53.497Z",
"__v": 0
},
"_links": {
"self": {
"href": "/v1/provider/send"
}
}
}
Set KeepAlive Time
Request URL:
POST /provider/send
Headers:
Content-Type: application/json
Authorization: Bearer {access_token}
Body:
{
"serial_number": “{Flood Serial Number}”,
"command" : "set_keepalive_time",
"time" : 3 // in minutes
}
Response:
{
"provider": {
"status": "pending",
"_id": "602fa06f0a9764116d41b4ab",
"commandParams": {
"time": 3
},
"commandName": "SetFloodPacketPeriod",
"deviceId": "3************1",
"createdAt": "2021-02-19T11:26:39.004Z",
"__v": 0
},
"_links": {
"self": {
"href": "/v1/provider/send"
}
}
}
Set Flood Alarm Time
Request URL:
POST /provider/send
Headers:
Content-Type: application/json
Authorization: Bearer {access_token}
Body:
{
"serial_number": “{Flood Serial Number}”,
"command" : "set_flood_alarm_time",
"time" : 10, //seconds, cannot be 0
}
Response:
{
"provider": {
"status": "pending",
"_id": "603117d8fd3e800bf072899f",
"commandName": "SetFloodAlarmTime",
"commandParams": {
"time": 10
},
"deviceId": "31**************18",
"createdAt": "2021-02-20T14:08:24.155Z",
"__v": 0
},
"_links": {
"self": {
"href": "/v1/provider/send"
}
}
}
Set LED
Request URL:
POST /provider/send
Headers:
Content-Type: application/json
Authorization: Bearer {access_token}
Body:
{
"serial_number": “{Flood Serial Number}”,
"command" : "set_led",
"led_id" : 0,
"behavior" : 1,
"senonds" : 2 //IF seconds=0, execute the command until OK button is pressed or
//next command is received
}
Response:
{
"provider": {
"status": "pending",
"_id": "602fba020a9764116d41b563",
"commandName": "SetLED",
"commandParams": {
"ledId": 0,
"behavior": 1,
"seconds": 2
},
"deviceId": "363************1",
"createdAt": "2021-02-19T13:15:46.578Z",
"__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": “{Flood 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" : 10, // ms; min 10ms
"off_time" : 20 // ms; min 10ms
}
Response:
{
"provider": {
"status": "pending",
"_id": "602fba020a9764116d41b563",
"commandName": "SetBuzzer",
"commandParams": {
"volume": 0,
"frequency": 1,
"activeTime": 2,
"onTime": 1,
"offTime": 2
},
"deviceId": "363************1",
"createdAt": "2021-02-19T13:15:46.578Z",
"__v": 0
},
"_links": {
"self": {
"href": "/v1/provider/send"
}
}
}
"href": "/v1/provider/send"
}
}
}
Last updated