mirror of
https://github.com/GeorgeSG/sarah.git
synced 2026-05-05 08:44:24 +00:00
Refactor lighting tempearture automations
This commit is contained in:
@@ -49,17 +49,20 @@ cards:
|
|||||||
entities:
|
entities:
|
||||||
- automation.lighting_turn_on_ceiling_lights_after_sunset
|
- automation.lighting_turn_on_ceiling_lights_after_sunset
|
||||||
- automation.lighting_turn_off_all_lights_after_sunrise
|
- automation.lighting_turn_off_all_lights_after_sunrise
|
||||||
- automation.lighting_adjust_temperature_on_start
|
|
||||||
- type: divider
|
- type: divider
|
||||||
- automation.lighting_living_room_adjust_temperature_based_on_time
|
- automation.lighting_temperature_adjust_on_start
|
||||||
|
- automation.lighting_temperature_adjust_based_on_time
|
||||||
|
- type: divider
|
||||||
- automation.lighting_master_bedroom_toggle_lights_on_bedside_switch_single_click
|
- automation.lighting_master_bedroom_toggle_lights_on_bedside_switch_single_click
|
||||||
- automation.lighting_master_bedroom_adjust_temperature_based_on_time
|
- type: divider
|
||||||
- automation.lighting_kitchen_day_mode_motion_turn_lights_on_after_sunset
|
- automation.lighting_kitchen_day_mode_motion_turn_lights_on_after_sunset
|
||||||
- automation.lighting_kitchen_day_mode_motion_turn_lights_off
|
- automation.lighting_kitchen_day_mode_motion_turn_lights_off
|
||||||
- automation.lighting_kitchen_night_mode_motion_turn_lights_on
|
- automation.lighting_kitchen_night_mode_motion_turn_lights_on
|
||||||
- automation.lighting_kitchen_night_mode_motion_turn_lights_off
|
- automation.lighting_kitchen_night_mode_motion_turn_lights_off
|
||||||
|
- type: divider
|
||||||
- automation.lighting_hallway_night_mode_motion_turn_lights_on
|
- automation.lighting_hallway_night_mode_motion_turn_lights_on
|
||||||
- automation.lighting_hallway_night_mode_motion_turn_lights_off
|
- automation.lighting_hallway_night_mode_motion_turn_lights_off
|
||||||
|
- type: divider
|
||||||
- automation.lighting_sync_tasmota_states_on_start_up
|
- automation.lighting_sync_tasmota_states_on_start_up
|
||||||
|
|
||||||
- type: divider
|
- type: divider
|
||||||
|
|||||||
@@ -1,59 +1,39 @@
|
|||||||
|
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:
|
automation:
|
||||||
- alias: Lighting · Adjust temperature on start
|
- alias: Lighting · Temperature · Adjust on start
|
||||||
trigger:
|
trigger:
|
||||||
platform: state
|
platform: state
|
||||||
entity_id:
|
entity_id:
|
||||||
- light.living_room_main_lights
|
- light.living_room_main_lights
|
||||||
- light.master_bedroom_main_lights
|
- light.master_bedroom_main_lights
|
||||||
|
- light.hallway_entrance_lights
|
||||||
to: "on"
|
to: "on"
|
||||||
action:
|
action:
|
||||||
- service: light.turn_on
|
- service: script.lighting_temperature_adjust
|
||||||
data_template:
|
data_template:
|
||||||
entity_id: "{{ trigger.entity_id }}"
|
entity_id: "{{ trigger.entity_id }}"
|
||||||
color_temp: >-
|
|
||||||
|
|
||||||
{% if is_state('sun.sun', 'above_horizon') %}
|
- alias: Lighting · Temperature · Adjust based on time
|
||||||
350
|
|
||||||
{% else %}
|
|
||||||
500
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
- alias: Lighting · Master bedroom · Adjust temperature based on time
|
|
||||||
trigger:
|
trigger:
|
||||||
platform: state
|
platform: state
|
||||||
entity_id: sun.sun
|
entity_id: sun.sun
|
||||||
condition:
|
|
||||||
condition: state
|
|
||||||
entity_id: light.master_bedroom_main_lights
|
|
||||||
state: "on"
|
|
||||||
action:
|
action:
|
||||||
- service: light.turn_on
|
- service: script.lighting_temperature_adjust
|
||||||
entity_id: light.master_bedroom_main_lights
|
data:
|
||||||
data_template:
|
entity_id: light.master_bedroom_main_lights
|
||||||
color_temp: >-
|
- service: script.lighting_temperature_adjust
|
||||||
|
data:
|
||||||
{% if is_state('sun.sun', 'above_horizon') %}
|
entity_id: light.living_room_main_lights
|
||||||
350
|
- service: script.lighting_temperature_adjust
|
||||||
{% else %}
|
data:
|
||||||
500
|
entity_id: light.hallway_entrance_lights
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
- alias: Lighting · Living room · Adjust temperature based on time
|
|
||||||
trigger:
|
|
||||||
platform: state
|
|
||||||
entity_id: sun.sun
|
|
||||||
condition:
|
|
||||||
condition: state
|
|
||||||
entity_id: light.living_room_main_lights
|
|
||||||
state: "on"
|
|
||||||
action:
|
|
||||||
- service: light.turn_on
|
|
||||||
entity_id: light.living_room_main_lights
|
|
||||||
data_template:
|
|
||||||
color_temp: >-
|
|
||||||
|
|
||||||
{% if is_state('sun.sun', 'above_horizon') %}
|
|
||||||
350
|
|
||||||
{% else %}
|
|
||||||
500
|
|
||||||
{% endif %}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user