Skip to content

Instantly share code, notes, and snippets.

@skrashevich
Last active January 14, 2022 15:31
Show Gist options
  • Save skrashevich/40ef89f7e403899545924f7f7387a9a7 to your computer and use it in GitHub Desktop.
Save skrashevich/40ef89f7e403899545924f7f7387a9a7 to your computer and use it in GitHub Desktop.
Zigbee2MQTT - Legrand 2-Button Switch
blueprint:
name: Zigbee2MQTT - Legrand 2-Button Switch
description: Automate Legrand 2-Button Switch via Zigbee2MQTT.
domain: automation
input:
switch:
name: Legrand 2-Button Switch
description: Legrand 2-Button Switch to use
selector:
entity:
integration: mqtt
domain: sensor
left_device:
name: Left Button
description: Device to manupulate left button
default: []
selector:
target:
entity:
domain: light
right_device:
name: Right Down Button
description: Device to manupulate right button
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_right' }}"
sequence:
- service: light.turn_on
target: !input 'right_device'
- conditions:
- "{{ command == 'off_right' }}"
sequence:
- service: light.turn_off
target: !input 'right_device'
- conditions:
- "{{ command == 'on_left' }}"
sequence:
- service: light.turn_on
target: !input 'left_device'
- conditions:
- "{{ command == 'off_left' }}"
sequence:
- service: light.turn_off
target: !input 'left_device'
- conditions:
- "{{ command == 'brightness_move_up_left' }}"
sequence:
- repeat:
while: []
sequence:
- service: light.turn_on
target: !input 'left_device'
data:
brightness_step_pct: 5
transition: 0.5
- delay:
milliseconds: 500
- conditions:
- "{{ command == 'brightness_move_down_left' }}"
sequence:
- repeat:
while: []
sequence:
- service: light.turn_on
target: !input 'left_device'
data:
brightness_step_pct: -5
transition: 0.5
- delay:
milliseconds: 500
- conditions:
- "{{ command == 'brightness_move_up_right' }}"
sequence:
- repeat:
while: []
sequence:
- service: light.turn_on
target: !input 'right_device'
data:
brightness_step_pct: 5
transition: 0.5
- delay:
milliseconds: 500
- conditions:
- "{{ command == 'brightness_move_down_right' }}"
sequence:
- repeat:
while: []
sequence:
- service: light.turn_on
target: !input 'right_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