question

ijeamaka-omayeka avatar image
ijeamaka-omayeka asked

Victron integration with home assistant using Modbus TCP

I'm currently trying to integrate my victron setup into home assistant, but when I turn on the Modbus on my CCGX I keep getting the message:

ERROR "Error processing function code 3, unit id 126, start address 40000, quantity 2, src 192.168.1.116: Modbus address 40000 is not registered"

My setup is a MG50 with fronius 8kw, victron mppt 250/100, 10kva Quattro, 13.8kwh BYD LiFePO4 battery, CCGX with firmware version v2.73.

Please any idea on how to resolve this?

Modbus TCP
2 |3000

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

3 Answers
shaneyake avatar image
shaneyake answered ·

Can you post what registers you are trying to read into Home Assistant?


40000 register is also not valid. Last Victron register is currently 3826.
Some modbus TCP clients will send the function code as the 4 and the registers afterwards as 0000 but there is no register 0 on a GX, starts at 3.

Likely the unit id is also incorrect. In the modbus TCP menu, services will show you the correct id for the diffrent Victron Components.

3 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.

ijeamaka-omayeka avatar image ijeamaka-omayeka commented ·

Thanks for the response.

IDs:

BMV: 225

PV inverter: 20

MPPT: 247

Quattro: 246

System: 100

Registers:

System:

817, 823, 808, 840, 814, 842, 850

BMV:

226, 303

MPPT:

776, 777, 789, 791, 784, 785, 786, 787

PV inverter:

1027, 1028, 1029, 1046, 1052

I was already seeing the error message even before inputting the Modbus configuration in home assistant.

0 Likes 0 ·
shaneyake avatar image shaneyake ijeamaka-omayeka commented ·

That looks all correct to me.

You can clear the error and try find out what on 192.168.1.116 to trying to access Modbus.

Does your HA integration work? If that IP is for your HA setup, then possible something misconfigured.

0 Likes 0 ·
ijeamaka-omayeka avatar image ijeamaka-omayeka shaneyake commented ·
That's the IP for my CCGX
0 Likes 0 ·
xtopher avatar image
xtopher answered ·

Sorry to resurrect an old thread, but has anyone seen an issue with register 789 - 'PV power'. I've seen that it reports properly a lot of the time but I've just seen it go a bit haywire and report negative completely unrealistic numbers, then after an amount of time goes back to normal? It made my HA dashboard go nuts as it couldnt balance the readings so was reading zero for PV Power when it was actually it was at multiple KW output


Here is an example in HA:1661339818812.png


And history graph:

1661339900918.png


Actually managed to get them together using remote console:


1661340171650.png


Any ideas why its going negative?

This is with a MTTP RS 450/100, Multiplus II and Cerbo GX (f/w: 2.89)


1661339818812.png (47.7 KiB)
1661339900918.png (80.0 KiB)
1661340171650.png (207.0 KiB)
7 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.

marcus-spranger avatar image marcus-spranger commented ·
Looking at your graph it looks as if the sign bit is flipped sometimes? Maybe an issue with the connection? Just guessing of course.
0 Likes 0 ·
xtopher avatar image xtopher commented ·

For completeness on my issue, it was when both MPPT were totalling over 3kW I would get this issue. It was down to register 789 (PV power) and changing to register 850 (PV - DC-coupled power fixed it). There was a comment in the example HA code that I had to say that 789 "not available if multiple VE.Can chargers are combined" which I am now guessing a MTTP RS 450/100 having 2 MPPT is the case. Like you say it looks like something is flipping over a certain number. It does say the register will hold to 6553.5w, and our array is a 6.6kW array but I've never seen it hit that. 850 can hold to 65535 so should never run out of space. Odd that it gave readings to a point but all fixed from my perspective by going to 850.

0 Likes 0 ·
marcus-spranger avatar image marcus-spranger xtopher commented ·

Ah yes that makes sense: The returned value from register 789 is a 16bit unsigned integer, with a scale factor of 10, which means that the value range that can be represented is 0 - 6553.5W. But it seems that Home Assistant interprets it as a signed integer, so the value range that can be represented is -3276.8 - 3276.7W. I.e. if it goes over 3276.7W, then it becomes a negative number.

Register 850 has a scale factor of 1, which means that it can store values 0 - 65535W or -32768 - 32767W if it's interpreted as a signed integer.

1 Like 1 ·
xtopher avatar image xtopher marcus-spranger commented ·

Ah of course, looks like I should be setting the datatype, default being int16. I'd just left it as the example I got online for Victron/HA and not really read into the types at all as it just 'worked'.


1667385721042.png


Better go check my config for all the others now!

0 Likes 0 ·
1667385721042.png (82.4 KiB)
marcus-spranger avatar image marcus-spranger xtopher commented ·

Both registers 789 and 850 have datatype "uint16".

Here you can get a download link to a spreadsheet with all available registers (Modbus-TCP register list):
https://www.victronenergy.com/support-and-downloads/technical-information

Each register in the list has also its data type specified.

1 Like 1 ·
Show more comments
marcus-spranger avatar image
marcus-spranger answered ·

Hi,

I just wanted to get back to you, since I am seeing the same problem as you - see:
https://community.victronenergy.com/questions/129522/enabling-modbus-tcp-in-cerbo-gx-triggers-error-due.html

I have not been able to locate the source of these Modbus requests. Today I spent some time disconnecting all devices from the (W)LAN, but the requests continued to arrive once per minute.

I also disconnected the Internet to check whether there may be some requests coming from the WAN, but that didn't make a difference either.

So the only possible sources in our system, that are still left are either:

  • the WiFi router (Huawei HG659)
  • some device that talks to the CerboGX via some other way than (W)LAN and somehow appears as Modbus TCP requests - which sounds rather unlikely especially considering that unit ID 126 doesn't exist in Victron land
  • a bug or some process running on the CerboGX itself that creates those spurious requests

Did you figure out what the source was of these register read requests?

Cheers,
Marcus

2 |3000

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

Related Resources