Skip to content

Instantly share code, notes, and snippets.

@krillerdk
Last active May 19, 2024 15:59
Show Gist options
  • Save krillerdk/e65f66d3b930289f19a57fa268923a95 to your computer and use it in GitHub Desktop.
Save krillerdk/e65f66d3b930289f19a57fa268923a95 to your computer and use it in GitHub Desktop.
Ikea E2001/E2002 temperature change
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
light:
name: Light
description: Select the light entity you wish to control.
selector:
entity:
domain: light
mode: restart
max_exceeded: silent
variables:
var_light: !input light
trigger:
- platform: event
event_type: zha_event
event_data:
device_id: !input remote
action:
- choose:
- 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:
entity_id: !input light
data:
color_temp: |-
{% if state_attr(var_light, "color_temp") - 25 < 153 %}
{{ 153 }}
{% else %}
{{ state_attr(var_light, "color_temp") - 25 }}
{% endif %}
transition: 0
- 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:
entity_id: !input light
data:
color_temp: |-
{% if state_attr(var_light, "color_temp") - 25 < 153 %}
{{ 153 }}
{% else %}
{{ state_attr(var_light, "color_temp") - 25 }}
{% endif %}
transition: 0
- delay:
milliseconds: 100
- 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:
entity_id: !input light
data:
color_temp: |-
{% if state_attr(var_light, "color_temp") + 25 > 500 %}
{{ 500 }}
{% else %}
{{ state_attr(var_light, "color_temp") + 25 }}
{% endif %}
transition: 0
- 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:
entity_id: !input light
data:
color_temp: |-
{% if state_attr(var_light, "color_temp") + 25 > 500 %}
{{ 500 }}
{% else %}
{{ state_attr(var_light, "color_temp") + 25 }}
{% endif %}
transition: 0
- delay:
milliseconds: 100
default: []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment