A little tutorial on how to connect and receive data from the cloud MQTT server into node-red.
This involves 2 steps:
- Subscribe to a topic to the right mqtt server. (you will need to calculate the address of your system - see below for details)
- Schedule a node to send a "keepalive" message every 50 second to keep receiving data
Subscribe to a topic
1. Use the "mqtt in" node and double click to configure.
2. Configure the topic you want to subscribe to. The example above will subscribe to the power out status. (other example topic: N/<yourVRMportalD>/system/0/Dc/Battery/Soc for battery status.)
Your VRM portal ID can be found on either:
- The console under settings/VRM Online Portal
- The web application under settings/general
3. Configure the output to be a string
4. Give the node a name
5.Configure the server: choose "Add new mqtt-broker" from the server drop down.
6. Click the pencil to edit.
7. Fill in your mqtt server address. You need to calculate this address from your Victron installation ID. Yours will probably be different from the screenshot below.
(more details on how you calculate the address can be found here: https://community.victronenergy.com/questions/155407/mqtt-local-via-mqtt-broker.html under the section "Cloud MQTT broker")
8. Click on the pencil next to "TLS configuration"
9. Upload the "venus-ca.crt" file which you can find on github: https://github.com/victronenergy/dbus-mqtt
Send a "keepalive" message to receive data
This is important to keep receiving data. Without this step your value's won't keep receiving!
1. Use an inject-node and schedule it to run every 50 second.
2. Fill in the topic with "R/<yourVRMportalID>/keepalive" and leave the msg.payload blank.
3. Use a "mqtt out" node like this:
You should now start receiving messages: