-
Notifications
You must be signed in to change notification settings - Fork 17
/
solis-modbus-esinv.yaml
536 lines (532 loc) · 15.2 KB
/
solis-modbus-esinv.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
#
# solis-modbus-esinv.yaml -- Ginlong Solis ESINV Inverter modbus sensors include file
#
# ! This file is to be included as a package in an ESPhome definition !
# ! This file only works with Solis 'ESINV' type inverters !
#
# (C) 2023 Hajo Noerenberg
#
# http://www.noerenberg.de/
# https://github.com/hn/ginlong-solis
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3.0 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/gpl-3.0.txt>.
#
number:
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Limit output power
disabled_by_default: true # intentionally disabled, remove if you know what you are doing
register_type: holding
address: 43052
value_type: U_WORD
unit_of_measurement: '%'
entity_category: config
icon: mdi:percent
skip_updates: 10
mode: box
min_value: 0
max_value: 110
multiply: 100
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Set backflow power
disabled_by_default: true # intentionally disabled, remove if you know what you are doing
register_type: holding
address: 43074
value_type: U_WORD
unit_of_measurement: 'W'
entity_category: config
icon: mdi:transmission-tower-import
skip_updates: 10
mode: box
min_value: 0
multiply: 0.01
binary_sensor:
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Operation status Normal Operation
device_class: problem
register_type: read
address: 33121
bitmask: 0x0001 # bit 00
filters:
invert:
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Operation status Initializing
register_type: read
address: 33121
bitmask: 0x0002 # bit 01
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Operation status Controlled turning OFF
device_class: problem
register_type: read
address: 33121
bitmask: 0x0004 # bit 02
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Operation status Fault leads to turning OFF
device_class: problem
register_type: read
address: 33121
bitmask: 0x0008 # bit 03
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Operation status Stand-by
register_type: read
address: 33121
bitmask: 0x0010 # bit 04
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Operation status Limited Operation
device_class: problem
register_type: read
address: 33121
bitmask: 0x0020 # bit 05
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Operation status Limited Operation external
device_class: problem
register_type: read
address: 33121
bitmask: 0x0040 # bit 06
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Operation status Backup overload
device_class: problem
register_type: read
address: 33121
bitmask: 0x0080 # bit 07
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Operation status Load fault
device_class: problem
register_type: read
address: 33121
bitmask: 0x0100 # bit 08
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Operation status Grid fault
device_class: problem
register_type: read
address: 33121
bitmask: 0x0200 # bit 09
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Operation status Battery fault
device_class: problem
register_type: read
address: 33121
bitmask: 0x0400 # bit 10
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Operation status Grid Surge Warn
device_class: problem
register_type: read
address: 33121
bitmask: 0x1000 # bit 12
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Operation status Fan Fault Warn
device_class: problem
register_type: read
address: 33121
bitmask: 0x2000 # bit 13
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Battery current direction
device_class: battery_charging # on means charging, off means not charging
register_type: read
address: 33135
filters:
- invert: # modbus returns 0 for charging, 1 for discharging
sensor:
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Total energy
device_class: energy
state_class: total_increasing
unit_of_measurement: kWh
register_type: read
address: 33029
value_type: U_DWORD
force_new_range: true # workaround to seperate reg 3006: "skip_updates applies for all components in the same range"
skip_updates: 10
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Energy this month
device_class: energy
state_class: total_increasing
unit_of_measurement: kWh
register_type: read
address: 33031
value_type: U_DWORD
skip_updates: 10
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Energy last month
device_class: energy
state_class: total_increasing
unit_of_measurement: kWh
register_type: read
address: 33033
value_type: U_DWORD
skip_updates: 10
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Energy today
device_class: energy
state_class: total_increasing
unit_of_measurement: kWh
register_type: read
address: 33035
value_type: U_WORD
accuracy_decimals: 1
filters:
- multiply: 0.1
skip_updates: 10
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Energy last day
device_class: energy
state_class: total_increasing
unit_of_measurement: kWh
register_type: read
address: 33036
value_type: U_WORD
accuracy_decimals: 1
filters:
- multiply: 0.1
skip_updates: 10
- platform: modbus_controller
modbus_controller_id: modbus_master
name: DC voltage 1
device_class: voltage
state_class: measurement
unit_of_measurement: V
register_type: read
address: 33049
value_type: U_WORD
accuracy_decimals: 1
filters:
- multiply: 0.1
- platform: modbus_controller
modbus_controller_id: modbus_master
name: DC current 1
device_class: current
state_class: measurement
unit_of_measurement: A
register_type: read
address: 33050
value_type: U_WORD
accuracy_decimals: 1
filters:
- multiply: 0.1
- platform: modbus_controller
modbus_controller_id: modbus_master
name: DC voltage 2
device_class: voltage
state_class: measurement
unit_of_measurement: V
register_type: read
address: 33051
value_type: U_WORD
accuracy_decimals: 1
filters:
- multiply: 0.1
- platform: modbus_controller
modbus_controller_id: modbus_master
name: DC current 2
device_class: current
state_class: measurement
unit_of_measurement: A
register_type: read
address: 33052
value_type: U_WORD
accuracy_decimals: 1
filters:
- multiply: 0.1
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Total DC output power
device_class: power
state_class: measurement
unit_of_measurement: W
register_type: read
address: 33057
value_type: U_DWORD
on_value:
then:
- script.execute: modbus_activity
- platform: modbus_controller
modbus_controller_id: modbus_master
name: AC voltage
device_class: voltage
state_class: measurement
unit_of_measurement: V
register_type: read
address: 33073
value_type: U_WORD
accuracy_decimals: 1
filters:
- multiply: 0.1
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Active power
device_class: power
state_class: measurement
disabled_by_default: true # Do not fill recorder when not needed
unit_of_measurement: W
register_type: read
address: 33079
value_type: S_DWORD
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Reactive power
device_class: reactive_power
state_class: measurement
disabled_by_default: true # Do not fill recorder when not needed
unit_of_measurement: var
register_type: read
address: 33081
value_type: S_DWORD
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Apparent power
device_class: apparent_power
state_class: measurement
disabled_by_default: true # Do not fill recorder when not needed
unit_of_measurement: VA
register_type: read
address: 33083
value_type: S_DWORD
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Inverter temperature
device_class: temperature
state_class: measurement
unit_of_measurement: °C
register_type: read
address: 33093
value_type: U_WORD
accuracy_decimals: 1
filters:
- multiply: 0.1
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Grid frequency
device_class: frequency
state_class: measurement
unit_of_measurement: Hz
register_type: read
address: 33094
value_type: U_WORD
accuracy_decimals: 2
filters:
- multiply: 0.01
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Battery voltage
device_class: voltage
state_class: measurement
disabled_by_default: true # Do not fill recorder when not needed
unit_of_measurement: V
register_type: read
address: 33133
value_type: U_WORD
accuracy_decimals: 2
filters:
- multiply: 0.1
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Battery current
device_class: current
state_class: measurement
disabled_by_default: true # Do not fill recorder when not needed
unit_of_measurement: A
register_type: read
address: 33134
value_type: S_WORD
accuracy_decimals: 2
filters:
- multiply: 0.1
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Battery state of charge (SoC)
device_class: battery
state_class: measurement
unit_of_measurement: "%"
register_type: read
address: 33139
value_type: U_WORD
skip_updates: 10
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Battery state of health (SoH)
device_class: battery
state_class: measurement
unit_of_measurement: "%"
register_type: read
address: 33140
value_type: U_WORD
icon: mdi:battery-heart-variant
skip_updates: 10
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Battery charge current limitation
device_class: current
state_class: measurement
disabled_by_default: true # Do not fill recorder when not needed
unit_of_measurement: A
register_type: read
address: 33143
value_type: U_WORD
accuracy_decimals: 2
filters:
- multiply: 0.1
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Battery discharge current limitation
device_class: current
state_class: measurement
disabled_by_default: true # Do not fill recorder when not needed
unit_of_measurement: A
register_type: read
address: 33144
value_type: U_WORD
accuracy_decimals: 2
filters:
- multiply: 0.1
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Household load power
device_class: power
state_class: measurement
unit_of_measurement: W
register_type: read
address: 33147
value_type: U_WORD
accuracy_decimals: 0
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Backup load power
device_class: power
state_class: measurement
disabled_by_default: true # Only relevant if backup connected
unit_of_measurement: W
register_type: read
address: 33148
value_type: U_WORD
accuracy_decimals: 0
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Battery power
device_class: power
state_class: measurement
unit_of_measurement: W
register_type: read
address: 33149
value_type: S_DWORD
accuracy_decimals: 0
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Total battery charge
device_class: energy
state_class: total_increasing
unit_of_measurement: kWh
register_type: read
address: 33161
value_type: U_DWORD
skip_updates: 10
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Total battery discharge
device_class: energy
state_class: total_increasing
unit_of_measurement: kWh
register_type: read
address: 33165
value_type: U_DWORD
skip_updates: 10
text_sensor:
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Product model
register_type: read
address: 33000
response_size: 2
raw_encode: HEXBYTES
entity_category: diagnostic
icon: mdi:factory
skip_updates: 10
- platform: modbus_controller
modbus_controller_id: modbus_master
name: DSP software version
register_type: read
address: 33001
response_size: 2
force_new_range: true # workaround for bug concatenating model, dsp and lcd
raw_encode: HEXBYTES
entity_category: diagnostic
icon: mdi:chip
skip_updates: 10
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Country standard code
register_type: read
address: 33092
response_size: 2
raw_encode: HEXBYTES
entity_category: diagnostic
icon: mdi:earth
skip_updates: 10
lambda: |-
uint16_t value = modbus_controller::word_from_hex_str(x, 0);
switch (value) {
/* Solis Spec Appendix 3 */
case 0x003: return std::string("VDE0126");
case 0x009: return std::string("MEX-CFE");
case 0x00B: return std::string("VDE4105");
}
return x;
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Inverter SN
register_type: read
address: 33004
register_count: 4
raw_encode: HEXBYTES
entity_category: diagnostic
icon: mdi:numeric
skip_updates: 10
lambda: |-
char serialnumber[4 * 4 + 1];
for (int j = 0; j < 4; j++) {
unsigned int r = esphome::modbus_controller::word_from_hex_str(x, j * 2);;
sprintf(serialnumber + (j * 4), "%02x%02x",
(r & 0x0F) << 4 | (r & 0xF0) >> 4, (r & 0x0F00) >> 4 | (r & 0xF000) >> 12);
}
serialnumber[4 * 4] = 0;
return std::string(serialnumber);
- platform: modbus_controller
modbus_controller_id: modbus_master
name: Inverter type definition
register_type: read
address: 35000
response_size: 2
raw_encode: HEXBYTES
entity_category: diagnostic
icon: mdi:chip
skip_updates: 10