mirror of
https://github.com/GeorgeSG/sarah.git
synced 2026-04-29 06:48:16 +00:00
63 lines
2.1 KiB
YAML
63 lines
2.1 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:
|
||
# Can't use the script for these automations, because they all could be fired at the same time.
|
||
# Hass can't run the script multiple times simultaneously.
|
||
- alias: Lighting · Temperature · Adjust Living room on start
|
||
trigger:
|
||
platform: state
|
||
entity_id: light.living_room_main_lights
|
||
to: "on"
|
||
action:
|
||
- service: light.turn_on
|
||
entity_id: light.living_room_main_lights
|
||
data_template:
|
||
color_temp: "{{ 400 if is_state('sun.sun', 'above_horizon') else 500 }}"
|
||
|
||
- alias: Lighting · Temperature · Adjust Bedroom on start
|
||
trigger:
|
||
platform: state
|
||
entity_id: light.master_bedroom_main_lights
|
||
to: "on"
|
||
action:
|
||
- service: light.turn_on
|
||
entity_id: light.master_bedroom_main_lights
|
||
data_template:
|
||
color_temp: "{{ 400 if is_state('sun.sun', 'above_horizon') else 500 }}"
|
||
|
||
- alias: Lighting · Temperature · Adjust Entrance on start
|
||
trigger:
|
||
platform: state
|
||
entity_id: light.hallway_entrance_lights
|
||
to: "on"
|
||
action:
|
||
- service: light.turn_on
|
||
entity_id: light.hallway_entrance_lights
|
||
data_template:
|
||
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
|