Skip to content

Instantly share code, notes, and snippets.

@niro1987
Last active January 15, 2022 08:56
Show Gist options
  • Save niro1987/90a3d8ffa169b4114e7d43a5276a1f0f to your computer and use it in GitHub Desktop.
Save niro1987/90a3d8ffa169b4114e7d43a5276a1f0f to your computer and use it in GitHub Desktop.
Home Assistant - Blueprint - ZHA - IKEA TRADFRI - 5 Button Remote - Custom Actions
---
# This automation simulates the use of the IKEA TRADFRI Remote control
# connected through ZHA.
blueprint:
source_url: https://github.com/niro1987/homeassistant-config/blob/main/blueprints/automation/niro1987/zha_ikea_tradfri_5button_remote_custom.yaml
name: ZHA - IKEA TRADFRI - 5 Button Remote - Custom Actions
description: >-
This automation simulates the use of the IKEA TRADFRI remote control
connected through ZHA.
domain: automation
input:
remote:
name: IKEA TRADFRI remote control
description: Select the remote control you wish to use.
selector:
device:
integration: zha
manufacturer: IKEA of Sweden
model: TRADFRI remote control
power_short:
name: Short Press - Power Button
description: The action to perform on Short Press of the Power Button
selector:
action:
default: []
dimup_short:
name: Short Press - Dim Up Button
description: The action to perform on Short Press of the Dim Up Button
selector:
action:
default: []
dimdown_short:
name: Short Press - Dim Down Button
description: The action to perform on Short Press of the Dim Down Button
selector:
action:
default: []
colorup_short:
name: Short Press - Color Up Button
description: The action to perform on Short Press of the Color Up Button
selector:
action:
default: []
colordown_short:
name: Short Press - Color Down Button
description: The action to perform on Short Press of the Color Down Button
selector:
action:
default: []
power_long:
name: Long Press - Power Button
description: The action to perform on Long Press of the Power Button
selector:
action:
default: []
dimup_long:
name: Long Press - Dim Up Button
description: The action to perform on Long Press of the Dim Up Button
selector:
action:
default: []
dimdown_long:
name: Long Press - Dim Down Button
description: The action to perform on Long Press of the Dim Down Button
selector:
action:
default: []
colorup_long:
name: Long Press - Color Up Button
description: The action to perform on Long Press of the Color Up Button
selector:
action:
default: []
colordown_long:
name: Long Press - Color Down Button
description: The action to perform on Long Press of the Color Down Button
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 the power button.
- conditions:
- condition: template
value_template: '{{ trigger.event.data.command == "toggle" }}'
sequence: !input power_short
# Long-Press on the power button.
- conditions:
- condition: template
value_template: '{{ trigger.event.data.command == "move_to_level_with_on_off" }}'
sequence: !input power_long
# Short-Press on the dim-up button.
- conditions:
- condition: template
value_template: '{{ trigger.event.data.command == "step_with_on_off" }}'
sequence: !input dimup_short
# Long-Press on the dim-up button.
- conditions:
- condition: template
value_template: '{{ trigger.event.data.command == "move_with_on_off" }}'
sequence: !input dimup_long
# Short-Press on the dim-down button.
- conditions:
- condition: template
value_template: '{{ trigger.event.data.command == "step" }}'
sequence: !input dimdown_short
# Long-Press on the dim-down button.
- conditions:
- condition: template
value_template: '{{ trigger.event.data.command == "move" }}'
sequence: !input dimdown_long
# Short-Press on the color-up button.
- conditions:
- condition: template
value_template: '{{ trigger.event.data.command == "press" }}'
- condition: template
value_template: "{{ trigger.event.data.args == [256,13,0] }}"
sequence: !input colorup_short
# Long-Press on the color-up button.
- conditions:
- condition: template
value_template: '{{ trigger.event.data.command == "hold" }}'
- condition: template
value_template: "{{ trigger.event.data.args == [3328,0] }}"
sequence: !input colorup_long
# Short-Press on the color-down button.
- conditions:
- condition: template
value_template: '{{ trigger.event.data.command == "press" }}'
- condition: template
value_template: "{{ trigger.event.data.args == [257,13,0] }}"
sequence: !input colordown_short
# Long-Press on the color-down button.
- conditions:
- condition: template
value_template: '{{ trigger.event.data.command == "hold" }}'
- condition: template
value_template: "{{ trigger.event.data.args == [3329,0] }}"
sequence: !input colordown_long
# Any other event will cancel the repeat loops.
default: []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment