Version: 2.2 Date: 2022-5-13
The device type is diy_light(type=diy_light) and the device API interface version is 1 (apivers=1).
URL:http://[ip]:[port]/zeroconf/info
json
Method:
1 2 3 4 | { "deviceid": "1000000001", "data": {} } |
Response body
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | { "seq": 2, "error": 0, "data": { "switch": "off", "startup": "off", "pulse": "off", "pulseWidth": 500, "ssid": "eWeLink", "otaUnlock": false, "fwVersion": "3.5.0", "deviceid": "100000140e", "bssid": "ec:17:2f:3d:15:e", "signalStrength": -25 } } |
URL:http://[ip]:[port]/zeroconf/switch
json
Method:
1 2 3 4 5 6 | { "deviceid": "1000000001", "data": { "switch": "on" } } |
Attribute | Type | Optional | Description |
---|---|---|---|
String | No | on: turn the light on, off: |
URL:http://[ip]:[port]/zeroconf/dimmable
json
Method:
{ //Change the light to cool & warm type "deviceid": "1000xxxxxx", "data":{ "ltype": "white", "white": {"br": 70, "ct": 100} } } //Change the light to RGBCW type { "deviceid": "1000xxxxxx", "data":{ "ltype": "color", "color": {"br": 100, "r": 255, "g": 0, "b": 0} } } //Bright { "deviceid": "1000xxxxxx", "data":{ "ltype":"bright", "bright":{"r":255,"g":255,"b":255,"br":100} } } //Sleep { "deviceid": "1000xxxxxx", "data":{ "ltype": "goodNight", "goodNight": {"r":255,"g":250,"b":125,"br":25} } } //Read { "deviceid": "1000xxxxxx", "data":{ "ltype":"read", "read":{"r":255,"g":255,"b":255,"br":60} } } //Night { "deviceid": "1000xxxxxx", "data":{ "ltype":"nightLight", "nightLight":{"r":255,"g":240,"b":225,"br":5} } } // The following Scene can be modified options in the app //Party { "deviceid": "1000xxxxxx", "data":{ "ltype":"party", "party":{"r":254,"g":132,"b":0,"br":45,"tf":1,"sp":1} } } //Relax { "deviceid": "1000xxxxxx", "data":{ "ltype":"leisure", "leisure":{"r":0,"g":40,"b":254,"br":55,"tf":1,"sp":1} } } //Soft { "deviceid": "1000xxxxxx", "data":{ "ltype":"soft", "soft":{"r":38,"g":254,"b":0,"br":20,"tf":1,"sp":1} } } //Vivid { "deviceid": "1000xxxxxx", "data":{ "ltype":"colorful", "colorful":{"r":255,"g":0,"b":0,"br":100,"tf":1,"sp":1} } } |
Attribute | Type | Optional | Description |
---|---|---|---|
String | No | Light Mode, include white,color,bright,goodNight,read,nightLight,party,leisure,soft,colorful | |
white | Object | Change the type to cool & warm | |
color | Object | Change the type to RGBCW | |
bright | Object | Change the Scene to “Bright” | |
goodNight | Object | Change the Scene to “Sleep” | |
read | Object | Change the Scene to “Read” | |
nightLight | Object | Change the Scene to “Night” | |
party | Object | Change the Scene to “Party” | |
leisure | Object | Change the Scene to “Relax” | |
soft | Object | Change the Scene to “Soft” | |
colorful | Object | Change the Scene to “Vivid” | |
br | Number | No | Brightness, [1,100] |
ct | Number | No | Color temperature, [0,100] |
r | Number | No | Red value, [0,255] |
g | Number | No | Green value, [0,255] |
b | Number | No | Blue value, [0,255] |
tf | Number | No | Color transformation mode, [1,3]. 1: Static, 2: Gradual, 3: Flicker |
sp | Number | No |
URL:http://[ip]:[port]/zeroconf/wifi
json
Method:
1 2 3 4 5 6 7 | { "deviceid": "", "data": { "ssid": "eWeLink", "password": "WeLoveIoT" } } |
Attribute | Type | Optional | Description |
---|---|---|---|
String | No | SSID of the WiFi network to which the device will connect | |
password | String | No |
URL:http://[ip]:[port]/zeroconf/signal_strength
json
Method:
1 2 3 4 | { "deviceid": "1000000001", "data": {} } |
Response body
eg.
1 2 3 4 5 6 7 | { "seq": 2, "error": 0, "data": { "signalStrength": -67 } } |
Attribute | Type | Optional | Description |
---|---|---|---|
Number | No |
URL:http://[ip]:[port]/zeroconf/ota_unlock
json
Method:
1 2 3 4 | { "deviceid": "", "data": {} } |
– 500: The operation failed and the device has errors. For example, the device ID or API Key error which is not authenticated by the vendor’s OTA unlock service;
– 503:
URL:http://[ip]:[port]/zeroconf/ota_flash
json
Method:
1 2 3 4 5 6 7 | { "deviceid": "", "data": { "downloadUrl": "http://192.168.1.184/ota/new_rom.bin", "sha256sum": "3213b2c34cecbb3bb817030c7f025396b658634c0cf9c4435fc0b52ec9644667" } } |
Attribute | Type | Optional | Description |
---|---|---|---|
String | No | The download address of the new firmware, only supports the HTTP protocol, the HTTP server must support the Range request header. | |
sha256sum | String | No |
The following failure codes are added to the error field of the response body:
– 403: The operation failed and the OTA function was not unlocked. The interface “3.2.6 OTA function unlocking” must be successfully called first.
– 408: The operation failed and the pre-download firmware timed out. You can try to call this interface again after optimizing the network environment or increasing the network speed.
– 413: The operation failed and the request body size is too large. The size of the new OTA firmware exceeds the firmware size limit allowed by the device.
– 424: The operation failed and the firmware could not be downloaded. The URL address is unreachable (IP address is unreachable, HTTP protocol is unreachable, firmware does not exist, server does not support Range request header, etc.)
– 471: The operation failed and the firmware integrity check failed. The SHA256 checksum of the downloaded new firmware does not match the value of the request body’s sha256sum field. Restarting the device will cause bricking issue.
Note:
The maximum firmware size is 508KB.
The SPI flash read mode must be DOUT.