This blueprint is basically the same as the 5-button version, but for use with the on/off-button.
The original use of the button is on or off (short presses) or brightness up (long pressing the on button) and brighness down (long pressing the off button).
But to make it more general, you select an action for on-short, off-short, on-long, off-long.
blueprint:
name: Ikea on/off-switch general use
description: "This blueprint is for the IKEA on/off-remote switch when used with zigbee2mqtt.
It is for genral use so all buttons can be connected to any action of your choice.
Make sure to select the correct sensor for the remote."
domain: automation
input:
remote:
name: Remote
description: IKEA remote to use
selector:
entity:
integration: mqtt
domain: sensor
on_button_short:
name: On button short
description: Action to run when ON button SHORT press
default: []
selector:
action: {}
off_button_short:
name: Off button short
description: Action to run when OFF button SHORT pressed
default: []
selector:
action: {}
on_button_long:
name: On button long
description: Action to run when ON button LONG pressed (brightness up)
default: []
selector:
action: {}
off_button_long:
name: Off button long
description: Action to run when OFF button LONG pressed (brightness down)
default: []
selector:
action: {}
mode: restart
max_exceeded: silent
trigger:
- platform: state
entity_id: !input "remote"
attribute: action
action:
- variables:
command: "{{ trigger.to_state.state }}"
- choose:
- conditions:
- "{{ command == 'on' }}"
sequence: !input "on_button_short"
- conditions:
- "{{ command == 'off' }}"
sequence: !input "off_button_short"
- conditions:
- "{{ command == 'brightness_move_up' }}"
sequence: !input "on_button_long"
- conditions:
- "{{ command == 'brightness_move_down' }}"
sequence: !input "off_button_long"