New to this forum, just trying to learn more about ESPHome and why you would need to flash a Shelly device seeing as though it’s already a smart device?
As far as I can figure out the reason would be to remove reliance on the cloud connection in favour of controlling the device locally from home assistant?
Thanks for that info mate, what sort of advanced automations would ESPHome allow you to do on a Shelly that you couldn’t do otherwise? Do you have any examples?
I have a bunch of Shelly Mini PM i’m about to install so i need to figure out of i should install them as is or flash them with ESPHome.
Shelly devices seem to work well with their own FW and they allow local control, but it is different than esphome. I got some of the gen 3 mini ones that only measure power. The way they report it is different, but they seem to be fine, so I am probably just going to leave them with the Shelly FW.
I have a number of Shelly devices, none of them flashed with ESPHome. Like Tom, I do use it for devices I’ve built myself.
Think of it this way: any HA automation you would write for your device that you want functioning in case HA isn’t running should rather be done on the device.
Well, one simple is that i can connect external sensor to my shelly 2pm which controls covers. Then models with esp32 can run btproxy. Then you can “insert” any homeassistant sensor and do automation inside esp itself…like open cover at dawn and close it at dusk (for this you don’t need ha sensor though); etc…
Possibilites are endless…
Mine will all be installed on light switches & exhaust fans, so i will just be turning lights on or off via home assistant interface, programmed buttons and through automations.
Hoping that as i will have a shelly PM on every light switch i can get a pretty complete picture of my lighting costs too.
I don’t use it myself, but there is one possible scenario where ESPHome automations would come in handy:
Say you connected the Shelly to smart bulbs. Not a great idea, but it’s entirely possible.
Now, say you set the Shelly to detached mode, so the switch doesn’t directly operate the relay. Instead, it uses an automation to send commands directly to the bulbs and leaves the relay permanently switched on.
Imagine your HA server (or wifi router) goes down, meaning that you can no longer control the lights at all.
You could use ESPHome logic to detect that there is no connection to the api and disable the detached mode when this happens. This will allow you to use the switch to essentially treat your smart lights as dumb lights until the problem is resolved.
There are lots of reasons to want to customize a device firmware beyond what the manufacturer provides.
On-device automations are just one, particularly powerful, option. You can browse the esphome automation docs for some ideas of what they can be used for.
But there’s more. Esphome can create new entities that monitor or control external devices, e,g. on your network, providing centralized or logically consistent access in HA. For example, if you have a Shelly relay controlling a fan, esphome firmware can create a fan entity that internally controls the relays or speed.
Esphome also has options for increased privacy and security, including encrypted data transit, password-protected OTA upgrades, and built-in wireguard vpn for untrusted networks.
Esphome can let you fully customize the data collection process, for example tweak an analog-to-digital converter parameters or adjust sensor readings, before they even make it into HA.
It can also provide better visibility into device operations, for example debugging or logging tools the manufacturer didn’t provide, to help troubleshoot when something isn’t working.
In the beginning I also flashed esphome on the shellys. With the first generation it was easier to get to the pinheaders, the newer ones are a bit more tedious. That’s why I’ve recently just started using the original shelly FW, because the shelly HA integration works very well and, as already stated by others, you can run the shellys separately from the internet in your local network, so no access from the manufacturer.
If I want to run certain things completely WAF save, then I run the automation directly on the ESP. This means using lambda code or script entries in ESPHome Yaml . The same thing can also be done with the original shelly firmware. It boils down to a script (a kind of java script). OK this is completely different from esphome but it works just as well, just a different programming language.
My conclusion is that i just leave the shellys as they come out of the bag, maybe an fw update if it makes sense but nothing else, i.e. don’t make a big fuss with unscrewing them, tricks to get to the serial interface and flashing a suitable esphome firmware etc.
I tell you the occasions when I flashed esphome on my Shellys:
Shelly 1: connected between doorbell and bell button. Normally pressing the button must ring the bell. But sometimes I need this not to happen. So I had set the Detatched mode, and made the choice go based on ha. Then one day I was doing the server and the postman couldn’t ring the bell. So I flashed esphome and the device now maintains its operation even if there is no connection to the server.
Shelly rgbw2: I have several connected to lights that remain on all night. Simply for my case setting 1% is too much. ESPHOME allows for more precise control over low lights thanks to the gamma correct (logaritmic curve). In addition, the shutdown transition is more pleasant because it can flow many more pwm fractions
Shelly 1 that controls the Gas boiler: if the wifi connection is missing or the server has then use the input to control the output (the electromechanical thermostat is connected to the input)
As long as you use the Shelly with the hardware connections that are included, there’s no need to reflash them aside from some very borderline cases (like the <1% brightness issue, or operating in a hostile network).
You may want to do it for a number or reasons, like not wanting to learn their scripting language when you already know how to do stuff with ESPHome.
If you want to add additional hardware, via i²c, uart, etc., you’ll likely need to flash them, as the support for random added stuff is pretty limited (but check out their clip-on expansion IO board). However, in that case I’d question why you’d start out with a Shelly in the first place and not an ESP32 dev board.
BTW, I have a strict rule: If it’s line voltage, it gets a Shelly (or something else where the manufacturer takes responsibility for building it in a way it won’t kill anyone or set my house on fire) and I do not mess with the hardware. Otherwise, I likely use an ESP32 with ESPHome.
Is it safe to add hardware on Shelly? I was wondering about the warning Shelly gives for all devices that have the pin header:
" CAUTION! High voltage on the add-on interface when the Device is powered!"