Skip to content

Instantly share code, notes, and snippets.

@skrashevich
Created January 14, 2022 21:06
Show Gist options
  • Save skrashevich/7db2bf0c38ec24373594c997fdae8924 to your computer and use it in GitHub Desktop.
Save skrashevich/7db2bf0c38ec24373594c997fdae8924 to your computer and use it in GitHub Desktop.
blueprint:
name: Zigbee2MQTT - Legrand 1-Button Switch
description: Automate Legrand 1-Button Switch via Zigbee2MQTT.
domain: automation
input:
switch:
name: Legrand 1-Button Switch
description: Legrand 1-Button Switch to use
selector:
entity:
integration: mqtt
domain: sensor
device:
name: Device to manupulate
description: Device to manupulate
default: []
selector:
target:
entity:
domain: light
mode: restart
max_exceeded: silent
trigger:
- platform: state
entity_id: !input "switch"
attribute: action
action:
- variables:
command: "{{ trigger.to_state.state }}"
- choose:
- conditions:
- "{{ command == 'on' }}"
sequence:
- service: light.turn_on
target: !input 'device'
- conditions:
- "{{ command == 'off' }}"
sequence:
- service: light.turn_off
target: !input 'device'
- conditions:
- "{{ command == 'brightness_move_up' }}"
sequence:
- repeat:
while: []
sequence:
- service: light.turn_on
target: !input 'device'
data:
brightness_step_pct: 5
transition: 0.5
- delay:
milliseconds: 500
- conditions:
- "{{ command == 'brightness_move_down' }}"
sequence:
- repeat:
while: []
sequence:
- service: light.turn_on
target: !input 'device'
data:
brightness_step_pct: -5
transition: 0.5
- delay:
milliseconds: 500
default: []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment