Open Sab3rRid3r opened 1 year ago
I have the same issue, can't use light toggle :(
Ditto. Blueprint is unusable for me because of this
@romprod I created a different blueprint with a fix: https://gist.github.com/CrazyCoder/28d660d9e2e8464458e591ad79b3698e.
I believe the reason this is happening is because the "Short Press" is actually capturing both the "Initial Press" and "Short Press Release" events. I came here because "Short Press" is being executed for me while attempting to do a long press... which should not be the case.
I posted a comment about this in the blueprint exchange forum. The dimmer sends 'press' events as soon as a button is pressed. If you keep it pressed it will keep sending 'hold' events repeatedly. On release, it will send either a 'press_release' or 'long_release' event depending on how long you pressed it. (I use ZHA, can't comment on other integrations)
For 'on' and 'off' The blueprint couples 'button_XX_short' events to both the 'press' And 'press_release' events so that goes wrong sometimes. If you edit the blueprint to map only the 'press_release' command of the dimmer to the blueprint's button_XX_short command I think it will work. This is what I do in my own selfmade blueprint and that works for two versions of the dimmer.
FYI, here's the blueprint I use to switch scenes kind of like how the Philips Hue app/bridge will do it, with some modifications. Use it as inspiration if you want.
blueprint:
name: Hue Dimmer Scene Switcher Multiclick
description: "Assigns actions to a subset of all the possible click combos of a RWL021 or RWL022 Hue dimmer remote, to select scenes to activate. Requires a 'counter' helper "
domain: automation
input:
the_remote:
name: Remote
description: "This remote will be controlling the action (required)"
selector:
device:
target_area:
name: target for off action
description: "Area or light (group) to be switched off"
selector:
area:
default: []
# I want a more general target here but it requires some templating, because 'target' generates some string sequence
counter_helper:
name: scene counter helper
description: "helper to keep track of which scene is active"
selector:
entity:
domain: counter
default: []
Scene_1:
name: Scene 1
description: "Scene set on single click of the 'on' button"
selector:
entity:
domain: scene
default: []
Scene_2:
name: Scene 2
description: "Scene set on double click of the 'on' button"
default: []
selector:
entity:
domain: scene
Scene_3:
name: Scene 3
description: "Scene set on triple click of the 'on' button"
default: []
selector:
entity:
domain: scene
Scene_4:
name: Scene 4
description: "Scene set on quad click of the 'on' button"
default: []
selector:
entity:
domain: scene
Scene_5:
name: Scene 5
description: "Scene set on quint click of the 'on' button"
default: []
selector:
entity:
domain: scene
include_all_off:
name: Add all off button?
description: "Turns all the lights in the home off on double click of the 'off' button"
default: True
selector:
boolean:
t_trans:
name: Transition time
description: "Time for transition between scenes"
default: 0.5
selector:
number:
min: 0
max: 10
unit_of_measurement: "s"
step: 0.1
bright_step:
name: Brightness step
description: "Step value for brightness"
default: 20
selector:
number:
min: 5
max: 100
step: 1
variables:
input_include_all_off: !input include_all_off
input_bright_step: !input bright_step
input_counter_helper: !input counter_helper
scene1: !input Scene_1
scene2: !input Scene_2
scene3: !input Scene_3
scene4: !input Scene_4
scene5: !input Scene_5
allscenes: "{{ [scene1, scene2, scene3, scene4, scene5]}}"
lights: !input target_area
trigger:
- device_id: !input the_remote
domain: zha
platform: device
type: remote_button_short_press
subtype: turn_on
id: On_1
- device_id: !input the_remote
domain: zha
platform: device
type: remote_button_double_press
subtype: turn_on
id: On_2
- device_id: !input the_remote
domain: zha
platform: device
type: remote_button_triple_press
subtype: turn_on
id: On_3
- device_id: !input the_remote
domain: zha
platform: device
type: remote_button_quadruple_press
subtype: turn_on
id: On_4
- device_id: !input the_remote
domain: zha
platform: device
type: remote_button_quintuple_press
subtype: turn_on
id: On_5
- device_id: !input the_remote
domain: zha
platform: device
type: remote_button_short_press
subtype: turn_off
id: Off_1
- device_id: !input the_remote
domain: zha
platform: device
type: remote_button_double_press
subtype: turn_off
id: Off_2
- device_id: !input the_remote
domain: zha
platform: device
type: remote_button_short_press
subtype: dim_up
id: Up_1
- device_id: !input the_remote
domain: zha
platform: device
type: remote_button_double_press
subtype: dim_up
id: Up_2
- device_id: !input the_remote
domain: zha
platform: device
type: remote_button_long_press
subtype: dim_up
id: Up_1L
- device_id: !input the_remote
domain: zha
platform: device
type: remote_button_short_press
subtype: dim_down
id: Down_1
- device_id: !input the_remote
domain: zha
platform: device
type: remote_button_double_press
subtype: dim_down
id: Down_2
- device_id: !input the_remote
domain: zha
platform: device
type: remote_button_long_press
subtype: dim_down
id: Down_1L
- device_id: !input the_remote
domain: zha
platform: device
type: remote_button_long_release
subtype: dim_down
id: Down_1LR
- platform: state
entity_id: !input counter_helper
to: null
id: count_change
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: On_1
sequence:
- service: counter.configure
data:
value: 1
target:
entity_id: !input counter_helper
- service: scene.turn_on
target:
entity_id: "{{allscenes[states(input_counter_helper)|int -1]}}"
data:
transition: !input t_trans
- conditions:
- condition: trigger
id: On_2
sequence:
- service: counter.configure
data:
value: 2
target:
entity_id: !input counter_helper
- service: scene.turn_on
target:
entity_id: !input Scene_2
data:
transition: !input t_trans
- conditions:
- condition: trigger
id: On_3
sequence:
- service: counter.configure
data:
value: 3
target:
entity_id: !input counter_helper
- service: scene.turn_on
target:
entity_id: !input Scene_3
data:
transition: !input t_trans
- conditions:
- condition: trigger
id: On_4
sequence:
- service: counter.configure
data:
value: 4
target:
entity_id: !input counter_helper
- service: scene.turn_on
target:
entity_id: !input Scene_4
data:
transition: !input t_trans
- conditions:
- condition: trigger
id: On_5
sequence:
- service: counter.configure
data:
value: 5
target:
entity_id: !input counter_helper
- service: scene.turn_on
target:
entity_id: !input Scene_5
data:
transition: !input t_trans
#scene cycling
- conditions:
- condition: trigger
id: Up_2
sequence:
if:
condition: template
value_template: "{{states(input_counter_helper)|int >4}}"
then:
- service: counter.configure
data:
value: 1
target:
entity_id: !input counter_helper
- service: scene.turn_on
target:
entity_id: "{{allscenes[states(input_counter_helper)|int -1]}}"
data:
transition: !input t_trans
else:
- service: counter.increment
target:
entity_id: !input counter_helper
- service: scene.turn_on
target:
entity_id: "{{allscenes[states(input_counter_helper)|int -1]}}"
data:
transition: !input t_trans
#brightness changes
- conditions:
- condition: trigger
id: Up_1
sequence:
- service: light.turn_on
data:
transition: 0.1
brightness_step: !input bright_step
target:
area_id: !input target_area
- conditions:
- condition: trigger
id: Up_1L
sequence:
- service: light.turn_on
data:
transition: 0.8
brightness_step: !input bright_step
target:
area_id: !input target_area
- conditions:
- condition: trigger
id: Down_1
sequence:
- service: light.turn_on
data:
transition: 0.1
brightness_step: "{{input_bright_step * -1}}"
target:
area_id: !input target_area
- conditions:
- condition: trigger
id: Down_1L
sequence:
- service: light.turn_on
data:
transition: 0.8
brightness_step: "{{input_bright_step * -1}}"
target:
area_id: !input target_area
- conditions:
- condition: trigger
id: Down_2
sequence:
- conditions:
- condition: trigger
id: Off_1
sequence:
- service: light.turn_off
data:
transition: !input t_trans
target:
area_id: !input target_area
- service: counter.reset
data: {}
target:
entity_id: !input counter_helper
- conditions:
- condition: trigger
id: Off_2
sequence:
if:
- condition: template
value_template: "{{input_include_all_off}}"
then:
- service: light.turn_off
data:
transition: !input t_trans
target:
entity_id: all
- service: counter.reset
data: {}
target:
entity_id: !input counter_helper
mode: restart
`
Blueprint name
philips_929002398602
Home Assistant Core Version
2022.11.5
Home Assistant Installation Type
Home Assistant Supervised
Description
The "On button short press" action executes the toggle command twice.
Mqtt Messages send from the Dimmer switch on single press (zigbee2mqtt/hue_dimmer_switch_kinderzimmer)
MQTT Messages send to the light (zigbee2mqtt/hue_lightstrip_kinderzimmer_lowboard)
Thanks in advance Andreas
Automation YAML config
To Reproduce
It always occurs on button short press
Expected behavior
My expectation would have been that either an event to turn on or off would be sent.
Actual Behaviour
The toggle event is triggered twice
Additional Details
Screenshots
No response
Additional context
No response