So I separated the automations into two for now. One handles the buttons, and I only consider the “press release” event for the first click, as otherwise, I get both “press” and “press release” events. The other handles the “hold” action. The other automation only takes the “dial” actions to separate the three settings: brightness step slow and fast. It’s working well, although it’s not optimized, but I’m taking it step by step. I’d like to add the double-click, so I think I would need to create an automation that doesn’t trigger the other one with a single click, but it’s not easy. If you have any ideas, please let me know.
alias: Philips Hue Dial Switch - Actions de Rotation
description: Gérer les actions de rotation du dial
trigger:
- platform: mqtt
topic: zigbee2mqtt/hue_tap_dial_switch/action
condition:
- condition: template
value_template: >-
{{ trigger.payload in ['dial_rotate_right_fast', 'dial_rotate_right_step',
'dial_rotate_right_slow', 'dial_rotate_left_fast',
'dial_rotate_left_step', 'dial_rotate_left_slow'] }}
action:
- choose:
- conditions:
- condition: template
value_template: "{{ trigger.payload in ['dial_rotate_right_fast'] }}"
sequence:
- choose:
- conditions:
- condition: template
value_template: >-
{{
states('input_text.philips_hue_dial_switch_last_pressed')
== '1' }}
sequence:
- service: light.turn_on
target:
entity_id: light.allcentris
data:
brightness_step: 80
transition: 1
- conditions:
- condition: template
value_template: >-
{{
states('input_text.philips_hue_dial_switch_last_pressed')
== '2' }}
sequence:
- service: light.turn_on
target:
entity_id: light.hue_color_lamp_1
data:
brightness_step: 80
transition: 1
- conditions:
- condition: template
value_template: >-
{{
states('input_text.philips_hue_dial_switch_last_pressed')
== '3' }}
sequence:
- service: light.turn_on
target:
entity_id: light.table
data:
brightness_step: 80
transition: 1
- conditions:
- condition: template
value_template: >-
{{
states('input_text.philips_hue_dial_switch_last_pressed')
== '4' }}
sequence:
- service: light.turn_on
target:
entity_id: light.allhue
data:
brightness_step: 80
transition: 1
default:
- service: light.turn_on
target:
entity_id: all
data:
brightness_step: 80
- conditions:
- condition: template
value_template: "{{ trigger.payload in ['dial_rotate_right_step'] }}"
sequence:
- choose:
- conditions:
- condition: template
value_template: >-
{{
states('input_text.philips_hue_dial_switch_last_pressed')
== '1' }}
sequence:
- service: light.turn_on
target:
entity_id: light.allcentris
data:
brightness_step: 5
transition: 1
- conditions:
- condition: template
value_template: >-
{{
states('input_text.philips_hue_dial_switch_last_pressed')
== '2' }}
sequence:
- service: light.turn_on
target:
entity_id: light.hue_color_lamp_1
data:
brightness_step: 5
transition: 1
- conditions:
- condition: template
value_template: >-
{{
states('input_text.philips_hue_dial_switch_last_pressed')
== '3' }}
sequence:
- service: light.turn_on
target:
entity_id: light.table
data:
brightness_step: 5
transition: 1
- conditions:
- condition: template
value_template: >-
{{
states('input_text.philips_hue_dial_switch_last_pressed')
== '4' }}
sequence:
- service: light.turn_on
target:
entity_id: light.allhue
data:
brightness_step: 5
transition: 1
default:
- service: light.turn_on
target:
entity_id: all
data:
brightness_step: 5
transition: 1
- conditions:
- condition: template
value_template: "{{ trigger.payload in ['dial_rotate_right_slow'] }}"
sequence:
- choose:
- conditions:
- condition: template
value_template: >-
{{
states('input_text.philips_hue_dial_switch_last_pressed')
== '1' }}
sequence:
- service: light.turn_on
target:
entity_id: light.allcentris
data:
brightness_step: 20
transition: 1
- conditions:
- condition: template
value_template: >-
{{
states('input_text.philips_hue_dial_switch_last_pressed')
== '2' }}
sequence:
- service: light.turn_on
target:
entity_id: light.hue_color_lamp_1
data:
brightness_step: 20
transition: 1
- conditions:
- condition: template
value_template: >-
{{
states('input_text.philips_hue_dial_switch_last_pressed')
== '3' }}
sequence:
- service: light.turn_on
target:
entity_id: light.table
data:
brightness_step: 20
transition: 1
- conditions:
- condition: template
value_template: >-
{{
states('input_text.philips_hue_dial_switch_last_pressed')
== '4' }}
sequence:
- service: light.turn_on
target:
entity_id: light.allhue
data:
brightness_step: 20
transition: 1
default:
- service: light.turn_on
target:
entity_id: all
data:
brightness_step: 20
- conditions:
- condition: template
value_template: "{{ trigger.payload in ['dial_rotate_left_fast'] }}"
sequence:
- choose:
- conditions:
- condition: template
value_template: >-
{{
states('input_text.philips_hue_dial_switch_last_pressed')
== '1' }}
sequence:
- service: light.turn_on
target:
entity_id: light.allcentris
data:
brightness_step: -80
transition: 1
- conditions:
- condition: template
value_template: >-
{{
states('input_text.philips_hue_dial_switch_last_pressed')
== '2' }}
sequence:
- service: light.turn_on
target:
entity_id: light.hue_color_lamp_1
data:
brightness_step: -80
transition: 1
- conditions:
- condition: template
value_template: >-
{{
states('input_text.philips_hue_dial_switch_last_pressed')
== '3' }}
sequence:
- service: light.turn_on
target:
entity_id: light.table
data:
brightness_step: -80
transition: 1
- conditions:
- condition: template
value_template: >-
{{
states('input_text.philips_hue_dial_switch_last_pressed')
== '4' }}
sequence:
- service: light.turn_on
target:
entity_id: light.allhue
data:
brightness_step: -80
transition: 1
default:
- service: light.turn_on
target:
entity_id: all
data:
brightness_step: -80
transition: 1
- conditions:
- condition: template
value_template: "{{ trigger.payload in ['dial_rotate_left_step'] }}"
sequence:
- choose:
- conditions:
- condition: template
value_template: >-
{{
states('input_text.philips_hue_dial_switch_last_pressed')
== '1' }}
sequence:
- service: light.turn_on
target:
entity_id: light.allcentris
data:
brightness_step: -5
transition: 1
- conditions:
- condition: template
value_template: >-
{{
states('input_text.philips_hue_dial_switch_last_pressed')
== '2' }}
sequence:
- service: light.turn_on
target:
entity_id: light.hue_color_lamp_1
data:
brightness_step: -5
transition: 1
- conditions:
- condition: template
value_template: >-
{{
states('input_text.philips_hue_dial_switch_last_pressed')
== '3' }}
sequence:
- service: light.turn_on
target:
entity_id: light.table
data:
brightness_step: -5
transition: 1
- conditions:
- condition: template
value_template: >-
{{
states('input_text.philips_hue_dial_switch_last_pressed')
== '4' }}
sequence:
- service: light.turn_on
target:
entity_id: light.allhue
data:
brightness_step: -5
transition: 1
default:
- service: light.turn_on
target:
entity_id: all
data:
brightness_step: -5
transition: 1
- conditions:
- condition: template
value_template: "{{ trigger.payload in ['dial_rotate_left_slow'] }}"
sequence:
- choose:
- conditions:
- condition: template
value_template: >-
{{
states('input_text.philips_hue_dial_switch_last_pressed')
== '1' }}
sequence:
- service: light.turn_on
target:
entity_id: light.allcentris
data:
brightness_step: -20
transition: 1
- conditions:
- condition: template
value_template: >-
{{
states('input_text.philips_hue_dial_switch_last_pressed')
== '2' }}
sequence:
- service: light.turn_on
target:
entity_id: light.hue_color_lamp_1
data:
brightness_step: -20
transition: 1
- conditions:
- condition: template
value_template: >-
{{
states('input_text.philips_hue_dial_switch_last_pressed')
== '3' }}
sequence:
- service: light.turn_on
target:
entity_id: light.table
data:
brightness_step: -20
transition: 1
- conditions:
- condition: template
value_template: >-
{{
states('input_text.philips_hue_dial_switch_last_pressed')
== '4' }}
sequence:
- service: light.turn_on
target:
entity_id: light.allhue
data:
brightness_step: -20
transition: 1
default:
- service: light.turn_on
target:
entity_id: all
data:
brightness_step: -20
transition: 1
mode: parallel
max: 10
alias: Philips Hue Dial Switch juste bouton
description: Update last pressed button
trigger:
- platform: mqtt
topic: zigbee2mqtt/hue_tap_dial_switch/action
condition:
- condition: template
value_template: "{{ 'dial' not in trigger.payload }}"
action:
- choose:
- conditions:
- condition: template
value_template: "{{ trigger.payload == 'button_1_press_release' }}"
alias: Button 1 Press/Release
sequence:
- service: light.toggle
target:
entity_id: light.allcentris
data: {}
- service: input_text.set_value
data:
value: "1"
target:
entity_id: input_text.philips_hue_dial_switch_last_pressed
- conditions:
- condition: template
value_template: "{{ trigger.payload == 'button_1_hold' }}"
alias: Button 1 Hold
sequence:
- service: scene.turn_on
target:
entity_id: scene.salon_lumiere_naturelle
data: {}
- service: input_text.set_value
data:
value: "1"
target:
entity_id: input_text.philips_hue_dial_switch_last_pressed
- conditions:
- condition: template
value_template: "{{ trigger.payload == 'button_2_press_release' }}"
alias: Button 2 Press/Release
sequence:
- service: light.toggle
target:
entity_id: light.hue_color_lamp_1
data: {}
- service: input_text.set_value
data:
value: "2"
target:
entity_id: input_text.philips_hue_dial_switch_last_pressed
- conditions:
- condition: template
value_template: "{{ trigger.payload == 'button_2_hold' }}"
alias: Button 2 Hold
sequence:
- service: scene.turn_on
target:
entity_id: scene.salon_concentration
data: {}
- service: input_text.set_value
data:
value: "2"
target:
entity_id: input_text.philips_hue_dial_switch_last_pressed
- conditions:
- condition: template
value_template: "{{ trigger.payload == 'button_3_press_release' }}"
alias: Button 3 Press/Release
sequence:
- service: light.toggle
target:
entity_id: light.table
data: {}
- service: input_text.set_value
data:
value: "3"
target:
entity_id: input_text.philips_hue_dial_switch_last_pressed
- conditions:
- condition: template
value_template: "{{ trigger.payload == 'button_3_hold' }}"
alias: Button 3 Hold
sequence:
- service: scene.turn_on
target:
entity_id: scene.salon_hocus_pocus
data: {}
- service: input_text.set_value
data:
value: "3"
target:
entity_id: input_text.philips_hue_dial_switch_last_pressed
- conditions:
- condition: template
value_template: "{{ trigger.payload == 'button_4_press_release' }}"
alias: Button 4 Press/Release
sequence:
- service: light.toggle
target:
entity_id: light.allhue
data: {}
- condition: template
value_template: "{{ is_state('light.centris_centre', 'on') }}"
- service: input_text.set_value
data:
value: "4"
target:
entity_id: input_text.philips_hue_dial_switch_last_pressed
- conditions:
- condition: template
value_template: "{{ trigger.payload == 'button_4_hold' }}"
alias: Button 4 Hold
sequence:
- service: scene.turn_on
target:
entity_id: scene.salon_festive_fun
data: {}
- service: input_text.set_value
data:
value: "4"
target:
entity_id: input_text.philips_hue_dial_switch_last_pressed
mode: parallel
max: 10