From 50d80cb4d8c755a77571dc4d4f40297df24f2f81 Mon Sep 17 00:00:00 2001 From: Georgi Gardev Date: Sun, 22 May 2022 10:08:43 +0300 Subject: [PATCH] Helper for bedtime mode switching --- config/lovelace/home_dashboard/bedroom_dashboard.yaml | 4 +--- config/packages/devices/bedroom/bedside_switch.yaml | 3 +-- config/packages/modes/house_mode.yaml | 9 +++++++++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/config/lovelace/home_dashboard/bedroom_dashboard.yaml b/config/lovelace/home_dashboard/bedroom_dashboard.yaml index ced210e..8d9674f 100644 --- a/config/lovelace/home_dashboard/bedroom_dashboard.yaml +++ b/config/lovelace/home_dashboard/bedroom_dashboard.yaml @@ -168,9 +168,7 @@ name: Mode tap_action: action: call-service - service: input_select.select_next - service_data: - entity_id: input_select.bedroom_mode + service: script.toggle_bedroom_mode - type: vertical-stack cards: diff --git a/config/packages/devices/bedroom/bedside_switch.yaml b/config/packages/devices/bedroom/bedside_switch.yaml index 9cdc9ad..816bbc0 100644 --- a/config/packages/devices/bedroom/bedside_switch.yaml +++ b/config/packages/devices/bedroom/bedside_switch.yaml @@ -47,5 +47,4 @@ automation: brightness_pct: "{{ is_state('input_select.bedroom_mode', 'night') | iif(40, 100)}}" hold: - - service: input_select.select_next - entity_id: input_select.bedroom_mode + - service: script.toggle_bedroom_mode diff --git a/config/packages/modes/house_mode.yaml b/config/packages/modes/house_mode.yaml index 7e5ca02..43440c9 100644 --- a/config/packages/modes/house_mode.yaml +++ b/config/packages/modes/house_mode.yaml @@ -61,6 +61,15 @@ sensor: {% endif %} +script: + toggle_bedroom_mode: + alias: Toggle bedroom mode + sequence: + - service: input_select.select_option + entity_id: input_select.bedroom_mode + data_template: + option: "{{ is_state('input_select.bedroom_mode', 'day') | iif('night', 'day') }}" + automation: - alias: Bedroom mode ยท Set to day trigger: