Overview

The Sonoff device is a cheap $5 ESP8266 wifi enabled switch.

Pinout


GPIODescription
0Button
1Serial Rx and Optional Sensor
3Serial Rx and Optional Sensor
4Optional Sensor (no pad, available at esp8266 chip)
12Relay and Red LED
13Green LED
14Optional Sensor


Wiring the Sonoff to the serial cable




Flashing Sonoff using Arduino IDE


The Arduino project is located in Sonoff-Tasmota/sonoff/sonoff.ino.


> cd Sonoff-Tasmota/lib

> cp -R * ~/Documents/Arduino/libraries/.







See https://github.com/arendst/Sonoff-Tasmota/wiki/Arduino-IDE


Commands


http://HOST/cm?user=USER&password=PASSWORD&cmnd=Power%20TOGGLE

CommandDescriptionOutput
Power%20TOGGLEToggle Power
{"POWER":"OFF"}
{"POWER":"ON"}

Power%20On

Power On
{"POWER":"ON"}

Power%20Off

Power Off
{"POWER":"OFF"}
PowerPower status
{"POWER":"ON"}
FriendlyNameDisplay Friendly name
{"FriendlyName1":"Sonoff"}
StatusDisplay Status
{"Status":{"Module":1,"FriendlyName":"Sonoff","Topic":"sonoff" 
,"ButtonTopic":"0","Power":0,"PowerOnState":3,"LedState":1
,"SaveData":1,"SaveState":1,"ButtonRetain":0,"PowerRetain":0}}


See https://github.com/arendst/Sonoff-Tasmota/wiki/Commands for the full list.

References

ReferenceURL
Sonoff Manufacturer's Pagehttp://sonoff.itead.cc/en/
Flashing Sonoff using Arduinohttps://github.com/arendst/Sonoff-Tasmota/wiki/Arduino-IDE

Sonoff-Tasmota Commands

https://github.com/arendst/Sonoff-Tasmota/wiki/Commands