-
Notifications
You must be signed in to change notification settings - Fork 0
/
smartthermostat2.yaml
173 lines (169 loc) · 5.04 KB
/
smartthermostat2.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
blueprint:
name: Door controlled heater Summer
description: Raise heater temp to 26 when opening window and bring back with delay
domain: automation
source_url: https://github.com/thefunkygibbon/homeassistant/edit/main/smartthermostat2.yaml
input:
heating_target:
name: Heater
selector:
entity:
domain: climate
door_entity:
name: Door Sensor
selector:
entity: {}
door_closed_wait:
name: Wait time open
description: Time to leave the heating on after door is opened.
default: 120
selector:
number:
min: 0.0
max: 3600.0
unit_of_measurement: seconds
mode: slider
step: 1.0
door_opened_wait:
name: Wait time closed
description: Time to leave the heating off after door is closed.
default: 120
selector:
number:
min: 0.0
max: 3600.0
unit_of_measurement: seconds
mode: slider
step: 1.0
target_temp:
name: Target Temperature
description: Temperature to set the heater to.
default: 20
selector:
number:
min: 0.0
max: 40
unit_of_measurement: degrees
mode: slider
step: 0.1
default_temp:
name: Default Temperature
description: Temperature to set the heater back down to when not in use
default: 10
selector:
number:
min: 0.0
max: 40
unit_of_measurement: degrees
mode: slider
step: 0.1
start_time:
name: Start Time
selector:
time:
end_time:
name: End Time
selector:
time:
run_on_sunday:
name: Run on Sunday
selector:
boolean:
run_on_monday:
name: Run on Monday
selector:
boolean:
run_on_tuesday:
name: Run on Tuesday
selector:
boolean:
run_on_wednesday:
name: Run on Wednesday
selector:
boolean:
run_on_thursday:
name: Run on Thursday
selector:
boolean:
run_on_friday:
name: Run on Friday
selector:
boolean:
run_on_saturday:
name: Run on Saturday
selector:
boolean:
mode: restart
max_exceeded: silent
variables:
heating_target: !input 'heating_target'
heating_temperature: '{{ state_attr(heating_target, ''temperature'') }}'
run_on_sunday: !input run_on_sunday
run_on_monday: !input run_on_monday
run_on_tuesday: !input run_on_tuesday
run_on_wednesday: !input run_on_wednesday
run_on_thursday: !input run_on_thursday
run_on_friday: !input run_on_friday
run_on_saturday: !input run_on_saturday
trigger_variables:
run_on_sunday: !input run_on_sunday
run_on_monday: !input run_on_monday
run_on_tuesday: !input run_on_tuesday
run_on_wednesday: !input run_on_wednesday
run_on_thursday: !input run_on_thursday
run_on_friday: !input run_on_friday
run_on_saturday: !input run_on_saturday
trigger:
- platform: time
at: !input start_time
id: "start_trigger"
- platform: time
at: !input end_time
id: "end_trigger"
action:
- choose:
- conditions:
# Turn On Time
- condition: template
value_template: |-
{{ ((now().strftime('%A') == 'Sunday') and run_on_sunday) or
((now().strftime('%A') == 'Monday') and run_on_monday) or
((now().strftime('%A') == 'Tuesday') and run_on_tuesday) or
((now().strftime('%A') == 'Wednesday') and run_on_wednesday) or
((now().strftime('%A') == 'Thursday') and run_on_thursday) or
((now().strftime('%A') == 'Friday') and run_on_friday) or
((now().strftime('%A') == 'Saturday') and run_on_saturday) }}
- condition: trigger
id: "start_trigger"
- conditions:
# Turn Off Time
- condition: template
value_template: |-
{{ ((now().strftime('%A') == 'Sunday') and run_on_sunday) or
((now().strftime('%A') == 'Monday') and run_on_monday) or
((now().strftime('%A') == 'Tuesday') and run_on_tuesday) or
((now().strftime('%A') == 'Wednesday') and run_on_wednesday) or
((now().strftime('%A') == 'Thursday') and run_on_thursday) or
((now().strftime('%A') == 'Friday') and run_on_friday) or
((now().strftime('%A') == 'Saturday') and run_on_saturday) }}
- condition: trigger
id: "end_trigger"
- delay: !input 'door_opened_wait'
- service: climate.set_temperature
entity_id: !input 'heating_target'
data:
temperature: !input 'default_temp'
- wait_for_trigger:
platform: state
entity_id: !input 'door_entity'
from: 'on'
to: 'off'
- delay: !input 'door_closed_wait'
- service: climate.set_temperature
entity_id: !input 'heating_target'
data:
temperature: !input 'target_temp'
- service: climate.set_temperature
entity_id: !input 'heating_target'
data:
temperature: '{{heating_temperature}}'