Refactor lighting module

This commit is contained in:
2020-04-18 12:29:31 +03:00
parent 04f927d7ce
commit cfa8e399b8
6 changed files with 59 additions and 59 deletions
@@ -21,25 +21,6 @@ automation:
- service: light.turn_off - service: light.turn_off
entity_id: light.all_lights entity_id: light.all_lights
- alias: Lighting · Adjust temperature on start
trigger:
platform: state
entity_id:
- light.living_room_main_lights
- light.master_bedroom_main_lights
to: "on"
action:
- service: light.turn_on
data_template:
entity_id: "{{ trigger.entity_id }}"
color_temp: >-
{% if is_state('sun.sun', 'above_horizon') %}
350
{% else %}
500
{% endif %}
- alias: Lighting · Master bedroom · Toggle main lights on bedside switch single click - alias: Lighting · Master bedroom · Toggle main lights on bedside switch single click
trigger: trigger:
platform: event platform: event
@@ -51,46 +32,6 @@ automation:
- service: light.toggle - service: light.toggle
entity_id: light.master_bedroom_main_lights entity_id: light.master_bedroom_main_lights
- alias: Lighting · Master bedroom · Adjust temperature based on time
trigger:
platform: state
entity_id: sun.sun
condition:
condition: state
entity_id: light.master_bedroom_main_lights
state: "on"
action:
- service: light.turn_on
entity_id: light.master_bedroom_main_lights
data_template:
color_temp: >-
{% if is_state('sun.sun', 'above_horizon') %}
350
{% else %}
500
{% 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 %}
- alias: Lighting · Living room · Turn all lights on on Magic Cube flip 90 - alias: Lighting · Living room · Turn all lights on on Magic Cube flip 90
trigger: trigger:
platform: event platform: event
@@ -0,0 +1,59 @@
automation:
- alias: Lighting · Adjust temperature on start
trigger:
platform: state
entity_id:
- light.living_room_main_lights
- light.master_bedroom_main_lights
to: "on"
action:
- service: light.turn_on
data_template:
entity_id: "{{ trigger.entity_id }}"
color_temp: >-
{% if is_state('sun.sun', 'above_horizon') %}
350
{% else %}
500
{% endif %}
- alias: Lighting · Master bedroom · Adjust temperature based on time
trigger:
platform: state
entity_id: sun.sun
condition:
condition: state
entity_id: light.master_bedroom_main_lights
state: "on"
action:
- service: light.turn_on
entity_id: light.master_bedroom_main_lights
data_template:
color_temp: >-
{% if is_state('sun.sun', 'above_horizon') %}
350
{% else %}
500
{% 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 %}