subby28 avatar image
subby28 asked

Home Assistant control of Relay 2


I currently have the Victron integration working perfectly in Home Assistant.

However i don't seem to have a control to toggle the Cerbo Relay 2 on and off to allow me to use in automations.

I found the following on another post, but i have no idea where to input this data into Home Assistant. Please forgive my ignorance, i've only really dabbled with the UI based parts of HA and not text based etc. Any advice for a novice would be much appreciated. Thanks.


Multiplus-IIcerbo gxRelayhome assistant
1680037798275.png (43.6 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.

1 Answer
matt1309 avatar image
matt1309 answered ·

Hi @Subby28,

I'm not familiar with home assistant (only openhab) but i can explain what the information above is trying to show you if that's helpful.

The integration above appears to be using Modbus TCP to connect to Victron system and is sending a 1 or 0 to the cerbo relay Modbus address to turn relay on/off.

It may be worth checking what your other Victron integrations are using ModbusTCP or MQTT as I think both will work and you may want to use all the same to be consistent within home assistant.

The Modbus information above is saying homeassistant is going to send a 1 or a 0 (on or off) message via ModbusTCP to address 807 on slave 100. You'll need to check the modbusTCP address is correct for what you want to control: (you want Modbus TCP registers)

Technical information - Victron Energy

I've had a quick look and it seems to be correct in the excel, you just need to make sure the UnitID is correct in VRM devices. I think that's what slave 100 is in the above example you've provided. The unique ID I'm unfamiliar with potentially arbitrary, I also cant see an IP address/Port input in the above snip you've provided.

A far more detailed explanation of Modbus can be found here: GX Modbus-TCP Manual [Victron Energy]

The above snip will make far more sense once you've read that.

If however you go the MQTT route, you'll need to send a 0 or 1 to the cerbo relay topic within the victron MQTT server. The MQTT topics are explained here:

GitHub - victronenergy/dbus-mqtt: Venus OS service mapping the D-Bus on Venus OS to MQTT

but essentially it's the same as DBUS path with a bit added at the front:

You can find DBUS paths here: dbus · victronenergy/venus Wiki · GitHub

MQTT Topic are in the form:

N/{ VRM ID}/{ dbus path} Use this topic for reading

W/{ VRM ID}/{ dbus path} Use this topic for writing

1 comment
2 |3000

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

subby28 avatar image subby28 commented ·
Thankyou for taking the time to reply. I had just about got my head around the Modbus side of things and made a modbus.yaml file with the switch i wanted in it, but it was just what i did next to use the switch in HA. i was just being stupid in the end, and it was in plain sight. I now have use of Relay 2 in HA to disable AC IN. I have an automation that disables AC IN during daytime hours when there is low solar, so if i charge EV, it doesnt drain battery.
0 Likes 0 ·