Victron integrated with HA and EMHASS - My Single Guide

yes please!!!

https://github.com/Daddy1976/mqtt

Readme first

if there are any problems, just write

I hope that the procedure is sufficient

Iā€™m sorry, if you find some Slovak names there, change them accordingly

files can be customized (itā€™s my configuration, may not suit everyone)

if something doesnā€™t work as expected, you need to download and check the path in state_topic and command_topic using MQTT explorer.

all necesary items can be imported into ENERGY immediately after starting and working properly

I recommend to simply use the Victron integration provided here:

It works fantastic, no hassle with manually adding devices etc plus pretty much all parameters can be modified, not only the setpoint.

To control charging, for example, there are two main parameters
select.victron_vebus_mode_X
and
number.victron_settings_ess_batterylife_minimumsoc

Hi,
Iā€™m trying to figure out if EMHASS still fits in the system if I enable Dynamic ESS from victron: What is Dynamic ESS? | Dynamic ESS Overview [Victron Energy]

I get that it can be used to control the loads more efficiently, but Iā€™m worried running both will interfere with one and other. So Iā€™m wondering which would be better?

Hi. Thanks very much for this. I have all the parameters reading nicely onto Dashboards, setup automations for fans, heaters and when to run things and about to add the slider for exporting.

Iā€™d like to add a ā€œBOOSTā€ button whereby I export 1 hours worth of energy to the grid or 2kWh at a certain time.

For this I will need to ā€œset the sliderā€ to a certain value of wattage and measure time. Ideally understanding better how the slider controls Victron would be better but I think that will take a little leap of faith on my programming skills and understanding!

Is this something you can help with or would like to do?
Iā€™m thinking of a dashboard with button and kWh option buttons and a set time to do it.
e.g.

My system is a Multiplus II 5000 with 10.5KwH Pylontech US3000C batteries, CERBO GX 3.8KW PV.
Timed Version - Export
At 4PM (when the grid pays for export @ Ā£1.50-Ā£4.50) ,
IF the SOC of the battery is above 90% - Export 1KwH (this would be at 4kW for 18-20 minutes on my system since 4kw from battery gives about 3.5Kw to the grid after conversion losses.

Ad-Hoc Version
BOOST BUTTON: Export 1KwH Now - Low Power
Setpoint to -1200 for 1 hour.

BOOST BUTTON: Export 1KwH Now - Hi Power
Setpoint to -4000 for /18 minutes

Timed Version - Import
At 2AM (when the grid charges ~40% less for energy between 2am and 5am) ,
IF the SOC of the battery is below 60% - Import until SOC is 90% (this would be at 4kW for 18-20 minutes on my system since 4kw from battery gives about 3.5Kw from the grid after conversion losses.

1 Like

Hi Marek, yes please provide me the full code.
I already used MQTT for SMH & Axpert. I had to buy new batteries, so i switched from lead to litio. Therefore i also needed a new inverter. victron!

Regards
Peter, Spain

the code is here GitHub - Daddy1976/mqtt: MQTT Victron HomeAssistant
see also readme.md
in homeassistant it is necessary to add mqtt and set ip to cerbo gx
it is necessary to enable it in cerbo

I have os venus large installed

this code i have in NODE-RED

it is necessary to set the mqtt wakeup in cerbo every 30 seconds

[
    {
        "id": "4193f98e1ac08b2d",
        "type": "inject",
        "z": "eb825fdd94044cc5",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "30",
        "crontab": "",
        "once": true,
        "onceDelay": "2",
        "topic": "R/YOUR_VICTRON_ID/keepalive",
        "payload": "",
        "payloadType": "str",
        "x": 170,
        "y": 40,
        "wires": [
            [
                "abcb55e7bea05728"
            ]
        ]
    },
    {
        "id": "abcb55e7bea05728",
        "type": "mqtt out",
        "z": "eb825fdd94044cc5",
        "name": "mqtt wakeup",
        "topic": "",
        "qos": "0",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "6ee2e89363dc76a1",
        "x": 430,
        "y": 40,
        "wires": []
    },
    {
        "id": "6ee2e89363dc76a1",
        "type": "mqtt-broker",
        "name": "victron",
        "broker": "192.168.2.130",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "userProps": "",
        "sessionExpiry": ""
    }
]

change to large venus os


Super! Thank you Marek.
Instead of a Cerbo GX i have a Color Control. Does this change anything? The displays look similar.

As i do not know NodeRed i will try it with automation. It looks to me as you write/send a string of text without any meaning. Is this correct?

And how did you do the screen shots??

node-red is only to refresh mqtt every 30s. this is how i do it

automation or a script created in homeassistant can also handle it.
but this matter is beyond me

and yes the payload is empty. only the topic is sent

you download mqtt explorer. it is a great help to understand mqtt

http://venus.local or IP color control
macbook, command+shift+4
windows, windows key + shift + s

is there anything like Predbat for that is compatible with Victron Inverters?

https://springfall2008.github.io/batpred/what-does-predbat-do/

It uses solcast to decide how much to charge the batteries up to over night, depending on the sun the following day, and when the cheapest slots are on the live pricing electric tarrif (octopus agile in the UK).

Or does victron do this out the box?

Iā€™m trying to setup your select.yaml so I can change my inverter mode. Iā€™m able to get it to show up in MQTT, but it immediately says itā€™s unavailable. Iā€™ve set my Cerbo ID correctly, and double checked all the topics. Not sure where Iā€™m going wrong.

EDIT: Nvm figured it out. Typo on my end. Actually it looks like itā€™s still not working. I was able to get the selector to show the different states, and it is updating anytime I toggle the inverter from within VRM, but if I try to change it using the selector in home assistantā€¦nothing happens.

it is necessary to check also # 276. you may have another number

pls paste here your ā€œselect.yaml codeā€ for verify

 - select:
    state_topic: 'N/***/vebus/276/Mode'.         --- read
    command_topic: 'W/***/vebus/276/Mode'        --- write

Appreciate the reply. The solution came to me very early in the morning, and it was just a mistake on my part. I originally setup my Victron MQTT with instructions that have sense been updated. My victron.conf file was not setup to include ā€œtopic W/# out 0 victron/ā€

I added that line in and now everything works correctly!

My next step here is to setup a selector to change the input current limit on AC1 in 1 and AC in 2. Do you have any examples I could draw from for this? I imagine itā€™s similar to the yaml for changing the inverter states.

did you mean something like this?

 - number:
    state_topic: 'N/***/vebus/276/Ac/ActiveIn/CurrentLimit'
    command_topic: 'W/***/vebus/276/Ac/ActiveIn/CurrentLimit'
    name: 'Input Current Limit'
    unique_id: 'vebus/276/Ac/ActiveIn/CurrentLimit'
    min: 1
    max: 12
    step: 0.5
    mode: slider
    command_template: '{"value": {{ value }} }'
    value_template: '{{ value_json.value }}'
    device: {
         identifiers: [
          "Multiplus-II"
          ],
         manufacturer: "Victron Energy",
         model: "48/3000/35-32",
         name: "Multiplus-II"}
    entity_category: "config"

all important entities for ā€œessā€ management are in those files

if you would like to add something else that you are missing, I recommend downloading CCGX-modbus-tcp-register-list-3.00.xlsx from the victron website and mqtt explorer

and add the necessary data by editing my config

files are divided into entities:
sensor - data that is numerical, does not need to be changed or cannot be changed. if it is changed, it will not affect VenusOs, or it will revert to the original value.
number - these are numerical values that can change the operation of the victron
switch - is a switch for turning on and off the relay or charger, or other functionsā€¦
select - numeric values are converted to text for better reading of numeric status and back to numeric status for victron

It took me 2 weeks to set up entities by searching the internet. And itā€™s still not perfect.
The documentation on the homeassistant website is not sufficient for a beginner.
The developers should think and add the necessary examples where it would be explained that this or that can be added. And especially what he does and where she can be found ,if is this added.

cheers

1 Like

Iā€™m having connected my Victron installation over Modbus only to HA and I ask myself what the advantages are in using MQTT over Modbus only.

I used to use MODBUS because the work in node-red implemented in VenusOS is better and more efficient with it. The external request for venusOS via MODBUS gave me problems. It didnā€™t want to load and when I didnā€™t monitor it, the data didnā€™t go to HA for a week.
The MQTT protocol is much less demanding on the CerboGX processor than MODBUS. Just update the VenusOS entity payload via MQTT. And VenusOS does it on its own.
On MODBUS, it is necessary to set the time requirement manually for each entity separately, and the values ā€‹ā€‹still need to be recalculated. And a wrongly set request can overwhelm the CerboGX CPU.
That was probably the reason for my failure and switch from MODBUS to MQTT.

If something is wrong, please let others comment and correct my text.

EMHASS and Dynamic ESS have different goals, EMHASS does control your loads (deferrable ones), while Dynamic ESS does control your battery and decides when you should charge or discharge from/to the grid.

I started using Predbat for my setup but it has a steep learning curve. If you can feed into the grid I recommend Dynamic ESS.
My WIP is described here.