I split the blueprint into 2 separate ones. One for on/off/dim and the 2nd to change the color using a input_select. Since they both need to work in a different mode I had to split the blueprint. I’ve taken the default colors and added a couple of extra.
In the config.yaml I added a input_select for each remote:
input_select:
ikea_remote_1_colors:
options:
- white
- orange
- gold
- red-orange
- pink
- lavender
- periwinkle
- light-salmon
- peach
- blue
- sky
- lime
- yellow
I had a 2nd set so I recreated each color setting and asked chatgpt to name the RBG values… names like periwinkle are not something I could come up with myself
BLUEPRINT 1
blueprint:
name: ZHA - IKEA four button remote for lights
description: 'Control lights with an IKEA four button remote (the square ones),
for use with [ZHA](https://www.home-assistant.io/integrations/zha/).
Extends [SwerveShot](https://community.home-assistant.io/u/SwerveShot)''s [version](https://community.home-assistant.io/t/zha-ikea-four-button-remote-for-lights/347657)
which is 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.
Pressing and holding the up/down buttons will change the brightness smoothly and
can be pressed and hold until the brightness is satisfactory.
The "left" and "right" buttons can be assigned to a short and long button press
action. This allows you to assign, e.g., a scene or anything else. Use the left
and right button events with care, as before the long press event is sent, the
"on" event gets triggered.
'
domain: automation
input:
remote:
name: Remote
description: IKEA remote to use
selector:
device:
integration: zha
manufacturer: IKEA of Sweden
model: Remote Control N2
multiple: false
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.0
max: 100.0
mode: slider
step: 1.0
unit_of_measurement: '%'
hold_time:
name: Hold Time
description: Time between the execution of the brighter/darker actions when
holding the brighter/darker button.
default: 0.5
selector:
number:
min: 0.1
max: 2.0
step: 0.1
unit_of_measurement: seconds
mode: slider
button_left_short:
name: Left button - short press
description: Action to run on short left button press
default: []
selector:
action: {}
button_left_long:
name: Left button - long press
description: Action to run on long left button press. Use with care, as before
the long press event is sent, the "on" event gets triggered.
default: []
selector:
action: {}
button_right_short:
name: Right button - short press
description: Action to run on short right button press
default: []
selector:
action: {}
button_right_long:
name: Right button - long press
description: Action to run on long right button press. Use with care, as before
the long press event is sent, the "on" event gets triggered.
default: []
selector:
action: {}
source_url: https://community.home-assistant.io/t/zha-ikea-four-button-remote-styrbar-for-lights-e2001-e2002/384482
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:
transition: 1
brightness_pct: !input brightness
default:
- service: light.turn_on
target: !input light
data:
transition: 1
- conditions:
- '{{ command == ''off'' }}'
- '{{ cluster_id == 6 }}'
- '{{ endpoint_id == 1 }}'
sequence:
- service: light.turn_off
target: !input light
data:
transition: 1
- conditions:
- '{{ command == ''move_with_on_off'' }}'
- '{{ cluster_id == 8 }}'
- '{{ endpoint_id == 1 }}'
sequence:
- repeat:
count: 10
sequence:
- service: light.turn_on
target: !input light
data:
brightness_step_pct: 10
transition: !input hold_time
- delay: !input hold_time
- conditions:
- '{{ command == ''move'' }}'
- '{{ cluster_id == 8 }}'
- '{{ endpoint_id == 1 }}'
sequence:
- repeat:
count: 10
sequence:
- service: light.turn_on
target: !input light
data:
brightness_step_pct: -10
transition: !input hold_time
- delay: !input hold_time
- conditions:
- '{{ command == ''press'' }}'
- '{{ cluster_id == 5 }}'
- '{{ endpoint_id == 1 }}'
- '{{ args == [257, 13, 0] }}'
sequence: !input button_left_short
- conditions:
- '{{ command == ''hold'' }}'
- '{{ cluster_id == 5 }}'
- '{{ endpoint_id == 1 }}'
- '{{ args == [3329, 0] }}'
sequence: !input button_left_long
- conditions:
- '{{ command == ''press'' }}'
- '{{ cluster_id == 5 }}'
- '{{ endpoint_id == 1 }}'
- '{{ args == [256, 13, 0] }}'
sequence: !input button_right_short
- conditions:
- '{{ command == ''hold'' }}'
- '{{ cluster_id == 5 }}'
- '{{ endpoint_id == 1 }}'
- '{{ args == [3328, 0] }}'
sequence: !input button_right_long
BLUEPRINT 2
blueprint:
name: ZHA - IKEA four button remote for lights - color switch
description: 'Control lights with an IKEA four button remote (the square ones),
for use with [ZHA](https://www.home-assistant.io/integrations/zha/).
Extends [SwerveShot](https://community.home-assistant.io/u/SwerveShot)''s [version](https://community.home-assistant.io/t/zha-ikea-four-button-remote-for-lights/347657)
which is 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.
Pressing and holding the up/down buttons will change the brightness smoothly and
can be pressed and hold until the brightness is satisfactory.
The "left" and "right" buttons can be assigned to a short and long button press
action. This allows you to assign, e.g., a scene or anything else. Use the left
and right button events with care, as before the long press event is sent, the
"on" event gets triggered.
'
domain: automation
input:
remote:
name: Remote
description: IKEA remote to use
selector:
device:
integration: zha
manufacturer: IKEA of Sweden
model: Remote Control N2
multiple: false
light:
name: Light(s)
description: The light(s) to control
selector:
target:
entity:
- domain:
- light
input_select:
name: Color Loop
description: The input select that defines the color loop
selector:
target:
entity:
- domain:
- input_select
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.0
max: 100.0
mode: slider
step: 1.0
unit_of_measurement: '%'
hold_time:
name: Hold Time
description: Time between the execution of the brighter/darker actions when
holding the brighter/darker button.
default: 0.5
selector:
number:
min: 0.1
max: 2.0
step: 0.1
unit_of_measurement: seconds
mode: slider
button_left_long:
name: Left button - long press
description: Action to run on long left button press. Use with care, as before
the long press event is sent, the "on" event gets triggered.
default: []
selector:
action: {}
button_right_long:
name: Right button - long press
description: Action to run on long right button press. Use with care, as before
the long press event is sent, the "on" event gets triggered.
default: []
selector:
action: {}
source_url: https://community.home-assistant.io/t/zha-ikea-four-button-remote-styrbar-for-lights-e2001-e2002/384482
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 }}'
input_select: !input input_select
- choose:
- conditions:
- '{{ command == ''press'' }}'
- '{{ cluster_id == 5 }}'
- '{{ endpoint_id == 1 }}'
- '{{ args == [257, 13, 0] }}'
sequence:
- service: input_select.select_previous
target: !input input_select
data:
cycle: true
- service: light.turn_on
data_template:
rgb_color: >
{% set color = states(input_select.entity_id) %}
{% if color == 'white' %}[255, 255, 255]
{% elif color == 'orange' %}[255, 146, 39]
{% elif color == 'gold' %}[255, 168, 37]
{% elif color == 'red-orange' %}[255, 103, 49]
{% elif color == 'pink' %}[255, 91, 232]
{% elif color == 'lavender' %}[198, 116, 255]
{% elif color == 'periwinkle' %}[148, 122, 255]
{% elif color == 'light-salmon' %}[255, 170, 95]
{% elif color == 'peach' %}[255, 197, 149]
{% elif color == 'blue' %}[0, 0, 255]
{% elif color == 'sky' %}[135, 206, 235]
{% elif color == 'lime' %}[0, 255, 0]
{% elif color == 'yellow' %}[255, 255, 0]
{% else %}[255, 255, 255] {% endif %}
target: !input light
- conditions:
- '{{ command == ''press'' }}'
- '{{ cluster_id == 5 }}'
- '{{ endpoint_id == 1 }}'
- '{{ args == [256, 13, 0] }}'
sequence:
- service: input_select.select_next
target: !input input_select
data:
cycle: true
- service: light.turn_on
data_template:
rgb_color: >
{% set color = states(input_select.entity_id) %}
{% if color == 'white' %}[255, 255, 255]
{% elif color == 'orange' %}[255, 146, 39]
{% elif color == 'gold' %}[255, 168, 37]
{% elif color == 'red-orange' %}[255, 103, 49]
{% elif color == 'pink' %}[255, 91, 232]
{% elif color == 'lavender' %}[198, 116, 255]
{% elif color == 'periwinkle' %}[148, 122, 255]
{% elif color == 'light-salmon' %}[255, 170, 95]
{% elif color == 'peach' %}[255, 197, 149]
{% elif color == 'blue' %}[0, 0, 255]
{% elif color == 'sky' %}[135, 206, 235]
{% elif color == 'lime' %}[0, 255, 0]
{% elif color == 'yellow' %}[255, 255, 0]
{% else %}[255, 255, 255] {% endif %}
target: !input light
- conditions:
- '{{ command == ''hold'' }}'
- '{{ cluster_id == 5 }}'
- '{{ endpoint_id == 1 }}'
- '{{ args == [3329, 0] }}'
sequence: !input button_left_long
- conditions:
- '{{ command == ''hold'' }}'
- '{{ cluster_id == 5 }}'
- '{{ endpoint_id == 1 }}'
- '{{ args == [3328, 0] }}'
sequence: !input button_right_long
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 500
mode: single