The sleepace lamp-type equipment control API
sleepace lamp type equipment control
The third party can send the command message through the http interface provided by the sleepace service
Basic description of the http interface
Request protocol interface data format support: Content-Type: application / json
Response protocol interface data format: Content-Type: application / json
Protocol interface data character encoding: UTF-8
method:post
Parameter Basic Format
{
“token”:{
“appId”:”testAppId”,
“secureKey”:”testSecretKey”
},
“data”:{
“deviceId”: <
“isSave”: <
“operateList”:[
{
“The code”: <
“msgStr”: <
}
]
}
}
Token:
field | type | description |
---|---|---|
appId | string | For authentication (provided by Sleepace) |
secureKey | string | For authentication (provided by Sleepace) |
data
field | type | description |
---|---|---|
deviceId | string | equipment ID |
isSave | byte | Whether to save configuration 0: Do not save 1: Save the configuration to the device locally |
operateList | List |
functional composition |
Operate
field | type | description |
---|---|---|
code | byte | action code |
msgStr | String | Action message JSON string Follow the specific operation message |
respond:
{
“status”: <
“msg”: <
“The data”:, <
}
Close all
Turn off the lights, incense, sleep aid, and the alarm clock
Url
http(s)://domain{:port}/sleepace/operate/closeAll
The Operate parameter
- Close All: {code: 0}
Light operation
Url
http(s)://domain{:port}/sleepace/operate/light
The Operate parameter
- Light on: {code: 1}
- Turn off the lights: {code: 2}
- Adjust the brightness: {code: 3, msgStr: “{brightness: 10}”}
msgStr:
field | type | description |
---|---|---|
brightness | byte | Brightness: 1-100 |
Adjust the light mode: {code: 4, msgStr: “{lightMode: 0}”} | field | type | description | | —- | —- | —- | | lightMode | byte | 0: Normal mode
1: Streamlight mode |Adjust the light color: {code: 5, msgStr: “{colorR: 100, colorG: 100, colorB: 100, colorW: 100}”}
msgStr:
field | type | description |
---|---|---|
colorR | byte | 0-255 |
colorG | byte | 0-255 |
colorB | byte | 0-255 |
colorW | byte | 0-255 |
Incense operation
Url
http(s)://domain{:port}/sleepace/operate/aroma
The Operate parameter
- incense: {code: 6}
- Guan Xiang: {code: 7}
- Adjust the incense: {code: 8, msgStr: “{gears: 1}”}
msgStr:
field | type | description |
---|---|---|
gears | byte | 1-3 |
Sleep aid operation
Url
http(s)://domain{:port}/sleepace/operate/aid
The Operate parameter
- Open to help sleep:
{“code”:9,”msgStr”:”{startConfig:0,volume:10,brightness:10,colorR:30,colorG:100,colorB:100,colorW:100,rate:1,timeRange:1,musicId:0}”}
field | type | description |
---|---|---|
startConfig | byte | Enable additional configuration 0: Not enabled (no subsequent) 1:, Enable |
volume | byte | Volume (0-16) 0: Mute |
brightness | byte | Maximum light brightness (0-100) 0: No light |
colorR | byte | Light color R component 0-255 |
colorG | byte | Light color G component 0-255 |
colorB | byte | Light color component B is 0-255 |
colorW | byte | Light color W component 0-255 |
rate | byte | Incense rate 0: No,1-3: incense gear |
timeRange | byte | Auxiliary stop time in unit: minutes |
musicId | short | Local music number, 0 will use the device default sleep aid music |
- Guan Mian: {code: 10}
Alarm clock operation
Url
http(s)://domain{:port}/sleepace/operate/alarmClock
The Operate parameter
- Open the alarm clock: {code: 11}
- Turn off the alarm clock: {code: 12}
condition code
condition code | description |
---|---|
0 | success |
1 | The device is not online |
2 | Server Error |
3 | Device request timeout |
4 | Device or user is not bound |
5 | Device or user does not exist |
7 | Operation failed |
8 | The operating code is incorrect |
9 | parameter error |
10 | The failure of authentication |