Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save pantherale0/6e01cec92f451a7137805dc625d079e0 to your computer and use it in GitHub Desktop.
Save pantherale0/6e01cec92f451a7137805dc625d079e0 to your computer and use it in GitHub Desktop.
Z2M Philips Hue Switch RWL022
blueprint:
name: Z2M - Philips Hue Dimmer Switch RWL022
description: Choose what all four buttons will do.
domain: automation
input:
remote:
name: Hue Dimmer switch
description: Hue Dimmer switch to use (Zigbee2mqtt event sensor)
selector:
entity:
domain: event
button_1_single_press:
name: Button 1 (POWER) Single Press
description: Action to run on single press
default: []
selector:
action: {}
button_1_long_press:
name: Button 1 (POWER) Long Press
description: Action to run on long press
default: []
selector:
action: {}
button_2_single_press:
name: Button 2 (BRIGHTNESS_UP) Single Press
description: Action to run on single press
default: []
selector:
action: {}
button_2_long_press:
name: Button 2 (BRIGHTNESS_UP) Long Press
description: Action to run on long press
default: []
selector:
action: {}
button_3_single_press:
name: Button 3 (BRIGHTNESS_DOWN) Single Press
description: Action to run on single press
default: []
selector:
action: {}
button_3_long_press:
name: Button 3 (BRIGHTNESS_DOWN) Long Press
description: Action to run on long press
default: []
selector:
action: {}
button_4_single_press:
name: Button 4 (HUE) Single Press
description: Action to run on single press
default: []
selector:
action: {}
button_4_long_press:
name: Button 4 (HUE) Long Press
description: Action to run on long press
default: []
selector:
action: {}
source_url: https://gist.github.com/pantherale0/6e01cec92f451a7137805dc625d079e0/edit
mode: restart
max_exceeded: silent
trigger:
- platform: state
entity_id: !input "remote"
attribute: event_type
conditions:
- condition: template
value_template: "{{ trigger.to_state.attributes.event_type | default('unavailable') not in ('', 'None', 'unknown', 'unavailable') }}"
action:
- variables:
command: "{{trigger.to_state.attributes.button ~ '_' ~ trigger.to_state.attributes.event_type }}"
- choose:
- conditions:
- '{{ command == "on_press_release" }}'
sequence: !input "button_1_single_press"
- conditions:
- '{{ command == "up_press_release" }}'
sequence: !input "button_2_single_press"
- conditions:
- '{{ command == "down_press_release" }}'
sequence: !input "button_3_single_press"
- conditions:
- '{{ command == "off_press_release" }}'
sequence: !input "button_4_single_press"
- conditions:
- '{{ command == "on_hold" }}'
sequence: !input "button_1_long_press"
- conditions:
- '{{ command == "up_hold" }}'
sequence: !input "button_2_long_press"
- conditions:
- '{{ command == "down_hold" }}'
sequence: !input "button_3_long_press"
- conditions:
- '{{ command == "off_hold" }}'
sequence: !input "button_4_long_press"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment