I have a 433MHz remote with 10 buttons. Long presses don’t result in prolonged “On” states; instead, the result is On/Off/On/Off… and my ESPHome yaml features delayed_off: 500ms
, so I presume the button would have five “On” states in three seconds.
I want Button 2 to turn off the lights in my bedroom, but I want a long press to turn off every light in the house. Let’s say a long press is three seconds. I think this would call for two parallel sequences when Button 2 is pressed. One sequence to turn off the lights in my room and a parallel sequence to wait for five “On” states within three seconds and then activate the “All Off” scene.
Here is a relevant excerpt of my automation so far:
alias: 433MHz Buttons
description: ""
trigger:
- platform: state
entity_id:
- binary_sensor.remote_433mhz_1_button_2
id: Button 2
to: "on"
action:
- choose:
- conditions:
- condition: trigger
id: Button 2
sequence:
- parallel:
- service: light.turn_off
data:
transition: 2
target:
entity_id:
- light.master_bedroom_dimmer
- light.master_bedroom_lamp_right_side
- light.master_bedroom_lamp_left_side
- service:
(...if 5 On states within 3 seconds --> Activate Scene: "All Off")
Any assistance would be appreciated.