Philips Tap Dial Switch with double tap and 4 dial actions

Hi all,

maybe someone have a hint for me.
The blueprint works fine and as expectet.
Only thing what doesn’t work are the rotation steps.
Broker sees the rotation but dimming p.e. isn’t possible.
Which Action do you recomment to increase and decrease a light / light group?
I’ve testet it with Action = Device or Action = Light.

Both works for me if i use it to turn it on or off.

I’ve read the whole thread but didn’t found a solution for me.
Is there something where i do it wrong?

In addition here a bit of my yaml

button_3_rotate_clockwise:
      - action: light.turn_on
        target:
          entity_id: light.lampe_buro
        data:
          transition: 0
          brightness_step: 10
    button_3_rotate_counter_clockwise:
      - action: light.turn_on
        target:
          entity_id: light.lampe_buro
        data:
          brightness_step: -10 

I also have the problem that z2m sends 2 commands at a time. The counter jumps to 2 when you click once and to 4 when you double click. This must be related to some z2m update.

I deleted the dial switch, the counter, etc. Can someone tell me exactly where I need to change the blueprint or maybe make a small update.

thank you

So I am trying to figure this out.

What i wanted to do was utilize the step_size to make the increase the values faster or slower depending on amount of steps. E.g 0-15, 10% 16-30, 20% etc etc.
But then i walked into this.

The device seems to send two different payloads (dial_rotate* and brightness_step*) at the approximately same time (within 0.1s).
Both contain unique values. E.g action_direction and action_step_size.

This automation/blueprint seems to work with the first type of payload, rendering it impossible (as is) to get hold of the step_size.

I also notices that sometimes, instead of only 2 events. I get 4. i.e two of each kind, when spinning the dial fast, creating one a “slow” and a “fast” event for a single turn of the dial.

This made me start looking into de-bounce in z2m.
But doing that it will overwrite the action, and depending on what action triggered first i guess it will retain common attributes.

I do not know, is this intended behavior or not and is there other mitigation to be made and not only denounce?

I guess one could add a choice to act differently if the action is a _fast/_slow?
E.g slow = 10%, fast 20%.

Thoughts and suggestions?

  payload_json:
    action: dial_rotate_right_fast
    action_direction: right
    action_step_size: null
    action_time: 90
    action_type: step
    battery: 100
    brightness: null
    last_seen: '2025-01-08T19:21:36+01:00'
    linkquality: 98
    update:
      installed_version: 33569561
      latest_version: 33569561
      state: idle
  payload_json:
    action: brightness_step_up
    action_direction: null
    action_step_size: 38
    action_time: null
    action_transition_time: 0.04
    action_type: null
    battery: 100
    brightness: null
    last_seen: '2025-01-08T19:21:36+01:00'
    linkquality: 94
    update:
      installed_version: 33569561
      latest_version: 33569561
      state: idle

Debounce set to 0.1

payload_json:
    action: brightness_step_up
    action_direction: right
    action_step_size: 26
    action_time: 60
    action_transition_time: 0.04
    action_type: rotate
    battery: 100
    brightness: null
    last_seen: '2025-01-08T19:30:58+01:00'
    linkquality: 58
    update:
      installed_version: 33569561
      latest_version: 33569561
      state: idle

Ended up doing a choose block, with template conditions that check for :

dial_rotate_*_fast
dial_rotate_*_slow

And a default action for the step.
Also added a condition in the beginning of the blueprint so that it ignores the brightness_step* actions as early as possible to slightly speed up the execution time.

Experimenting with if using queued execution also feels more reliable than parallel as it seems like sometimes the turning of the wheel will send a fast and slow action and the light in/de-crease looks a bit jerky when it’s parallel. Could be imaginary though.

Love the blueprint and your work
Is there an easy way to modify the Zigbee2mqtt to set the dial to not turn on a light if it is off and I’m increasing brightness? I’m also looking to set different values (say eg. brightness change) for a fast and a slow rotation

I received a request from someone having my issue with the tap dial recording twice with each button press. Hope this is ok - sharing my automation below because I couldn’t fit the full script in a PM and figured others might have a use for this too.

alias: Basement Tap Dial Switch Automation YAML
description: >-
  Zigbee2MQTT - Philips Hue Tap Dial Switch by SmartHomeGeeks.io


  4-9-2024: JWD Modified single and double presses to account for
  double-registers on Z2M with every press…
triggers:
  - topic: zigbee2mqtt/Basement Tap Dial
    trigger: mqtt
conditions:
  - condition: template
    value_template: "{{ trigger.payload_json.action != '' }}"
actions:
  - variables:
      input_text_var: input_text.basement_dial_switch_last_pressed
      counter_var: counter.basement_dial_switch_button_counter
    alias: Variables for input and counter helpers
  - choose:
      - conditions:
          - condition: template
            value_template: "{{ trigger.payload_json.action is match('^button_[1-4]_press$') }}"
        sequence:
          - if:
              - condition: template
                value_template: >-
                  {{ trigger.payload_json.action | regex_replace(find='[^1-4]',
                  replace='') != states(input_text_var) }}
            then:
              - target:
                  entity_id: "{{ counter_var }}"
                action: counter.reset
            alias: Prevent different buttons to be registered as double press
          - data:
              value: >-
                {{ trigger.payload_json.action | regex_replace(find='[^1-4]',
                replace='') }}
            target:
              entity_id: "{{ input_text_var }}"
            alias: Update the input text helper with the last pressed button number
            action: input_text.set_value
          - target:
              entity_id: "{{ counter_var }}"
            alias: Increase the counter helper with 1
            action: counter.increment
          - delay:
              seconds: 1
          - target:
              entity_id: "{{ counter_var }}"
            alias: Reset the counter helper
            action: counter.reset
        alias: Update Last Pressed
      - conditions:
          - condition: template
            value_template: >-
              {{ trigger.payload_json.action is
              match('button_[1-4]_press_release') and states(counter_var) > '2'
              }}
        sequence:
          - choose:
              - conditions:
                  - condition: template
                    value_template: >-
                      {{ trigger.payload_json.action == 'button_1_press_release'
                      }}
                sequence:
                  - action: automation.trigger
                    metadata: {}
                    data:
                      skip_condition: true
                    target:
                      entity_id: automation.basement_fan_power
                alias: Double press button 1
              - conditions:
                  - condition: template
                    value_template: >-
                      {{ trigger.payload_json.action == 'button_2_press_release'
                      }}
                sequence:
                  - action: automation.trigger
                    metadata: {}
                    data:
                      skip_condition: true
                    target:
                      entity_id: automation.basement_fan_speed_up
                alias: Double press button 2
              - conditions:
                  - condition: template
                    value_template: >-
                      {{ trigger.payload_json.action == 'button_3_press_release'
                      }}
                sequence:
                  - action: automation.trigger
                    metadata: {}
                    data:
                      skip_condition: true
                    target:
                      entity_id: automation.basement_fan_reverse_direction
                alias: Double press button 3
              - conditions:
                  - condition: template
                    value_template: >-
                      {{ trigger.payload_json.action == 'button_4_press_release'
                      }}
                sequence:
                  - action: automation.trigger
                    metadata: {}
                    data:
                      skip_condition: true
                    target:
                      entity_id: automation.basement_fan_speed_down
                alias: Double press button 4
              - conditions: []
                sequence: []
        alias: Double xxx2 event
    default:
      - if:
          - condition: template
            value_template: >-
              {{ trigger.payload_json.action is
              match('button_[1-4]_press_release') }}
        then:
          - delay:
              milliseconds: 250
          - if:
              - condition: template
                value_template: "{{ states(counter_var) > '2' }}"
            then:
              - stop: Double tap detected
        alias: Single xxx2 event
      - choose:
          - conditions:
              - condition: template
                value_template: >-
                  {{ states(input_text_var) == '1' and
                  trigger.payload_json.action is match('^dial_rotate_') }}
            sequence:
              - choose:
                  - conditions:
                      - condition: template
                        value_template: >-
                          {{ trigger.payload_json.action is
                          match('^dial_rotate_left_') }}
                    sequence:
                      - if:
                          - condition: device
                            type: is_on
                            device_id: 4943284b3347df987a71cee5aa6a9473
                            entity_id: c9ab062b90f984dc278d1ef7974833aa
                            domain: light
                          - condition: device
                            type: is_off
                            device_id: 4943284b3347df987a71cee5aa6a9473
                            entity_id: 454c09d2a21fb1f3edae8c7378507f1b
                            domain: light
                          - condition: device
                            type: is_on
                            device_id: abe459c54de778cc9a02b28b708828cc
                            entity_id: 8dc9951481ea5f4da632be0db234b838
                            domain: light
                        then:
                          - metadata: {}
                            data:
                              brightness_step_pct: -10
                              transition: 1
                            target:
                              entity_id:
                                - light.basement_aqara_light_white
                                - light.basement_hue_overhead
                            action: light.turn_on
                        enabled: true
                      - if: []
                        then: []
                  - conditions:
                      - condition: template
                        value_template: >-
                          {{ trigger.payload_json.action is
                          match('^dial_rotate_right_') }}
                    sequence:
                      - metadata: {}
                        data:
                          brightness_step_pct: 10
                          transition: 1
                        target:
                          entity_id:
                            - light.basement_aqara_light_white
                            - light.basement_hue_overhead
                        action: light.turn_on
            alias: Dial rotate after button 1 pressed
          - conditions:
              - condition: template
                value_template: >-
                  {{ states(input_text_var) == '2' and
                  trigger.payload_json.action is match('^dial_rotate_') }}
            sequence:
              - choose:
                  - conditions:
                      - condition: template
                        value_template: >-
                          {{ trigger.payload_json.action is
                          match('^dial_rotate_left_') }}
                    sequence:
                      - if:
                          - condition: device
                            type: is_on
                            device_id: abe459c54de778cc9a02b28b708828cc
                            entity_id: 8dc9951481ea5f4da632be0db234b838
                            domain: light
                        then:
                          - metadata: {}
                            data:
                              transition: 1
                              brightness_step_pct: -10
                            target:
                              entity_id:
                                - light.basement_hue_overhead
                            action: light.turn_on
                      - if:
                          - condition: device
                            type: is_on
                            device_id: 4943284b3347df987a71cee5aa6a9473
                            entity_id: c9ab062b90f984dc278d1ef7974833aa
                            domain: light
                        then:
                          - metadata: {}
                            data:
                              transition: 1
                              brightness_step_pct: -10
                            target:
                              entity_id:
                                - light.basement_aqara_light_white
                            action: light.turn_on
                      - if:
                          - condition: device
                            type: is_on
                            device_id: 4943284b3347df987a71cee5aa6a9473
                            entity_id: 454c09d2a21fb1f3edae8c7378507f1b
                            domain: light
                        then:
                          - metadata: {}
                            data:
                              transition: 1
                              brightness_step_pct: -10
                            target:
                              entity_id:
                                - light.basement_aqara_light_rgb
                            action: light.turn_on
                  - conditions:
                      - condition: template
                        value_template: >-
                          {{ trigger.payload_json.action is
                          match('^dial_rotate_right_') }}
                    sequence:
                      - if:
                          - condition: device
                            type: is_on
                            device_id: abe459c54de778cc9a02b28b708828cc
                            entity_id: 8dc9951481ea5f4da632be0db234b838
                            domain: light
                        then:
                          - metadata: {}
                            data:
                              transition: 1
                              brightness_step_pct: 10
                            target:
                              entity_id:
                                - light.basement_hue_overhead
                            action: light.turn_on
                      - if:
                          - condition: device
                            type: is_on
                            device_id: 4943284b3347df987a71cee5aa6a9473
                            entity_id: c9ab062b90f984dc278d1ef7974833aa
                            domain: light
                        then:
                          - metadata: {}
                            data:
                              transition: 1
                              brightness_step_pct: 10
                            target:
                              entity_id:
                                - light.basement_aqara_light_white
                            action: light.turn_on
                      - if:
                          - condition: device
                            type: is_on
                            device_id: 4943284b3347df987a71cee5aa6a9473
                            entity_id: 454c09d2a21fb1f3edae8c7378507f1b
                            domain: light
                        then:
                          - metadata: {}
                            data:
                              transition: 1
                              brightness_step_pct: 10
                            target:
                              entity_id:
                                - light.basement_aqara_light_rgb
                            action: light.turn_on
            alias: Dial rotate after button 2 pressed
          - conditions:
              - condition: template
                value_template: >-
                  {{ states(input_text_var) == '3' and
                  trigger.payload_json.action is match('^dial_rotate_') }}
            sequence:
              - choose:
                  - conditions:
                      - condition: template
                        value_template: >-
                          {{ trigger.payload_json.action is
                          match('^dial_rotate_left_') }}
                    sequence:
                      - if:
                          - condition: device
                            type: is_on
                            device_id: abe459c54de778cc9a02b28b708828cc
                            entity_id: 8dc9951481ea5f4da632be0db234b838
                            domain: light
                        then:
                          - metadata: {}
                            data:
                              transition: 1
                              brightness_step_pct: -10
                            target:
                              entity_id:
                                - light.basement_hue_overhead
                            action: light.turn_on
                      - if:
                          - condition: device
                            type: is_on
                            device_id: 4943284b3347df987a71cee5aa6a9473
                            entity_id: c9ab062b90f984dc278d1ef7974833aa
                            domain: light
                        then:
                          - metadata: {}
                            data:
                              transition: 1
                              brightness_step_pct: -10
                            target:
                              entity_id:
                                - light.basement_aqara_light_white
                            action: light.turn_on
                      - if:
                          - condition: device
                            type: is_on
                            device_id: 4943284b3347df987a71cee5aa6a9473
                            entity_id: 454c09d2a21fb1f3edae8c7378507f1b
                            domain: light
                        then:
                          - metadata: {}
                            data:
                              transition: 1
                              brightness_step_pct: -10
                            target:
                              entity_id:
                                - light.basement_aqara_light_rgb
                            action: light.turn_on
                  - conditions:
                      - condition: template
                        value_template: >-
                          {{ trigger.payload_json.action is
                          match('^dial_rotate_right_') }}
                    sequence:
                      - if:
                          - condition: device
                            type: is_on
                            device_id: abe459c54de778cc9a02b28b708828cc
                            entity_id: 8dc9951481ea5f4da632be0db234b838
                            domain: light
                        then:
                          - metadata: {}
                            data:
                              transition: 1
                              brightness_step_pct: 10
                            target:
                              entity_id:
                                - light.basement_hue_overhead
                            action: light.turn_on
                      - if:
                          - condition: device
                            type: is_on
                            device_id: 4943284b3347df987a71cee5aa6a9473
                            entity_id: c9ab062b90f984dc278d1ef7974833aa
                            domain: light
                        then:
                          - metadata: {}
                            data:
                              transition: 1
                              brightness_step_pct: 10
                            target:
                              entity_id:
                                - light.basement_aqara_light_white
                            action: light.turn_on
                      - if:
                          - condition: device
                            type: is_on
                            device_id: 4943284b3347df987a71cee5aa6a9473
                            entity_id: 454c09d2a21fb1f3edae8c7378507f1b
                            domain: light
                        then:
                          - metadata: {}
                            data:
                              transition: 1
                              brightness_step_pct: 10
                            target:
                              entity_id:
                                - light.basement_aqara_light_rgb
                            action: light.turn_on
            alias: Dial rotate after button 3 pressed
          - conditions:
              - condition: template
                value_template: >-
                  {{ states(input_text_var) == '4' and
                  trigger.payload_json.action is match('^dial_rotate_') }}
            sequence:
              - choose:
                  - conditions:
                      - condition: template
                        value_template: >-
                          {{ trigger.payload_json.action is
                          match('^dial_rotate_left_') }}
                    sequence:
                      - if:
                          - condition: device
                            type: is_on
                            device_id: abe459c54de778cc9a02b28b708828cc
                            entity_id: 8dc9951481ea5f4da632be0db234b838
                            domain: light
                        then:
                          - metadata: {}
                            data:
                              transition: 1
                              brightness_step_pct: -10
                            target:
                              entity_id:
                                - light.basement_hue_overhead
                            action: light.turn_on
                      - if:
                          - condition: device
                            type: is_on
                            device_id: 4943284b3347df987a71cee5aa6a9473
                            entity_id: c9ab062b90f984dc278d1ef7974833aa
                            domain: light
                        then:
                          - metadata: {}
                            data:
                              transition: 1
                              brightness_step_pct: -10
                            target:
                              entity_id:
                                - light.basement_aqara_light_white
                            action: light.turn_on
                      - if:
                          - condition: device
                            type: is_on
                            device_id: 4943284b3347df987a71cee5aa6a9473
                            entity_id: 454c09d2a21fb1f3edae8c7378507f1b
                            domain: light
                        then:
                          - metadata: {}
                            data:
                              transition: 1
                              brightness_step_pct: -10
                            target:
                              entity_id:
                                - light.basement_aqara_light_rgb
                            action: light.turn_on
                  - conditions:
                      - condition: template
                        value_template: >-
                          {{ trigger.payload_json.action is
                          match('^dial_rotate_right_') }}
                    sequence:
                      - if:
                          - condition: device
                            type: is_on
                            device_id: abe459c54de778cc9a02b28b708828cc
                            entity_id: 8dc9951481ea5f4da632be0db234b838
                            domain: light
                        then:
                          - metadata: {}
                            data:
                              transition: 1
                              brightness_step_pct: 10
                            target:
                              entity_id:
                                - light.basement_hue_overhead
                            action: light.turn_on
                      - if:
                          - condition: device
                            type: is_on
                            device_id: 4943284b3347df987a71cee5aa6a9473
                            entity_id: c9ab062b90f984dc278d1ef7974833aa
                            domain: light
                        then:
                          - metadata: {}
                            data:
                              transition: 1
                              brightness_step_pct: 10
                            target:
                              entity_id:
                                - light.basement_aqara_light_white
                            action: light.turn_on
                      - if:
                          - condition: device
                            type: is_on
                            device_id: 4943284b3347df987a71cee5aa6a9473
                            entity_id: 454c09d2a21fb1f3edae8c7378507f1b
                            domain: light
                        then:
                          - metadata: {}
                            data:
                              transition: 1
                              brightness_step_pct: 10
                            target:
                              entity_id:
                                - light.basement_aqara_light_rgb
                            action: light.turn_on
            alias: Dial rotate after button 4 pressed
          - conditions:
              - condition: template
                value_template: "{{ trigger.payload_json.action == 'button_1_press_release' }}"
            sequence:
              - target:
                  entity_id:
                    - light.basement_theater_lights_ringonly
                data:
                  transition: 1
                  kelvin: 3999
                  brightness_pct: 55
                action: light.toggle
            alias: Button 1 pressed
          - conditions:
              - condition: template
                value_template: "{{ trigger.payload_json.action == 'button_1_hold' }}"
            sequence:
              - metadata: {}
                data:
                  transition: 3
                target:
                  entity_id:
                    - light.basement_theater_lights_ringonly
                    - light.basement_aqara_light_rgb
                action: light.turn_off
            alias: Button 1 hold
          - conditions:
              - condition: template
                value_template: "{{ trigger.payload_json.action == 'button_2_press_release' }}"
            sequence:
              - metadata: {}
                data:
                  transition: 1
                  brightness_pct: 100
                  kelvin: 4002
                target:
                  entity_id: light.basement_aqara_light_rgb
                action: light.toggle
            alias: Button 2 pressed
          - conditions:
              - condition: template
                value_template: "{{ trigger.payload_json.action == 'button_2_hold' }}"
            sequence: []
            alias: Button 2 hold
          - conditions:
              - condition: template
                value_template: "{{ trigger.payload_json.action == 'button_3_press_release' }}"
            sequence:
              - metadata: {}
                data:
                  transition: 1
                  kelvin: 4000
                  brightness: 55
                target:
                  entity_id: light.basement_hue_overhead
                action: light.toggle
            alias: Button 3 pressed
          - conditions:
              - condition: template
                value_template: "{{ trigger.payload_json.action == 'button_3_hold' }}"
            sequence: []
            alias: Button 3 hold
          - conditions:
              - condition: template
                value_template: "{{ trigger.payload_json.action == 'button_4_press_release' }}"
            sequence:
              - metadata: {}
                data:
                  transition: 1
                  kelvin: 3997
                  brightness_pct: 55
                target:
                  entity_id: light.basement_aqara_light_white
                action: light.toggle
            alias: Button 4 pressed
          - conditions:
              - condition: template
                value_template: "{{ trigger.payload_json.action == 'button_4_hold' }}"
            sequence:
              - action: light.turn_off
                metadata: {}
                data:
                  transition: 5
                target:
                  entity_id:
                    - light.basement_aqara_light_white
                    - light.basement_aqara_light_rgb
              - action: light.turn_on
                metadata: {}
                data:
                  transition: 5
                  brightness_pct: 15
                  kelvin: 2596
                target:
                  device_id:
                    - 8675afb6e6400d442fd8ca525a676ca8
                    - 3d6a14ab94c9f45709d53fb47d92699f
              - action: light.turn_on
                metadata: {}
                data:
                  transition: 5
                  kelvin: 2596
                  brightness_pct: 50
                target:
                  device_id:
                    - c1bd36e0699a2014388915c474f1d01a
                    - 2b5a52ebc18eb61a9a1e579387e7faff
            alias: Button 4 hold
mode: parallel
max: 10
max_exceeded: silent
1 Like

Thank you for sharing this Blueprint. It works great with my Hue Dial Switch and Z2M integration.

I was wondering if anyone had a tip to share to accelerate/decelerate the brightness change when rotating the dial?

What I mean is that I can set an action to increase or decrease brightness through the Blueprint but that step is the same whether the dial rotates half a rotation or one click.

Not sure if this can be done through the blueprint or I need to move away from it.

I started to use a bunch of these controllers with zigbee2mqtt and got frustrated with the multiple button presses and other superfluous mqtt messages that make it a bit difficult to use.

So I created an integration that hopefully resolves this:

It supports short & long presses, dial rotations and combined button holds + dial rotations.

For easy dial control, it exposes a parameter brightness_delta to the automation.

To create an automation that changes a value on rotation you can use the exposed “Device” as a trigger and select brightness_step_up and brightness_step_down as triggers. Then you can access the delta and scale it down like so:
{{ trigger.event.data.brightness_delta | float ) * 0.1) | round(0) }}
it is positive for right turns and negative for left turns, so you can just add it to the current value of the device.

To make it work you need to enable simulated brightness in zigbee2mqtt. A delta of 1 and an interval of 50ms seem to work well.

I would appreciate your feedback if you decide to try it out! :slight_smile:

3 Likes

@xuio Thank you for your work and for sharing your approach. I’m curious if your combined controls could co-exist with multiple button presses, so basically if the original smarthomegeeks control possibilities could be extended by yours? If this was possible we’d have the most versatile tap dial switch possible I think. I could imagine to use them e.g. like this (just a real life example in my personal environment):

  • one button press: on/identify and select light (blink)
  • press button twice: off
  • rotate: change brightness of selected light
  • button hold+dial: change light color (cold-warm/RGB)
  • button hold: change e.g. from cold to warm immediately (CCT), change from CCT to RGB mode or - for my star projectors - switch through different modes (stars on/off, rotation on/off, nebula on/off)

I have 10 hue tap dial switches in my apartment which I use to control about 30 different light sources (each button on the tap dial switch for one light) and currently I use them with very basic functionality but one of my next projects will be to really make use all their potential to provide intuitive light control in all rooms. Your contribution and the contributions of the other blueprint creators is really valuable here and will make achieving this final goal much much easier!

1 Like

I just set up my Philips Hue Tap Dial controller as a scene controller with ZHA. It works quite well so I thought I’d share my experience with folks here.

First, I used Scenery to define some favorite colors and light profiles for my lights (and light groups).

Then, I created an automation blueprint to associate a Philips Hue Tap Dial controller with a light (or a light group). It works like this:

  • Single/double/triple/quadruple/quintuple click button 1, 2, or 3 to turn on the light and apply a light profile.

  • Click button 4 to turn off the light.

  • Hold button 1, 2, 3, or 4 to run a script.

  • Turn the dial to change the brightness of the light.

For my purposes, I configured button 1 to turn the light on bright white, button 2 for warm white, button 3 for a variety of colors that are easy on the eyes for bedtime, button 4 turns the light off. Multi-clicking each button produces variations on this theme. I configured the scripts to perform global actions for lights in the same area when I hold a button. In particular, holding button 4 turns off all of the lights. It feels pretty intuitive overall.

I’ve uploaded the blueprint in the Scenery repository because it works best when you have already defined a bunch of light profiles (and that’s what Scenery is good for). Hope you find it useful!

Link to the blueprint:

3 Likes

@jeffbrown Very interesting, thank you!

I just found time to test your integration and wanted to let you know it’s really well done, thank you. One thing that doesn’t work for me is Hold+Rotate actions. The sensor and the logbook don’t show any actions.

Hi @fleeman, thanks for the ZHA blueprint! I do have one issue though, I’m not able to select the device in the blueprint in the field ‘Philips Hue Tap Dial Switch’. There are no devices available. I did add the switch in the Zigbee environment, I’m also able to see the actions (buttons pressed) in the logfiles.

I did create a counter and a text helper and for those i’m able to select the correct entities.

Am I missing something?

Hi there,
I am pretty new to yaml automations. I have downloaded your most recent automation. When i paste it into my yaml code in studio code server in Hpme assistant it doesn’t get recognised as an automation. All my automations in HA start with a “-alias” but your code doesnt have “-” in front of “alias”. Am I missing something here. IU keep all my automations in a automations folder and they all work fine. How can I get the yaml file recognised as an automation.
Thank you for your help.
here is the code I have pasted in my yaml file.

alias: Z2M Tap Dial Switch Automation
description: Zigbee2MQTT - Philips Hue Tap Dial Switch by SmartHomeGeeks.io
trigger:
  - platform: mqtt
    topic: zigbee2mqtt/Tap Dial Switch Man Cave # Change to correct value
condition:
  - condition: template
    value_template: "{{ trigger.payload_json.action != '' }}"
action:
  - variables:
      input_text_var: input_text.philips_hue_dial_switch_last_pressed # Change to correct value
      counter_var: counter.philips_hue_dial_switch_button_counter # Change to correct value
    alias: Variables for input and counter helpers
  - choose:
      - conditions:
          - condition: template
            value_template: "{{ trigger.payload_json.action is match('^button_[1-4]_press$') }}"
        sequence:
          - if:
              - condition: template
                value_template: "{{ trigger.payload_json.action | regex_replace(find='[^1-4]', replace='') != states(input_text_var) }}"
            then:
              - service: counter.reset
                target:
                  entity_id: "{{ counter_var }}"
            alias: Prevent different buttons to be registered as double press
          - service: input_text.set_value
            data:
              value: "{{ trigger.payload_json.action | regex_replace(find='[^1-4]', replace='') }}"
            target:
              entity_id: "{{ input_text_var }}"
            alias: Update the input text helper with the last pressed button number
          - service: counter.increment
            target:
              entity_id: "{{ counter_var }}"
            alias: Increase the counter helper with 1
          - delay:
              seconds: 1
          - service: counter.reset
            target:
              entity_id: "{{ counter_var }}"
            alias: Reset the counter helper
        alias: Update Last Pressed
      - conditions:
          - condition: template
            value_template: "{{ trigger.payload_json.action is match('button_[1-4]_press_release') and states(counter_var) > '1' }}"
        sequence:
          - choose:
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.payload_json.action == 'button_1_press_release' }}"
                sequence: []
                alias: Double press button 1
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.payload_json.action == 'button_2_press_release' }}"
                sequence: []
                alias: Double press button 2
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.payload_json.action == 'button_3_press_release' }}"
                sequence: []
                alias: Double press button 3
              - conditions:
                  - condition: template
                    value_template: "{{ trigger.payload_json.action == 'button_4_press_release' }}"
                sequence: []
                alias: Double press button 4
        alias: Double xxx2 event
    default:
      - if:
          - condition: template
            value_template: "{{ trigger.payload_json.action is match('button_[1-4]_press_release') }}"
        then:
          - delay:
              milliseconds: 250
          - if:
              - condition: template
                value_template: "{{ states(counter_var) > '1' }}"
            then:
              - stop: Double tap detected
        alias: Single xxx2 event
      - choose:
          - conditions:
              - condition: template
                value_template: "{{ states(input_text_var) == '1' and trigger.payload_json.action is match('^dial_rotate_') }}"
            sequence:
              - choose:
                  - conditions:
                      - condition: template
                        value_template: "{{ trigger.payload_json.action is match('^dial_rotate_left_') }}"
                    sequence: []
                  - conditions:
                      - condition: template
                        value_template: "{{ trigger.payload_json.action is match('^dial_rotate_right_') }}"
                    sequence: []
            alias: Dial rotate after button 1 pressed
          - conditions:
              - condition: template
                value_template: "{{ states(input_text_var) == '2' and trigger.payload_json.action is match('^dial_rotate_') }}"
            sequence:
              - choose:
                  - conditions:
                      - condition: template
                        value_template: "{{ trigger.payload_json.action is match('^dial_rotate_left_') }}"
                    sequence: []
                  - conditions:
                      - condition: template
                        value_template: "{{ trigger.payload_json.action is match('^dial_rotate_right_') }}"
                    sequence: []
            alias: Dial rotate after button 2 pressed
          - conditions:
              - condition: template
                value_template: "{{ states(input_text_var) == '3' and trigger.payload_json.action is match('^dial_rotate_') }}"
            sequence:
              - choose:
                  - conditions:
                      - condition: template
                        value_template: "{{ trigger.payload_json.action is match('^dial_rotate_left_') }}"
                    sequence: []
                  - conditions:
                      - condition: template
                        value_template: "{{ trigger.payload_json.action is match('^dial_rotate_right_') }}"
                    sequence: []
            alias: Dial rotate after button 3 pressed
          - conditions:
              - condition: template
                value_template: "{{ states(input_text_var) == '4' and trigger.payload_json.action is match('^dial_rotate_') }}"
            sequence:
              - choose:
                  - conditions:
                      - condition: template
                        value_template: "{{ trigger.payload_json.action is match('^dial_rotate_left_') }}"
                    sequence: []
                  - conditions:
                      - condition: template
                        value_template: "{{ trigger.payload_json.action is match('^dial_rotate_right_') }}"
                    sequence: []
            alias: Dial rotate after button 4 pressed
          - conditions:
              - condition: template
                value_template: "{{ trigger.payload_json.action == 'button_1_press_release' }}"
            sequence: []
            alias: Button 1 pressed
          - conditions:
              - condition: template
                value_template: "{{ trigger.payload_json.action == 'button_1_hold' }}"
            sequence: []
            alias: Button 1 hold
          - conditions:
              - condition: template
                value_template: "{{ trigger.payload_json.action == 'button_2_press_release' }}"
            sequence: []
            alias: Button 2 pressed
          - conditions:
              - condition: template
                value_template: "{{ trigger.payload_json.action == 'button_2_hold' }}"
            sequence: []
            alias: Button 2 hold
          - conditions:
              - condition: template
                value_template: "{{ trigger.payload_json.action == 'button_3_press_release' }}"
            sequence: []
            alias: Button 3 pressed
          - conditions:
              - condition: template
                value_template: "{{ trigger.payload_json.action == 'button_3_hold' }}"
            sequence: []
            alias: Button 3 hold
          - conditions:
              - condition: template
                value_template: "{{ trigger.payload_json.action == 'button_4_press_release' }}"
            sequence: []
            alias: Button 4 pressed
          - conditions:
              - condition: template
                value_template: "{{ trigger.payload_json.action == 'button_4_hold' }}"
            sequence: []
            alias: Button 4 hold
mode: parallel
max: 10
max_exceeded: silent