M5Stack - use HA or local ESPHome code for LED logic?

Hi,

I have an M5Stack Atom Lite, esp32 controller, being used to read a pressure sensor for pond level status.

I got this working fine, and now I’m considering the on-board LED on the Atom Lite. I currently control the on-board LED by exposing the fastled_clockless platform and the gpio platform for the on-board push button.

What I wonder, is if I’d like a particular reading from the pressure sensor to be “yellow” (say 3/4 full) and “red” if it’s less that 30% full, I can template these in HA. Or I can control that by reading the pressure setting locally on the esp32 code. It would be nice if the Lovelace needle graph used its knowledge of “red”, “yellow”, or “green” to launch an entity or automation when the level is set. But sure, another automation could be used.

I’d also want to automate the fact that the Atom Lite has successfully connected to the wifi. I may do this by pinging HA (or have HA ping the sensor) and if on the sensor, change the color of the light or make it flash if it can or cannot see the other side.

This would allow someone who’s watching the house not need to use HA to check the status of the monitoring.

So, the general question then is: Where is the best place to put an automation or control code for a separate controller like the ESP devices? On the board or in my HA?

Thanks,

Ambi

Esphome is very powerful and I believe you can implement these within the esphome code itself. If you do like that, the advantage is that you can make that system independent form HA which means even if HA is down for some time, the automations in esphome would run. If you are using HA automations, the automations would not work if HA is down.

The only problem with the Esphome code route is that, to modify the automation, you will have to edit and code and flash the firmware again. It is easy but sometimes you may have to use an intermediate minimal firmware also.

To help more do please upload your esphome code.

1 Like