From ae247e929a3e2db8ccf87a2351835a95c89a69a9 Mon Sep 17 00:00:00 2001 From: Przemek Grondek Date: Sun, 7 Aug 2022 23:55:25 +0200 Subject: [PATCH] Add bedroom tv off automation --- configuration/automations/bedroom-tv.yaml | 19 +++++++++++++++- scripts/91.lights-bedroom.yaml | 27 +++++++++++++++++++++-- 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/configuration/automations/bedroom-tv.yaml b/configuration/automations/bedroom-tv.yaml index 621791d..4558e94 100644 --- a/configuration/automations/bedroom-tv.yaml +++ b/configuration/automations/bedroom-tv.yaml @@ -1,8 +1,25 @@ - id: bedroom-tv-on - alias: '[Bedroom] TV ON' + alias: '[Bedroom] TV On' trigger: - platform: state entity_id: media_player.bedroom_tv to: 'on' + condition: + - condition: state + entity_id: input_select.home_mode + state: Day action: - service: script.bedroom_tv_scene + +- id: bedroom-tv-off + alias: '[Bedroom] TV Off' + trigger: + - platform: state + entity_id: media_player.bedroom_tv + to: 'off' + condition: + - condition: state + entity_id: input_select.home_mode + state: Day + action: + - service: script.bedroom_tv_off_scene diff --git a/scripts/91.lights-bedroom.yaml b/scripts/91.lights-bedroom.yaml index d65328e..1495b91 100644 --- a/scripts/91.lights-bedroom.yaml +++ b/scripts/91.lights-bedroom.yaml @@ -106,8 +106,31 @@ bedroom_tv_scene: entity_id: light.bedroom_lights - service: light.turn_off entity_id: light.bed_lightstrip - - service: light.turn_off - entity_id: light.bed_lamps + - service: cover.close_cover + entity_id: cover.bedroom_blinds + +bedroom_tv_off_scene: + alias: '[Bedroom] TV Off scene' + sequence: + - choose: + - conditions: + - condition: numeric_state + entity_id: sensor.office_illuminance + above: '30' + sequence: + - service: cover.open_cover + entity_id: cover.office_blinds + - conditions: + - condition: numeric_state + entity_id: sensor.office_illuminance + below: '31' + sequence: + - service: light.turn_on + entity_id: light.bed_lamps + data: + transition: 60 + brightness_pct: 100 + kelvin: 2000 bedroom_bed_lamp_off: alias: '[Bedroom] Bed lamps off'