Files
sarah/config/packages/modules/lighting/temperature.yaml
T

51 lines
1.7 KiB
YAML

script:
lighting_temperature_adjust:
alias: Lighting · Temperature · Adjust
sequence:
- condition: template
value_template: "{{ is_state(entity_id, 'on') }}"
- service: light.turn_on
data_template:
entity_id: "{{ entity_id }}"
color_temp: "{{ 400 if is_state('sun.sun', 'above_horizon') else 500 }}"
automation:
- alias: Lighting · Temperature · Adjust on start
trigger:
platform: state
entity_id:
# If the lights are listed by groups, turning on 1 light always turns on the others in the group.
- light.light_lohas_1
- light.light_lohas_2
- light.light_lohas_3
- light.light_lohas_4
- light.light_lohas_5
- light.light_lohas_6
- light.light_le_1
- light.light_le_2
- light.light_le_3
- light.light_le_4
to: "on"
action:
# Can't use the script here, because they all could be fired at the same time.
# Hass can't run the script multiple times simultaneously.
- service: light.turn_on
data_template:
entity_id: "{{ trigger.entity_id }}"
color_temp: "{{ 400 if is_state('sun.sun', 'above_horizon') else 500 }}"
- alias: Lighting · Temperature · Adjust based on time
trigger:
platform: state
entity_id: sun.sun
action:
- service: script.lighting_temperature_adjust
data:
entity_id: light.master_bedroom_main_lights
- service: script.lighting_temperature_adjust
data:
entity_id: light.living_room_main_lights
- service: script.lighting_temperature_adjust
data:
entity_id: light.hallway_entrance_lights