question

woogieboogie avatar image
woogieboogie asked

How does the VRM Remote Console avoid no-data due to VRM keep-alive strategy?

I have a simple Python script that subscribes to the VRM SoC value. The problem is that it often doesn't get a value, it just waits, due, I think, to the keep-alive strategy of the VRM MQTT broker.

Running the VRM remote console on another device always kicks it into life and a value is retrieved. And of course the Remote console manages to retrieve values all the time.

So what is the remote console doing that kicks the MQTT broker into life? Whatever it is, I want to replicate that function in my code to always retrieve a value, not just when something changes.

remote console
2 |3000

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

2 Answers
Teun Lassche avatar image
Teun Lassche answered ·

I think it’s not the remote console that does this, but the VRM dashboard. VRM sends keepalives for the installation you are currently looking at in order to show real-time data.

See https://github.com/victronenergy/dbus-mqtt#keep-alive for details

3 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.

woogieboogie avatar image woogieboogie commented ·

Hi - thanks for the reply.
I've read that section on keepalives before but it's unclear to me how to do it from Python.

I'm using the PAHO library and can "subscribe" and "publish" data points but your help section talks about using Mosquito (which I think is depreciated?) and also talks about "Read" and "Write" requests. I

can't see a way to issue a regular "Read" requests on that suggested point using PAHO? I can only see how to subscribe to changes, which is slightly different and doesn't keep the Keep-Alive alive.

So I'm still stuck I'm afraid.

0 Likes 0 ·
woogieboogie avatar image woogieboogie commented ·

Hi @Teun Lassche (Victron Energy Staff), thanks for your reply. I had read that section on keep-alives but my application won't have local access to my Venus to keep my local broker alive. I need to keep my local broker "alive" from over the internet, like the VRM does. But I can't figure out how the VRM manages it? Can you help? I'm at a brick-wall otherwise..

Thanks,
Cliff Hewett

0 Likes 0 ·
mkh avatar image mkh woogieboogie commented ·

When you open VRM dashboard, it publish periodically MQTT message (keep alive packet) to your Venus/Cerbo/... as long as web page is open.

You can connect your MQTT client to Victron MQTT broker and publish periodically empty paylod to the topic "R/yourVRMID/system/0/Serial". This is keep alive packet and this wake up and keep data transfer active from device to Victron MQTT broker.

If you have your own MQTT broker, you can set up bridge between your and Victron MQTT broker. Then you can send same empty payload to same topic "R/yourVRMID/system/0/Serial" to your broker and it will be redirected to your device via Victron broker. This is usefull in case, when application can connect only to one broker and use it for another data.

Search here in the forum for "MQTT" and you can find instructions how to find correct Victron public MQTT broker, how to send keep alive packet or how to configure MQTT bridge.

0 Likes 0 ·
Teun Lassche avatar image
Teun Lassche answered ·

Hi @WoogieBoogie,


The keep alive concept is exactly the same for the local broker and the cloud broker, the only difference is the broker you connect to and the credentials you need to use. To connect to the victron cloud broker, see this section: https://github.com/victronenergy/dbus-mqtt#determining-the-broker-url-for-a-given-installation and https://github.com/victronenergy/dbus-mqtt#connecting-to-the-victron-mqtt-server

The credentials are simply your VRM credentials

2 |3000

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

Related Resources

Additional resources still need to be added for this topic