Raspberry Pi 3 B+ running HASS.IO. I’m thinking of connecting some relays to the GPIO pins. The relays would be powered by components in my HVAC system, so would appear to the GPIO just like switches (two states; opened or closed.) I’m not looking to control anything, just read the status of these components.
I’ve never done this before, never used Python before, only just coming up to speed with HA in general. I’ve searched, and found some pointers, but most documents I’ve found so far assume a lot more experience.
For example, is there a way to display the status of the GPIO pins while testing? I found the command “sudo gpio readall” but all it returns is an error saying the gpio command doesn’t exist.
I added a small “switch” sample I found to configuration.yaml, and the couple of switches in the example are available to add to Lovelace, so I’ve got that far, even with no pins connected. I’ve read up on the issues with pin numbering and naming.
Next step would be to physically wire some switches to the pins, open and close them, and see what displays. Am I on the right track?
Thank you! Yes, I’ve seen that. The first example on the page, Binary Sensor, is what I put in my configuration.yaml. I got as far as adding a card for it into Lovelace, and it looks right; so far no errors.
If it’s that simple, great! I was actually hoping for a way to display the status of all the GPIO pins, to allow better testing, and thought the “sudo gpio readall” command would be perfect, but it’s not recognized as a valid command.
The reason for the relays is simple. My heating system has three zones. The zone valves run on 24VAC. Rather than try to detect 24VAC at the GPIO pins, I have three relays with 24VAC coils. I have another with a 120VAC coil which is powered by the circuit which runs the burner on the boiler. Then there’s a separate air conditioner, and that runs on 240VAC. I’ll eventually add another relay there. All the relays will live on one small rail, and I’ll only need one 18 gauge, 7 conductor thermostat cable back to the RPi. These relays are inexpensive.
From the perspective of the RPi GPIO pins, I’ll have five “on/off” switches (the relay contacts) and no need to worry about voltages. The end goal is to know when, and for how long, each zone, and the AC, was running. With information from the burner, I’ll be able to estimate how much fuel I’m using, too. Most importantly, I’ll be able to see the status of my heating system when I’m away from home, so I’ll know if there’s any danger of the pipes freezing.