Sonoff firmware for openHAB and others

Below firmware evolved completely to a new firmware called AFE Firmware. If you considered using it then look at AFE Firmware. It has 100% + functionalities as below version. This one is longer maintained and supported by me. 


This is documentation to Firmware for Sonoff v0.7

Table of contents


I’m sharing an alternative firmware to Sonoff switch.

The switch comes with its own software, but this is a closed type of software. This means it does not allow for connecting the switch to other systems or applications than the one provided by the manufacturer. To solve this problem (if it is a problem for someone), there are alternative firmwares available for Sonoff. An example would be Supla. If someone decided to use Supla, as a system for automation control in home or office he or she can buy Sonoff switch and reprogram it. Benefit from that is that instead of using original application Ewelink, Supla user can use only one application and control all devices connected with Supla including Sonoff. No need to use many different application to control all devices at home.

You have to take into account that Supla is also a closed software, so if you decided to reprogram Sonoff to use Supla you would have to use only Supla to control Sonoff switch.

There are systems for home automation, which are hardware agnostic – it basically means system like that focus more on connection’s mechanisms to devices rather than devices itself.  These systems use many industry standards to connect to devices to retrieve data from or to control them. A device model, a manufacturer is not very important. OpenHAB is an example of such solutions, and I think it beats solutions like Supla, Ewelink because of it’s hardware agnostic focus.

I was missing software for Sonoff switch which would allow connecting to open home automation system like openHAB. This was the reason I decided to create such for myself and share it with everyone who might find it useful.

The firmware allows controlling Sonoff switch by using MQTT protocol which is one of data exchange standard between machine-2-machine and it’s fast and does not overload resources.

Main functionalities

  • Relay controlled by build-in button into the switch
  • Relay controlled by MQTT messages
  • State of the relay is saved and restored if there is electricity interruption
  • There is possibility to install DS18B20 temperature sensor into the switch
    • interval how often temperature should be ready can be set
    • temperature is published to MQTT broker
    • there is possibility to automatically correct value of temperature by certain value before it’s publish to MQTT Broker
  • Support of external switch eg wall light switch
  • Sonoff is configured by web browser
  • Firmware can be updated by web browser

> Go to  installation now