fbpx

Can Sonoff work with Home Assistant?

Smart switch are a nice to have when they work in isolation (e.g. switch lights on from the comfort of your sofa) but they really become useful when they are setup as part of an automation (e.g. automating you lights to be switched on when you enter a room or when the sun sets). It is for this reason why many people want to integrate their Sonoff devices with platforms such as Home Assistant.

Yes, Sonoff devices do work with Home Assistant. There are two approaches that you can take to get Sonoff devices working with Home Assistant. The first approach is to setup the Sonoff LAN Integration in Home Assistant and the second approach is to flash your Sonoff device with Tasmota firmware.

Disclaimer: I am not an electrician and if you are not one either then you should get your electrician to carry out all steps involving mains voltages.

1. Sonoff LAN Integration

In the past, if you wanted to get your Sonoff devices working with Home Assistant, then you would have no choice but to flash them with custom firmware such Tasmota. However, with the development of the Sonoff LAN integration for Home Assistant (by AlexxIT), you are now able to use most of your existing Sonoff devices with Home Assistant without custom firmware such as Tasmota.

The Sonoff LAN integration into Home Assistant allows your Home Assistant setup to interface directly with your Sonoff devices over your local area network (LAN Mode) without routing though the eWeLink servers. This means that your Sonoff devices will work over your local area network even if you don’t have a working internet connection. You will however still need to pair your Sonoff devices with the eWeLink app during the initial setup. After that is done though, you can block access to the eWeLink services in your router (if you have privacy concerns) and your Sonoff devices will continue to function though Home Assistant. I chose not to block access to the eWeLink servers as I do use the app from time to time.

For the full list of supported Sonoff devices, visit the AlexxIT GitHub page.

Pros of Sonoff LAN

  • Very quick to add devices once Sonoff LAN is setup
  • No need to flash firmware
  • Retain control via the eWeLink app
  • Sonoff devices still work with Alexa, Google Assistant out the box

Cons of Sonoff LAN

  • It take a few minutes to setup the Home Assistant Community Store (HACS) and then add the Sonoff LAN Integration.
  • You are relying third party software so there is a greater risk of your installation breaking after updates. I just turn off automatic updates and only update from time to time.

Setting up Sonoff LAN on Home Assistant

If you are looking for a step-by-step guide on how to setup Sonoff LAN on Home Assistant, then take a look at this blog of mine: How to install Sonoff LAN

2. Using Tasmota Firmware

Tasmota is an alternative firmware for ESP8266 (low-cost Wi-Fi microchip) based devices such as Sonoff. To install this firmware on your Sonoff devices, you need to ‘flash’ your device with the Tasmota firmware. If you own a Sonoff device that features DIY mode (e.g. Sonoff Basic R3, RFR3 and Mini), then it will make it a lot less technical and quicker to flash your Sonoff with Tasmota.

If however you own another Sonoff device then you will have to manually connect to specific pins on the board to flash the new firmware. In the past this was done using the ESP command line utility (aka esptool.py). This process has recently been made easier with the introduction of Tasmotizer, a GUI interface tool that significantly simplifies the process. Read the ‘Flashing with Tasmota’ section below for more information on how to flash your Sonoff with Tasmota.

Pros of Tasmota

  • Features local control over MQTT, HTTP, Serial or KNX
  • Add automation using timers or rules
  • Integrate additional functionality

Cons of Tasmota

  • Requires third party Alexa Skill to get Sonoff devices working with Alexa & Google Assistant
  • You cannot easily go back to the standard Sonoff firmware
  • Flashing non-DIY mode Sonoff devices is time consuming, pretty technical and requires additional hardware

Flashing with Tasmota (Sonoff DIY Mode)

If you have a Sonoff Basic R3, RFR3 or Mini and want to flash it using Sonoff DIY mode then check out the excellent step-by-step video by Justin Aden (aka DrZzs).

Flashing with Tasmota (Using FTDI Adapter)

If you’ve decided to flash your Sonoff device with Tasmota and are looking for a guide, look no further than the video below by Jonathan Oxer. He also have a written a great blog post with all the step-by-step instructions.

Recent Posts