So I have an issue where when all my relays are active. Im basicly running all relays via GPIOs as active, and then dropping power to them when i am triggering my devices.
My issue with this is when there is a power cut, the relay will drop and the state then changes. This is unsafe for a number of devices I am using.
What I would prefer to do is, have the relays LOW and energize them when turning my devices ON, and when devices are off, the relays are LOW so if power fails, they dont change state.
The issue with this is, when the PI boots, it always sends all relays HIGH, until HASSIO boots, then when HASSOS loads, it sends them LOW again.
I gave up connecting relays directly on ESP. No matter what pin i used i happened occasionally that relay triggerred quickly (and opened garage door at 2 in the morning). Now i changed/updated all my devices and i always use MCP23017, MCP23008 or PCF8574. Problem solved.
I guess it’s similar with Pi GPIO’s. If you can use mentioned I/O chips, do so. Their outputs will stay inactive until chip is initialized.