GET /admin/user
Sample Response:
[
{
"userID": "00000000-0000-0000-0000-0000000000000",
"username": "test",
"hash": "0uathu049ighn3thpukrkucg039yhintuich.09ig0.8"
},
...
]
requires Admin token
DELETE /admin/user
Sample Request:
{
"userID": "1234"
}
requires admin token
POST /admin/script
Sample Request:
{
"scriptName": "default",
"script": "if(light > 2)then end"
}
scriptName is optional
requires admin token
POST /create
Sample Request:
{
"username": "Test",
"password": "test"
}
returns token
POST /token
Sample Request:
{
"username": "Test",
"password": "test"
}
returns token for existing user
POST /device/(deviceID)
Sample Request:
{
"deviceName": "Living room alarm"
}
requires User Token
PUT /device/(deviceID)
Sample Request:
{
"deviceName": "This is actually not the living room"
}
requires token
DELETE /device/(deviceID)
Requires User Token
GET /device
Sample Response:
[
{
"deviceID": "deviceid",
"deviceName": "deviceName"
}
]
Requires User Token
0 - temperature
1 - humidity
2 - light
3 - noise
POST /sensors/(sensorType)/(deviceID)
Sample Request:
{
"value": 20.0
}
GET /sensors/(sensorType)/(deviceID)
Sample Response:
[
{
"id": 0,
"value": 0,
"timestamp": 0
}
]
POST /sensor/motion/:deviceID
POST /script
Sample Request:
{
"scriptName": "default",
"script": "if(temperature < 20 & noise > 400) then kettle; end"
}
scriptName is optional
requires user token
GET /script
Sample Response:
{
"script": "if(temperature < 20 & noise > 400) then kettle; end"
}
DELETE /script
returns OK
requires user token
POST /actuator/kettle
Sample request:
{
"on": true
}
returns OK
POST /actuator/lights
Sample request:
{
"isWhite": false,
"hue": 255,
"brightness": 255
}
returns OK
requires Token
POST /actuator/plug
Sample request:
{
"on": true
}
returns OK
requires token
POST /actuator/alarm
Sample Request:
{
"on": true
}
GET /flashPhoton/:deviceID
returns 200
POST /idealTemp
Sample Request:
{
"temp": 20
}
GET /idealTemp
Sample Response:
{
"temp": 20
}
POST /zone
Sample Request:
{
"zoneName": "Zone 1"
}
DELETE /zone
Sample Request:
{
"zoneName": "Zone 1"
}
GET /zone
Sample response:
[
{
"id": "0",
"userID": "00000000-0000-0000-0000-0000000000000",
"name": "Zone 1"
},
...
]
Bridge WebSocket ws://<ip>/bridgeWS
if(temperature > 10 & humidity > 10 & light > 10 & noise > 10) then
email;
text;
notification;
kettle;
lights on;
lightSetting true, 200, 20;
end
lights command has parameters:
- on
- off
lightSetting command has parameters:
- isWhite: true, false
- hue: Color as a hue value between 0 and 255
- brightness: brightness as a value between 0 and 20