Sonoff IoT API’s

Nataraj
1 min readFeb 18, 2022

Sonoff and Shelly are two of the best know IoT smart solutions available. Sonoff is that they are easily available and less expensive than Shelly devices.

Accessing the API’s seems to be straight forward for either of the devices the only challenge that i had is to configure the devices to wifi network early on.

I have tested these API’s with Sonoff Mini, Sonoff BasicR2 and POWR3. You if you have decided to use Tasmato as the firmware on Sonoff then i read my other article here on how to use Tasmato API’s

SwitchOn
http://192.168.29.61:8081/zeroconf/switch
{
“deviceid”: “”,
“data”: {
“switch”: “on”
}
}


SwitchOff
http://192.168.29.61:8081/zeroconf/switch
{
“deviceid”: “”,
“data”: {
“switch”: “off”
}
}

GetDeviceInfo
http://192.168.29.61:8081/zeroconf/info
{
“deviceid”: “”,
“data”: { }
}

Inching
http://192.168.29.167:8081/zeroconf/startup
{
“deviceid”: “”,
“data”: {
“startup”: “stay”
}
}

WifiSSID and Password Setting
http://192.168.29.167:8081/zeroconf/wifi
{
“deviceid”: “”,
“data”: {
“ssid”: “ssidhere”
“password”: “passwordhere”
}
}

OtaUnlocking
http://192.168.29.167:8081/zeroconf/ota_unlock
{
“deviceid”: “”,
“data”: {
}
}

OtaFlashing
http://192.168.29.167:8081/zeroconf/ota_flash
{
“deviceid”: “”,
“data”: {
“downloadUrl”: “http://192.168.1.184/ota/new_rom.bin",
“sha256sum”: “3213b2c34cecbb3bb817030c7f025396b658634c0cf9c4435fc0b52ec9644667”
}
}

Reference:

  1. eWeLink API
  2. eWeLinik API for JavaScript
  3. SONOFF DIY Mode API Protocol

--

--