-
Notifications
You must be signed in to change notification settings - Fork 0
/
thermostat-schedules.yaml
241 lines (228 loc) · 6.63 KB
/
thermostat-schedules.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
---
# SPDX-License-Identifier: MIT
blueprint:
name: Airbnb Thermostat Schedule Manager (v0.2)
description: |
Manage thermostat schedules based on guest schedule and weather report /
season
domain: automation
input:
daily_run_time:
name: Time to run each day
description: Time to run each day for temperature based schedule forcing
selector:
time: {}
default: "08:00:00"
force_winter:
name: Force Winter High (when in spring or autumn)
description: Daily high that forces winter schedule
selector:
number:
min: 35
max: 100
unit_of_measurement: "°F"
default: 65
forecast:
name: High temperature forecast
description: The high temperature forecast for the day
selector:
entity:
filter:
- integration: openweathermap
domain: sensor
rental_control_calendar:
name: Rental Control Calendar
description: The calendar to track for event status
selector:
entity:
filter:
- integration: rental_control
domain: calendar
rental_control_event_0:
name: Primary Rental Control Event
description: The current or exiting guest event
selector:
entity:
filter:
- integration: rental_control
domain: sensor
rental_control_event_1:
name: Secondary Rental Control Event
description: The next guest event
selector:
entity:
filter:
- integration: rental_control
domain: sensor
schedule_custom:
name: Custom guest schedule
description: Custom Guest thermostat schedule
selector:
entity:
filter:
- integration: scheduler
domain: switch
schedule_no_guest:
name: No guest schedule
description: Thermostat schedule for when no guest
selector:
entity:
filter:
- integration: scheduler
domain: switch
schedule_summer:
name: Summer schedule
description: Thermostat schedule for summer
selector:
entity:
filter:
- integration: scheduler
domain: switch
schedule_winter:
name: Winter schedule
description: Thermostat schedule for winter
selector:
entity:
filter:
- integration: scheduler
domain: switch
season:
name: Season
description: Season sensor
selector:
entity:
filter:
- integration: season
domain: sensor
mode: restart
trigger:
- platform: state
entity_id:
- !input rental_control_event_0
attribute: description
for:
hours: 1
minutes: 0
seconds: 0
id: rc0_description
- platform: time
at: !input daily_run_time
id: daily_run
- platform: numeric_state
entity_id: !input rental_control_event_0
attribute: eta_minutes
below: 180
id: Guests
- platform: numeric_state
entity_id: !input rental_control_event_1
attribute: eta_minutes
below: 180
id: Guests
- platform: state
entity_id:
- !input rental_control_calendar
to: "on"
id: Guests
variables:
# inputs
input_event_0: !input rental_control_event_0
input_event_1: !input rental_control_event_1
# yamllint disable rule:line-length
no_guests: >-
{%- if 'No reservation' in states(input_event_0) or 1 <= state_attr(input_event_0, 'eta_days') -%}
true
{%- else -%}
false
{%- endif -%}
# yamllint enable rule:line-length
action:
- choose:
# Switch to No Guests mode
- conditions: "{{ no_guests }}"
sequence:
# disable all of the schedules
- service: switch.turn_off
data: {}
target:
entity_id:
- !input schedule_custom
- !input schedule_no_guest
- !input schedule_summer
- !input schedule_winter
# Wait for the schedules to normalize
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
# Turn on no guest schedule
- service: switch.turn_on
data: {}
target:
entity_id:
- !input schedule_no_guest
# Calendar triggered guest mode or daily run when no custom schedule
- conditions:
- condition: or
conditions:
- condition: trigger
id: Guests
- condition: and
conditions:
- condition: trigger
id: daily_run
- condition: state
entity_id: !input schedule_custom
state: "off"
sequence:
# disable all of the schedules
- service: switch.turn_off
data: {}
target:
entity_id:
- !input schedule_custom
- !input schedule_no_guest
- !input schedule_summer
- !input schedule_winter
# Wait for the schedules to normalize
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- choose:
# winter
- conditions:
- condition: state
entity_id: !input season
state: winter
sequence:
- service: switch.turn_on
data: {}
target: !input schedule_winter
# summer
- conditions:
- condition: state
entity_id: !input season
state: summer
sequence:
- service: switch.turn_on
data: {}
target: !input schedule_summer
# spring or autumn, we select the schedule based on the daily high
default:
- choose:
# force winter
- conditions:
- condition: numeric_state
entity_id: !input forecast
below: !input force_winter
sequence:
- service: switch.turn_on
data: {}
target: !input schedule_winter
# default to summer mode
default:
- service: switch.turn_on
data: {}
target: !input schedule_summer