-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcs24.yaml
666 lines (590 loc) · 16.1 KB
/
cs24.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
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
# Setup for CircuitSetup 6 channel energy monitor
# https://esphome.io/components/sensor/atm90e32.html?highlight=circuitsetup
#
# Current Transformer gain settings:
# 80A/26.6mA SCT-010: 41660
# 120A/40mA: SCT-016: 41787
# 120A/40mA: SCT-016: 21274 # (1/2 and 2x in filter)
# 200A/100mA SCT-024: 27518
# 200A/100mA SCT-024: 9455 # (1/3 and 3x in filter)
# Jameco 9VAC Transformer ACU090100/157041: 7350
substitutions:
# Node naming
device_name: 'cs24'
# Voltage calibration constants
calibration_v1: '7390'
calibration_v2: '7390'
# CT calibrtion constants
calibration_ct11: '9455' # 200A/100mA SCT-024 (divide by 3 and filter by 3)
calibration_ct12: '9455' # 200A/100mA SCT-024
calibration_ct13: '41800' # 120A/40mA: SCT-016 (all the rest)
calibration_ct14: '41800'
calibration_ct15: '41800'
calibration_ct16: '41800'
calibration_ct21: '41800'
calibration_ct22: '41800'
calibration_ct23: '41800'
calibration_ct24: '41800'
calibration_ct25: '41800'
calibration_ct26: '41800'
calibration_ct31: '41800'
calibration_ct32: '41800'
calibration_ct33: '41800'
calibration_ct34: '41800'
calibration_ct35: '41800'
calibration_ct36: '41800'
calibration_ct41: '41800'
calibration_ct42: '41800'
calibration_ct43: '41800'
calibration_ct44: '41800'
calibration_ct45: '41800'
calibration_ct46: '41800'
# Update intervals
update_sensors: 10s
sample_rate: '10'
# Adjust naming
name_ct11: 'ct11'
name_ct12: 'ct12'
name_ct13: 'ct13'
name_ct14: 'ct14'
name_ct15: 'ct15'
name_ct16: 'ct16'
name_ct21: 'ct21'
name_ct22: 'ct22'
name_ct23: 'ct23'
name_ct24: 'ct24'
name_ct25: 'ct25'
name_ct26: 'ct26'
name_ct31: 'ct31'
name_ct32: 'ct32'
name_ct33: 'ct33'
name_ct34: 'ct34'
name_ct35: 'ct35'
name_ct36: 'ct36'
name_ct41: 'ct41'
name_ct42: 'ct42'
name_ct43: 'ct43'
name_ct44: 'ct44'
name_ct45: 'ct45'
name_ct46: 'ct46'
# Device setup
esphome:
name: ${device_name}
platform: ESP32
board: nodemcu-32s
# Wifi connection
wifi:
ssid: !secret cs_wifi_ssid
password: !secret cs_wifi_password
manual_ip:
static_ip: !secret cs24_static_ip
gateway: !secret cs_wifi_gateway
subnet: !secret cs_wifi_subnet
# MQTT broker setup
#mqtt:
# broker: !secret cs_mqtt_broker
# username: !secret cs_mqtt_username
# password: !secret cs_mqtt_password
# topic_prefix: ${device_name}
# Enable logging
# logger:
# Enable Home Assistant API
api:
# password: !secret cs_api_password
# Allow over the air updates
ota:
# Port used for the ESPHome dashboard
web_server:
port: 80
# Pin assignments
spi:
clk_pin: 18
miso_pin: 19
mosi_pin: 23
sensor:
# Main board - ATM90E32 #1
- platform: atm90e32
cs_pin: 5
line_frequency: 60Hz
current_phases: 3
gain_pga: 1X
update_interval: ${update_sensors}
frequency:
id: freq
internal: true
phase_a:
gain_voltage: ${calibration_v1}
gain_ct: ${calibration_ct11}
voltage:
id: v1
internal: true
current:
id: ct11
internal: true
filters:
- multiply: 3.0
power_factor:
id: pf1
internal: true
phase_b:
gain_ct: ${calibration_ct12}
current:
id: ct12
internal: true
filters:
- multiply: 3.0
power_factor:
id: pf2
internal: true
phase_c:
gain_ct: ${calibration_ct13}
current:
id: ct13
internal: true
# Main board - ATM90E32 #2
- platform: atm90e32
cs_pin: 4
line_frequency: 60Hz
current_phases: 3
gain_pga: 1X
update_interval: ${update_sensors}
phase_a:
gain_voltage: ${calibration_v2}
gain_ct: ${calibration_ct14}
voltage:
id: v2
internal: true
current:
id: ct14
internal: true
phase_b:
gain_ct: ${calibration_ct15}
current:
id: ct15
internal: true
phase_c:
gain_ct: ${calibration_ct16}
current:
id: ct16
internal: true
# Expansion board 1 = ATM90E32 #1
- platform: atm90e32
cs_pin: 0
line_frequency: 60Hz
current_phases: 3
gain_pga: 1X
update_interval: ${update_sensors}
phase_a:
gain_ct: ${calibration_ct21}
current:
id: ct21
internal: true
phase_b:
gain_ct: ${calibration_ct22}
current:
id: ct22
internal: true
phase_c:
gain_ct: ${calibration_ct23}
current:
id: ct23
internal: true
# Expansion board 1 = ATM90E32 #2
- platform: atm90e32
cs_pin: 16
line_frequency: 60Hz
current_phases: 3
gain_pga: 1X
update_interval: ${update_sensors}
phase_a:
gain_ct: ${calibration_ct24}
current:
id: ct24
internal: true
phase_b:
gain_ct: ${calibration_ct25}
current:
id: ct25
internal: true
phase_c:
gain_ct: ${calibration_ct26}
current:
id: ct26
internal: true
# Expansion board 2 = ATM90E32 #1
- platform: atm90e32
cs_pin: 14
line_frequency: 60Hz
current_phases: 3
gain_pga: 1X
update_interval: ${update_sensors}
phase_a:
gain_ct: ${calibration_ct31}
current:
id: ct31
internal: true
phase_b:
gain_ct: ${calibration_ct32}
current:
id: ct32
internal: true
phase_c:
gain_ct: ${calibration_ct33}
current:
id: ct33
internal: true
# Expansion board 2 = ATM90E32 #2
- platform: atm90e32
cs_pin: 17
line_frequency: 60Hz
current_phases: 3
gain_pga: 1X
update_interval: ${update_sensors}
phase_a:
gain_ct: ${calibration_ct34}
current:
id: ct34
internal: true
phase_b:
gain_ct: ${calibration_ct35}
current:
id: ct35
internal: true
phase_c:
gain_ct: ${calibration_ct36}
current:
id: ct36
internal: true
# Expansion board 3 = ATM90E32 #1
- platform: atm90e32
cs_pin: 15
line_frequency: 60Hz
current_phases: 3
gain_pga: 1X
update_interval: ${update_sensors}
phase_a:
gain_ct: ${calibration_ct41}
current:
id: ct41
internal: true
phase_b:
gain_ct: ${calibration_ct42}
current:
id: ct42
internal: true
phase_c:
gain_ct: ${calibration_ct43}
current:
id: ct43
internal: true
# Expansion board 3 = ATM90E32 #2
- platform: atm90e32
cs_pin: 21
line_frequency: 60Hz
current_phases: 3
gain_pga: 1X
update_interval: ${update_sensors}
phase_a:
gain_ct: ${calibration_ct44}
current:
id: ct44
internal: true
phase_b:
gain_ct: ${calibration_ct45}
current:
id: ct45
internal: true
phase_c:
gain_ct: ${calibration_ct46}
current:
id: ct46
internal: true
# System parameters
- platform: template
name: ${device_name}_sampling
lambda: return ${sample_rate};
accuracy_decimals: 1
unit_of_measurement: seconds
disabled_by_default: true
# Line measurements (voltage/frequency)
- platform: template
name: ${device_name}_volts
id: v
lambda: return id(v1).state + id(v2).state;
accuracy_decimals: 2
unit_of_measurement: V
icon: "mdi:flash-circle"
update_interval: ${update_sensors}
- platform: template
name: ${device_name}_volts_ph1
lambda: return id(v1).state;
accuracy_decimals: 2
unit_of_measurement: V
icon: "mdi:flash-circle"
update_interval: ${update_sensors}
- platform: template
name: ${device_name}_volts_ph2
lambda: return id(v2).state;
accuracy_decimals: 2
unit_of_measurement: V
icon: "mdi:flash-circle"
update_interval: ${update_sensors}
- platform: template
name: ${device_name}_frequency
lambda: return id(freq).state;
accuracy_decimals: 2
unit_of_measurement: 'Hz'
icon: "mdi:sine-wave"
update_interval: ${update_sensors}
- platform: template
name: ${device_name}_pf1
lambda: return id(pf1).state;
accuracy_decimals: 2
unit_of_measurement: ''
icon: "mdi:transmission-tower"
update_interval: ${update_sensors}
# Power
- platform: template
name: ${device_name}_w
id: demand_w
lambda: return (id(ct11).state * id(v1).state) + (id(ct12).state * id(v2).state);
accuracy_decimals: 0
unit_of_measurement: W
icon: "mdi:power-plug-outline"
update_interval: ${update_sensors}
# Energy
- platform: total_daily_energy
name: ${device_name}_kwh
power_id: demand_w
filters:
- multiply: 0.001
unit_of_measurement: kWh
# Current transformer power - board #1
- platform: template
name: ${device_name}_${name_ct11}_w
id: ct11_w
lambda: return id(ct11).state * id(v1).state;
accuracy_decimals: 0
unit_of_measurement: W
icon: "mdi:power-plug-outline"
update_interval: ${update_sensors}
- platform: template
name: ${device_name}_${name_ct12}_w
id: ct12_w
lambda: return id(ct12).state * id(v2).state;
accuracy_decimals: 0
unit_of_measurement: W
icon: "mdi:power-plug-outline"
update_interval: ${update_sensors}
- platform: template
name: ${device_name}_${name_ct13}_w
id: ct13_w
lambda: return id(ct13).state * id(v).state;
accuracy_decimals: 0
unit_of_measurement: W
icon: "mdi:power-plug-outline"
update_interval: ${update_sensors}
- platform: template
name: ${device_name}_${name_ct14}_w
id: ct14_w
lambda: return id(ct14).state * id(v1).state;
accuracy_decimals: 0
unit_of_measurement: W
icon: "mdi:power-plug-outline"
update_interval: ${update_sensors}
- platform: template
name: ${device_name}_${name_ct15}_w
id: ct15_w
lambda: return id(ct15).state * id(v1).state;
accuracy_decimals: 0
unit_of_measurement: W
icon: "mdi:power-plug-outline"
update_interval: ${update_sensors}
- platform: template
name: ${device_name}_${name_ct16}_w
id: ct16_w
lambda: return id(ct16).state * id(v).state;
accuracy_decimals: 0
unit_of_measurement: W
icon: "mdi:power-plug-outline"
update_interval: ${update_sensors}
# Current transformer power - board #2
- platform: template
name: ${device_name}_${name_ct21}_w
id: ct21_w
lambda: return id(ct21).state * id(v).state;
accuracy_decimals: 0
unit_of_measurement: W
icon: "mdi:power-plug-outline"
update_interval: ${update_sensors}
- platform: template
name: ${device_name}_${name_ct22}_w
id: ct22_w
lambda: return id(ct22).state * id(v2).state;
accuracy_decimals: 0
unit_of_measurement: W
icon: "mdi:power-plug-outline"
update_interval: ${update_sensors}
- platform: template
name: ${device_name}_${name_ct23}_w
id: ct23_w
lambda: return id(ct23).state * id(v).state;
accuracy_decimals: 0
unit_of_measurement: W
icon: "mdi:power-plug-outline"
update_interval: ${update_sensors}
- platform: template
name: ${device_name}_${name_ct24}_w
id: ct24_w
lambda: return id(ct24).state * id(v).state;
accuracy_decimals: 0
unit_of_measurement: W
icon: "mdi:power-plug-outline"
update_interval: ${update_sensors}
- platform: template
name: ${device_name}_${name_ct25}_w
id: ct25_w
lambda: return id(ct25).state * id(v).state;
accuracy_decimals: 0
unit_of_measurement: W
icon: "mdi:power-plug-outline"
update_interval: ${update_sensors}
- platform: template
name: ${device_name}_${name_ct26}_w
id: ct26_w
lambda: return id(ct26).state * id(v1).state;
accuracy_decimals: 0
unit_of_measurement: W
icon: "mdi:power-plug-outline"
update_interval: ${update_sensors}
# Current transformer power - board #3
- platform: template
name: ${device_name}_${name_ct31}_w
id: ct31_w
lambda: return id(ct31).state * id(v1).state;
accuracy_decimals: 0
unit_of_measurement: W
icon: "mdi:power-plug-outline"
update_interval: ${update_sensors}
- platform: template
name: ${device_name}_${name_ct32}_w
id: ct32_w
lambda: return id(ct32).state * id(v2).state;
accuracy_decimals: 0
unit_of_measurement: W
icon: "mdi:power-plug-outline"
update_interval: ${update_sensors}
- platform: template
name: ${device_name}_${name_ct33}_w
id: ct33_w
lambda: return id(ct33).state * id(v1).state;
accuracy_decimals: 0
unit_of_measurement: W
icon: "mdi:power-plug-outline"
update_interval: ${update_sensors}
- platform: template
name: ${device_name}_${name_ct34}_w
id: ct34_w
lambda: return id(ct34).state * id(v1).state;
accuracy_decimals: 0
unit_of_measurement: W
icon: "mdi:power-plug-outline"
update_interval: ${update_sensors}
- platform: template
name: ${device_name}_${name_ct35}_w
id: ct35_w
lambda: return id(ct35).state * id(v1).state;
accuracy_decimals: 0
unit_of_measurement: W
icon: "mdi:power-plug-outline"
update_interval: ${update_sensors}
- platform: template
name: ${device_name}_${name_ct36}_w
id: ct36_w
lambda: return id(ct36).state * id(v1).state;
accuracy_decimals: 0
unit_of_measurement: W
icon: "mdi:power-plug-outline"
update_interval: ${update_sensors}
# Current transformer power - board #4
- platform: template
id: ct41_w
name: ${device_name}_${name_ct41}_w
lambda: return id(ct41).state * id(v1).state;
accuracy_decimals: 0
unit_of_measurement: W
icon: "mdi:power-plug-outline"
update_interval: ${update_sensors}
- platform: template
name: ${device_name}_${name_ct42}_w
id: ct42_w
lambda: return id(ct42).state * id(v2).state;
accuracy_decimals: 0
unit_of_measurement: W
icon: "mdi:power-plug-outline"
update_interval: ${update_sensors}
- platform: template
name: ${device_name}_${name_ct43}_w
id: ct43_w
lambda: return id(ct43).state * id(v1).state;
accuracy_decimals: 0
unit_of_measurement: W
icon: "mdi:power-plug-outline"
update_interval: ${update_sensors}
- platform: template
name: ${device_name}_${name_ct44}_w
id: ct44_w
lambda: return id(ct44).state * id(v1).state;
accuracy_decimals: 0
unit_of_measurement: W
icon: "mdi:power-plug-outline"
update_interval: ${update_sensors}
- platform: template
name: ${device_name}_${name_ct45}_w
id: ct45_w
lambda: return id(ct45).state * id(v1).state;
accuracy_decimals: 0
unit_of_measurement: W
icon: "mdi:power-plug-outline"
update_interval: ${update_sensors}
- platform: template
name: ${device_name}_${name_ct46}_w
id: ct46_w
lambda: return id(ct16).state * id(v1).state;
accuracy_decimals: 0
unit_of_measurement: W
icon: "mdi:power-plug-outline"
update_interval: ${update_sensors}
# Sum of the measured loads
- platform: template
id: mia_ct1x
internal: true
lambda: return (id(ct13_w).state + id(ct14_w).state + id(ct15_w).state + id(ct16_w).state);
update_interval: ${update_sensors}
- platform: template
id: mia_ct2x
internal: true
lambda: return (id(ct21_w).state + id(ct22_w).state + id(ct23_w).state + id(ct24_w).state + id(ct25_w).state + id(ct26_w).state);
update_interval: ${update_sensors}
- platform: template
id: mia_ct3x
internal: true
lambda: return (id(ct31_w).state + id(ct32_w).state + id(ct33_w).state + id(ct34_w).state + id(ct35_w).state + id(ct36_w).state);
update_interval: ${update_sensors}
- platform: template
id: mia_ct4x
internal: true
lambda: return (id(ct41_w).state + id(ct42_w).state + id(ct43_w).state + id(ct44_w).state + id(ct45_w).state + id(ct46_w).state);
update_interval: ${update_sensors}
- platform: template
id: metered
name: ${device_name}_metered_w
lambda: return (id(mia_ct1x).state + id(mia_ct2x).state + id(mia_ct3x).state + id(mia_ct4x).state);
accuracy_decimals: 0
unit_of_measurement: W
icon: "mdi:power-plug-outline"
update_interval: ${update_sensors}
# Enable time component to reset total daily energy at midnight
time:
- platform: sntp
id: sntp_time