ESPHome Firmware for Shelly (Toggle Relay when no connection to WIFI or HA)

I have 60 Shelly 1, 2.5, and Dimmer 2’s in my home powering mostly LEDVANCE Color Smart lights (Except the Dimmer 2’s). I use the Shelly Binary Sensors in Detached Mode to trigger my HA Automations for each lighting group.

I am toying with the idea of flashing them with ESPHome firmware to take advantage of one feature:

In case there is no connection to Wifi, or no API connection (normally Home Assistant) the config will toggle the relay, so it will still toggle the attached light in cases where Wifi or HA fails.

(ESPHome -

I really want my lights to feel normal to visitors and others that use my house, and sometimes I get latency issues or downright non-function of my lights with my current setup.

Does anyone have any thoughts on this? Can I setup this same functionality with the new Shelly integration in Home Assistant somehow?

I appreciate your help.

1 Like

I would say convert one or two and try it. Nothing beats hands-on experimentation.

For what it’s worth, I used to get occasional latency issues when using MQTT to control my lights. That went away entirely when I switched to ESPHome, because it has HA api integration. Probably the reason I went ahead and flashed everything with ESPHome in the end. Being able to edit/maintain them with OTA firmware updates is also a big win.

Ok I have completed one room and it works as desired. ESPHome is very nice.

I have finally have the functionality that I needed.

Smart Lights that just work, all the time, even with no WiFi or HA. Awesome!

To make that happen I flashed them OTA, no wires by following this:

Than made custom firmware for ESPHome by using this:

NOTE: Once I made the firmware for ESPHome, I had to Gzip it in the CLI to get it to load over Tasmota.

Anyone with questions about my setup, please reach out. I am happy to share info.

Just a side note, because I stumbled upon this today:


Did you also flash your dimmers with ESPHome? I was under the impression they are not jet supported by ESPHome.

Yes the Shelly Dimmer 2’s all got flashed as well.

Oh, would you mind pointing me to a source for the ESPHome configuration for the dimmers?
Mine are still V1. Do you know if they are supported aswell?

Hi everyone who has done something similar (flash stock shelly firmware to ESPhome) and @AlohaFlyer in particular what have your experiences been so far please? Are you still on a similar setup after a few years please?

As of today I still have the same issue that you had a few years ago: lights toggle based on (lack of stable) wifi connectivity. Not great for the Home Approval Factor (HAF)!

My first Shelly is still running like on the first day. I flashed it first with ESPHome and then put it in the wall, where it still is, toogling one of my livingroom lights. That was nearly five years ago, maybe only four and a half, but yes, still running nicely!

Both of my Shelly Dimmers are flashed as well, working as well without any problems. Both for at least one and a half years (something around that).

I also have a Shelly Uni running with ESPHome in my car, no problems as well. :wink:

Regarding your issue, if you know that a bad wifi signal is the cause, why not change that? :wink:

You aware of the user customizable timeouts described in the FAQ?

Indeed, you should work on your wifi infrastructure :wink:

Fantastic, thanks for the apt replies!

ESPhome seems very nice since. One reason for it is the ease of adding a device (copy config vs clicking around and copying and pasting various fields).

Indeed. Wifi infrastructure is just fine now (one Unifi AP per floor and a UPS (battery pack) to supply the switch that delivers power). Just got screwed over with updates that happen simultaneously with the default Unifi Controller settings. Solution was to schedule auto updates on different time-slots for each device in an order that allows the remaining AP to take over the connections and, most importantly not at night… :monkey:

Yes, 2 years in I am still on that same setup. Its quite stable.

The only issues I have on a rare occaision, are that my kids play with the lights in a room and unpair the smartbulbs after 5 quick resets. So I have to quickly re-pair them back into the zigbee network.

All said and done, I am very happy with my setup. I have had visitors come who have had no trouble and its very stable. Feel free to ask more if you need more details.