ee21 avatar image
ee21 asked

HOW TO: Bidirectional integration of VenusOS and Home Automation Controller, using MQTT

I have spent days upon days, pulling my hair out trying to figure out how to accomplish a method of integrating some platform that would allow me to setup triggers and such that would adjust the parameters of the VenusGX, or allow it to communicate status updates that would fire home automation triggers. Eventually, after a lot of trial and error, and many a late night staring at my computer screen to get this working, I got a working implementation which functions beautifully.. I do hope someone else will find this helpful.

*This guide will show screenshots, and discuss functionality that is from my own flavor of Home Automation Controller, for which I use HomeSeer 4, however should work in a very similar fashion with any other platform that has support or a plugin for MQTT; a quick Google search reveals Home Assistant and SmartThings appear to have support for MQTT as well*

I will begin this guide with a screenshot here which gives you an idea what you can accomplish:


Having access to this functionality opens up a world of possibilities inside a Home Automation Controller, henceforth referred to as an "HAC".

A few examples of what I have done with automations:

  • Visual queues when the grid has failed, Smart Light bulbs pulse yellow, followed by a spoken alert
  • Automated conservation of energy when the grid has failed, easily switch off smart appliances/plugs
  • Reconfigure ESS settings when the utility company issues a "Demand Response" energy event; instead of just saving energy, am now able to sell it when most profitable

What you need:

  1. A Venus OS product
  2. A HAC which supports MQTT
  3. A platform to run an instance of Node-Red (this can be a Rasberry Pi or literally any always-on machine running Linux, Windows or possibly MacOS)*
  4. Some intermediary/entry-level IT skills, or ability to very closely follow directions

Phase 1 (VenusOS):

  1. Assign a static IP to your device, either in the network settings of the device itself, or on your DHCP server. This is detailed in chapter 3.6 of the VenusGX manual.
  2. Enable MQTT. Settings -> Services, flip on both options which mention MQTT, most importantly the plaintext option
  3. ESS Mode does not need to be in External Control mode, leave set to Optimized or whatever it was normally
  4. Note your VRM portal ID for use later in this guide. Save it to a text file somewhere you can easily copy paste from. This is found in Settings -> VRM online portal
  5. Note your Multiplus instance ID. From the very top level menu, select your Multiplus in the devices list, and click right. Go alllll the way down, and click right on Device, and look for "VRM Instance ID"

Phase 2 (Node-Red):

*Alternatively, as suggested by Marcus, you can follow these instructions to install Node-Red on the VenusOS device itself, if your HAC does not support this:

  1. Select a machine that will always be on for this. I am running this on the same server as I run HomeSeer4 (My software based HAC) which isn't a problem.
  2. Install Node.js (prerequise for Node-Red)
  3. Using the Node.js command prompt (newly installed app from step 2), install Node-Red
  4. Unblock port 1880 and 1883 on the firewall of the machine running Node-Red
  5. Optional: Follow this guide here to make Node-Red start on boot, after downloading "nssm.exe":
  6. Start Node-Red, either by running the command "node-red" from the node.js command prompt, or using the service manager to start the service, if you followed step 5
  7. Assign a static IP on the server running Node-Red
  8. From a different computer, open a web browser and make sure you can get to "IPADDRESSYOUPICKED:1880" (without quotes), this should pull up the node-red GUI, if not make sure the process is running, and you unblocked 1880 on the firewall

Phase 3 (HAC):

1. Assign your HAC a static IP. I won't go into details here as there are too many variables.

2. If you are running your HAC as a software implementation on a Windows box, or other OS which has a software firewall, you will need to unblock port 1883

3. Install any required components to enable MQTT, in my implementation using HS4, I used the mcsMQTT plugin

4. Make sure the implementation of MQTT on your HAC is running a local broker, you may need to familiarize yourself with MQTT a little bit here, but this step is usually pretty easy, and think was configured as default in my instance

  • Typically you will be looking for setting like this: "MQTT Broker name or IP address", which in my instance, I just filled in with (local host IP address)

Phase 4 (Connecting VenusOS -> HAC):

Now it's time to set up your "flows", these are sort of like little customized data paths in Node-Red, which I will do my best to explain without making it sound too intimidating I hope.

Basically the idea is this, you connect a "receive node" to the VenusOS device, which then grabs that bit of data every time VenusOS updates the value. You then implement some intermediary "nodes" which convert that bit of data into a more usable format. The reason for this being, is that "bit of data" is really a packet which contains a few pieces of information, only 1 of which we really care about.

For example, the packet of data which contains my AC Input value (the number you see "Grid" listed as in the HUD of the VenusOS device) looks like this when it first comes in:

N/985dad8185e7/vebus/261/Ac/ActiveIn/P : msg.payload : Object

objectvalue: -3147

So we need to strip that away until a single string is left with a value "-3147"

The reason for this being that my HAC knows exactly what to do, "If AC_Input < 1000", but not so much if "AC_Input=objectvalue: -3147"

I will provide my exported flows in NodeRed so you can easily import and tweak them, but wanted to explain how it works so everyone can understand what is happening to the data.

Here are some screenshots for each phase from this flow, which I will try to explain as I go:


This one is fairly simple. The first node is the "MQTT in" node, which connects to the VenusGX, looks for a topic (I will provide a list of all topics toward the end), this topic is the "AC Input" value, as mentioned before, which is listed as "grid" in the HUD. It then stores the data in a parsed JSON object, this format breaks up the packet into different bits which can easily be grabbed.

To add your own VenusOS device here, all you need is to plug-in the IP address from Phase 1, by clicking the edit button


Next, we have a "change" node, which takes only msg.payload.value, and passes it on, if you recall here, the output from the first step looks like this:

N/985dad8185e7/vebus/261/Ac/ActiveIn/P : msg.payload : Object

objectvalue: -3147

So this node takes that whole packet, and only passes on what is to the right of "objectvalue:"


Finally, we have the MQTT out node. This takes the data we just stripped down, and sends to to my HAC, by publishing to a topic, Energy/Grid


That's it for this phase! We now have the data flowing to the HAC for Ac Input.

Phase 5 (HAC):

We now have data being sent to the HAC, but the HAC hasn't been told what to do with it yet. To get your HAC to process this data, we now need to "subscribe" to the topic. This will be very different for you, depending on your HAC and how it implements MQTT, but in general subscribing to a topic is one of the easiest functions and should be immediately obvious when you access the MQTT functions.

With my instance of MQTT, when you subscribe to a topic, a virtual device is created that allows you to fire a trigger, or just read the value. In my case, device #724 (seen in the very first screenshot at the top) was created, and I renamed and customized with some icons of my choosing, and then grouped it together with other such devices. This whole process again will vary greatly depending on your HAC. I can provide specific instructions for HomeSeer if anyone is interested however.

MQTT Topics (data channels):

I will cover the topics that the VenusOS MQTT broker publishes, and subscribes (listens) to. These can be used to read various bits of data, or write to them and thusly alter settings in VenusOS itself.

As far as connecting Node-Red to your HAC, you can pick and choose your own topics. I simply choose Energy/Grid in my example, because that seemed logical to me at the time.

  • Structure of the MQTT topic

Let's look at my example: N/985dad8185e7/vebus/261/Ac/ActiveIn/P

The first segment, "N" signifies a "get" or a "read" command, if you will. If you setup Node-Red with a "MQTT in" node to read data from VenusOS, you are always going to start your topic with this part. I don't know why the programmers chose this, but there you go.

To write a value, alternatively, you begin a topic with "W/" which makes a little more sense I suppose.

Next we have this big, ugly alphanumeric string. This is your VRM Portal ID, which if you followed Phase 1 Step 4, you will have ready to copy paste.

Following this, we have the first path to the data you are looking to read or write. I think most useful bits of data are located under the vebus path, but there may be some stuff in system or settings as well. I would recommend this app to fully explore your VenusOS device:

Going down the vebus path, you will next need to specify your vebus device ID, which you should have handy from Phase 1, step 5.

From there, there is lots of stuff to choose from depending on what you're looking for. I will outline a few key ones here that I use


N/985dad8185e7/vebus/261/Dc/0/Temperature - Multiplus Temperature

N/985dad8185e7/battery/258/Soc - Battery SOC*

N/985dad8185e7/vebus/261/Ac/ActiveIn/P - Reading on the AC Input side ("grid" value)

N/985dad8185e7/vebus/261/Ac/ActiveIn/Connected - Grid status, publishes a 0 or 1

N/985dad8185e7/pvinverter/21/Ac/Power - PV inverter power, "21" will be your inverter ID

*Not entirely sure how I obtained "258", I probably used MQTT explorer as linked above. It's definitely not the same as your vebus ID though.

*ESS Assistant Required* These can either be read, or written to with N or W

N/985dad8185e7/settings/0/Settings/CGwacs/MaxDischargePower - Self-explanatory, I hope


N/985dad8185e7/settings/0/Settings/CGwacs/AcPowerSetPoint - "Grid set point"

N/985dad8185e7/settings/0/Settings/CGwacs/BatteryLife/State - ESS Mode, 9=Stay Charged, 10=Optimized w/o battery life, and I think 11= Optimized w/battery life

*I will continue updating and adding to this guide, I am just burnt out from typing all this out so far for now. To be added still is how to now get your HAC to talk back to the VenusOS device.*

screenshot-1.png (38.6 KiB)
screenshot-3.png (10.1 KiB)
screenshot-2.png (7.7 KiB)
screenshot-4.png (7.5 KiB)
screenshot-5.png (8.9 KiB)
2 |3000

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

5 Answers
markus avatar image
markus answered ·


Thank you very much for your detailed How To. It's awesome.

Node Red is already available on GX Devices.

See here: Venus OS Large image: Signal K and Node-RED [Victron Energy]

Best Regards,


2 |3000

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

ee21 avatar image ee21 commented ·

Thank you! - And I'll update my how to, to reflect that, I figured the community would take what I had done and make some improvements! I'm running it on the same box as my HAC, so still have just two physical devices in play.

0 Likes 0 ·
markus avatar image markus ♦♦ ee21 commented ·

The advantage is, that you have a lot of Victron Nodes available for use on the large Venus image Version of NodeRED.

0 Likes 0 ·
Adam Sherman avatar image
Adam Sherman answered ·

This is excellent work and really exciting. I will be implementing it as soon as I get all the components together.

2 |3000

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

djbower1 avatar image
djbower1 answered ·

Hi @ee21

Thanks for the info. I am slowly getting there with my HS4 integration (very slow....)

I have managed to get HS4 pulling data via node-red from my cerbo and im sure at some point I had it writing aswel.

Could you share your HS flows and maybe you device status/controls?

Could you explain abit in further about how to set value like you have in your HS4 setup. Max Charge (800) for example



2 |3000

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

djbower1 avatar image
djbower1 answered ·

Think I got it working. I will post flows when finished

2 |3000

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

john245 avatar image john245 commented ·
@Djbower1 Are you willing to share your Node-RED flows?
0 Likes 0 ·
djbower1 avatar image djbower1 john245 commented ·

For now I have only attached one of my flows just for statuses, if you get this working ok I will battery overview, and my control one which does charge etc. Dont want to my waste time if you give it on it like I almost did ;)

inverter overview.txt

Here is the inverter status only values I pull from my quattro. your need to add your portal id to each mqtt in node and your HS3/4 IP address to broker in node-red and then if using mcsMQTT which I recommend just open the plugin, it should pick up the new devices as configured in the flow and once you press the checkbox under the "O" column on the plugin page the device will be create. Your then need to go create the status graphics to match what the value represent.


0 Likes 0 ·
djbower1 avatar image djbower1 djbower1 commented ·

Your also need to setup a keep alive topic otherwise one minute everything will work and then it wont!

Whilst setting up, Your can just have the VRM open in a browser window and make sure you view it minute or so to refresh the topics.

0 Likes 0 ·
john245 avatar image john245 djbower1 commented ·
Thanks a lot, have it working. Your help is much appreciated.
0 Likes 0 ·
djbower1 avatar image djbower1 john245 commented ·

Glad you've got it working. Would you like my flows for battery overview ( I have pylon, but you could adapt) and my inverter control flow?


0 Likes 0 ·
victroncontrols.png (189.2 KiB)
john245 avatar image john245 djbower1 commented ·
Yes, Please provide your flows. I have Pylontech US5000. Did set-up read out (no control).

Always good to have a look at other flows and see what can be done.

Relatively new to Victron (system now working for 6 days).

But using HomeSeer for 13 years.

0 Likes 0 ·
djbower1 avatar image djbower1 john245 commented ·

Well your starting with a good system! Pretty much everything you can think of can be read and controlled on the Victron via mqtt. I took me a couple of months before I attempted the HS4 integration though.




The battery overview is for pylon so should work for yours and also includes a calculated voltage differential which your will soon find out is very very important.

Let me know if I can help with anything else. I am no victron, node-red or hs4 guru, but I will help if I can. Just bear with me as I am not the fastest at replying.

Cheer, Dan

0 Likes 0 ·
john245 avatar image
john245 answered ·

I started the integration with Modbus TCP as I'm highly skilled in this. However the advantages of the MQTT integration is that it is a push concept and no data manipulation is required.

I'm not in a rush to finish the integration. But it should be finished at the end of this year.

Thanks again for all your valuable information.

I'm curious if you are also writing the values of some attributes to a Database (such as InfluxDb). In that case which attributes are you writing to your Database?

2 |3000

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

djbower1 avatar image djbower1 commented ·

Only ever dabbled in Modbus in the past, so if U get stuck in the future I know know to ask ;)

I have not yet got any values writing to any external database but it is on my todo list. This is one downside with HS4 and its logging / charting abilities.

My aim is to go down the Grafana and Influx route for both Victron and HS4 as it will provide complete offline VRM style user interfaces etc.

Check this out

0 Likes 0 ·
john245 avatar image john245 djbower1 commented ·
Looks great.

You can configure in mcsMQTT to write to a InfluxDB database.

Or are you planning to install the container? I think it depends on your other requirements. Currently my amount of dashboards is limited and most of them were just created by other and slightly tweaked by me.

In my case I have HomSeer, InfluxDB and Grafana running on VM's.

0 Likes 0 ·
djbower1 avatar image djbower1 john245 commented ·

I noticed that with mcsMQTT and that was my plan. Is that how you use it with InfluxDB and Grafana?

It sounds like great minds think alike ;)

Currently I run my HS4 system on a old i5 (Good quality board PSU Etc) that has never gone down since being built. I have a Dell T340 sitting under the dining table waiting for promox so I can migrate some of my older system over and consolidate. Just another one of those projects ill get round to at some point.

0 Likes 0 ·
john245 avatar image john245 djbower1 commented ·

Yes, that is exactly how I use it.

Decided today to go for an external broker and installed Mosquitto.

Here running Promox 8 on 3 Nodes. The main machine is a 32 x Intel(R) Xeon(R) Silver 4314 CPU @ 2.40GHz (1 Socket).

0 Likes 0 ·
djbower1 avatar image djbower1 john245 commented ·
Very cool, Sound abit more complicated than I plan :)
0 Likes 0 ·
john245 avatar image john245 djbower1 commented ·
Do you have screenshots of how you did set-up the control in mcsMQTT. For e.g. for the "Display auto off" In my case the HS device is not updated and I will get a paring error for the MWTT Node,
0 Likes 0 ·
djbower1 avatar image djbower1 john245 commented ·

Not 100% sure what your mean

Do you mean the HS4 status setup?


0 Likes 0 ·
djbower1 avatar image djbower1 djbower1 commented ·
If you used my flow (within reason) then and set HS status and control as above, then all should would as it should. Have you got the keep alive setup yet?
0 Likes 0 ·
djbower1 avatar image djbower1 djbower1 commented ·
0 Likes 0 ·
keepalive.txt (4.4 KiB)
john245 avatar image john245 djbower1 commented ·

Keep alive is set. I will get a parsing error. So I assume the issue is in the mcsMQTT part. What is all your info in this screen?


0 Likes 0 ·
1696362209708.png (80.7 KiB)
djbower1 avatar image djbower1 john245 commented ·

Sounds like it could be a nodered issue maybe....?


0 Likes 0 ·
mqtt.pdf (115.4 KiB)
john245 avatar image john245 djbower1 commented ·

Thanks a lot. For some reason there was a payload template in my MQTT part. After removing this it is working as expected. So I also have to remove it for my other devices.

0 Likes 0 ·
djbower1 avatar image djbower1 john245 commented ·

Phew, Glad you've got it sorted. You started making me have doubts about Homeseer. I've been nearly jumped ship just before HS4 came out as everyone was going to HA but HS4 events engine kept me loyal ;) Confidence restored!

0 Likes 0 ·
john245 avatar image john245 djbower1 commented ·

To be honest I also was thinking to have a look at HA. But the difference is that HomeSeer is a product and HA a project. A project with a lot of maintenance and breaking changes. And I like the improvements HomeSeer is making. I don't need a new version every month. Still running

Did this weekend an update of Node-RED to 3.1 and that forced me also to update the Modbus Node. Good to have a test Plan for all critical items.

0 Likes 0 ·
djbower1 avatar image djbower1 john245 commented ·
That seems to be the thing with Homeseer, you can forgot about checking for updates and patching for 6 months + without worrying and it will still be chugging along happily using its little resources until windows decides to override your registry hack and reboot your computer for a windows update :)
0 Likes 0 ·
Show more comments