From 1c3b54c35bb38d0f32a7dedb5467be308a39aad8 Mon Sep 17 00:00:00 2001 From: Przemek Grondek Date: Sat, 23 Sep 2023 00:54:55 +0200 Subject: [PATCH] Bedroom tv turn off after 30 minutes --- configuration/automations/bedroom-tv.yaml | 24 +++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/configuration/automations/bedroom-tv.yaml b/configuration/automations/bedroom-tv.yaml index 30fba86..b75cd2b 100644 --- a/configuration/automations/bedroom-tv.yaml +++ b/configuration/automations/bedroom-tv.yaml @@ -2,7 +2,7 @@ alias: '[Bedroom] TV On' trigger: - platform: state - entity_id: switch.bedroom_tv + entity_id: media_player.bedroom_tv to: 'on' condition: - condition: state @@ -15,7 +15,7 @@ alias: '[Bedroom] TV Off' trigger: - platform: state - entity_id: switch.bedroom_tv + entity_id: media_player.bedroom_tv to: 'off' condition: - condition: state @@ -28,8 +28,20 @@ alias: '[Bedroom] TV turn off at night' mode: single trigger: - - platform: time - at: "01:30:00" + - platform: state + entity_id: input_select.home_mode + state: 'Night' + for: + minutes: 30 + - platform: state + entity_id: input_select.home_mode + state: 'Night' + for: + minutes: 60 + condition: + - condition: state + entity_id: input_select.home_mode + state: 'Night' action: - service: media_player.turn_off target: @@ -40,7 +52,7 @@ mode: single trigger: - platform: state - entity_id: switch.bedroom_tv + entity_id: media_player.bedroom_tv to: 'on' condition: - condition: time @@ -52,7 +64,7 @@ entity_id: media_player.bedroom_tv - service: switch.turn_off target: - entity_id: switch.bedroom_tv + entity_id: media_player.bedroom_tv - service: light.turn_off entity_id: - light.bedroom_lights