-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathesphome-web-745c70.yaml
404 lines (375 loc) · 10.9 KB
/
esphome-web-745c70.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
esphome:
name: esphome-web-745c70
friendly_name: LILYGO RS485
min_version: 2024.11.0
name_add_mac_suffix: false
esp32:
board: esp32dev
framework:
type: esp-idf
# Enable logging
logger:
# level: VERY_VERBOSE
# Enable Home Assistant API
api:
# Allow Over-The-Air updates
ota:
- platform: esphome
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
web_server:
port: 80
# Configure uart that will be used
uart:
- id: mod_bus
rx_pin: GPIO21
tx_pin: GPIO22
baud_rate: 115200
data_bits: 8
stop_bits: 1
parity: NONE
modbus:
- uart_id: mod_bus
id: modbus1
send_wait_time: 200ms
modbus_controller:
- id: marstek_venus
address: 0x1
modbus_id: modbus1
command_throttle: 200ms
update_interval: 1s
#modbus registers
# range 31000-
text_sensor:
- name: "Marstek device name"
icon: "mdi:information"
platform: modbus_controller
modbus_controller_id: marstek_venus
register_type: holding
address: 31000
register_count: 1
response_size: 20
skip_updates: 30 #skip updates bepaalt hoe veel update_intervalss dit geskipts wordt. Dus als update_interval van modbus_controller 1s is dit 30s
binary_sensor:
- platform: modbus_controller
name: "Marstek Battery Protection Active"
icon: "mdi:information"
modbus_controller_id: marstek_venus
register_type: holding
address: 44001
bitmask: 0x01
skip_updates: 30
- platform: modbus_controller
name: "Marstek Battery Overvoltage Warning"
icon: "mdi:information"
modbus_controller_id: marstek_venus
register_type: holding
address: 44002
bitmask: 0x02
skip_updates: 30
- platform: modbus_controller
name: "Battery Undervoltage Warning"
icon: "mdi:information"
modbus_controller_id: marstek_venus
register_type: holding
address: 44003
bitmask: 0x04
skip_updates: 30
#for reference
# U_WORD: unsigned 16 bit integer from 1 register = 16bit
# S_WORD: signed 16 bit integer from 1 register = 16bit
# U_DWORD: unsigned 32 bit integer from 2 registers = 32bit
# S_DWORD: signed 32 bit integer from 2 registers = 32bit
# U_DWORD_R: unsigned 32 bit integer from 2 registers low word first
# S_DWORD_R: signed 32 bit integer from 2 registers low word first
# U_QWORD: unsigned 64 bit integer from 4 registers = 64bit
# S_QWORD: signed 64 bit integer from 4 registers = 64bit
# U_QWORD_R: unsigned 64 bit integer from 4 registers low word first
# S_QWORD_R: signed 64 bit integer from 4 registers low word first
# FP32: 32 bit IEEE 754 floating point from 2 registers
# FP32_R: 32 bit IEEE 754 floating point - same as FP32 but low word first
sensor:
- name: "Marstek Battery State of Charge"
icon: mdi:battery-70
platform: modbus_controller
modbus_controller_id: marstek_venus
register_type: holding
address: 32104 # Register address for Battery SOC
value_type: U_WORD # Unsigned 16-bit value =u16 in marstek pdf
unit_of_measurement: "%"
accuracy_decimals: 1
skip_updates: 30
- name: "Marstek total charging energy"
platform: modbus_controller
icon: mdi:battery-arrow-up
modbus_controller_id: marstek_venus
register_type: holding
address: 33000
value_type: U_DWORD
unit_of_measurement: "kWh"
device_class: energy
state_class: total_increasing
accuracy_decimals: 2
skip_updates: 300
filters:
- multiply: 0.01
- name: "Marstek total discharging energy"
platform: modbus_controller
icon: mdi:battery-arrow-down
modbus_controller_id: marstek_venus
register_type: holding
address: 33002
value_type: U_DWORD #=U32 in marstek pdf
unit_of_measurement: "kWh"
device_class: energy
state_class: total_increasing
accuracy_decimals: 2
skip_updates: 300
filters:
- multiply: 0.01
- name: "Marstek daily charging energy"
platform: modbus_controller
icon: mdi:battery-arrow-up
modbus_controller_id: marstek_venus
register_type: holding
address: 33004
value_type: U_DWORD
unit_of_measurement: "kWh"
device_class: energy
state_class: total_increasing
accuracy_decimals: 2
skip_updates: 30
filters:
- multiply: 0.01
- name: "Marstek daily discharging energy"
platform: modbus_controller
icon: mdi:battery-arrow-down
modbus_controller_id: marstek_venus
register_type: holding
address: 33006
value_type: U_DWORD #=U32 in marstek pdf
unit_of_measurement: "kWh"
device_class: energy
state_class: total_increasing
accuracy_decimals: 2
skip_updates: 300
filters:
- multiply: 0.01
- name: "Marstek monthly charging energy"
platform: modbus_controller
icon: mdi:battery-arrow-up
modbus_controller_id: marstek_venus
register_type: holding
address: 33008
value_type: U_DWORD
unit_of_measurement: "kWh"
device_class: energy
state_class: total_increasing
accuracy_decimals: 2
skip_updates: 300
filters:
- multiply: 0.01
- name: "Marstek monthy discharging energy"
platform: modbus_controller
icon: mdi:battery-arrow-down
modbus_controller_id: marstek_venus
register_type: holding
address: 33010
value_type: U_DWORD #=U32 in marstek pdf
unit_of_measurement: "kWh"
device_class: energy
state_class: total_increasing
accuracy_decimals: 2
skip_updates: 300
filters:
- multiply: 0.01
- name: "Marstek AC power"
platform: modbus_controller
icon: mdi:battery-charging
modbus_controller_id: marstek_venus
register_type: holding
address: 32202
value_type: S_DWORD #=s32 in marstek pdf
unit_of_measurement: "W"
device_class: power
state_class: measurement
accuracy_decimals: 0
skip_updates: 5
filters:
- multiply: 1
- name: "Marstek offgrid power"
platform: modbus_controller
icon: mdi:power-plug-battery
modbus_controller_id: marstek_venus
register_type: holding
address: 32302
value_type: S_DWORD #=s32 in marstek pdf
unit_of_measurement: "W"
device_class: power
state_class: measurement
accuracy_decimals: 0
skip_updates: 5
filters:
- multiply: 1
select:
- platform: modbus_controller
name: "Marstek forcible charge/discharge"
icon: mdi:swap-horizontal
modbus_controller_id: marstek_venus
address: 42010
value_type: U_WORD
optionsmap:
"Stop": 0
"Charge": 1
"Discharge": 2
skip_updates: 10
- platform: modbus_controller
name: "Marstek backup function"
icon: mdi:power-socket-fr
modbus_controller_id: marstek_venus
address: 41200
value_type: U_WORD
optionsmap:
"enable": 0
"disable": 1
skip_updates: 10
- platform: modbus_controller
name: "Marstek user work mode"
icon: mdi:auto-mode
modbus_controller_id: marstek_venus
address: 43000
value_type: U_WORD
optionsmap:
"manual": 0
"anti-feed": 1
"trade-mode": 2
skip_updates: 10
- platform: modbus_controller
name: "Marstek RS485 Control Mode Select"
icon: mdi:swap-horizontal
modbus_controller_id: marstek_venus
address: 42000
value_type: U_WORD
optionsmap:
"Enable": 21930
"Disable": 21947
skip_updates: 10
#enable: 21930 # 0x55AA in decimal
#disable: 21947 # 0x55BB in decimal
number:
- platform: modbus_controller
name: "Marstek forcible charge power"
icon: mdi:tune-variant
modbus_controller_id: marstek_venus
mode: box
register_type: holding
address: 42020
value_type: U_WORD
unit_of_measurement: "W"
min_value: 0
max_value: 2500
step: 1
skip_updates: 5
# write_lambda: |-
# // Convert the value to an integer explicitly
# return uint16_t(x);
- platform: modbus_controller
name: "Marstek forcible discharge power"
icon: mdi:tune-variant
modbus_controller_id: marstek_venus
mode: box
register_type: holding
address: 42021
value_type: U_WORD
unit_of_measurement: "W"
min_value: 0
max_value: 2500
step: 1
skip_updates: 5
# write_lambda: |-
# // Convert the value to an integer explicitly
# return uint16_t(x);
- platform: modbus_controller
name: "Marstek charge to SOC"
icon: mdi:battery-charging-medium
modbus_controller_id: marstek_venus
mode: box
register_type: holding
address: 42011
value_type: U_WORD
unit_of_measurement: "%"
min_value: 12
max_value: 100
step: 1
skip_updates: 5
#we should try to read/write 44000-44003 in one go https://esphome.io/components/modbus_controller.html#optimizing-modbus-communications
- name: "Marstek charging cutoff capacity"
platform: modbus_controller
icon: mdi:battery-90
modbus_controller_id: marstek_venus
register_type: holding
address: 44000 #line to add : register_count: 4 # Read all 4 registers at once
value_type: U_WORD #=u16 in marstek pdf
unit_of_measurement: "%"
skip_updates: 20
min_value: 80
max_value: 100
multiply: 10
- name: "Marstek discharging cutoff capacity"
platform: modbus_controller
icon: mdi:battery-10
modbus_controller_id: marstek_venus
register_type: holding
address: 44001
value_type: U_WORD #=u16 in marstek pdf
unit_of_measurement: "%"
skip_updates: 20
min_value: 12
max_value: 30
multiply: 10
- platform: modbus_controller
name: "Marstek max charge power"
icon: mdi:tune-variant
modbus_controller_id: marstek_venus
mode: box
register_type: holding
address: 44002
value_type: U_WORD
unit_of_measurement: "W"
min_value: 0
max_value: 2500
step: 1
skip_updates: 5
- platform: modbus_controller
name: "Marstek max discharge power"
icon: mdi:tune-variant
modbus_controller_id: marstek_venus
mode: box
register_type: holding
address: 44003
value_type: U_WORD
unit_of_measurement: "W"
min_value: 0
max_value: 2500
step: 1
skip_updates: 5
#### krijg die switch niet werkend, heb er een select van gemaakt. esphome bekijkt een switch steeds als een coil en niet als holding register
#### al getest met de decimals (21930 # 0x55AA in decimal) en verschillende bitmasks zoals hier waar ze gewwon 0 of 1 willen schrijven naar een holding register met een switch
#### switch zou wel een betere oplosing zijn https://github.com/esphome/issues/issues/5888
# switch:
# - platform: modbus_controller
# name: "Marstek RS485 Control Mode"
# icon: mdi:transfer
# modbus_controller_id: marstek_venus
# register_type: holding
# address: 42000
# write_lambda: |-
# if (x) {
# // Enable RS485 control mode (0x55AA)
# payload.push_back(0x55AA); // Add the full 16-bit word
# } else {
# // Disable RS485 control mode (0x55BB)
# payload.push_back(0x55BB); // Add the full 16-bit word
# }
# return true; // Indicate success