So I was just wondering after watching this video, https://youtu.be/YV0DFPBQbWQ?si=SLTobftbl2sidnVj , how to use wireless keypad to l run automations in HA. I was wondering since it is a wireless numpad for a computer can you add a series of key presses followed by enter and then it will run an automation? For an example if I enter numbers 1918(enter key) it will turn on x y and z lights. Just was wondering. Thanks
I have not clicked on the link but I believe I know what video it is.
As far as my understanding is each button becomes an event.
The way that is used is generally one event is one automation.
But I guess you could have the events trigger an automation that appends to an input text what number you pressed and have the enter “flush” it.
So most likely doable.
Do you know how that would look in code?
You would need one automation per button.
For example button 1.
Action input_text set
{{ states('input_text.code') }}1
And for button 2 you replace the 1 with a 2.
This should build your string of button presses
I didn’t watch the entire video, just skimmed through but I would just create a single automation with multiple triggers, one for each button event. Then use a choose action to determine what to do for each particular button.
As Dave said.
If you want to do multiple key presses though, it would get quite a bit more complicated, as I think you’d need to trigger on an event for any key press, followed by a sequence of wait for triggers (the amount of these would depend on the PIN length you want to use). I would probably then use an input text helper and for each event append the number to it, and then wait for the “enter” event. After that you’d choose out action. Doable, but if you want to trigger only 10 or so distinct events, then reacting directly to single presses would by far the easiest.
A while back I did a play project to make a MOES Scene switch into a combination lock (link below).
You should be able to adapt that logic to a keypad, additionally if all of your codes are the same length it should be easy to add multiple codes.
If you want different length codes it may become a bit more complex.
There is this…
Not sure if it’s exactly what you want, but you could also take control and change the number of button presses to get to a command or something.