Ok, so ive been going at this one for a while now and cant find a clean, easy way to achieve this.
My setup is a esp32 controlling a relay. I have the esp32 connected and all GPIOs mapped and the relay can be controlled via on/off via an entity.
I need to trigger the relay for 5 seconds on an OFF event. So when I turn on a switch or button in my dashboard, the button should remain off, but the relay must pulse for 5 seconds.
When the switch is turned on, the button changes state to ON and the relay pulses twice for 5 seconds. (5 seconds active, off, 5 seconds active, off).
Is there an easy way to do this? esp32 yaml directly or going to need some fancy automations and helpers/timers etc?
Do you know a way to stop the GPIO pins changing state if devices reboot.
Right now this is driving a heater, and if there is a power cut the heater will turn on. It seems each time the pi or esp32 reboot, the relay states change, even if returning to the default state, if the relay is inactive on a power down, the relay will energize and become active before the esp reads the codes and then deactivates the relay again. This would be enough to cause my heater to turn on.