Skip to content

Instantly share code, notes, and snippets.

@psbaltar
Created February 17, 2024 23:55
Show Gist options
  • Save psbaltar/bb8f44e715051ae37852f39cf75e7a60 to your computer and use it in GitHub Desktop.
Save psbaltar/bb8f44e715051ae37852f39cf75e7a60 to your computer and use it in GitHub Desktop.
Home Assistant blueprint for handling ZHA events from Hue Tap Dial Switch
blueprint:
name: Hue Tap Dial Switch handler (ZHA)
description: >
Home Assistant blueprint for handling ZHA events from Hue Tap Dial Switch
Available variables:
command
args
params
group_id
scene_id
transition_time
step_mode
step_size
source_url: https://gist.github.com/psbaltar/bb8f44e715051ae37852f39cf75e7a60
domain: automation
input:
remote:
name: Philips Hue Tap Dial Switch
selector:
device:
integration: zha
manufacturer: Signify Netherlands B.V.
model: RDM002
button_1:
name: Button 1 Tap
description: "Action to run when button 1 is pressed."
default: []
selector:
action: {}
button_2:
name: Button 2 Tap
description: "Action to run when button 2 is pressed."
default: []
selector:
action: {}
button_3:
name: Button 3 Tap
description: "Action to run when button 3 is pressed."
default: []
selector:
action: {}
button_4:
name: Button 4 Tap
description: "Action to run when button 4 is pressed."
default: []
selector:
action: {}
dial_cw:
name: Dial CW
description: "Action to run when dial is rotated clockwise."
default: []
selector:
action: {}
dial_ccw:
name: Dial CCW
description: "Action to run when dial is rotated counterclockwise."
default: []
selector:
action: {}
mode: queued
max: 5
max_exceeded: silent
trigger:
- platform: event
event_type: zha_event
event_data:
device_id: !input "remote"
action:
- variables:
command: "{{ trigger.event.data.command }}"
args: "{{ trigger.event.data.args }}"
params: "{{ trigger.event.data.params }}"
group_id: >-
{{ trigger.event.data.params.group_id if
trigger.event.data.params.group_id is defined }}
scene_id: >-
{{ trigger.event.data.params.scene_id if
trigger.event.data.params.scene_id is defined }}
transition_time: >-
{{ trigger.event.data.params.transition_time if
trigger.event.data.params.transition_time is defined }}
step_mode: >-
{{ trigger.event.data.params.step_mode if
trigger.event.data.params.step_mode is defined }}
step_size: >-
{{ trigger.event.data.params.step_size if
trigger.event.data.params.step_size is defined }}
- choose:
- conditions: "{{ command == 'recall' and scene_id == 1 }}"
sequence: !input button_1
- conditions: "{{ command == 'recall' and scene_id == 0 }}"
sequence: !input button_2
- conditions: "{{ command == 'recall' and scene_id == 5 }}"
sequence: !input button_3
- conditions: "{{ command == 'recall' and scene_id == 4 }}"
sequence: !input button_4
- conditions: "{{ command == 'step_with_on_off' and step_mode == 'StepMode.Up' }}"
sequence: !input dial_cw
- conditions: "{{ command == 'step_with_on_off' and step_mode == 'StepMode.Down' }}"
sequence: !input dial_ccw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment