Hi guys, im attempting to control a door lock using a relay, and the RPI with GPIO.
What is the best method to achieve this? Originally I was going to go down the track of using node-red and creating a flow, which I would then trigger in HA, but upon further investigation I found that it is possible to trigger the GPIO directly from within HA?
Simple Lovelace UI with 2 button, one to lock and one to unlock, GPIO going high or low.
Thanks, im struggling with this as the article does actually tell me how to create the button in HA to activate the GPIO, could you please explain that.
Once you add the platform: rpi_gpio switch to your configuration.yaml and restart Home Assistant, a new switch entity will be created. You can than control the GPIO by turning the switch entity on and off.
You should just control your switch entity by calling services like switch.turn_on.
I guess you could do something like this: (This is a Lovelace card. Do NOT put this in your configuration.yaml. Add a manual card to your Lovelace UI and paste it there instead.)
Thanks for the reply. Where do the reflected services go? Are they put in the configuration? For example how does it know what service: switch.turn_on does? Or is that just understood by default?
Also, I have another strange issue. Im not YAML pro but I do know its very fussy on indentation so this could be something im doing wrong.
It won’t ignore the request, but it will try to set the gpio pin (which is already logical high) to high. That’s effectively the same as ignoring the request.
Source code here: