Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save c-kick/299999c9512c4260fe6de1cd843efdde to your computer and use it in GitHub Desktop.
Save c-kick/299999c9512c4260fe6de1cd843efdde to your computer and use it in GitHub Desktop.
blueprint zha_ikea_tradfri_4button_remote_color
#Blueprint by Klaas Leussink / hnldesign.nl (c) 2022
blueprint:
name: ZHA - IKEA TRADFRI - 4 Button Remote - Color Lights
source_url: https://gist.github.com/c-kick/299999c9512c4260fe6de1cd843efdde
description: This automation simulates the use of the IKEA TRADFRI remote control
connected through ZHA. Original blueprint by orcema, modified by hnldesign/c-kick,
- added brightness and color control inputs (for usage with IKEA TRADFRI bulbs)
- more fine-grained dimming
- color_temp changing
domain: automation
input:
remote:
name: IKEA TRADFRI remote control 4 buttons
description: Select the remote control you wish to use.
selector:
device:
integration: zha
manufacturer: IKEA of Sweden
model: Remote Control N2
multiple: false
light:
name: Light
description: Select the light entity you wish to control.
selector:
entity:
domain: light
multiple: false
speed:
name: Speed
description: The speed in which to update the light when the button is held.
selector:
number:
min: 20.0
max: 200.0
step: 10.0
unit_of_measurement: milliseconds
mode: slider
default: 20
color:
name: Color
description: The default color temperature of the light when powered on
selector:
number:
min: 250
max: 454
step: 10
unit_of_measurement: mired
mode: slider
default: 370
brightness:
name: Brightness
description: The default brightness of the light when powered on
selector:
number:
min: 1
max: 100
step: 1
unit_of_measurement: percent
mode: slider
default: 80
mode: restart
max_exceeded: silent
variables:
var_light: !input light
var_speed: !input speed
var_color: !input color
var_brightness: !input brightness
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" }}'
sequence:
- service: light.turn_on
target:
entity_id: !input light
data:
brightness_pct: '{{ var_brightness|float }}'
color_temp: '{{ var_color|int }}'
- conditions:
- condition: template
value_template: '{{ trigger.event.data.command == "off" }}'
sequence:
- service: light.turn_off
target:
entity_id: !input light
- conditions:
- condition: template
value_template: '{{ trigger.event.data.command == "move_to_level_with_on_off"
}}'
sequence:
- service: light.turn_on
target:
entity_id: !input light
data:
brightness_pct: '{{ state_attr(var_light, "brightness_pct") }}'
color_temp: '{{ state_attr(var_light, "color_temp") }}'
- conditions:
- condition: template
value_template: '{{ trigger.event.data.command == "step_with_on_off" }}'
sequence:
- service: light.turn_on
target:
entity_id: !input light
data:
brightness_step_pct: 20
transition: '{{ (var_speed / 1000)|float }}'
- conditions:
- condition: template
value_template: '{{ trigger.event.data.command == "move_with_on_off" }}'
sequence:
- repeat:
while: []
sequence:
- service: light.turn_on
target:
entity_id: !input light
data:
brightness_step_pct: 2
transition: '{{ (var_speed / 1000)|float }}'
- delay:
milliseconds: !input speed
- conditions:
- condition: template
value_template: '{{ trigger.event.data.command == "step" }}'
sequence:
- service: light.turn_on
target:
entity_id: !input light
data:
brightness_step_pct: -20
transition: '{{ (var_speed / 1000)|float }}'
- conditions:
- condition: template
value_template: '{{ trigger.event.data.command == "move" }}'
sequence:
- repeat:
while: []
sequence:
- service: light.turn_on
target:
entity_id: !input light
data:
brightness_step_pct: -2
transition: '{{ (var_speed / 1000)|float }}'
- delay:
milliseconds: !input speed
- 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: '{{ state_attr(var_light, "color_temp") + 10 }}'
transition: '{{ (var_speed / 1000)|float }}'
- 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: '{{ state_attr(var_light, "color_temp") + 10 }}'
transition: '{{ (var_speed / 1000)|float }}'
- delay:
milliseconds: !input speed
- 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: '{{ state_attr(var_light, "color_temp") - 10 }}'
transition: '{{ (var_speed / 1000)|float }}'
- 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: '{{ state_attr(var_light, "color_temp") - 10 }}'
transition: '{{ (var_speed / 1000)|float }}'
- delay:
milliseconds: !input speed
default: []
@c-kick
Copy link
Author

c-kick commented Oct 14, 2022

Finally ... one with Fixed temp & brightness ... Do you know if theres a blueprint for "IKEA LED bulb E26 1100 lumen, smart wireless dimmable/white spectrum" IKEA LED2003G10

Hi, no I don't know of such a blueprint, sorry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment