Getting data from inverters via an RS485 connection

Here

OK. That must be a different doc than the one in Craig’s post. (the one I’ve been looking at)
Looks like you’ve got the right one, since it agrees with what you’re seeing from your inverter.

What data do you get when you try read the line frequency?

So it seems like the python doesn’t simply need the extra 3 in front as that doesn’t seem to match the doc:
i.e. Realtime_ACW = instrument.read_long(33004, functioncode=4, signed=False) #Read AC Watts as Unsigned 32-Bit


Which is the line frequency?

Not quite sure what you mean there, as the doc shows a 5 digit address.

The doc that I have says 3043 is the line freq register. You’d have to look at the doc you have.
If you could, attach it to a post and I’ll have a look at it.

Good news is that the pi rs485 hat is also getting back data via python code once adding the 3 in front but need to find the correct values
The problem is I would have no clue how to convert them as in the python code:

A1 = Realtime_ACW % 256
	A2 = (Realtime_ACW >> 8) % 256
	A3 = (Realtime_ACW >> 16) % 256
	A4 = (Realtime_ACW >> 24) % 256

Thanks for posting that. Helps a lot.

It says register 33094 holds the grid frequency value.


Registers 33257, 259, 261 and 263 hold the active power values. To convert them to kW,
simply divide by 1000. They are Signed 32-bit values vice the Unsigned 16-bit values
we dealt with earlier.

Value is 327876611 via instrument.read_long(33094, functioncode=4, signed=False) from python but I assume that value needs converting

It’s signed, so that parameter needs to be set to True.

327614467 with it as signed=True

OK. Hopefully, this will point you in the right direction:

Thanks, will check it out.
It’s just strange that the read register doesn’t work instrument.read_register(33094, functioncode=4, signed=True)

You’re referring to minimalmodbus, correct?

Yes API for MinimalModbus — MinimalModbus 2.0.1 documentation

That’s because read_register handles 16-bit values. Viz:

Yeah but also tried 33035 which is a U16 and still didn’t work whereas read_long did return a vlaue

What results did you get when you tried to read register 33035 with read_register?

Nothing goes into an exception

I’m thinking we still don’t have the addressing quite right yet.
The line freq value is a 16-bit number, which means there should be no problems reading it
with the read_register function.