A little tutorial to connect to either the MQTT broker in the cloud (accessible from anywhere) or your local MQTT broker on the system itself via local LAN with MQTT Explorer.
Local
The system has a build in MQTT broker to which you can connect. In the console you will need to enable this MQTT broker to publish on local LAN.
Next find out the local IP address your system is using. You should find this under settings/Ethernet in the console.
Configure MQTT Explorer:
There is no certificate required, no username, no password.
You should see something like this:
Cloud MQTT broker
Your system publishes data to the cloud, which in turn is used for your web and mobile app.
There are several MQTT cloud brokers. There are maximum 128 systems connected to a cloud broker. The DNS address of the cloud broker will be something like: mqtt86.victronenergy.com
But how do you find out the broker you should use for your installation?
This can be calculated based on the portal ID you have.
Your portal ID can be found on either:
- The console under settings/VRM Online Portal
- The web application under settings/general
You can use this little python program to find your cloud broker DNS name: (replace the VRM_portal_ID with your ID) (it uses the ASCII code of each character, adds them together and divides by 128)
This should return something like the above example.
VRM_portal_ID = "d41243b50dfc" def _get_vrm_broker_url(_system_id): sum = 0 for character in _system_id.lower().strip(): sum += ord(character) broker_index = sum % 128 return "mqtt{}.victronenergy.com".format(broker_index) print(_get_vrm_broker_url(VRM_portal_ID))
Now you know the MQTT broker address you can configure the MQTT Explorer.
You will need the following:
- Username & password of your web portal
- a certificate
You will need to add a valid certificate which you can find on this GitHub repository: https://github.com/victronenergy/dbus-mqtt
You can simply download the ZIP and extract the file:
Under the advanced section click on certificates
Add the certificate to the SERVER CERTIFICATE (CA) by clicking on the button.
Now connect and you should see the following:
Keep the connection alive: get the full content
It seems that you have to publish a "keepalive" message to the MQTT server every 55 seconds to keep on getting more information than just the system/serial information. If not it will stop receiving the full data.
Hope this helps.