Victron MQTT configurations

Add the following code to your mqtt.yaml file:

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
sensor:
  # Grid meter power
  - state_topic: "venus-home/N/c0619xxxxxx/grid/30/Ac/Power"
    name: "Grid power"
    unique_id: "grid_meter_power"
    device_class: power
    value_template: '{{ value_json.value | round(0) }}'
    unit_of_measurement: "W"
    icon: mdi:TransmissionTower
 
  # Victron alarms
  - state_topic: "venus-home/N/c0619xxxxxx/battery/512/Alarms/CellImbalance"
    name: "Alarm cell imbalance"
    unique_id: "alarm_battery_cell_imbalance"
    value_template: >
      {% if value_json.value == 0 %}
        OK
      {% elif value_json.value == 1 %}
        Warning
      {% elif value_json.value == 2 %}
        Alarm
      {% endif %}
       
  - state_topic: "venus-home/N/c0619xxxxxx/battery/512/Alarms/ChargeBlocked"
    name: "Alarm Charge blocked"
    unique_id: "alarm_battery_charge_blocked"
    value_template: >
      {% if value_json.value == 0 %}
        OK
      {% elif value_json.value == 1 %}
        Warning
      {% elif value_json.value == 2 %}
        Alarm
      {% endif %}
       
 
       
  - state_topic: "venus-home/N/c0619xxxxxx/battery/512/Alarms/DischargeBlocked"
    name: "Alarm Discharge blocked"
    unique_id: "alarm_battery_discharge_blocked"
    value_template: >
      {% if value_json.value == 0 %}
        OK
      {% elif value_json.value == 1 %}
        Warning
      {% elif value_json.value == 2 %}
        Alarm
      {% endif %}
 
 
  - state_topic: "venus-home/N/c0619xxxxxx/battery/512/Alarms/HighChargeCurrent"
    name: "Alarm high charge current"
    unique_id: "alarm_battery_high_charge_current"
    value_template: >
      {% if value_json.value == 0 %}
        OK
      {% elif value_json.value == 1 %}
        Warning
      {% elif value_json.value == 2 %}
        Alarm
      {% endif %}
 
  - state_topic: "venus-home/N/c0619xxxxxx/battery/512/Alarms/HighChargeTemperature"
    name: "Alarm high charge temperature"
    unique_id: "alarm_battery_high_charge_temperature"
    value_template: >
      {% if value_json.value == 0 %}
        OK
      {% elif value_json.value == 1 %}
        Warning
      {% elif value_json.value == 2 %}
        Alarm
      {% endif %}
 
  - state_topic: "venus-home/N/c0619xxxxxx/battery/512/Alarms/HighDischargeCurrent"
    name: "Alarm high discharge current"
    unique_id: "alarm_battery_high_discharge_current"
    value_template: >
      {% if value_json.value == 0 %}
        OK
      {% elif value_json.value == 1 %}
        Warning
      {% elif value_json.value == 2 %}
        Alarm
      {% endif %}
       
  - state_topic: "venus-home/N/c0619xxxxxx/battery/512/Alarms/HighTemperature"
    name: "Alarm high temperature"
    unique_id: "alarm_battery_high_temperature"
    value_template: >
      {% if value_json.value == 0 %}
        OK
      {% elif value_json.value == 1 %}
        Warning
      {% elif value_json.value == 2 %}
        Alarm
      {% endif %}
 
  - state_topic: "venus-home/N/c0619xxxxxx/battery/512/Alarms/HighVoltage"
    name: "Alarm high voltage"
    unique_id: "alarm_battery_high_voltage"
    value_template: >
      {% if value_json.value == 0 %}
        OK
      {% elif value_json.value == 1 %}
        Warning
      {% elif value_json.value == 2 %}
        Alarm
      {% endif %}
 
  - state_topic: "venus-home/N/c0619xxxxxx/battery/512/Alarms/InternalFailure"
    name: "Alarm internal failure"
    unique_id: "alarm_battery_internal_failure"
    value_template: >
      {% if value_json.value == 0 %}
        OK
      {% elif value_json.value == 1 %}
        Warning
      {% elif value_json.value == 2 %}
        Alarm
      {% endif %}
 
  - state_topic: "venus-home/N/c0619xxxxxx/battery/512/Alarms/LowChargeTemperature"
    name: "Alarm low charge temperature"
    unique_id: "alarm_battery_low_charge_temp"
    value_template: >
      {% if value_json.value == 0 %}
        OK
      {% elif value_json.value == 1 %}
        Warning
      {% elif value_json.value == 2 %}
        Alarm
      {% endif %}
 
  - state_topic: "venus-home/N/c0619xxxxxx/battery/512/Alarms/LowTemperature"
    name: "Alarm low temperature"
    unique_id: "alarm_battery_low_temp"
    value_template: >
      {% if value_json.value == 0 %}
        OK
      {% elif value_json.value == 1 %}
        Warning
      {% elif value_json.value == 2 %}
        Alarm
      {% endif %}
 
  - state_topic: "venus-home/N/c0619xxxxxx/battery/512/Alarms/LowVoltage"
    name: "Alarm low voltage"
    unique_id: "alarm_battery_low_voltage"
    value_template: >
      {% if value_json.value == 0 %}
        OK
      {% elif value_json.value == 1 %}
        Warning
      {% elif value_json.value == 2 %}
        Alarm
      {% endif %}
 
  # Victron Cerbo GX Serial number
  - state_topic: "venus-home/N/c0619xxxxxx/system/0/Serial"
    name: "Cerbo GX Serial number"
    unique_id: "victron_cerbo_serial"
    value_template: '{{ value_json.value }}'
 
  # Active SoC limit 
  - state_topic: "venus-home/N/c0619xxxxxx/system/0/Control/ActiveSocLimit"
    name: "Active SoC limit"
    unique_id: "active_soc_limit"
    device_class: battery
    unit_of_measurement: "%"
    value_template: '{{ value_json.value | round(0)}}'
    icon: mdi:battery-low
 
  # AC ActiveIN L1 Current
  - state_topic: "venus-home/N/c0619xxxxxx/system/0/Ac/ActiveIn/L1/Current"
    name: "AC ActiveIn L1 Current"
    unique_id: "victron_activein_L1_current"
    device_class: current
    value_template: '{{ value_json.value |float(0)|round(2) }}'
    unit_of_measurement: "A"
    icon: mdi:power-socket-eu  
 
  # AC ActiveIN L1 Current
  - state_topic: "venus-home/N/c0619xxxxxx/system/0/Ac/ActiveIn/L2/Current"
    name: "AC ActiveIn L2 Current"
    unique_id: "victron_activein_L2_current"
    device_class: current
    value_template: '{{ value_json.value |float(0)|round(2) }}'
    unit_of_measurement: "A"
    icon: mdi:power-socket-eu 
 
  # AC ActiveIN L1 Current
  - state_topic: "venus-home/N/c0619xxxxxx/system/0/Ac/ActiveIn/L3/Current"
    name: "AC ActiveIn L3 Current"
    unique_id: "victron_activein_L3_current"
    device_class: current
    value_template: '{{ value_json.value |float(0)|round(2) }}'
    unit_of_measurement: "A"
    icon: mdi:power-socket-eu 
 
  # Grid Lost Status
  - state_topic: "venus-home/N/c0619xxxxxx/vebus/276/Alarms/GridLost"
    name: "Grid Lost Status"
    unique_id: "victron_grid_lost_status"
    value_template: >
      {% if value_json.value == 0 %}
        Grid Connected
      {% elif value_json.value == 2 %}
        Grid Lost
      {% endif %}
 
  # Current Grid Setpoint
  - state_topic: "venus-home/N/c0619xxxxxx/settings/0/Settings/CGwacs/AcPowerSetPoint"
    name: "Current grid setpoint"
    unique_id: "current_grid_setpoint"
    device_class: power
    value_template: '{{ value_json.value }}'
    unit_of_measurement: "W"
 
    # Battery percentage
  - state_topic: "venus-home/N/c0619xxxxxx/battery/512/Soc"
    name: "Battery Percent"
    unique_id: "battery_percent"
    device_class: battery
    value_template: '{{ value_json.value | round(1) }}'
    unit_of_measurement: "%"
   
    # Battery percentage
  - state_topic: "venus-home/N/c0619xxxxxx/battery/512/Soh"
    name: "Battery Health"
    unique_id: "battery_health"
    device_class: battery
    value_template: '{{ value_json.value | round(1) }}'
    unit_of_measurement: "%"
 
  # AC Loads
  - state_topic: "venus-home/N/c0619xxxxxx/vebus/276/Ac/Out/P"
    name: "AC Loads"
    unique_id: "ac_loads"
    device_class: power
    value_template: '{{ value_json.value }}'
    unit_of_measurement: "W"
    icon: mdi:power-socket-eu
  
  # L1 Load
  - state_topic: "venus-home/N/c0619xxxxxx/vebus/276/Ac/Out/L1/P"
    name: "L1 Load"
    unique_id: "L1_load"
    device_class: power
    value_template: '{{ value_json.value }}'
    unit_of_measurement: "W"
    icon: mdi:power-socket-eu
  
  # L1 Output Voltage
  - state_topic: "venus-home/N/c0619xxxxxx/vebus/276/Ac/Out/L1/V"
    name: "L1 Output Voltage"
    unique_id: "L1_Output_Voltage"
    device_class: voltage
    value_template: '{{ value_json.value|round(1) }}'
    unit_of_measurement: "V"
    icon: mdi:power-socket-eu
 
  # L1 Output frequency
  - state_topic: "venus-home/N/c0619xxxxxx/vebus/276/Ac/Out/L1/F"
    name: "L1 output frequency"
    unique_id: "L1_output_frequency"
    device_class: frequency
    value_template: '{{ value_json.value|round(1) }}'
    unit_of_measurement: "Hz"
    icon: mdi:sine-wave   
 
  # L2 Load
  - state_topic: "venus-home/N/c0619xxxxxx/vebus/276/Ac/Out/L2/P"
    name: "L2 Load"
    unique_id: "L2_load"
    device_class: power
    value_template: '{{ value_json.value }}'
    unit_of_measurement: "W"
    icon: mdi:power-socket-eu   
 
  # L2 Output Voltage
  - state_topic: "venus-home/N/c0619xxxxxx/vebus/276/Ac/Out/L2/V"
    name: "L2 Output Voltage"
    unique_id: "L2_Output_Voltage"
    device_class: voltage
    value_template: '{{ value_json.value|round(1) }}'
    unit_of_measurement: "V"
    icon: mdi:power-socket-eu
 
  # L2 Output frequency
  - state_topic: "venus-home/N/c0619xxxxxx/vebus/276/Ac/Out/L2/F"
    name: "L2 output frequency"
    unique_id: "L2_output_frequency"
    device_class: frequency
    value_template: '{{ value_json.value|round(1) }}'
    unit_of_measurement: "Hz"
    icon: mdi:sine-wave   
 
  # L3 Load
  - state_topic: "venus-home/N/c0619xxxxxx/vebus/276/Ac/Out/L3/P"
    name: "L3 Load"
    unique_id: "L3_load"
    device_class: power
    value_template: '{{ value_json.value }}'
    unit_of_measurement: "W"
    icon: mdi:power-socket-eu   
 
  # L3 Output Voltage
  - state_topic: "venus-home/N/c0619xxxxxx/vebus/276/Ac/Out/L3/V"
    name: "L3 Output Voltage"
    unique_id: "L3_Output_Voltage"
    device_class: voltage
    value_template: '{{ value_json.value|round(1) }}'
    unit_of_measurement: "V"
    icon: mdi:power-socket-eu
 
  # L3 Output frequency
  - state_topic: "venus-home/N/c0619xxxxxx/vebus/276/Ac/Out/L3/F"
    name: "L3 output frequency"
    unique_id: "L3_output_frequency"
    device_class: frequency
    value_template: '{{ value_json.value|round(1) }}'
    unit_of_measurement: "Hz"
    icon: mdi:sine-wave
 
  # L1 Grid
  - state_topic: "venus-home/N/c0619xxxxxx/system/0/Ac/Grid/L1/Power"
    name: "L1 Grid"
    unique_id: "L1_grid"
    device_class: power
    value_template: '{{ value_json.value }}'
    unit_of_measurement: "W"
    icon: mdi:power-socket-eu
     
  # L2 Grid
  - state_topic: "venus-home/N/c0619xxxxxx/system/0/Ac/Grid/L2/Power"
    name: "L2 Grid"
    unique_id: "L2_grid"
    device_class: power
    value_template: '{{ value_json.value }}'
    unit_of_measurement: "W"
    icon: mdi:power-socket-eu
 
  # L3 Grid
  - state_topic: "venus-home/N/c0619xxxxxx/system/0/Ac/Grid/L3/Power"
    name: "L3 Grid"
    unique_id: "L3_grid"
    device_class: power
    value_template: '{{ value_json.value }}'
    unit_of_measurement: "W"
    icon: mdi:power-socket-eu
 
  # DC Loads
  - name: "DC Loads"
    device_class: power
    unique_id: "dc_loads"
    state_topic: "venus-home/N/c0619xxxxxx/system/0/Dc/System/Power"
    value_template: '{{ value_json.value|float(0)|round(0) }}'
    unit_of_measurement: "W"
    icon: mdi:power
     
  # Net Solar Production
  - name: "Current Solar Production"
    unique_id: "net_solar_production"
    device_class: power
    state_topic: "venus-home/N/c0619xxxxxx/system/0/Dc/Pv/Power"
    value_template: '{{ value_json.value|float(0)|round(0) }}'
    unit_of_measurement: "W"
    icon: mdi:solar-power
   
  # Battery Voltage
  - name: "Battery Voltage"
    unique_id: "battery_voltage"
    device_class: voltage
    state_topic: "venus-home/N/c0619xxxxxx/system/0/Dc/Battery/Voltage"
    value_template: '{{ value_json.value|float(0)|round(1) }}'
    unit_of_measurement: "V"
 
  # Battery Temp (If you have a temp sensor)
  - name: "Battery Temp"
    device_class: temperature
    unique_id: "battery_temperature"
    state_topic: "venus-home/N/c0619xxxxxx/system/0/Dc/Battery/Temperature"
    value_template: '{{ ((value_json.value * 9/5) + 32) | round(0) }}'
    unit_of_measurement: "°F"
 
  # Net load going in/out of your battery
  - name: "Battery Load"
    unique_id: "battery_load"
    device_class: power
    state_topic: "venus-home/N/c0619xxxxxx/system/0/Dc/Vebus/Power"
    value_template: '{{ value_json.value |float(0)|round(0) }}'
    unit_of_measurement: "W"
     
  # Net current going in/out of your battery
  - name: "Battery Current"
    unique_id: "battery_current"
    device_class: current
    state_topic: "venus-home/N/c0619xxxxxx/system/0/Dc/Vebus/Current"
    value_template: '{{ value_json.value |float(0)|round(0) }}'
    unit_of_measurement: "A"
 
  # Temperature Multiplus II - Phase 1
  - name: "Temperature MPII #1"
    unique_id: "temp_mpII_1"
    device_class: temperature
    state_topic: "venus-home/N/c0619xxxxxx/temperature/25/Temperature"
    value_template: '{{ value_json.value |float(0)|round(0) }}'
    unit_of_measurement: "°C"
 
  # Temperature Multiplus II - Phase 2
  - name: "Temperature MPII #2"
    unique_id: "temp_mpII_2"
    device_class: temperature
    state_topic: "venus-home/N/c0619xxxxxx/temperature/26/Temperature"
    value_template: '{{ value_json.value |float(0)|round(0) }}'
    unit_of_measurement: "°C"
 
  # Temperature Multiplus II - Phase 3
  - name: "Temperature MPII #3"
    unique_id: "temp_mpII_3"
    device_class: temperature
    state_topic: "venus-home/N/c0619xxxxxx/temperature/27/Temperature"
    value_template: '{{ value_json.value |float(0)|round(0) }}'
    unit_of_measurement: "°C"
 
  # Temperature Multiplus II - Phase 3
  - name: "Pylontech battery power"
    unique_id: "pylontech_batt_power"
    device_class: power
    state_topic: "venus-home/N/c0619xxxxxx/battery/512/Dc/0/Power"
    value_template: '{{ value_json.value |round(0) }}'
    unit_of_measurement: "W"
 
  # Current State of your Inverter
  - name: "Inverter State"
    unique_id: "inverter_state"
    state_topic: "venus-home/N/c0619xxxxxx/system/0/SystemState/State"
    value_template: >
      {% if value_json.value == 0 %}
        Off
      {% elif value_json.value == 1 %}
        Low power
      {% elif value_json.value == 2 %}
        VE.Bus Fault condition
      {% elif value_json.value == 3 %}
        Bulk charging
      {% elif value_json.value == 4 %}
        Absorption charging
      {% elif value_json.value == 5 %}
        Float charging
      {% elif value_json.value == 6 %}
        Storage mode
      {% elif value_json.value == 7 %}
        Equalize
      {% elif value_json.value == 8 %}
        Passthru
      {% elif value_json.value == 9 %}
        Inverting
      {% elif value_json.value == 10 %}
        Assisting
      {% elif value_json.value == 252 %}
        External control
      {% elif value_json.value == 256 %}
        Discharging
      {% elif value_json.value == 257 %}
        Sustain
      {% elif value_json.value == 258 %}
        Recharging
      {% elif value_json.value == 259 %}
        Scheduled recharging
      {% else %}
        Error - No Data
      {% endif %}
   
  # Current state of your charge controller
  - name: "Solar Charger State"
    unique_id: "solar_charger_state"
    state_topic: "venus-home/N/c0619xxxxxx/solarcharger/289/State"
    value_template: >
      {% if value_json.value == 0 %}
        Off
      {% elif value_json.value == 2 %}
        Fault
      {% elif value_json.value == 3 %}
        Bulk
      {% elif value_json.value == 4 %}
        Absorption
      {% elif value_json.value == 5 %}
        Float
      {% elif value_json.value == 6 %}
        Storage
      {% elif value_json.value == 7 %}
        Equalize
      {% else %}
        Error - No Data
      {% endif %}
 
switch:
  #Multiplus Entladeleistung Begrenzen !Number
  - unique_id: multiplus_switch_discharge_power
    name: Inverter Power
    command_topic: "venus-home/W/c0619xxxxxx/settings/0/Settings/CGwacs/MaxDischargePower"
    payload_on: '{"value": 1000}'
    payload_off: '{"value": -1}'
    state_topic: "venus-home/N/c0619xxxxxx/settings/0/Settings/CGwacs/MaxDischargePower"
    value_template: >
      {% if value_json.value | int == -1 %}
        {% set state_limit = 'OFF' %}
      {% else %}
        {% set state_limit = 'ON' %}
      {% endif %}
      {{ state_limit }}
    state_on: 'ON'
    state_off: 'OFF'
     
    device: {
      identifiers: [
        "Victron Cerbo GX"
      ],
      manufacturer: "Victron Energy",
      model: "Cerbo GX",
      name: "Cerbo GX"}
 
  #Multiplus AC PV-Überschuss einspeisen
  - unique_id: multiplus_allow_ac_feed_in
    name: Multiplus allow AC feed in
    command_topic: "venus-home/W/c0619xxxxxx/settings/0/Settings/CGwacs/PreventFeedback"
    payload_on: '{"value": 0}'
    payload_off: '{"value": 1}'
    state_topic: "venus-home/N/c0619xxxxxx/settings/0/Settings/CGwacs/PreventFeedback"
    value_template: "{{ value_json.value | int }}"
    state_on: '0'
    state_off: '1'
     
    device: {
      identifiers: [
        "Victron Cerbo GX"
      ],
      manufacturer: "Victron Energy",
      model: "Cerbo GX",
      name: "Cerbo GX"}
 
  #Multiplus DC PV-Überschuss einspeisen
  - unique_id: multiplus_allow_dc_feed_in
    name: Multiplus allow DC feed in
    command_topic: "venus-home/W/c0619xxxxxx/settings/0/Settings/CGwacs/OvervoltageFeedIn"
    payload_on: '{"value": 1}'
    payload_off: '{"value": 0}'
    state_topic: "venus-home/N/c0619xxxxxx/settings/0/Settings/CGwacs/OvervoltageFeedIn"
    value_template: "{{ value_json.value | int }}"
    state_on: '1'
    state_off: '0'
     
    device: {
      identifiers: [
        "Victron Cerbo GX"
      ],
      manufacturer: "Victron Energy",
      model: "Cerbo GX",
      name: "Cerbo GX"}