I’m trying to add an optocoupler to my HASS.IO unit in order to detect a power outage.
I’ve built an optocoupler using this tutorial
I entered the following in my configuration.yaml file (I entered all ports while troubleshooting to make sure I had the right one). The sensors do show up on my HA UI.
#GPIO Ports
binary_sensor:
- platform: rpi_gpio
ports:
1: one
2: two
3: three
4: four
5: five
6: six
7: seven
8: eight
9: nine
10: ten
11: eleven
12: twelve
13: thirteen
14: fourteen
15: fifteen
16: sixteen
17: seventeen
18: eighteen
19: nineteen
20: twenty
21: twenty one
22: Twenty two
23: twenty three
24: twenty four
25: twenty five
26: twenty six
I have the optocoupler plugged into the ports as described in the instructions.
I hooked the other end of the optocoupler into 110V main power and toggled the power on and off. I haven’t seen any change to the binary sensors in HA.
Do I need to do something else to get the GPIO pins to work? Is there a way to test that the pins do work?