question

wildsilo avatar image
wildsilo asked

Configure Venus MQTT to connect to other local broker

Hi there


I am a new member of this forum and the Victron family. I have recently installed a PV system at home running on a Quattro, 2x MPPTs (250/100 + 150/85) and Pylontech batteries. I have a Venus GX for control and monitoring. The system is running perfectly and it is easy to monitor on the web/phone app.

I have also set up Home Assistant (hass.io) on a Raspberry PI, and it is running as expected. I have almost 20 Sonoff switches that I am configuring to perform load management. This is to switch large consumers in my house (water heater, geysers, pool pump, pool heat pump, etc.) and some other lights and devices/switches at the most opportune time, such as when there is sufficient excess solar available.

I have installed the Mosquitto MQTT broker on the Home Assistant Raspberry Pi. I can successfully connect via MQTT to the Sonoff devices on my network to see their status and switch them on and off.

I am also able to subscribe to the Venus MQTT broker. I haven't configured the keep-alive yet, but soon after publishing to it, I receive all the topics on a N/xxx/# subscription.

But my Home Assistant MQTT broker cannot "subscribe" or "publish" directly to the Venus MQTT broker, as it is a separate instance with its own "clients", namely all the Victron devices it communicates with.

I would like to use my Home Assistant broker to control everything. Unless I understand it wrong, I will need the devices to connect to my Home Assistant broker, or the Venus broker should forward to my HA broker (probably best, as it doesn't break anything).

Is this possible?

Thanks

Gerhard

Venus GX - VGXMQTT
5 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

rondo avatar image rondo commented ·

Hi all

I'm new in this forum and I've no more ideas what I'm doing wrong.

I have a Venus GX working in my RV together with an BMV700.

An openhab is also working an an RPi 3B+ but I'm absolutly unable to get the Venus Data into openhab.

I know that I have to use MQTT an MQTT is enabled at Venus.

I tried the MQTT1 and the MQTT2 Binding in openhab an both are not working correctly.
I took several ways to configure everthing but it's not showing any data.

With mosquitto_sub -h ccgx -t "N/#" -v I see that the Venus is publishing but I unable to read it in openhab.

I don't know whats wrong. Maybe you could give me a little help.

What I have is.

ccgx.things

Bridge mqtt:broker:ccgxBroker [ host="local_ccgx_IP", secure=false ]

{

Thing topic venus {

Channels:

Type number : PV_battery_voltage "Battery Voltage" [ stateTopic="N/b827ebd3bbd6/system/0/Dc/Battery/Voltage", transformationPattern="JSONPATH:$.value" ]

}

}

ccgx.items

Number PV_battery_voltage "Battery Voltage" {channel="mqtt:topic:ccgxBroker:venus:PV_battery_voltage"}

ccgx.rules

rule "CCGX MQTT Keep Alive Timer"

when

Time cron "0/30 * * * * ?"

then

val actions = getActions("mqtt", "mqtt:broker:ccgxBroker")

actions.publishMQTT("R/b827ebd3bbd6/system/0/Serial", "")

end

sitemap

...
Frame label="ccgx" {

Text item=PV_battery_voltage label="Battery Voltage [%.2f V]"


PV_battery_voltage should be around 14.1 but it's allways empty.

0 Likes 0 ·
Show more comments
georgelza avatar image georgelza commented ·

How did this end for you, sounding very similar to what I'm doing.

My thinking was to use Node-Red to connect/subscibe to the mqtt broker on my VenusGX and to get the MQTT clients on on my sonoff devices to subscribe/publish to my mqtt running on my hass.io platform.

At the moment all I'm getting for the Venus is my serial number.

G

0 Likes 0 ·
Warwick Bruce Chapman avatar image Warwick Bruce Chapman commented ·

Hey Gerhard


Did you make progress with this? Were the Sonoff devices flashed with Tasmota?


Warwick

0 Likes 0 ·
Show more comments
5 Answers
mvader (Victron Energy) avatar image
mvader (Victron Energy) answered ·

Hi @WildSilo the address of the broker to which the services connect to is not available as a setting.


What you can so however is get root access and change the asdress in that python code.


Google for venus victron root access; and see our github and search for mqtt. And read the venus repo wiki.

If you need more help on that; there are some other people here that can help you with that.

2 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

mvader (Victron Energy) avatar image mvader (Victron Energy) ♦♦ commented ·

It can be quite a journey; be prepared for lots of reading and enjoy

0 Likes 0 ·
philippoo avatar image philippoo mvader (Victron Energy) ♦♦ commented ·

hi, i'm new to all this stuff, but can anybody please explain to me why it is that secret and that complicated to just use/enter another IP address of the mosquitto mqtt broker?!?

thank you very much!

0 Likes 0 ·
hobohome avatar image
hobohome answered ·

I have a very similar setup, but use OpenHAB instead of hass.io

OpenHAB allows connection to more than one broker - I have mosquito running on a RasbPi for general OpenHAB communication (to Sonoffs etc), and also a connection to the Venus MQTT broker to gather data for load management. I don’t know anything about hass.io, but I would suggest you check to see if a connection to two brokers is possible.

Just as a side point, be aware that the Venus broker responds with json coded data that can include the null value (not a legal value for json). This causes me quite a lot of grief.

1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

mvader (Victron Energy) avatar image mvader (Victron Energy) ♦♦ commented ·

Hi @Hobohome for the null value; thanks for reporting. The code that puts the data on mqtt is public: welcome to put in a pull request; thanks!

0 Likes 0 ·
wildsilo avatar image
wildsilo answered ·

Thank you for the feedback. I will explore multiple connections in hass.io ASAP.

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

georgelza avatar image
georgelza answered ·

... note to self... be ready once you get it flowing... created a 2nd node-red flow that just subscribed to the serial topic... and well it came gushing...

G

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

shalombi avatar image
shalombi answered ·

I've detailed how to do this in this post similarly to how @mvader (Victron Energy Staff) suggested.

https://community.victronenergy.com/answers/42997/view.html

1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

katia-khennoune avatar image katia-khennoune commented ·

@shalombi

Hello,

I would like to retrieve data from vrm portal, I followed all the steps you described in https://community.victronenergy.com/answers/42997/view.html and when I write the command mosquitto_sub -v -I myclient_ -c -t 'N /............/ system / 0 / Ac / Consumption / Total / Power' -h <broker_url> -u <email> -P <passwd> --cafile venus-ca. crt -p 8883

It sends me back: No such file or directory

Could you help me please?


0 Likes 0 ·