-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdishwasher.yaml
226 lines (204 loc) · 6.41 KB
/
dishwasher.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
substitutions:
name: "dishwasher"
friendly_name: "Dishwasher"
relay_restore_mode: RESTORE_DEFAULT_ON
packages:
athom.smart-plug-v2: github://athom-tech/athom-configs/athom-smart-plug-v2.yaml
esphome:
name: ${name}
name_add_mac_suffix: false
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
static_ip: 10.0.0.111
gateway: 10.0.0.1
subnet: 255.255.255.0
text_sensor:
- platform: template
name: "Dishwasher Current State"
id: dishwasher_current_state
binary_sensor:
#Dishwasher Running Check
#if the machine uses more than 4W it is deemed to be running
#after an entire cycle (deemed no longer running) it will update all binary sensors to false (i would like to move to only the one text sensor and maybe a single running yes/no sensor)
- platform: template
name: "Dishwasher Running"
id: dishwasher_running
filters:
- delayed_on: 30s
- delayed_off: 320s
lambda: |-
if (isnan(id(power_sensor).state)) {
return {};
} else if (id(power_sensor).state > 4) {
return true;
} else {
return false;
}
on_press:
then:
- lambda: |-
{
id(dishwasher_current_state).publish_state("Running");
}
on_release:
then:
- lambda: |-
{
id(dishwasher_end).publish_state(true);
id(dishwasher_first_rinse).publish_state(false);
id(dishwasher_minimum_working_time).publish_state(false);
id(dishwasher_heated_wash).publish_state(false);
id(dishwasher_passive_wash).publish_state(false);
id(dishwasher_heated_rinse).publish_state(false);
id(dishwasher_drying).publish_state(false);
id(dishwasher_current_state).publish_state("Ended");
}
#Minimum Cycle time
#machine needs to be running for at least 1 minute to count as on and move onto the first stage
#this could potentially be shortened in the future
- platform: template
name: "Minimum time"
internal: true
id: dishwasher_minimum_working_time
filters:
- delayed_on: 60s
- delayed_off: 300s
lambda: |-
if (isnan(id(power_sensor).state)) {
return {};
} else if (id(power_sensor).state > 4) {
// Running
return true;
} else {
// Not running
return {};
}
#First Rinse
#this cycle just appears to turn on the pump, so power draw does not exceed ~70W for a majority of the cycle
#there is a brief peak, which is why the sensor is between 10 and 300
#i chose not to delay the off, because i wanted transitions to be as consistent as possible
- platform: template
name: "Dishwasher First Rinse"
id: dishwasher_first_rinse
filters:
- delayed_on: 60s
lambda: |-
if (isnan(id(power_sensor).state)) {
return {};
} else if ( (id(power_sensor).state > 10)&&(id(power_sensor).state < 300)&&(id(dishwasher_minimum_working_time).state) ){
// Running
return true;
} else {
// Not running
return {};
}
on_press:
then:
- lambda: |-
{
id(dishwasher_current_state).publish_state("First Rinse");
}
#Heated Wash
#for this stage the dishwasher heats up water resulting in a larger power draw
- platform: template
name: "Dishwasher Heated Wash"
id: dishwasher_heated_wash
filters:
- delayed_on: 60s
lambda: |-
if (isnan(id(power_sensor).state)) {
return {};
} else if ( (id(power_sensor).state > 250) && (id(power_sensor).state < 2500) && (id(dishwasher_first_rinse).state) ){
// Running
return true;
} else {
// Not running
return {};
}
on_press:
then:
- lambda: |-
{
id(dishwasher_current_state).publish_state("Heated Wash");
}
#Passive Wash
#this cycle continues to feed off the already heated water from previous cycle and continues the wash
- platform: template
name: "Dishwasher Passive Wash"
id: dishwasher_passive_wash
filters:
- delayed_on: 60s
lambda: |-
if (isnan(id(power_sensor).state)) {
return {};
} else if ( (id(power_sensor).state > 10) && (id(power_sensor).state < 100) && (id(dishwasher_heated_wash).state) ){
// Running
return true;
} else {
// Not running
return {};
}
on_press:
then:
- lambda: |-
{
id(dishwasher_current_state).publish_state("Passive Wash");
}
#Heated Rinse
#machine heats up water again
#the manual says this is not a full wash so it is likely that the machine in removing any streaks/leftover suds from detergent
#this cycle has a delayed off as there is a brief dip at the start which falls within perameters for the next stage
- platform: template
name: "Dishwasher Heated Rinse"
id: dishwasher_heated_rinse
filters:
- delayed_on: 60s
- delayed_off: 90s
lambda: |-
if (isnan(id(power_sensor).state)) {
return {};
} else if ( (id(power_sensor).state > 300) && (id(power_sensor).state < 2500) && (id(dishwasher_passive_wash).state) ){
// Running
return true;
} else {
// Not running
return {};
}
on_press:
then:
- lambda: |-
{
id(dishwasher_current_state).publish_state("Heated Rinse");
}
#Drying
#this stage is internally a mystery. potentially also a passive rinse phase
#we used to think this stage used the same power as a heating phase, but it seems to use the least
#i may come back to this one in the future and split it into 2
- platform: template
name: "Dishwasher Drying"
id: dishwasher_drying
filters:
- delayed_on: 60s
lambda: |-
if (isnan(id(power_sensor).state)) {
return {};
} else if ( (id(power_sensor).state > 10) && (id(power_sensor).state < 80) && (id(dishwasher_heated_rinse).state) ){
// Running
return true;
} else {
// Not running
return {};
}
on_press:
then:
- lambda: |-
{
id(dishwasher_current_state).publish_state("Drying");
}
#Ended
#this sensor exists purely to be updated by other sensors
- platform: template
name: "Dishwasher Ended"
id: dishwasher_end