From e3dcf35f5c7a11c170eba6ab6afab81fa376d7d0 Mon Sep 17 00:00:00 2001 From: Giorgio Ravera Date: Tue, 19 Feb 2019 16:52:05 +0100 Subject: [PATCH] Added themes automations. --- automation/home_assistant.yaml | 21 ++++++--------------- automation/themes.yaml | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+), 15 deletions(-) create mode 100644 automation/themes.yaml diff --git a/automation/home_assistant.yaml b/automation/home_assistant.yaml index a7f3f92e..753c54c7 100644 --- a/automation/home_assistant.yaml +++ b/automation/home_assistant.yaml @@ -80,16 +80,7 @@ input_boolean.home_mode_day {% else %} input_boolean.home_mode_night - {% endif %} - - - service: frontend.set_theme - data_template: - name: >- - {% if now().strftime('%H')|int >= 8 and now().strftime('%H')|int < 23 %} - default - {% else %} - midnight - {% endif %} + {% endif %} ###################################################################### # Home Assistant: Management of Speech Notifications @@ -108,11 +99,11 @@ action: - service_template: >- - {% if trigger.to_state.state == 'on' %} - input_boolean.turn_off - {% else %} - input_boolean.turn_on - {% endif %} + {% if trigger.to_state.state == 'on' %} + input_boolean.turn_off + {% else %} + input_boolean.turn_on + {% endif %} data: entity_id: input_boolean.speech_notifications diff --git a/automation/themes.yaml b/automation/themes.yaml new file mode 100644 index 00000000..3aae6ac4 --- /dev/null +++ b/automation/themes.yaml @@ -0,0 +1,22 @@ +###################################################################### +# Themes: Management of Day/Night Mode +###################################################################### + +- alias: "Temi: Modalità giorno/Notte" + initial_state: 'on' + + trigger: + - platform: state + entity_id: input_boolean.home_mode_night + to: 'on' + - platform: state + entity_id: input_boolean.home_mode_night + to: 'off' + - service: frontend.set_theme + data_template: + name: >- + {% if now().strftime('%H')|int >= 8 and now().strftime('%H')|int < 23 %} + default + {% else %} + midnight + {% endif %} -- 2.47.3