-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathexample_itho.yaml
318 lines (275 loc) · 7.27 KB
/
example_itho.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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
substitutions:
device_name: test
friendly_name: Test
esphome:
name: $device_name
esp32:
board: esp32dev
framework:
type: arduino
external_components:
- source: github://hencou/esphome_components
components: [itho]
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
fast_connect: true
logger:
level: INFO
api:
reboot_timeout: 480min
ota:
- platform: esphome
light:
- platform: status_led
name: "Status LED"
id: board_status_led
pin:
number: 17
inverted: true
entity_category: diagnostic
itho:
syssht30: disable ##Optional, default enabled: enable or disable Itho build in sensor and automation, set to disable when using own automation logic
syssht30_address: 0x44 ##Optional, default 0x44, I2C SHT30 sensor address
sda: 21 ##Optional, default to default SDA pin of ESP module (21)
scl: 22 ##Optional, default to default SCL pin of ESP module (22)
fan:
- platform: itho
id: itho_fan
name: $friendly_name
select:
- platform: itho
name: ${friendly_name} stand
id: itho_select
on_value:
then:
- globals.set:
id: faninfo
value: !lambda |-
return x.c_str();
globals:
- id: humidity_mean
type: float
- id: humidity_count
type: int
- id: max_speed
type: bool
- id: old_e_term
type: float
- id: e_term
type: float
- id: p_term
type: float
- id: i_term
type: float
- id: d_term
type: float
- id: o_term
type: float
- id: faninfo
type: std::string
number:
- platform: template
name: $friendly_name minimum output
id: minimal_output
entity_category: config
icon: mdi:chart-bell-curve
restore_value: true
initial_value: 15.0
optimistic: true
min_value: 10
max_value: 30
step: 1
- platform: template
name: $friendly_name Kp
id: kp
entity_category: config
icon: mdi:chart-bell-curve
restore_value: true
initial_value: 5.0
optimistic: true
min_value: 0
max_value: 10
step: 0.1
- platform: template
name: $friendly_name Ki
id: ki
entity_category: config
icon: mdi:chart-bell-curve
restore_value: true
initial_value: 0.0125
optimistic: true
min_value: 0
max_value: 0.05
step: 0.0001
- platform: template
name: $friendly_name max i term
id: max_i_term
entity_category: config
icon: mdi:chart-bell-curve
restore_value: true
initial_value: 30
optimistic: true
min_value: 0
max_value: 50
step: 1
- platform: template
name: $friendly_name Kd
id: kd
entity_category: config
icon: mdi:chart-bell-curve
restore_value: true
initial_value: 4.0
optimistic: true
min_value: 0
max_value: 10
step: 0.1
sensor:
- platform: itho
update_interval: 8s
temperature:
name: ${friendly_name} temperatuur
filters:
- or:
- delta: 1.0
- heartbeat: 60s
humidity:
name: ${friendly_name} luchtvochtigheid
filters:
- or:
- delta: 1.0
- heartbeat: 60s
id: "humidity"
on_raw_value:
if:
condition:
sensor.in_range:
id: humidity
above: 0.1
below: 120.0
then:
- globals.set:
id: humidity_mean
value: !lambda |-
id(humidity_count) = id(humidity_count) + 1;
if (id(humidity_count) > 1000) { id(humidity_count) = 1000;}
return (((id(humidity_count)-1) * id(humidity_mean)) + x) / id(humidity_count);
- globals.set:
id: e_term
value: !lambda |-
return x - id(humidity_mean) - 2.0;
- globals.set:
id: p_term
value: !lambda |-
return id(e_term) * id(kp).state;
- globals.set:
id: i_term
value: !lambda |-
float value = id(i_term) + (id(e_term) * id(ki).state);
if (value > id(max_i_term).state) {value = id(max_i_term).state;}
if (value < 0) {value = 0;}
return value;
- globals.set:
id: d_term
value: !lambda |-
float value = (id(e_term) - id(old_e_term)) * id(kd).state;
return value;
- globals.set:
id: old_e_term
value: !lambda |-
return id(e_term);
- globals.set:
id: o_term
value: !lambda |-
float value = id(p_term) + id(i_term) + ((id(d_term) < 0)? 0 : id(d_term));
value = (id(o_term) < value) ? value : id(o_term) -1; //Fast speed up, slow speed down
return (value < id(minimal_output).state) ? id(minimal_output).state : value;
- lambda: !lambda |-
if (id(faninfo) == "auto") {
int speed = 0;
if (x > 87.00 && id(max_speed) == false) {
id(max_speed) = true;
speed = 254;
auto call = id(itho_fan).make_call();
call.set_speed(speed);
call.perform();
}
if (x <= 87.00) {
if (x < 80.00) {
id(max_speed) = false;
speed = int(id(o_term) * 2.54);
} else {
if (id(max_speed) == true) {
speed = 254;
} else {
speed = int(id(o_term) * 2.54);
}
}
if (speed > 254) {speed = 254;}
auto call = id(itho_fan).make_call();
call.set_speed(speed);
call.perform();
}
}
- platform: template
name: ${friendly_name} gem. luchtvochtigheid
unit_of_measurement: "%"
lambda: !lambda |-
return id(humidity_mean);
- platform: template
name: $friendly_name error value
lambda: !lambda |-
return id(e_term);
- platform: template
name: $friendly_name p term
lambda: !lambda |-
return id(p_term);
- platform: template
name: $friendly_name i term
lambda: !lambda |-
return id(i_term);
- platform: template
name: $friendly_name d term
id: d_term_t
lambda: !lambda |-
return id(d_term);
- platform: template
name: $friendly_name output term
lambda: !lambda |-
return id(o_term);
- platform: uptime
name: ${friendly_name} uptime
filters:
- throttle: 300s
- platform: wifi_signal
name: ${friendly_name} WiFi signaal
filters:
- delta: 0.01
- throttle: 300s
binary_sensor:
- platform: analog_threshold
name: ${friendly_name} douchen
sensor_id: d_term_t
threshold:
upper: 5
lower: -1.4
button:
- platform: restart
entity_category: config
name: ${friendly_name} restart
- platform: safe_mode
entity_category: config
name: ${friendly_name} safemode
- platform: factory_reset
name: ${friendly_name} factory reset
entity_category: config
text_sensor:
- platform: version
name: ${friendly_name} ESPHome versie
- platform: wifi_info
ip_address:
name: ${friendly_name} ipadres
ssid:
name: ${friendly_name} SSID
bssid:
name: ${friendly_name} BSSID