-
Notifications
You must be signed in to change notification settings - Fork 185
/
sleep_mode.yaml
executable file
·96 lines (91 loc) · 2.94 KB
/
sleep_mode.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
---
#-
# _ _
# ___| | ___ ___ _ __ _ __ ___ ___ __| | ___
# / __| |/ _ \/ _ \ '_ \ | '_ ` _ \ / _ \ / _` |/ _ \
# \__ \ | __/ __/ |_) | | | | | | | (_) | (_| | __/
# |___/_|\___|\___| .__/___|_| |_| |_|\___/ \__,_|\___|
# |_| |_____|
#
#- from github.com/basnijholt/home-assistant-config
- alias: "Night mode: automatically turn off when alarm turns off or at 7AM"
trigger:
- platform: time
at: "07:00"
- platform: state
entity_id: input_boolean.alarm_clock
from: "on"
to: "off"
condition:
condition: state
entity_id: input_boolean.alarm_clock
state: "off"
action:
entity_id: input_select.sleep_mode
service: input_select.select_option
data:
option: "half"
- alias: "Night mode: turn off automatic bedroom lights"
trigger:
platform: state
entity_id: input_select.sleep_mode
from: "off"
action:
service: input_boolean.turn_off
entity_id: input_boolean.automatic_bedroom_lights
- alias: "Night mode: set low temperature when sleep mode turns on"
trigger:
platform: state
entity_id: input_select.sleep_mode
from: "off"
action:
service: script.set_low_temperature
- alias: "Night mode: go from half to total sleeping mode"
description: >
When it is half sleeping mode and there is no activity in
the house for more than an hour go to total sleeping mode.
trigger:
platform: state
entity_id: binary_sensor.activity_outside_bedroom
to: "off"
for: "01:00:00"
condition:
condition: state
entity_id: input_select.sleep_mode
state: half
action:
- service: input_select.select_option
entity_id: input_select.sleep_mode
data:
option: "total"
- service: notify.iphone_bas
data:
title: "Night mode"
message: "Automatically switched from 'half' to 'total' sleeping mode! 💤🛌"
- alias: "Night mode: set sleeping mode in the living room"
description: >
Set the living room lights to sleep mode only when no-one is there anymore.
trigger:
platform: state
entity_id: input_select.sleep_mode
to: "total"
action:
choose:
- conditions: "{{ is_state('binary_sensor.activity_in_living_room', 'on') }}"
sequence:
- wait_for_trigger:
platform: state
entity_id: binary_sensor.activity_in_living_room
from: "on"
to: "off"
timeout: "06:00:00"
continue_on_timeout: false
- condition: state # make sure sleep mode is still on
entity_id: input_select.sleep_mode
state: "total"
- service: switch.turn_on
entity_id: switch.adaptive_lighting_sleep_mode_living_room
- conditions: "{{ is_state('binary_sensor.activity_in_living_room', 'off') }}"
sequence:
service: switch.turn_on
entity_id: switch.adaptive_lighting_sleep_mode_living_room