I have lights automation that adopts to many things like time of day etc, however often, my wife changes them manually.
I would like to make automation, that would copy the light color from one (A) entity to another (A) whenever the xy color changes on the fly.
Is it even possible?
EdwardTFN
(Edward Firmo)
February 21, 2023, 8:40pm
2
Create a light group (Settings > Devices and Services > Helpers) and replace the lights in your dashboard by the new group light, so when your wife change setting, the whole group will be affected.
It is a work-around. I would like to be able to change it after her changes as well as only to work over certain hours.
I need a template / automation for that however no clue how to set it up
pedolsky
(Pedolsky)
February 21, 2023, 10:13pm
4
could be achieved with:
alias: 1 TEST clone color
description: ""
trigger:
- platform: state
entity_id:
- light.a
attribute: xy_color
condition: []
action:
- service: light.turn_on
data:
xy_color: "{{ state_attr(trigger.entity_id, 'xy_color') }}"
target:
entity_id:
- light.b
mode: single
But that doesn’t fit what you wrote in your last post. So I would create a snapshot:
action:
else:
- service: scene.create
data:
scene_id: my_snapshot
snapshot_entities:
- light.a
The new created scene is available as scene.my_snapshot
. Note, that the scene can be overwritten, for more information see here: Scenes - Home Assistant
1 Like
EdwardTFN
(Edward Firmo)
February 21, 2023, 10:37pm
5
You probably will need a trigger per attribute you want to sync.
Something like this (probably needing some trimming):
alias: Sync lights
description: ""
trigger:
- id: Turn off
platform: state
entity_id:
- light.kitchen_table_light_1
- light.kitchen_table_light_2
- light.kitchen_table_light_3
from: "on"
to: "off"
- id: Turn on
platform: state
entity_id:
- light.kitchen_table_light_1
- light.kitchen_table_light_2
- light.kitchen_table_light_3
from: "off"
to: "on"
- id: Change brightness
platform: state
entity_id:
- light.kitchen_table_light_1
- light.kitchen_table_light_2
- light.kitchen_table_light_3
attribute: brightness
- id: Change color temperature
platform: state
entity_id:
- light.kitchen_table_light_1
- light.kitchen_table_light_2
- light.kitchen_table_light_3
attribute: color_temp
condition: []
action:
- if:
- condition: trigger
id: Turn off
then:
- service: light.turn_off
target:
entity_id:
- light.kitchen_table_light_1
- light.kitchen_table_light_2
- light.kitchen_table_light_3
data: {}
else:
- service: light.turn_on
target:
entity_id:
- light.kitchen_table_light_1
- light.kitchen_table_light_2
- light.kitchen_table_light_3
data:
brightness: "{{ state_attr(trigger.entity_id, 'brightness') | int }}"
color_temp: "{{ state_attr(trigger.entity_id, 'color_temp') | int }}"
mode: single