mirror of
https://github.com/GeorgeSG/sarah.git
synced 2026-06-15 09:12:57 +00:00
Replace sleep mode with house mode
This commit is contained in:
@@ -165,7 +165,7 @@ views:
|
||||
name: Speech
|
||||
- type: custom:button-card
|
||||
template: small
|
||||
entity: input_boolean.sleep_mode
|
||||
entity: binary_sensor.house_mode
|
||||
- type: custom:button-card
|
||||
template: small
|
||||
entity: input_boolean.guest_mode
|
||||
|
||||
@@ -104,7 +104,7 @@ cards:
|
||||
- input_boolean.speech_notifications
|
||||
- input_boolean.guest_mode
|
||||
- input_boolean.domestina
|
||||
- input_boolean.sleep_mode
|
||||
- input_select.house_mode
|
||||
- input_boolean.georgi_home
|
||||
|
||||
- type: "custom:travel-time-card"
|
||||
|
||||
@@ -112,12 +112,13 @@ cards:
|
||||
- type: custom:fold-entity-row
|
||||
head:
|
||||
type: custom:dummy-entity-row
|
||||
entity: input_boolean.sleep_mode
|
||||
entity: binary_sensor.house_mode
|
||||
entities:
|
||||
- automation.routine_bedtime_toggle_on_bedside_switch_hold
|
||||
- automation.sleep_mode_enable
|
||||
- automation.sleep_mode_disable
|
||||
- automation.sleep_mode_toggle_on_bedside_switch_double_click
|
||||
- automation.house_mode_set_to_day
|
||||
- automation.house_mode_set_to_bed
|
||||
- automation.house_mode_set_to_night
|
||||
- automation.house_mode_set_to_night_on_bedside_switch_double_click
|
||||
- automation.house_mode_set_to_bed_on_bedside_switch_hold
|
||||
- automation.alarm_wake_up
|
||||
- automation.alarm_set_time
|
||||
|
||||
|
||||
@@ -8,6 +8,14 @@ broader_popup_style: &broad_popup_style
|
||||
width: 40%
|
||||
min-width: 500px
|
||||
|
||||
binary_sensor.house_mode:
|
||||
title: House mode
|
||||
style: *popup_style
|
||||
card:
|
||||
type: entities
|
||||
entities:
|
||||
- input_select.house_mode
|
||||
|
||||
binary_sensor.motion_1_ias_zone:
|
||||
title: Kitchen motion
|
||||
style:
|
||||
|
||||
@@ -9,9 +9,12 @@ group:
|
||||
- automation.presence_coming_home
|
||||
- automation.routine_coming_home_left_work
|
||||
- automation.presence_leaving_home
|
||||
- automation.sleep_mode_enable
|
||||
- automation.sleep_mode_disable
|
||||
- automation.sleep_mode_toggle_on_bedside_switch_double_click
|
||||
- automation.house_mode_set_to_night
|
||||
- automation.house_mode_set_to_bed
|
||||
- automation.house_mode_set_to_day
|
||||
- automation.house_mode_set_to_night_on_bedside_switch_double_click
|
||||
- automation.house_mode_set_to_bed_on_bedside_switch_hold
|
||||
- automation.alarm_wake_up
|
||||
- automation.music_play_pause_on_magic_cube_knock
|
||||
- automation.music_volume_down_on_magic_cube_rotate_left
|
||||
- automation.music_volume_up_on_magic_cube_rotate_right
|
||||
@@ -19,7 +22,6 @@ group:
|
||||
- automation.lighting_turn_off_all_lights_after_sunrise
|
||||
- automation.lighting_living_room_turn_all_lights_on_on_magic_cube_flip_90
|
||||
- automation.lighting_living_room_turn_all_lights_off_on_magic_cube_flip_180
|
||||
- automation.routine_bedtime_toggle_on_bedside_switch_hold
|
||||
|
||||
automation:
|
||||
- alias: Domestina · Automate start
|
||||
|
||||
@@ -1,3 +1,30 @@
|
||||
# Mode config
|
||||
input_select:
|
||||
house_mode:
|
||||
name: House mode
|
||||
icon: mdi:home-analytics
|
||||
options:
|
||||
- day
|
||||
- bed
|
||||
- night
|
||||
|
||||
binary_sensor:
|
||||
- platform: template
|
||||
sensors:
|
||||
house_mode:
|
||||
friendly_name: House mode
|
||||
value_template: "{{ states('input_select.house_mode') }}"
|
||||
icon_template: >-
|
||||
|
||||
{% if is_state('input_select.house_mode', 'day') %}
|
||||
mdi:weather-sunny
|
||||
{% elif is_state('input_select.house_mode', 'bed') %}
|
||||
mdi:bed-queen
|
||||
{% else %}
|
||||
mdi:weather-night
|
||||
{% endif %}
|
||||
|
||||
# Alarm config
|
||||
input_datetime:
|
||||
alarm_time:
|
||||
name: Wake up time
|
||||
@@ -5,34 +32,38 @@ input_datetime:
|
||||
has_time: true
|
||||
|
||||
input_boolean:
|
||||
sleep_mode:
|
||||
name: Sleep mode
|
||||
initial: off
|
||||
icon: mdi:sleep
|
||||
alarm_enabled:
|
||||
name: Enable alarm
|
||||
icon: mdi:alarm
|
||||
|
||||
automation:
|
||||
- alias: Sleep mode · Enable
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: input_boolean.sleep_mode
|
||||
from: "off"
|
||||
to: "on"
|
||||
action:
|
||||
- service: script.routine_good_night
|
||||
|
||||
- alias: Sleep mode · Disable
|
||||
automation:
|
||||
|
||||
- alias: House mode · Set to day
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: input_boolean.sleep_mode
|
||||
from: "on"
|
||||
to: "off"
|
||||
entity_id: input_select.house_mode
|
||||
to: "day"
|
||||
action:
|
||||
- service: script.routine_waking_up
|
||||
|
||||
- alias: Sleep mode · Toggle on bedside switch double click
|
||||
- alias: House mode · Set to bed
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: input_select.house_mode
|
||||
to: "bed"
|
||||
action:
|
||||
- service: script.routine_bedtime
|
||||
|
||||
- alias: House mode · Set to night
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: input_select.house_mode
|
||||
to: "night"
|
||||
action:
|
||||
- service: script.routine_good_night
|
||||
|
||||
- alias: House mode · Set to night on bedside switch double click
|
||||
trigger:
|
||||
- platform: event
|
||||
event_type: zha_event
|
||||
@@ -40,13 +71,30 @@ automation:
|
||||
device_ieee: !secret master_bedroom_bedside_switch_ieee
|
||||
command: double
|
||||
action:
|
||||
- service_template: >-
|
||||
{% if now().strftime('%H')|int > 20 or now().strftime('%H')|int < 6 %}
|
||||
input_boolean.turn_on
|
||||
{% else %}
|
||||
input_boolean.turn_off
|
||||
{% endif %}
|
||||
entity_id: input_boolean.sleep_mode
|
||||
- service: input_select.select_option
|
||||
entity_id: input_select.house_mode
|
||||
data_template:
|
||||
option: >
|
||||
|
||||
{% if now().strftime('%H')|int > 20 or now().strftime('%H')|int < 6 %}
|
||||
night
|
||||
{% else %}
|
||||
day
|
||||
{% endif %}
|
||||
|
||||
- alias: House mode · Set to bed on bedside switch hold
|
||||
trigger:
|
||||
- platform: event
|
||||
event_type: zha_event
|
||||
event_data:
|
||||
device_ieee: !secret master_bedroom_bedside_switch_ieee
|
||||
command: hold
|
||||
action:
|
||||
- service: input_select.select_option
|
||||
entity_id: input_select.house_mode
|
||||
data:
|
||||
option: bed
|
||||
|
||||
|
||||
- alias: Alarm · Wake up
|
||||
trigger:
|
||||
@@ -59,8 +107,8 @@ automation:
|
||||
entity_id: input_boolean.alarm_enabled
|
||||
state: "on"
|
||||
- condition: state
|
||||
entity_id: input_boolean.sleep_mode
|
||||
state: "on"
|
||||
entity_id: input_select.house_mode
|
||||
state: "night"
|
||||
action:
|
||||
- service: script.music_play
|
||||
data:
|
||||
@@ -68,8 +116,8 @@ automation:
|
||||
|
||||
- delay: 00:01:00
|
||||
- condition: state
|
||||
entity_id: input_boolean.sleep_mode
|
||||
state: "on"
|
||||
entity_id: input_select.house_mode
|
||||
state: "night"
|
||||
- service: script.sonos_say
|
||||
data:
|
||||
message: "Hey! It's time to wake up!"
|
||||
@@ -82,8 +130,8 @@ automation:
|
||||
|
||||
- delay: 00:02:00
|
||||
- condition: state
|
||||
entity_id: input_boolean.sleep_mode
|
||||
state: "on"
|
||||
entity_id: input_select.house_mode
|
||||
state: "night"
|
||||
- service: script.sonos_say
|
||||
data:
|
||||
message: "Good morning! Time to get out of bed!"
|
||||
@@ -96,8 +144,8 @@ automation:
|
||||
|
||||
- delay: 00:05:00
|
||||
- condition: state
|
||||
entity_id: input_boolean.sleep_mode
|
||||
state: "on"
|
||||
entity_id: input_select.house_mode
|
||||
state: "night"
|
||||
- service: script.sonos_say
|
||||
data:
|
||||
message: "Hey! It's time to wake up!"
|
||||
@@ -33,10 +33,10 @@ automation:
|
||||
data_template:
|
||||
entity_id: >-
|
||||
|
||||
{% if is_state('input_boolean.sleep_mode', 'on') %}
|
||||
light.bedside_light
|
||||
{% else %}
|
||||
{% if is_state('input_select.house_mode', 'day') %}
|
||||
light.master_bedroom_main_lights
|
||||
{% else %}
|
||||
light.bedside_light
|
||||
{% endif %}
|
||||
|
||||
- alias: Lighting · Living room · Turn all lights on on Magic Cube flip 90
|
||||
@@ -72,9 +72,8 @@ automation:
|
||||
from: "off"
|
||||
to: "on"
|
||||
condition:
|
||||
condition: state
|
||||
entity_id: input_boolean.sleep_mode
|
||||
state: "on"
|
||||
condition: template
|
||||
value_template: "{{ not is_state('input_select.house_mode', 'day') }}"
|
||||
action:
|
||||
- service: light.turn_on
|
||||
entity_id: light.light_le_12
|
||||
@@ -96,9 +95,8 @@ automation:
|
||||
from: "off"
|
||||
to: "on"
|
||||
condition:
|
||||
condition: state
|
||||
entity_id: input_boolean.sleep_mode
|
||||
state: "on"
|
||||
condition: template
|
||||
value_template: "{{ not is_state('input_select.house_mode', 'day') }}"
|
||||
action:
|
||||
- service: light.turn_on
|
||||
entity_id:
|
||||
|
||||
@@ -69,8 +69,8 @@ automation:
|
||||
to: "off"
|
||||
condition:
|
||||
condition: state
|
||||
entity_id: input_boolean.sleep_mode
|
||||
state: "off"
|
||||
entity_id: input_select.house_mode
|
||||
state: "day"
|
||||
action:
|
||||
- service: sonos.join
|
||||
data:
|
||||
|
||||
@@ -29,10 +29,9 @@ script:
|
||||
say:
|
||||
alias: Speech · Say
|
||||
sequence:
|
||||
# Don't talk while in sleep mode.
|
||||
- condition: state
|
||||
entity_id: input_boolean.sleep_mode
|
||||
state: "off"
|
||||
# Don't talk while in night mode.
|
||||
- condition: template
|
||||
value_template: "{{ not is_state('input_select.house_mode', 'night') }}"
|
||||
# Combine partials for speech message.
|
||||
- service: script.say_discretely
|
||||
data_template:
|
||||
|
||||
@@ -31,14 +31,3 @@ script:
|
||||
- media_player.living_room_tv
|
||||
- service: light.turn_off
|
||||
entity_id: light.ceiling_lights
|
||||
|
||||
automation:
|
||||
- alias: Routine · Bedtime · Toggle on bedside switch hold
|
||||
trigger:
|
||||
- platform: event
|
||||
event_type: zha_event
|
||||
event_data:
|
||||
device_ieee: !secret master_bedroom_bedside_switch_ieee
|
||||
command: hold
|
||||
action:
|
||||
- service: script.routine_bedtime
|
||||
|
||||
@@ -12,7 +12,7 @@ script:
|
||||
entity_id:
|
||||
- media_player.nvidia_shield
|
||||
- media_player.living_room_tv
|
||||
# Use say_discretely instead of talk, because sleep_mode is already on.
|
||||
# Use say_discretely instead of talk, because night mode is already on.
|
||||
- service: script.say_discretely
|
||||
data:
|
||||
message: "Entering sleep mode. Good night!"
|
||||
message: "Entering night mode. Good night!"
|
||||
|
||||
Reference in New Issue
Block a user