MQTT Explorer

Bridge your Victron Energy Venus device to your MQTT server in Home Assistant

Introduction

My first blog post explained how to add your Victron Energy system into Home Assistant using the MQTT integration.

This worked well for me for a long time but I felt like it was very heavy and didn't refresh fast enough of present all the data in a precise and convenient way.

This is the reason I have decided to switch from Modbus to MQTT to connect my Victron System to my Home Assistant. We're doing it by taking advantage of the bridging fonction of MQTT and the MQTT server present in the Color Control GX (It will also work with other Venus devices, like Venux GX, Cerbo or a Raspberry Pi). I am using the Mosquitto addon provided by Hass.io, and the customization capabilities it offers. Bridging the MQTT with a different server might work but the configuration will be different.

To better see what is happening on my MQTT Server and to debug/check, I am using the software "MQTT Explorer" which provides excellent functions, realtime highlights of changed messages and works very well in my experience. You can download MQTT Explorer by clicking here

MQTT Explorer main window

Requirements

  • A working HASS.IO installation (preferred) or Home Assistant with a mosquitto broker (you will need to adjust the steps shown here)
  • A MQTT Client (MQTT Explorer for example)
  • A Victron system with a Venus device (CCGX, Cerbo, Venus GX, ...)
  • Both Home Assistant and the Victron need to be on the same network for this guide.

Enable MQTT listening on the Venus Device

WARNING: Don't do this if you don't trust the network you are on, or if your Venus is exposed to internet !

To start, you need to enable MQTT on the Venus device. This can be done in the settings, services.

Enable MQTT server

Enable bridging on Mosquitto

Custom configuration for Mosquitto Add-On

Then on Home Assistant (HassIO), make sure you have the Mosquitto broker add-on installed, or install it. Once installed, you can go to the configuration tab and add this:

customize:
  active: true
  folder: mosquitto

Restart the Mosquitto Add-on.

Configure the bridge

I am using the Add-on named Samba Share to browse the files on my computer and find the folder /share/mosquitto/

You can now create a new file named bridge-venus.conf (or any other name you want, but the .conf is important.) With the following content: (Replace the IP address by your Venus device.)

connection venus-home
address 192.168.1.XXX
topic # both 0 venus-home/

Save the file and restart the "Mosquitto Broker" add-on and check in the logs that it started correctly. If it starts correctly, you should see a line like that:

Connecting bridge venus-home (192.168.1.XXX:1883)

This defines the bridge in MQTT. It tells to bridge all the remote server to the folder named victron-home. Here is the example on my system (you need another step before getting all the information, you should only see a few folders under /venus-home at first.) InkedMQTT Explorer 1vpeD5MrM2 LI

Wake up the MQTT script on Venus

Once that is done, you need to set up an automation on Home Assistant that will write in a topic on MQTT to request the data from the Venus device. This is to prevent devices from using too much processing power and sending useless data on the Victron Servers.

With MQTT Explorer, find your installation id, you will see it under the path /venus-home/system/0/Serial. Copy the value of the field and create the following automation, don't forget to replace the YOUR SYSTEM ID:

alias: Refresh MQTT Victron
description: 'Request the data on the MQTT server'
trigger:
  - platform: time_pattern
    seconds: '30'
action:
  - service: mqtt.publish
    data:
      topic: venus-home/R/YOUR SYSTEM ID/system/0/Serial
mode: single

It works

Now in MQTT Explorer, you can see all the data appear and refresh before your eyes: ZTImYkoKEF

Please feel free to share with me what you built with that!

{{ message }}

{{ 'Comments are closed.' | trans }}