Sonoff is a brand of low cost (£5) Wi-Fi switches that can be used for controlling mains powered devices like lights, pumps, heaters etc.
They consist of the ESP8266 Wi-Fi Chip plus additional circuitry. and are made by ITEAD Studio based in China ,who also make a collection of home automation products.
There are many switch types (see here), but two versions of the software.
- Official software
- Tasmota MQTT software
ITEAD have recently introduced a Zigbee version of the the sonoff basic switch.
This looks the same as the Wi-fi version but uses a Texas Instruments CC2530.
Because it uses Zigbee it will require a Zigbee hub to connect to the Internet. However the latest Amazon Echo plus will do this.
This could turn out to be a game changer for sonoff devices and it will be interesting to see how quickly they are adopted.
The official software that comes on the devices you buy from Amazon etc are designed to be connected to the Internet in order to operate successfully.
These devices work with the EWelink Apps,Google home and Alexa etc
They work using the http(s) protocol but the main drawback is that they need an Internet connection to work.
Recent versions of the switch (R3) have a mode called LAN mode which allows control via the LAN and so will work even if the Internet is down.
You can also get these devices from the Internet, but not from Amazon.
These devices are the original devices, but flashed with the Tasmota MQTT software.
You can get the standard devices, and flash them yourself, as the Tasmota software is available on Github.
Tasmota devices don’t work with the official EWelink Apps
The main advantage of using this software is that it uses the MQTT protocol and doesn’t need an Internet connection to operate.
Using the Official Sonoff Switch
Before you can use it you will need to set it up to work on your network. To do that you will require an Internet connection.
Here are the setup Instructions.
If you are interested on how they actually work and communicate with the control server then see this very good tutorial.
You can get the device to work with your own control server but it isn’t straightforward. Here are the instructions.
Using the Tasmota Sonoff Switch
Unless you can find one to buy that has been flashed you will need to flash it yourself.
Again this process isn’t really for the non technical but there are many good tutorials and videos online.
Video flash Sonoff with Tasmota uses serial port.
SuperHouse Tutorial and video
The Tasmota software lets you control the switch locally without an Internet connection with either http or MQTT
- Setting up the Sonoff Tasmota MQTT Switch
- Controlling the Sonoff Tasmota Switch Using MQTT and Node-red
- Controlling the Sonoff Tasmota Switch Using HTTP and Node-red
Advantages and Disadvantages -Tasmota vs Official Software
The main advantages with using Sonoff switches with the official software are:
- No Need for Hacking
- They work with Alexa, Google Home etc
The main disadvantages are:
- They need an Internet Connection –Note: newer ones(r3) have a LAN mode and DIY mode..
- They don’t support MQTT
- They rely on an External server controlled by Itead who could decide to charge for this at a later date or could discontinue the service altogether.
- The lack of MQTT support in the official Sonoff devices
- The fact that I don’t want to mess about flashing devices
- ITead seem to be making it more difficult to flash the devices.
- I would like full control of my own devices.
I decided to look for alternatives so far I’ve found the Shelly range of switches which are low cost and made to be flashed.
Personally I haven’t tried them yet but they look worth considering.
MQTT protocol – This is a publish and subscribe message protocol fast becoming the de facto protocol for connecting IOT devices.
http– Hyper text transfer protocol. The protocol used by web browsers.
https – secure http- Uses encryption to protect data.
Device Flashing – Process of putting new code on a device.
Related Tutorials and Resources
Technical tutorials very useful if you want to understand how Sonoff works and for hacking
- Sonoff basics
- How do sonoff devices work
- Sonoff switch complete hack without firmware upgrade
- OTA flash–
- Sonoff – Flashing Installation and configuration video