Skip to content

Instantly share code, notes, and snippets.

@hurricanepkt
Last active March 10, 2022 05:40
Show Gist options
  • Save hurricanepkt/55a24d2edc6f2ff3c957ac26b0a183b8 to your computer and use it in GitHub Desktop.
Save hurricanepkt/55a24d2edc6f2ff3c957ac26b0a183b8 to your computer and use it in GitHub Desktop.
Zigbee2Mqtt Button Light Control
blueprint:
name: Zigbee2MQTT Button Control
description: "This Blueprint allows Zigbee2MQTT - Sonoff SNZB01 button to lights. Different Lights for Single, double, and Long Press"
domain: automation
input:
z2m_button_topic:
name: MQTT State Topic of your Zigbee2MQTT Button
description: "The State Topic is composed of your Zigbee2MQTT base_topic (see your Z2M Addon Configuration) and the Friendly Name of your keypad in Z2M. Example: zigbee2mqtt/0x00124b0024ce317c"
single_light:
name: Single Press Light
description: "The entity for the light to toggle when Single Click occurrs"
double_light:
name: Double Press Light
description: "The entity for the light to toggle when Double Click occurrs"
trigger:
- platform: mqtt
topic: !input z2m_button_topic
id: button_mqtt
condition: []
action:
- choose:
- conditions:
- condition: template
value_template: '{{ trigger.payload_json.action == "single" }}'
sequence:
- service: light.toggle
data: {}
target:
entity_id: !input single_light
- conditions:
- condition: template
value_template: '{{ trigger.payload_json.action == "double" }}'
sequence:
- service: light.toggle
data: {}
target:
entity_id: !input double_light
- conditions:
- condition: template
value_template: '{{ trigger.payload_json.action == "long" }}'
sequence:
- service: light.toggle
data: {}
target:
entity_id: !input single_light
- service: light.toggle
data: {}
target:
entity_id: !input double_light
mode: parallel
max: 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment