From ec51e5d788e8b2275f26098dc3ebc774cd722a7b Mon Sep 17 00:00:00 2001 From: Jeffrey Stone Date: Fri, 24 Apr 2020 14:36:01 -0400 Subject: [PATCH] Adding some scripts to help with light automations --- config/automations.yaml | 21 +++++++++++++---- config/scripts/lights.yaml | 48 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 5 deletions(-) diff --git a/config/automations.yaml b/config/automations.yaml index a497a38..d971c8a 100644 --- a/config/automations.yaml +++ b/config/automations.yaml @@ -259,10 +259,6 @@ action: - service: scene.turn_on entity_id: scene.night_time_livingroom_lighting - - service: switch.turn_off - entity_id: switch.upstairs_fan - - service: switch.turn_off - entity_id: switch.upstairs - service: switch.turn_off entity_id: switch.incense - service: switch.turn_off @@ -277,6 +273,7 @@ - service: light.turn_off data: entity_id: light.kitchen_cabinets + - service: script.good_night_loft - service: script.twitter_notify_image data_template: tweet: >- @@ -687,4 +684,18 @@ at: '15:12:15' action: - service: script.save_old_covid_stats - initial_state: true \ No newline at end of file + initial_state: true + +- id: kitchen_occupency_lighting + alias: Kitchen Occupency Lighting + initial_state: true + trigger: + - platform: state + entity_id: binary_sensor.kitchen_motion + to: 'on' + action: + - service: script.kitchen_lights_night + - service: script.dog_mode_on + - service: script.kitchen_lights_on + - service: script.kitchen_lights_morning + \ No newline at end of file diff --git a/config/scripts/lights.yaml b/config/scripts/lights.yaml index da1ef16..56fd508 100755 --- a/config/scripts/lights.yaml +++ b/config/scripts/lights.yaml @@ -51,3 +51,51 @@ livingroom_lamps_off: - service: group.turn_off entity_id: group.livingroom_lamps +good_night_loft: + sequence: + - condition: state + entity_id: media_player.pn60e550_pn60e550 + state: "off" + - service: switch.turn_off + entity_id: switch.upstairs_fan + - service: switch.turn_off + entity_id: switch.upstairs + +kitchen_lights_on: + sequence: + - condition: state + entity_id: sun.sun + state: 'below_horizon' + - service: scene.turn_on + entity_id: scene.normal_kitchen_lighting + +kitchen_lights_night: + sequence: + - condition: and + conditions: + - condition: state + entity_id: sun.sun + state: 'below_horizon' + - condition: time + after: '22:30:00' + before: '05:00:00' + - service: scene.turn_on + entity_id: scene.diminished_kitchen_lighting + - delay: + minutes: 18 + - service: light.turn_off + entity_id: light.kitchen_cabinets + +kitchen_lights_morning: + sequence: + - condition: and + conditions: + - condition: state + entity_id: light.kitchen_cabinet_lights + state: 'off' + - condition: time + after: '05:30:00' + before: '08:30:00' + - service: scene.turn_on + entity_id: scene.normal_kitchen_lighting + \ No newline at end of file