forked from louliangsheng/daikin-air-sensor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
daikin-bry88aa151k.yaml
312 lines (295 loc) · 6.25 KB
/
daikin-bry88aa151k.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
esphome:
name: "daikin-air-sensor"
project:
name: "DAIKIN.BRY88AA151K"
version: "PM2005"
name_add_mac_suffix: true
includes:
- "cm1106.h"
- "pm2005.h"
esp32:
board: nodemcu-32s
wifi:
ssid: 'L' #填写自己的WiFi及密码
password: '1234567890'
ap:
ssid: "DAIKIN Fallback Hotspot"
captive_portal:
api:
ota:
web_server:
port: 80
logger:
logs:
hdc1080: WARN
sensor: WARN
component: ERROR
# bluetooth_proxy: #需要蓝牙代理功能可以打开
# active: true
# esp32_ble_tracker:
uart:
- id: cm1106_uart
rx_pin: 16
tx_pin: 17
baud_rate: 9600
i2c:
- id: pm25_bus
sda: 23
scl: 22
scan: true
sensor:
- platform: custom
lambda: |-
auto cm1106Sensor = new CM1106Sensor(id(cm1106_uart), 10000);
App.register_component(cm1106Sensor);
return {cm1106Sensor};
sensors:
- name: "DAIKIN CO2 Sensor"
id: co2sensor
device_class: carbon_dioxide
state_class: measurement
unit_of_measurement: "ppm"
- platform: custom
lambda: |-
auto pm25 = new pm2005();
App.register_component(pm25);
return {pm25};
sensors:
- name: "DAIKIN PM2.5 Sensor "
id: pm25sensor
device_class: pm25
state_class: measurement
unit_of_measurement: "µg/m³"
- platform: adc
pin: 34
attenuation: auto
name: "DAIKIN TVOC Sensor"
id: tvocsensor
device_class: volatile_organic_compounds
unit_of_measurement: "µg/m³"
accuracy_decimals: 0
update_interval: 15s
filters:
- skip_initial: 3 #tgs2602传感器需要约30s以上预热时间
- lambda: |-
static float min_value = x;
if (x < min_value) {
min_value = x;
}
float diff = x - min_value;
if (diff * 4000 * id(tvocmultiply).state + 1 > id(tvocmax).state) {
return id(tvocmax).state;
} else {
return diff * 4000 * id(tvocmultiply).state + 1;
}
- platform: hdc1080
update_interval: 15s
temperature:
name: "DAIKIN Temperature Sensor"
id: temperature
filters:
- lambda: return x - id(temperatureoffset).state;
humidity:
name: "DAIKIN Humidity Sensor"
id: humidity
filters:
- lambda: return x * id(humiditymultiply).state;
- clamp:
max_value: 100
- platform: wifi_signal
name: "DAIKIN Signal"
switch:
- platform: template
name: "DAIKIN Sleep Mode"
icon: mdi:sleep
id: sleepmode
optimistic: true
- platform: custom
lambda: |-
auto cm1106Calib = new CM1106CalibrateSwitch(id(cm1106_uart));
App.register_component(cm1106Calib);
return {cm1106Calib};
switches:
id: calibration
internal: true
- platform: gpio
pin: 5
id: co2led
internal: true
- platform: gpio
pin: 32
id: tvocled
internal: true
- platform: gpio
pin: 33
id: pm25led
internal: true
status_led:
pin: 25
number:
- platform: template
name: "DAIKIN Threshold CO2"
entity_category: "config"
id: co2threshold
optimistic: true
unit_of_measurement: "ppm"
min_value: 400
max_value: 5000
step: 100
initial_value: 1000
restore_value: true
- platform: template
name: "DAIKIN Threshold PM2.5"
entity_category: "config"
id: pm25threshold
optimistic: true
unit_of_measurement: "µg/m³"
min_value: 0
max_value: 200
step: 10
initial_value: 50
restore_value: true
- platform: template
name: "DAIKIN Threshold TVOC"
entity_category: "config"
id: tvocthreshold
optimistic: true
unit_of_measurement: "µg/m³"
min_value: 0
max_value: 10000
step: 1000
initial_value: 1000
restore_value: true
- platform: template
name: "DAIKIN TVOC MAX"
entity_category: "config"
id: tvocmax
optimistic: true
unit_of_measurement: "µg/m³"
min_value: 3000
max_value: 10000
step: 1000
initial_value: 5000
restore_value: true
- platform: template
name: "DAIKIN TVOC Multiply"
entity_category: "config"
id: tvocmultiply
optimistic: true
min_value: 0.2
max_value: 5
step: 0.1
initial_value: 1
restore_value: true
- platform: template
name: "DAIKIN Humidity Multiply"
entity_category: "config"
id: humiditymultiply
optimistic: true
min_value: 1
max_value: 1.2
step: 0.01
initial_value: 1
restore_value: true
- platform: template
name: "DAIKIN Temperature Offset"
entity_category: "config"
id: temperatureoffset
optimistic: true
min_value: 0
max_value: 5
step: 0.1
initial_value: 1
restore_value: true
binary_sensor:
- platform: template
internal: true
id: tvoclambda
lambda: |-
if (id(sleepmode).state == false) {
if (id(tvocsensor).state > id(tvocthreshold).state) {
return true;
} else {
return false;
}
} else {
return false;
}
on_press:
then:
- switch.turn_on: tvocled
on_release:
then:
- switch.turn_off: tvocled
- platform: template
internal: true
id: co2lambda
lambda: |-
if (id(sleepmode).state == false) {
if (id(co2sensor).state > id(co2threshold).state) {
return true;
} else {
return false;
}
} else {
return false;
}
on_press:
then:
- switch.turn_on: co2led
on_release:
then:
- switch.turn_off: co2led
- platform: template
internal: true
id: pm25lambda
lambda: |-
if (id(sleepmode).state == false) {
if (id(pm25sensor).state > id(pm25threshold).state) {
return true;
} else {
return false;
}
} else {
return false;
}
on_press:
then:
- switch.turn_on: pm25led
on_release:
then:
- switch.turn_off: pm25led
- platform: template
internal: true
id: co2_calibration
lambda: |-
if (id(co2sensor).state == 400) {
return true;
} else {
return false;
}
filters:
- delayed_on: 5min #CO2持续400ppm并保持5分钟会自动校准
on_press:
then:
- switch.turn_on: calibration
- platform: gpio
pin: 19
id: RESET
internal: true
on_press:
then:
- button.press: reset
button:
- platform: restart
name: "DAIKIN Restart"
entity_category: "diagnostic"
- platform: factory_reset
id: reset
internal: true
- platform: template
name: "DAIKIN CO2 Calibration" #按下后会将当前环境CO2浓度设置为基准400ppm,按下时请确保放入室外或此时CO2浓度足够低
entity_category: "diagnostic"
on_press:
then:
- switch.turn_on: calibration