My first blueprint. This blueprint allows you to set custom actions for all four buttons for both press and long-press on an Osram Lightify 4 button remote. Presently works with ZHA only as that is all I use.
Button 1 is top left, 2 is top right, 3 is bottom left, 4 is bottom right.
blueprint:
name: ZHA - OSRAM 4x-Lightify - Custom Actions
description: >-
This automation allows you to define custom actions for the OSRAM 4x-Lightify remote control
connected through ZHA.
domain: automation
input:
remote:
name: Osram Lightify 4 button remote
description: Select the remote control you wish to use.
selector:
device:
integration: zha
manufacturer: OSRAM
model: Switch 4x-LIGHTIFY
btn1_short:
name: Short Press - Button 1
description: The action to perform on Short Press of Button 1
selector:
action:
default: []
btn3_short:
name: Short Press - Button 3
description: The action to perform on Short Press of Button 3
selector:
action:
default: []
btn2_short:
name: Short Press - Button 2
description: The action to perform on Short Press of Button 2
selector:
action:
default: []
btn4_short:
name: Short Press - Button 4
description: The action to perform on Short Press of Button 4
selector:
action:
default: []
btn1_long:
name: Long Press - Button 1
description: The action to perform on Long Press of Button 1
selector:
action:
default: []
btn3_long:
name: Long Press - Button 3
description: The action to perform on Long Press Button 3
selector:
action:
default: []
btn2_long:
name: Long Press - Button 2
description: The action to perform on Long Press of Button 2
selector:
action:
default: []
btn4_long:
name: Long Press - Button 4
description: The action to perform on Long Press of the Button 4
selector:
action:
default: []
mode: restart
max_exceeded: silent
trigger:
- platform: event
event_type: zha_event
event_data:
device_id: !input remote
action:
- choose:
# Short-Press on button 1.
- conditions:
- condition: template
value_template: '{{ trigger.event.data.command == "on" }}'
- condition: template
value_template: '{{ trigger.event.data.endpoint_id == 1 }}'
sequence: !input btn1_short
# Long-Press on button 1.
- conditions:
- condition: template
value_template: '{{ trigger.event.data.command == "move" }}'
- condition: template
value_template: '{{ trigger.event.data.endpoint_id == 1 }}'
sequence: !input btn1_long
# Short-Press on the button 3.
- conditions:
- condition: template
value_template: '{{ trigger.event.data.command == "on" }}'
- condition: template
value_template: '{{ trigger.event.data.endpoint_id == 3 }}'
sequence: !input btn3_short
# Long-Press on the button 3.
- conditions:
- condition: template
value_template: '{{ trigger.event.data.command == "move" }}'
- condition: template
value_template: '{{ trigger.event.data.endpoint_id == 3 }}'
sequence: !input btn3_long
# Short-Press on the button 2.
- conditions:
- condition: template
value_template: '{{ trigger.event.data.command == "on" }}'
- condition: template
value_template: '{{ trigger.event.data.endpoint_id == 2 }}'
sequence: !input btn2_short
# Long-Press on button 2.
- conditions:
- condition: template
value_template: '{{ trigger.event.data.command == "move" }}'
- condition: template
value_template: '{{ trigger.event.data.endpoint_id == 2 }}'
sequence: !input btn2_long
# Short-Press on the button 4.
- conditions:
- condition: template
value_template: '{{ trigger.event.data.command == "on" }}'
- condition: template
value_template: '{{ trigger.event.data.endpoint_id == 4 }}'
sequence: !input btn4_short
# Long-Press on button 4.
- conditions:
- condition: template
value_template: '{{ trigger.event.data.command == "hold" }}'
- condition: template
value_template: '{{ trigger.event.data.endpoint_id == 4 }}'
sequence: !input btn4_long
# Any other event will cancel the repeat loops.
default: []