Hi,
thanks to the advices I got here, I now almost finished the configuration of my first ESPHome switch.
The configuration is based on this article. The idea is following:
I have Zigbee lights, which I want to control with the switch. If everything works correctly, the switch is on and the lights are powered all the time. The switch only tells HA to turn the lights on and off using Zigbee2MQTT. If for some reason, HA is not working, then the switch will work in a normal “dumb” mode. This will allow me to turn on and off the lights, even if HA is down.
In the script, this is done by this condition:
script:
- id: hass_light_toggle
then:
if:
condition:
api.connected:
then:
...
else:
# When HA is unavailable, toggle the relay.
- switch.toggle: relay
But in my setup for some reson quite often happens, that HA is running, but Zigbee2MQTTT is down, devices don’t communicate and I have to restart HA completely to make it work again.
The question is, if and how can I detect, that the lights I control are connected and working correctly. Anybody has an idea?