mirror of
https://github.com/GeorgeSG/sarah.git
synced 2026-06-09 23:02:59 +00:00
162 lines
4.0 KiB
YAML
162 lines
4.0 KiB
YAML
# 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
|
|
has_date: false
|
|
has_time: true
|
|
|
|
input_boolean:
|
|
alarm_enabled:
|
|
name: Enable alarm
|
|
icon: mdi:alarm
|
|
|
|
|
|
automation:
|
|
|
|
- alias: House mode · Set to day
|
|
trigger:
|
|
platform: state
|
|
entity_id: input_select.house_mode
|
|
to: "day"
|
|
action:
|
|
- service: script.routine_waking_up
|
|
|
|
- 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 · Toggle on bedside switch double click
|
|
trigger:
|
|
- platform: event
|
|
event_type: zha_event
|
|
event_data:
|
|
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 %}
|
|
|
|
- alias: Alarm · Wake up
|
|
trigger:
|
|
platform: template
|
|
value_template: "{{ states('sensor.time') == states('input_datetime.alarm_time')[0:5] }}"
|
|
condition:
|
|
condition: and
|
|
conditions:
|
|
- condition: state
|
|
entity_id: input_boolean.alarm_enabled
|
|
state: "on"
|
|
- condition: state
|
|
entity_id: input_select.house_mode
|
|
state: "night"
|
|
action:
|
|
- service: script.music_play
|
|
data:
|
|
volume_level: 0.1
|
|
|
|
- delay: 00:01:00
|
|
- condition: state
|
|
entity_id: input_select.house_mode
|
|
state: "night"
|
|
- service: script.sonos_say
|
|
data:
|
|
message: "Hey! It's time to wake up!"
|
|
volume_level: 0.15
|
|
- delay: 00:00:05
|
|
- service: media_player.volume_set
|
|
entity_id: media_player.master_bedroom
|
|
data:
|
|
volume_level: 0.15
|
|
|
|
- delay: 00:02:00
|
|
- condition: state
|
|
entity_id: input_select.house_mode
|
|
state: "night"
|
|
- service: script.sonos_say
|
|
data:
|
|
message: "Good morning! Time to get out of bed!"
|
|
volume_level: 0.2
|
|
- delay: 00:00:05
|
|
- service: media_player.volume_set
|
|
entity_id: media_player.master_bedroom
|
|
data:
|
|
volume_level: 0.2
|
|
|
|
- delay: 00:05:00
|
|
- condition: state
|
|
entity_id: input_select.house_mode
|
|
state: "night"
|
|
- service: script.sonos_say
|
|
data:
|
|
message: "Hey! It's time to wake up!"
|
|
volume_level: 0.3
|
|
- delay: 00:00:05
|
|
- service: media_player.volume_set
|
|
entity_id: media_player.master_bedroom
|
|
data:
|
|
volume_level: 0.3
|
|
|
|
- alias: Alarm · Set time
|
|
trigger:
|
|
platform: time
|
|
at: "21:00:00"
|
|
action:
|
|
- service: input_datetime.set_datetime
|
|
data_template:
|
|
entity_id: input_datetime.alarm_time
|
|
time: >-
|
|
|
|
{% if is_state('binary_sensor.workday_tomorrow', 'on') %}
|
|
09:20:00
|
|
{% else %}
|
|
10:20:00
|
|
{% endif %}
|