mirror of
https://github.com/GeorgeSG/sarah.git
synced 2026-04-29 06:48:16 +00:00
Split alarm into clock module
This commit is contained in:
@@ -96,7 +96,7 @@ cards:
|
||||
|
||||
- type: divider
|
||||
|
||||
# Sleep Mode
|
||||
# House mode
|
||||
- type: custom:fold-entity-row
|
||||
head:
|
||||
type: custom:dummy-entity-row
|
||||
@@ -106,8 +106,6 @@ cards:
|
||||
- automation.house_mode_set_to_bed
|
||||
- automation.house_mode_set_to_night
|
||||
- automation.house_mode_toggle_on_bedside_switch_double_click
|
||||
- automation.alarm_wake_up
|
||||
- automation.alarm_set_time
|
||||
|
||||
- type: divider
|
||||
|
||||
@@ -151,6 +149,20 @@ cards:
|
||||
|
||||
- type: divider
|
||||
|
||||
# Clock
|
||||
- type: custom:fold-entity-row
|
||||
head:
|
||||
type: custom:dummy-entity-row
|
||||
entity: sun.sun
|
||||
icon: mdi:clock
|
||||
name: Clock
|
||||
tap_action: none
|
||||
entities:
|
||||
- automation.alarm_wake_up
|
||||
- automation.alarm_set_time
|
||||
|
||||
- type: divider
|
||||
|
||||
# System
|
||||
- type: custom:fold-entity-row
|
||||
head:
|
||||
|
||||
@@ -24,17 +24,6 @@ binary_sensor:
|
||||
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
|
||||
|
||||
script:
|
||||
house_mode_next:
|
||||
@@ -88,78 +77,3 @@ automation:
|
||||
action:
|
||||
- service: script.house_mode_next
|
||||
|
||||
- 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 %}
|
||||
|
||||
88
config/packages/modules/clock.yaml
Normal file
88
config/packages/modules/clock.yaml
Normal file
@@ -0,0 +1,88 @@
|
||||
# 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: 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 %}
|
||||
Reference in New Issue
Block a user