Extract next house mode into script. Use in home dashboard

This commit is contained in:
2020-04-24 01:06:15 +03:00
parent d3c4d1c238
commit 2448c2b36c
2 changed files with 20 additions and 13 deletions
+3
View File
@@ -171,6 +171,9 @@ views:
- type: custom:button-card
template: small
entity: input_boolean.guest_mode
tap_action:
action: call-service
service: script.house_mode_next
- type: horizontal-stack
cards:
- type: custom:button-card
+17 -13
View File
@@ -36,9 +36,24 @@ input_boolean:
name: Enable alarm
icon: mdi:alarm
script:
house_mode_next:
alias: House mode · Next
sequence:
- service: input_select.select_option
entity_id: input_select.house_mode
data_template:
option: >
{% if is_state('input_select.house_mode', 'day') %}
bed
{% elif is_state('input_select.house_mode', 'bed') %}
night
{% else %}
day
{% endif %}
automation:
- alias: House mode · Set to day
trigger:
platform: state
@@ -71,18 +86,7 @@ automation:
device_ieee: !secret master_bedroom_bedside_switch_ieee
command: double
action:
- service: input_select.select_option
entity_id: input_select.house_mode
data_template:
option: >
{% if is_state('input_select.house_mode', 'day') %}
bed
{% elif is_state('input_select.house_mode', 'bed') %}
night
{% else %}
day
{% endif %}
- service: script.house_mode_next
- alias: Alarm · Wake up
trigger: