From cfa8e399b8d9ff035b87757430ae6e320fc57ae1 Mon Sep 17 00:00:00 2001 From: Georgi Gardev Date: Sat, 18 Apr 2020 12:29:31 +0300 Subject: [PATCH] Refactor lighting module --- ...connectors.yaml => lights_connectors.yaml} | 0 .../{groups.yaml => lights_groups.yaml} | 0 .../lighting/{mqtt.yaml => lights_mqtt.yaml} | 0 .../{automations.yaml => lights_state.yaml} | 59 ------------------- .../modules/lighting/lights_temperature.yaml | 59 +++++++++++++++++++ .../lighting/{tuya.yaml => ligts_tuya.yaml} | 0 6 files changed, 59 insertions(+), 59 deletions(-) rename config/packages/modules/lighting/{connectors.yaml => lights_connectors.yaml} (100%) rename config/packages/modules/lighting/{groups.yaml => lights_groups.yaml} (100%) rename config/packages/modules/lighting/{mqtt.yaml => lights_mqtt.yaml} (100%) rename config/packages/modules/lighting/{automations.yaml => lights_state.yaml} (51%) create mode 100644 config/packages/modules/lighting/lights_temperature.yaml rename config/packages/modules/lighting/{tuya.yaml => ligts_tuya.yaml} (100%) diff --git a/config/packages/modules/lighting/connectors.yaml b/config/packages/modules/lighting/lights_connectors.yaml similarity index 100% rename from config/packages/modules/lighting/connectors.yaml rename to config/packages/modules/lighting/lights_connectors.yaml diff --git a/config/packages/modules/lighting/groups.yaml b/config/packages/modules/lighting/lights_groups.yaml similarity index 100% rename from config/packages/modules/lighting/groups.yaml rename to config/packages/modules/lighting/lights_groups.yaml diff --git a/config/packages/modules/lighting/mqtt.yaml b/config/packages/modules/lighting/lights_mqtt.yaml similarity index 100% rename from config/packages/modules/lighting/mqtt.yaml rename to config/packages/modules/lighting/lights_mqtt.yaml diff --git a/config/packages/modules/lighting/automations.yaml b/config/packages/modules/lighting/lights_state.yaml similarity index 51% rename from config/packages/modules/lighting/automations.yaml rename to config/packages/modules/lighting/lights_state.yaml index de86233..9022d31 100644 --- a/config/packages/modules/lighting/automations.yaml +++ b/config/packages/modules/lighting/lights_state.yaml @@ -21,25 +21,6 @@ automation: - service: light.turn_off 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 trigger: platform: event @@ -51,46 +32,6 @@ automation: - service: light.toggle 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 trigger: platform: event diff --git a/config/packages/modules/lighting/lights_temperature.yaml b/config/packages/modules/lighting/lights_temperature.yaml new file mode 100644 index 0000000..bc9ff72 --- /dev/null +++ b/config/packages/modules/lighting/lights_temperature.yaml @@ -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 %} diff --git a/config/packages/modules/lighting/tuya.yaml b/config/packages/modules/lighting/ligts_tuya.yaml similarity index 100% rename from config/packages/modules/lighting/tuya.yaml rename to config/packages/modules/lighting/ligts_tuya.yaml