Victron connection from Home-Assistant using ModBus

Good day,

I am hoping that someone can point me in the correct direction here, since a couple of hours of googling and experimenting has not gotten me any closer to resolve this issue:

Versions

HA Version: 2023.11.2
Node-Red: v3.1.0

Working

I have a Node-Red installation working on my Victron GX.

Issue

I am now trying to setup the same config on my Home-Assistant running on a VM.

The Victron nodes do not find the ModBus for some reason.

LOGS

HA Node Red
Error connecting to dbus: Error: connect ENOENT /var/run/dbus/system_bus_socket

What I have checked so far:

I have the ModBus enabled on the Victron and set to TCP.

I can telnet to the IP and port and it connects.

According to the installation instructions for the Victron pallete (@victronenergy/node-red-contrib-victron)
Installation instructions
There is a com.victronenergy.settings settings that needs to be set. I have no idea how to do this, since there is no clear instruction how to do that. I am not sure if this is the cause of the services not working remotely, because it is working locally on the Victron.
There is not dbus command on the Home Assistant, so I assume this needs to be done on the Victron:
dbus -y com.victronenergy.settings /Settings/Services/InsecureDbusOverTcp SetValue 1

It states that there is an old way to do this by editing the /etc/dbus/system.conf file that does exist on the HA, but they refer you to the new location for this file:
/usr/share/dbus-1/system.conf.
I have tried to set the tcp:host entry from the instructions, on the HA, but this also has not worked.

Next there are exports that refer to an IP that is not defined anywhere else in the document.
export NODE_RED_DBUS_ADDRESS=192.168.1.1:78
I am assuming this is referring to the Victron's IP. So, testing with telnet if I can connect to my Victron's IP on TCP port 78, I get a "Connection refused". So that server/Port is not available.
(This is on the same LAN as the HA and there is no firewall locally.)

Any help would be appreciated.

EDIT 1:
I have found a document that shows how to enable the SSH on the Victron side and I was able to get into it. I was able to run the dbus command end reboot it.

That didn't help.

I then removed the config from the system.conf (that was for the old method) and restarted HA again.

That didn't help.

My modbus.yaml file:

name: victron
type: tcp
host: 192.168.x.y
port: 502

IP masked
I can telnet to the IP and port 502 and get a connection.

EDIT 2:
I can now connect to the port 78 on the Victron. So the next step is to set export NODE_RED_DBUS_ADDRESS=192.168.x.y:78 only i can't find relevant documentation for the VM version of HA.
The documentation for setting up NODE-RED just states that you can set this up, but it doesn't state where to do it.
HA documentation shows that you can't do this through the YAML files.

  • I found a file /etc/profile.d/homeassistant.sh that already contained two other exports. I added the export just above the home assistant startup. But it seems that file get re-created. So my change was lost.
  • I then tried to add my own script to /etc/profile.d and this also got removed on reboot.
  • Then I added it to ~/.bash_profile, This one persisted a reboot, but the Node Red still doesn't pick up the Victron.

After each change I rebooted the VM, not just restart the HS to force the scripts to be executed.

Still not working.

I still have not been able to get the node to show the drop downs on Home Assistant OS (HAOS).

I have been able to confirm that the TCP modbus connection is working with this command from the Home Assistant command line:

dbus-monitor --address tcp:host=192.168.1.123,port=78

I just don't know how to get this NodeRed Nodes to connect to this connection.
Node Red coninues to fail to connect to the dbus socket.

Error connecting to dbus: Error: connect ENOENT /var/run/dbus/system_bus_socket

I have used the User Settings to set the environment variable to the correct IP and port, but it still tries the socket.

I have also not found any post anywhere where someone has set this up with HAOS.

Hi @LeonVanHeerden

You will need to seek guidance of the HA community.
barely anyone here uses Home Assistant, and instead use Node RED in its native form

Good day,
Thank you for the feedback.
Will try there.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.