I have a Z-wave switch that’s far away and we get lazy having to walk all the way over to it (I know, sad right?), so I’d like to give a second, closer Z-wave switch the ability to turn on those lights as well.
I’d like to physically flip switch.near 4 times (on, off, on, off) and then IF that sequence happens within 2 seconds, HA will activate switch.farfaraway.
I’m able to make it mirror the state switch.near, but I’m not sure how might I require it to be switched 4 times within 2 seconds as a trigger? Am I looking at an automation or a script? python?
technically possible to do with an automation, but I wouldn’t recommend it.
You would have an input_boolean, and an input_slider.
Then an automation that runs with switch_near that turns input_boolean on, and increments the slider value, and kicks of a script.
The script would delay 2 seconds then turn input_boolean off.
It would be pretty complex, and better implemented wit appdaemon.
Thanks for the ideas! It wasn’t crazy hard… I was having more problems with the ####ing indentions and -'s than anything else… sigh.
automation 5:
- alias: Switch on, bool on
trigger:
platform: state
entity_id: switch.island_23
to: 'on'
condition:
condition: state
entity_id: input_boolean.shortmemory
state: 'off'
action:
service: homeassistant.turn_on
entity_id: input_boolean.shortmemory
- alias: turn on cabinet light if conditions are true
trigger:
platform: state
entity_id: switch.island_23
to: 'on'
condition:
condition: state
entity_id: 'input_boolean.shortmemory'
state: 'on'
action:
service: switch.turn_on
entity_id: switch.cabinet_6
- alias: forget it
trigger:
- platform: state
entity_id: 'input_boolean.shortmemory'
to: 'on'
for:
seconds: 2
action:
- service: homeassistant.turn_off
entity_id: 'input_boolean.shortmemory'
It works but the timing has to be pretty exact for some reason. If I flip too fast it doesn’t seem to register. I’ll update this post if I do something different. The results are different if I’m flipping the physical switch on the wall vs. on the HASS frontend/webpage.