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