mirror of
https://github.com/GeorgeSG/sarah.git
synced 2026-05-07 17:34:42 +00:00
95 lines
2.4 KiB
YAML
95 lines
2.4 KiB
YAML
input_datetime:
|
|
alarm_time:
|
|
name: Wake up Time
|
|
has_date: false
|
|
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
|
|
trigger:
|
|
platform: state
|
|
entity_id: input_boolean.sleep_mode
|
|
from: "on"
|
|
to: "off"
|
|
action:
|
|
- service: script.routine_waking_up
|
|
|
|
- alias: Sleep 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_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
|
|
|
|
- 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_boolean.sleep_mode
|
|
state: "on"
|
|
action:
|
|
- service: script.music_play
|
|
data:
|
|
volume_level: 0.05
|
|
- delay: 00:01:00
|
|
- service: script.sonos_say
|
|
data:
|
|
message: "Hey! It's time to wake up!"
|
|
- delay: 00:00:10
|
|
- service: media_player.volume_set
|
|
entity_id: media_player.master_bedroom
|
|
data:
|
|
volume_level: 0.1
|
|
- delay: 00:02:00
|
|
- service: script.sonos_say
|
|
data:
|
|
message: "Good morning! Time to get out of bed!"
|
|
- delay: 00:00:10
|
|
- service: media_player.volume_set
|
|
entity_id: media_player.master_bedroom
|
|
data:
|
|
volume_level: 0.2
|
|
- delay: 00:05:00
|
|
- service: script.sonos_say
|
|
data:
|
|
message: "Hey! It's time to wake up!"
|
|
- delay: 00:00:10
|
|
- service: media_player.volume_set
|
|
entity_id: media_player.master_bedroom
|
|
data:
|
|
volume_level: 0.3
|