diy solar

diy solar

Solis/ Ginlong Modbus Comms

Jimmyburnworld

New Member
Joined
Aug 2, 2022
Messages
13
Does anyone have any experience with the Modbus RTU comms protocol on Solis inverters?

I have an RHI-5K-48ES-5G inverter and I would like to get data out of the 'COM' connector on the bottom of the inverter. My intention is to use an ESP8266 to poll the inverter for data, then serve it up on MQTT for Home Assistant.

The theory being that the Wifi adaptor available for the Solis products is a Modbus master which polls the inverter for data and then sends it to the cloud.

I've had a response from Solis technical support with a datasheet detailing the communications protocol, register addresses etc. I've found a blog where someone has done a similar interface using Python:


Try as I may, I cannot get the data out of the inverter. I've spent a fair bit of time trying to get a basic read working just using my PC and an RS485 serial converter, and I'm at the stage where I get a steady 'Illegal Address Error'.

1: Windows 10 laptop with USB-RS485 serial adaptor - actually have two
2: 2 core screened cable from RS485 adaptor to pins 3 (A) and 4 (B) on the COM connector on the inverter
3: Modbus Poll from https://www.modbustools.com/
4: Serial comms setup as: RTU, 9600bps, 8 data bits, 1 stop bit, None parity
5: Inverter address changed from 1 to 2, Modbus poll slave address pointing at 2

I've tried various 0x04 'Read Input Registers' requests. I even found an exciting lead that some Modbus devices will only respond to block requests where data is arranged in a chunk ie: Date:Time registers 3022-3027, however whether I read a single or multiple registers I get the same error code 02 'Illegal Address Error'

If I change any of the wiring, or if I change any of the serial comms settings I just get a timeout. If I change the slave address on the inverter back to 1 I get timeouts, back to 2, the error returns so I know the comms is active.

I used the code from the blog post to work up a Python script and this comes back with the same 'Illegal Address Error'.

If I didn't know better, its like there's a flag that the inverter needs to see set to allow it to communicate. Is it possible that the Wifi adaptor sets a flag in the inverter that allows communications?

Any input gratefully received.
 
Success!
I was messing around with a theory that the register address might be byte swapped for some unknown reason and noticed that when I ended up with hex values that translated into unfeasibly large decimal values, I suddenly got data back:

eg: register 3000
Little Endian hex value: B8 0B
Decimal equivalent: 47115

I've just got back from work and was trying a new Modbus polling program where you can type the register address in and it updates as your typing. I accidentally ended up typing 33000 and suddenly got data back. Lo and behold a 3 register call for 33025-33027 returned a live hh:mm:ss from the inverter!

So, where the official Solis documentation states:
"The address in the table below is the same as the
address in the actual information frame. No further offset or other conversion is required."

And then goes on to list Modbus register addresses as 33000, 33025 etc. it means it. Just because it's in the 3xxxx range normally truncated to xxxx for 0x04 type calls, you still have to call the whole register address.

Now, to implement in an ESP8266 and then off to MQTT land for Home Assistant integration!
 
I have a pre-built image already working with Dashboard for these with a Raspberry pi
@shavermcspud apologies if you've already posted it elsehwere, but please could you link me to where the details are?

Also, Ive seen other folk reference a Docker image, and there's a ton of stuff on github.

What are folk currently using for extracting and controlling modbus. Ideally that keeps SOliscloud working ? (ive got at least one spare data logger, ESP32 and Rasbpi etc)
 
What are folk currently using for extracting and controlling modbus.
Also check out @peufeu's modbus RPi python code for the Solis - see below for the link and I guess that whole thread may be of interest to you..

 
@shavermcspud apologies if you've already posted it elsehwere, but please could you link me to where the details are?

Also, Ive seen other folk reference a Docker image, and there's a ton of stuff on github.

What are folk currently using for extracting and controlling modbus. Ideally that keeps SOliscloud working ? (ive got at least one spare data logger, ESP32 and Rasbpi etc)
Under my resources section youll see the downloads. You cant reliably have the crappy solis cloud/ data logger and local Modbus working at the same time
 
I'm using two Waveshare RS485/MODBUS to Ethernet adaptors. One connects my inverter to my LAN, the other connects the datalogger to the LAN. That allows me to send MODBUS commands from any computer on my home network while still keeping the Soliscloud working.

There is another method that uses a unit with two RS485 connections and Wifi that does the same sort of thing.

For software I roll my own. I have a mic of C and Python routines that set and read registers as needed. Just plain CLI at the moment, but I will work on that.
 
Back
Top