-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtime_phase.yaml
100 lines (97 loc) · 2.62 KB
/
time_phase.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
97
98
99
100
blueprint:
name: Time Phase Control
description: Change the phase of the day based on time triggers, with minute offsets for sunrise and sunset.
domain: automation
input:
sunrise_offset:
name: Sunrise Offset
description: "Offset for the sunrise time in minutes (e.g., '-30' for 30 minutes before sunrise, '15' for 15 minutes after)."
default: 0
selector:
number:
min: -999
max: 999
mode: box
day_time:
name: Day Time
description: Time when it's considered day.
default: "08:00:00"
selector:
time: {}
sunset_offset:
name: Sunset Offset
description: "Offset for the sunset time in minutes (e.g., '-30' for 30 minutes before sunset, '15' for 15 minutes after)."
default: 0
selector:
number:
min: -999
max: 999
mode: box
night_time:
name: Night Time
description: Time when it's considered night.
default: "23:00:00"
selector:
time: {}
trigger:
- platform: sun
event: sunrise
offset: !input 'sunrise_offset'
id: morning
- platform: time
at: !input 'day_time'
id: day
- platform: sun
event: sunset
offset: !input 'sunset_offset'
id: evening
- platform: time
at: !input 'night_time'
id: night
action:
- choose:
- conditions:
- condition: trigger
id: morning
sequence:
- service: input_select.select_option
target:
entity_id: input_select.location_phase
data:
option: Morning
- conditions:
- condition: trigger
id: day
sequence:
- service: input_select.select_option
target:
entity_id: input_select.location_phase
data:
option: Day
- conditions:
- condition: trigger
id: evening
sequence:
- service: input_select.select_option
target:
entity_id: input_select.location_phase
data:
option: Evening
- conditions:
- condition: trigger
id: night
- condition: not
conditions:
- condition: state
entity_id: input_select.location_mode
state: Entertain
sequence:
- service: input_select.select_option
target:
entity_id: input_select.location_phase
data:
option: Night
- service: input_button.press
target:
entity_id: input_button.location_phase
mode: single