Skip to content

Instantly share code, notes, and snippets.

@towo
Last active December 9, 2022 23:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save towo/be7445e9a7c470ff16e25c6a6922e9e1 to your computer and use it in GitHub Desktop.
Save towo/be7445e9a7c470ff16e25c6a6922e9e1 to your computer and use it in GitHub Desktop.
OSRAM Smart+ Switch blueprint
blueprint:
name: OSRAM Smart+ Switch
description: Allows mapping of all the buttons of a OSRAM Smart+ Zigbee switch. (ZHA)
domain: automation
input:
device:
name: Device
description: Device entry for the switch.
selector:
device:
manufacturer: OSRAM
# Button 1 - top left
button_1_press:
name: Button 1 press
description: Action to run when pressing the top left button.
default: []
selector:
action:
button_1_hold:
name: Button 1 hold
description: Action to run when holding the top left button.
default: []
selector:
action:
button_1_release:
name: Button 1 release
description: Action to run when releasing the top left button.
default: []
selector:
action:
# Button 2 - top right
button_2_press:
name: Button 2 press
description: Action to run when pressing the top right button.
default: []
selector:
action:
button_2_hold:
name: Button 2 hold
description: Action to run when holding the top right button.
default: []
selector:
action:
button_2_release:
name: Button 2 release
description: Action to run when releasing the top right button.
default: []
selector:
action:
button_3_press:
name: Button 3 press
description: Action to run when pressing the bottom left button.
default: []
selector:
action:
# Button 3 - bottom left
button_3_hold:
name: Button 3 hold
description: Action to run when holding the bottom left button.
default: []
selector:
action:
button_3_release:
name: Button 3 release
description: Action to run when releasing the bottom left button.
default: []
selector:
action:
# Button 4 - bottom right
button_4_press:
name: Button 4 press
description: Action to run when pressing the bottom right button.
default: []
selector:
action:
button_4_hold:
name: Button 4 hold
description: Action to run when holding the bottom right button.
default: []
selector:
action:
button_4_release:
name: Button 4 release
description: Action to run when releasing the bottom right button.
default: []
selector:
action:
mode: restart
max_exceeded: silent
trigger:
- platform: device
device_id: !input device
type: remote_button_short_press
- platform: device
device_id: !input device
type: remote_button_long_press
- platform: device
device_id: !input device
type: remote_button_long_release
action:
- alias: "Register variables to use in automation"
variables:
button: "{{ trigger.event.data.endpoint_id }}"
command: >
{% if trigger.event.data.command == "on" %}
press
{% elif trigger.event.data.command == "move" %}
hold
{% else %}
release
{% endif %}
action: "button_{{ button }}_{{ command }}"
- alias: "Find action to run"
choose:
- conditions: "{{ action == 'button_1_press' }}"
sequence: !input button_1_press
- conditions: "{{ action == 'button_1_hold' }}"
sequence: !input button_1_hold
- conditions: "{{ action == 'button_1_release' }}"
sequence: !input button_1_release
- conditions: "{{ action == 'button_2_press' }}"
sequence: !input button_2_press
- conditions: "{{ action == 'button_2_hold' }}"
sequence: !input button_2_hold
- conditions: "{{ action == 'button_2_release' }}"
sequence: !input button_2_release
- conditions: "{{ action == 'button_3_press' }}"
sequence: !input button_3_press
- conditions: "{{ action == 'button_3_hold' }}"
sequence: !input button_3_hold
- conditions: "{{ action == 'button_3_release' }}"
sequence: !input button_3_release
- conditions: "{{ action == 'button_4_press' }}"
sequence: !input button_4_press
- conditions: "{{ action == 'button_4_hold' }}"
sequence: !input button_4_hold
- conditions: "{{ action == 'button_4_release' }}"
sequence: !input button_4_release
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment