Files
homeassistant-blueprints/zigbee2mqtt/z2m-ikea-onoff-switch.yaml
Andrew Williams 66b9e1ec07 Use attributes.action for command
Changes in Zigbee2MQTT 1.18.3 and HomeAssistant 2021.05.04 mean that the state value can be blank on trigger. As we trigger from the attribute action anyway, use that as the command value.
2021-05-19 09:46:38 +01:00

63 lines
1.8 KiB
YAML

blueprint:
name: Zigbee2MQTT - IKEA Tradfri On/Off Switch (E1743)
description:
This blueprint is for the IKEA 2 button Trafri On/Off Switch (E1524/E1810) being controlled via Zigbee2MQTT.
Hold buttons will be repeated every second, so are useful for brightness adjustments or other adjustable
values.
domain: automation
input:
remote:
name: Remote
description: IKEA remote to use
selector:
entity:
integration: mqtt
domain: sensor
'on':
name: "On"
description: Action to run when ON button SHORT press
default: []
selector:
action: {}
'off':
name: "Off"
description: Action to run when OFF button SHORT pressed
default: []
selector:
action: {}
brightness_move_up:
name: On Hold
description: Action to run when ON button LONG pressed (brightness up)
default: []
selector:
action: {}
brightness_move_down:
name: Off Hold
description: Action to run when OFF button LONG pressed (brightness down)
default: []
selector:
action: {}
source_url: https://github.com/nikdoof/homeassistant-blueprints/blob/main/zigbee2mqtt/z2m-ikea-onoff-switch.yaml
mode: restart
max_exceeded: silent
trigger:
- platform: state
entity_id: !input "remote"
attribute: action
action:
- variables:
command: '{{ trigger.to_state.attributes.action }}'
- choose:
- conditions:
- "{{ command == 'on' }}"
sequence: !input "on"
- conditions:
- "{{ command == 'off' }}"
sequence: !input "off"
- conditions:
- "{{ command == 'brightness_move_up' }}"
sequence: !input "brightness_move_up"
- conditions:
- "{{ command == 'brightness_move_down' }}"
sequence: !input "brightness_move_down"