I’m trying to use a rpi gpio pin and a 120v relay to monitor the AC power in the house (the rpi, router, and cable modem are behind a ups, so it should be able to remain up to notify if the mains power goes out). I’m using half of a dpdt relay and the pin is high when the power is off, and low when the power is on
It is working as expected, except when I restart Home Assistant. The sensor always seems to show “off” after a restart, until I cycle the power (unplug and plug the relay back in) which is not ideal.
Is there some kind of initialization that I need to do. Or is gpio 21 (pin 40) some kind of special pin?
binary_sensor:
- platform: rpi_gpio
ports:
21: AC Power