Skip to content

Instantly share code, notes, and snippets.

@ocean90
Created April 1, 2025 12:16
Show Gist options
  • Save ocean90/ac1a8c0647a04cd838c310019881f8dc to your computer and use it in GitHub Desktop.
Save ocean90/ac1a8c0647a04cd838c310019881f8dc to your computer and use it in GitHub Desktop.
blueprint:
homeassistant:
min_version: 2024.10.0
name: Z2M - Hue Dimmer switch v2 (929002398602) (MQTT trigger)
description:
"Controller automation for actions triggered by Philips Hue Dimmer switch v2 using Zigbee2MQTT.
Use the controller name as defined in Z2M e.g. (Livingroom Switch).
Version 2024.12.08"
# Based on different Blueprints. See sources.
domain: automation
input:
controller:
name: (Zigbee2MQTT) Controller Name
description: The name of the controller as defined in z2m (e.g. Livingroom Switch)
default: ""
base_topic:
name: (Zigbee2MQTT) Base mqtt topic
description: The base topic as configured in z2m
default: zigbee2mqtt
remote_button_on_press:
name: Button On Press
description: Action to run on button 1 single press
default: []
selector:
action: {}
remote_button_on_press_release:
name: Button On Press Release
description: Action to run on button 1 press release
default: []
selector:
action: {}
remote_button_on_hold:
name: Button On Hold
description: Action to run on button 1 hold
default: []
selector:
action: {}
remote_button_on_hold_release:
name: Button On Hold Release
description: Action to run on button 1 hold release
default: []
selector:
action: {}
remote_button_up_press:
name: Button Up Press
description: Action to run on button 2 single press
default: []
selector:
action: {}
remote_button_up_press_release:
name: Button Up Press Release
description: Action to run on button 2 press release
default: []
selector:
action: {}
remote_button_up_hold:
name: Button Up Hold
description: Action to run on button 2 hold
default: []
selector:
action: {}
remote_button_up_hold_release:
name: Button Up Hold Release
description: Action to run on button 2 hold release
default: []
selector:
action: {}
remote_button_down_press:
name: Button Down Press
description: Action to run on button 3 single press
default: []
selector:
action: {}
remote_button_down_press_release:
name: Button Down Press Release
description: Action to run on button 3 press release
default: []
selector:
action: {}
remote_button_down_hold:
name: Button Down Hold
description: Action to run on button 3 hold
default: []
selector:
action: {}
remote_button_down_hold_release:
name: Button Down Hold Release
description: Action to run on button 3 hold release
default: []
selector:
action: {}
remote_button_off_press:
name: Button Off Press
description: Action to run on button 4 single press
default: []
selector:
action: {}
remote_button_off_press_release:
name: Button Off Press Release
description: Action to run on button 4 press release
default: []
selector:
action: {}
remote_button_off_hold:
name: Button Off Hold
description: Action to run on button 4 hold
default: []
selector:
action: {}
remote_button_off_hold_release:
name: Button Off Hold Release
description: Action to run on button 4 hold release
default: []
selector:
action: {}
#source_url: https://gist.github.com/vandalon/20649ce1fbe5d91902d9c17f27751254
#and https://gist.github.com/CrazyCoder/28d660d9e2e8464458e591ad79b3698e
#and https://github.com/chris-1243/HA---Blueprint/blob/main/PTM_215Z_ZE%20(mqtt_trigger).yaml
mode: restart
max_exceeded: silent
trigger_variables:
base_topic: !input "base_topic"
controller: !input "controller"
triggers:
- trigger: mqtt
topic: '{{ base_topic ~ "/" ~ controller ~ "/action" }}'
conditions: '{{ "_release" | string in trigger.payload or "_press" | string in trigger.payload or "_hold" | string in trigger.payload }}'
actions:
- variables:
action: '{{ trigger.payload }}'
- choose:
- conditions: '{{ action == ''on_press'' }}'
sequence: !input remote_button_on_press
- conditions: '{{ action == ''on_press_release'' }}'
sequence: !input remote_button_on_press_release
- conditions: '{{ action == ''on_hold'' }}'
sequence: !input remote_button_on_hold
- conditions: '{{ action == ''on_hold_release'' }}'
sequence: !input remote_button_on_hold_release
- conditions: '{{ action == ''up_press'' }}'
sequence: !input remote_button_up_press
- conditions: '{{ action == ''up_press_release'' }}'
sequence: !input remote_button_up_press_release
- conditions: '{{ action == ''up_hold'' }}'
sequence: !input remote_button_up_hold
- conditions: '{{ action == ''up_hold_release'' }}'
sequence: !input remote_button_up_hold_release
- conditions: '{{ action == ''down_press'' }}'
sequence: !input remote_button_down_press
- conditions: '{{ action == ''down_press_release'' }}'
sequence: !input remote_button_down_press_release
- conditions: '{{ action == ''down_hold'' }}'
sequence: !input remote_button_down_hold
- conditions: '{{ action == ''down_hold_release'' }}'
sequence: !input remote_button_down_hold_release
- conditions: '{{ action == ''off_press'' }}'
sequence: !input remote_button_off_press
- conditions: '{{ action == ''off_press_release'' }}'
sequence: !input remote_button_off_press_release
- conditions: '{{ action == ''off_hold'' }}'
sequence: !input remote_button_off_hold
- conditions: '{{ action == ''off_hold_release'' }}'
sequence: !input remote_button_off_hold_release
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment