Hi, I´m working on gardenlights. I have 4 relays working in HA. Now I want to
turn the relay on with a hardware push button in my garden.
I´ve connected a button with a resistor to 3.3v and to a gpio port.
Now I need the “code” for the configuration.yaml.
Hi, that´s the code i used to switch the relays over the web interface. But I want
to have some “real” buttons on the wall in the garden wich can turn the relay on an off.
Cool, the button works. Now I want to tell the button that if I push the button
once eg. relay1 goes on. If I push the button again the relay1 goes off.
Any idea?
Have the button press toggle a switch, and automations that run based on what should happen when the switch goes off or when the switch goes on, I think this is what @MojaveTom is getting at.
Thanks for your answers.
Do you have any example code witch I can use? I´m new at HS and have a lot
to learn.
This is what I have right now (there are some german words in it):
Like many people before I encourage you to use english names in your config and only german stuff for friendly names…far less trouble that way…but anyway!
I do not have a raspi setup with gpio so the entity_ids and states I am using might be wrong (see the devtools for correct ones):
I´ve changed the entity_id and it works. Now I can push the button and
the relay turns on.
Sorry, for my next question! I want to push the button on time and the relay goes on and stay on. If I push the button again the relay goes off. How can I make this?
If I am not mistake this should already work this way. If not maybe someone else has to chime in because I don’t know enough of the raspi gpio component. But usually switches are toggles and stay in one state.