Good to see you got it to work with modbus. It is a very powerful protocol which I use for my swimming pool equipment (automatic filters and saline chlorinator) but it takes some time to learn.
When I started this thread 3 years ago I was new to HA and most of the possible integrations as well as to Victron but I did have some experience with APIs and remote calls so I naturally went that way.
In the meantime, I’ve learned a few things and have moved on with my installation. When I started out I had a small 6 panel 1.8kWatt installation running a pump and irrigation system. Since then I built my off-grid house with 13kW installed power, 2 Fronius PV inverters and 3 Victron Multiplus II, 18kWh Lithium batteries and a 10kW gas generator as back-up just in case. This system is powering a rather complex set of installations and I wanted more robust and resilient solution which needed to be 100% local and not dependent on availability of internet connection.
Lo and behold I “discovered” the fact the Victron CCGX or any implementation of their VenusOS software has an embedded MQTT server publishing all the data. I don’t know if this feature was already present in 2017 but at that time I didn’t look for it as I wasn’t aware or knew how to use MQTT.
The advantage of using MQTT integration with HA is that, assuming your HA and VenuOS instances are on the same network, it is not dependant on internet connection, which is what I was looking for. Furthermore, it is quite easy and user friendly to set-up.
1 - Enable MQTT on the Victron VenusOS device by going into Settings/Services/Enable MQTT on LAN (SSL)
2 - Test the connection using for instance MQTT Explorer pointing to the IP of the VenusOS device and port 1883 (standard port). You will see the N-topic with the device mac-address. At this stage you will probably not see any sensor data because the VenusOS device MPTT server needs a keepalive signal every 30-so seconds, otherwise it just goes silent
3 - Install a Mosquito broker on your HA instance (I use the official add-on which works perfectly) and configure it to your taste. In my case, as I have 2 VenusOS devices (one for the well-house PV installation, another one for the mani house) I needed to set-up “Customize = true” and set-up 2 connections in /share/mosquitto/mosquitto.conf specifying the top topic (but you can specify lower level topics if you want to)
connection casa
address 192.168.X.XXX:1883
topic N/b827ebbbwxyz/# in
topic R/b827ebbbwxyz/# out
connection caseta
address 192.168.X.XXX:1883
topic N/04a316c4wxyz/# in
topic R/04a316c4wxyz/# out
This setting allows the HA MQTT broker to connect to both VenusOS instances. You can go further and customise the topic command with prefix and so forth as explained in Mosquito Broker documentation but in my case I didn’t think that was worth the trouble
4 - Enable the integration in HA in Configuration/Integrations adding MQTT and pointing it to your HA instance IP
5 - Create an automation for the keepalive of each of the VenusOS MQTT server
- id: '1604576260450'
alias: mqtt keep alive pour caseta
description: ''
trigger:
- platform: time_pattern
seconds: /30
condition: []
action:
- data:
topic: R/04a316c4wxyz/system/0/Serial
service: mqtt.publish
mode: single
6 - Using MQTT Explorer browse through all the data exposed by your VenusOS device and select what you want/need to create HA sensors
7 - Enjoy