This is for the IKEA Tradfri “Open/Close” button that comes with the (now discontinued) Tradfri smart roller blinds. I couldn’t find a blueprint that used device triggers and works with Zigbee2MQTT 2.0+ so I created one myself. The device exposes 3 actions: open, close, and stop – the latter occurs when when either of the buttons are long-pressed.
blueprint:
domain: automation
name: IKEA Tradfri Open Close Button
description: IKIA Tradfri Open/Close Button (Z2M, device trigger).
input:
input_device:
name: Input Device
description: Select the IKIA Tradfri open/close button device
selector:
device:
integration: mqtt
manufacturer: IKEA
multiple: false
button_open_short_press:
name: Single Press - Button Open
description: Action to run on "open" button
default: []
selector:
action: {}
button_close_short_press:
name: Single Press - Button Close
description: Action to run on "close" button
default: []
selector:
action: {}
button_any_long_press:
name: Long Press - Open or Close
description: Action to run when either button is long pressed
default: []
selector:
action: {}
mode: parallel
max_exceeded: silent
trigger:
- id: button_open_short_event
device_id: !input input_device
domain: mqtt
type: action
subtype: open
trigger: device
- id: button_close_short_event
device_id: !input input_device
domain: mqtt
type: action
subtype: close
trigger: device
- id: button_any_long_event
device_id: !input input_device
domain: mqtt
type: action
subtype: stop
trigger: device
action:
- variables:
command: "{{ trigger.id }}"
- choose:
- conditions:
- "{{ command == 'button_open_short_event' }}"
sequence: !input "button_open_short_press"
- conditions:
- "{{ command == 'button_close_short_event' }}"
sequence: !input "button_close_short_press"
- conditions:
- "{{ command == 'button_any_long_event' }}"
sequence: !input "button_any_long_press"