Replace lights. Add Osram and Neo

This commit is contained in:
2021-03-30 21:51:04 +03:00
parent 5d12d9decd
commit 731f11cfe5
21 changed files with 504 additions and 208 deletions
@@ -1,14 +1,3 @@
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
mode: parallel
@@ -20,36 +9,62 @@ automation:
- light.light_lohas_2
- light.light_lohas_3
- light.light_lohas_4
- light.light_lohas_6
- light.light_le_1
- light.light_le_2
- light.light_le_3
- light.light_le_4
- light.osram_1
- light.osram_4
- light.osram_5
- light.light_lohas_6
- light.osram_2
- light.osram_3
- light.osram_6
- light.osram_7
- light.osram_8
- light.osram_9
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
mode: parallel
# TODO: this trigger is not good. Figure out something else.
trigger:
platform: sun
event: sunset
action:
- service: script.lighting_temperature_adjust
data:
entity_id: light.master_bedroom_main
- service: script.lighting_temperature_adjust
data:
entity_id: light.living_room_main
- service: light.turn_on
data_template:
entity_id:
- light.master_bedroom_main
- light.living_room_main
- light.kitchen
- light.hallway
color_temp: "{{ 400 if is_state('sun.sun', 'above_horizon') else 500 }}"
- service: logbook.log
data_template:
name: "💡 Lighting Module · "
message: >-
Adjusting temperature - sun changed from {{ trigger.from_state.state }} to {{ trigger.to_state.state }}
domain: light
# switch:
# - platform: flux
# disable_brightness_adjust: true
# lights:
# - light.living_room_main
# - light.master_bedroom_main
# - light.pc
# circadian_lighting:
# switch:
# - platform: circadian_lighting
# name: Circadian lights
# disable_brightness_adjust: true
# lights_ct:
# - light.master_bedroom_main
# - light.pc
# - light.living_room_main