Blatent ripp-off of @frenck’s version of the five button variant but adjusted for four buttons. Current version only has the on and off buttons set. Dimming or changing colors is not yet implemented.
Blueprint Code
Click the badge to import this Blueprint: (needs Home Assistant Core 2021.3 or higher)
Or import this Blueprint by using the forum topic URL:
blueprint:
name: ZHA - IKEA four button remote for lights
description: |
Control lights with an IKEA four button remote (the square ones).
Based on the work of [frenck](https://community.home-assistant.io/u/frenck) with the five button version.
Pressing the up button will turn on the lights at the last set brightness
(unless the force brightness is toggled on in the blueprint).
Pressing the down button will turn the lights off again.
Dim up/down buttons by holding them is not implemented yet.
The "left" and "right" buttons have not been implemented yet.
domain: automation
input:
remote:
name: Remote
description: IKEA remote to use
selector:
device:
integration: zha
manufacturer: IKEA of Sweden
model: Remote Control N2
light:
name: Light(s)
description: The light(s) to control
selector:
target:
entity:
domain: light
force_brightness:
name: Force turn on brightness
description: >
Force the brightness to the set level below, when the "on" button on
the remote is pushed and lights turn on.
default: false
selector:
boolean:
brightness:
name: Brightness
description: Brightness of the light(s) when turning on
default: 50
selector:
number:
min: 0
max: 100
mode: slider
step: 1
unit_of_measurement: "%"
mode: restart
max_exceeded: silent
variables:
force_brightness: !input force_brightness
trigger:
- platform: event
event_type: zha_event
event_data:
device_id: !input remote
action:
- variables:
command: "{{ trigger.event.data.command }}"
cluster_id: "{{ trigger.event.data.cluster_id }}"
endpoint_id: "{{ trigger.event.data.endpoint_id }}"
args: "{{ trigger.event.data.args }}"
- choose:
- conditions:
- "{{ command == 'on' }}"
- "{{ cluster_id == 6 }}"
- "{{ endpoint_id == 1 }}"
sequence:
- choose:
- conditions: "{{ force_brightness }}"
sequence:
- service: light.turn_on
target: !input light
data:
brightness_pct: !input brightness
default:
- service: light.turn_on
target: !input light
- conditions:
- "{{ command == 'off' }}"
- "{{ cluster_id == 6 }}"
- "{{ endpoint_id == 1 }}"
sequence:
- service: light.turn_off
target: !input light