Last active
May 5, 2024 19:48
-
-
Save lipkau/e22ab3e06dfdec3fbf7fe1a4f3570436 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Inspired by: | |
# * [Z2M - IKEA STYRBAR remote for multiple lights](https://community.home-assistant.io/t/z2m-ikea-styrbar-remote-for-multiple-lights/713964) | |
# * [ZHA - IKEA Styrbar - White Spectrum Lights](https://community.home-assistant.io/t/zha-ikea-styrbar-white-spectrum-lights/341688) | |
blueprint: | |
name: ZHA - IKEA Styrbar - Warm White Lights | |
description: Control a light with white spectrum and dimming via a Ikea Styrbar Remote connected trough ZHA | |
domain: automation | |
input: | |
remote: | |
name: IKEA Styrbar remote control | |
description: Select the remote control you wish to use. | |
selector: | |
device: | |
integration: zha | |
manufacturer: IKEA of Sweden | |
model: Remote Control N2 | |
target_lights: | |
name: Lights | |
description: The light entities you wish to control. | |
selector: | |
target: | |
entity: | |
- domain: light | |
mode: restart | |
max_exceeded: silent | |
variables: | |
var_lights: !input target_lights | |
trigger: | |
- platform: event | |
event_type: zha_event | |
event_data: | |
device_id: !input remote | |
action: | |
- choose: | |
- conditions: | |
- condition: template | |
value_template: '{{ trigger.event.data.command == "on" or trigger.event.data.command == "off"}}' | |
sequence: | |
- service: > | |
{% if trigger.event.data.command == "on" %} | |
light.turn_on | |
{% else %} | |
light.turn_off | |
{% endif %} | |
target: !input target_lights | |
- conditions: | |
- condition: template | |
value_template: '{{ trigger.event.data.command == "move_with_on_off" }}' | |
sequence: | |
- repeat: | |
while: [] | |
sequence: | |
- service: light.turn_on | |
target: !input target_lights | |
data: | |
brightness_step_pct: 10 | |
transition: 0.5 | |
- delay: | |
milliseconds: 500 | |
- conditions: | |
- condition: template | |
value_template: '{{ trigger.event.data.command == "move" }}' | |
sequence: | |
- repeat: | |
while: [] | |
sequence: | |
- service: light.turn_on | |
target: !input target_lights | |
data: | |
brightness_step_pct: -10 | |
transition: 0.5 | |
- delay: | |
milliseconds: 500 | |
- conditions: | |
- condition: template | |
value_template: '{{ trigger.event.data.command == "press" }}' | |
- condition: template | |
value_template: '{{ trigger.event.data.args == [256,13,0] }}' | |
sequence: | |
- service: light.turn_on | |
target: !input target_lights | |
data: | |
color_temp: |- | |
{% if state_attr(var_lights, "color_temp") - 25 < 153 %} | |
{{ 153 }} | |
{% else %} | |
{{ state_attr(var_lights, "color_temp") - 25 }} | |
{% endif %} | |
transition: 0.5 | |
- conditions: | |
- condition: template | |
value_template: '{{ trigger.event.data.command == "hold" }}' | |
- condition: template | |
value_template: '{{ trigger.event.data.args == [3328,0] }}' | |
sequence: | |
- repeat: | |
while: [] | |
sequence: | |
- service: light.turn_on | |
target: !input target_lights | |
data: | |
color_temp: |- | |
{% if state_attr(var_lights, "color_temp") - 25 < 153 %} | |
{{ 153 }} | |
{% else %} | |
{{ state_attr(var_lights, "color_temp") - 25 }} | |
{% endif %} | |
transition: 0.5 | |
- delay: | |
milliseconds: 500 | |
- conditions: | |
- condition: template | |
value_template: '{{ trigger.event.data.command == "press" }}' | |
- condition: template | |
value_template: '{{ trigger.event.data.args == [257,13,0] }}' | |
sequence: | |
- service: light.turn_on | |
target: !input target_lights | |
data: | |
color_temp: |- | |
{% if state_attr(var_lights, "color_temp") + 25 > 500 %} | |
{{ 500 }} | |
{% else %} | |
{{ state_attr(var_lights, "color_temp") + 25 }} | |
{% endif %} | |
transition: 0.5 | |
- conditions: | |
- condition: template | |
value_template: '{{ trigger.event.data.command == "hold" }}' | |
- condition: template | |
value_template: '{{ trigger.event.data.args == [3329,0] }}' | |
sequence: | |
- repeat: | |
while: [] | |
sequence: | |
- service: light.turn_on | |
target: !input target_lights | |
data: | |
color_temp: |- | |
{% if state_attr(var_lights, "color_temp") + 25 > 500 %} | |
{{ 500 }} | |
{% else %} | |
{{ state_attr(var_lights, "color_temp") + 25 }} | |
{% endif %} | |
transition: 0.5 | |
- delay: | |
milliseconds: 500 | |
default: [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment