question

Jimmy Bergetun avatar image
Jimmy Bergetun asked

Modbus device ID for relay 1 and 2 on Cerbo

screenshot-2021-01-27-at-180710.pngI am trying to controll relay 1 and 2 from Home assistant with Modbus . In the Victron modbus tcp register it says com.victronenergy.system (Should be Device/slave id 100?) with address 806 and 807. In Home assistant i have added the following for this "switch"


switch:
  - platform: modbus
    coils:
    - name: "Victron relay 2"
      hub: victron
      slave: 100
      coil: 807

(All "Sensors" from victron works fine)


Anyone here been able to controll the relays on a Cerbo from HA ? Is the Slave ID and Address correct?


cerbo gxModbus TCPhome assistant
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
wkirby avatar image
wkirby answered ·

You are writing to a coil. There no available coils to read or write (eg. Function code 1 or 5), only holding registers to read or write (eg. Function code 3 or 6 (single register)).
You need to write to a holding register.
If you just want to control the relay 2 with a request, then write 807 to holding register using Function code 6 (write single holding register). Unit ID 100 is correct also.

4 comments
2 |3000

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

Jimmy Bergetun avatar image Jimmy Bergetun commented ·

Thank you !! :)

0 Likes 0 ·
Juha Tuomala avatar image Juha Tuomala commented ·

I define the actual devices that I have as below:

- name: "Generator start"
  slave: 100
  address: 806
  command_on: 1
  command_off: 0

- name: XXXXXXXX
  slave: 100
  address: 807
  unique_id: 12435566778
  command_on: 1
  command_off: 0
  verify:
    input_type: holding
    address: 807
    state_on: 1
    state_off: 0


and when creating automations, I pick them for Action from Call Service as Switch:toggle XXXXXXXX on. It's much easier when modbus stuff is abstracted in server configuration.

Not yet sure will it switch it off once Conditions are not met (time) anymore.


0 Likes 0 ·
Show more comments