I am in the process of connecting to a Solis Inverter (SOL-3.0K-RAI-48ES-5G-AC) using modbus. I have managed to integrate with a few other devices for reading energy e.g. Single phase meters and other inverters, so little experience but I am having issues with the Solis.
The issue is that when reading other registries I am getting data back which I am not expecting. As seen below.
Both of the charge and discharge rates should be 50A and the hours and mins should just be integers between 0 and 60.
I have played with the data_type and also the count but they are listed as the same format within the modbus manual as registries I am reading correctly as above, (U16 or count:1)
With reviewing the Modbus manual from Solis it seems that the function code for the selection of requesters which is not working is 06H (6) not the same as the ones which work 04H (4)
So the question is, is there a way I can force the function code so I can test to see if this helps with reading the required registries.
Hope thatâs understandable and thanks in advance.
EDIT: After talking with the manufacture they confirm that we need to be using function 6. However when reviewing the HA Modbus specification at Modbus - Home Assistant (home-assistant.io) it says that by default its using 6 for a single value and not 4! So I am not sure whatâs happening and why I am getting any reading at the moment. Any insight from anyone would be appreciated!
Did you ever figure out the reason for the above and a fix? Maybe try reading the register without HA, with a laptop etc
Function 6 doesnât make sense because thatâs for writing a register
@sd_dracula/@boydo , not sure if this might be helpful, I have some python reading the modbus registers, largely thanks to a thread you and some others have that Iâve been following over on the OpenEnergyMonitor community
Itâs very much a work in progress but hereâs what I have so far: solis_5g_modbus.py ¡ GitHub
My ultimate goal is to get this ported onto an esp8266 or similar that can replace the board inside the data logger to feed into HA without having to have cables running between the inverter and my HA setup. Will try and share to one of the threads on here as I make progress.
Thatâs helpful thanks.
I can read the values just fine via python from my laptop using an RS485 to usb adapter or with a pi zero, but when I plugged in the same USB adapter into the rpi4 thatâs running my HA instance it doesnât work.
Itâs showing up as dev/ttyUSB0 in the device list and I tried your config.yaml from above but it just makes HA super slow to boot and it never gets any values for those registers, not sure why. Do I need to install any additional libraries?
In the logs it just says it expected 2 bytes but got back nothing (no activity on the usb adapter either)
Once I get the script to pull all the data I need might look at a TCP modbus adapter
By the way the new 340022 FW for the inverter can now set multiple charging schedules not just one.
Let me know if you get the writing of the registers to work
Basically I had to change the register_type from âholdingâ to âinputâ to get the correct function code which in the case of Solis and the 33k range was function code 4 or 0x4.
Or in the example below changing it to âholdingâ gives function code 3 e.g. â0x1 0x3 0xa8 0x85 0x0 0x1 0xb5 0x83â
- name: Solis Time Chargeing Charge Current #U16
hub: Hub1
unit_of_measurement: A
register: 43141
register_type: holding
count: 1
slave: 1
precision: 1
data_type: float
scale: 0.1
So at the moment I can read all the registries and pull all the data documented in the modbus manual. I can also update any single registers. e.g. min state of charge. So I can force it to charge but only up to 40% for some reason!
According to the manufacture you are meant to use the âTime-chargingâ discharge and charge times and rates to be able to force the inverter to charge and discharge at any time or rate.
Using write_register service I can set all of these registers individually but the inverter dose not respond to any changes! I have been advised to test writing multiple registers at once using function code 10, as per your manual snippet, to update the âTime-chargingâ registers as a group. But as far as I can see HA can only write using function code 6 for single registers or 16 for multiple.
So this is what I am working on at the moment and I am going to try node red and see if that works!
If anyone has success in forcing the inverter to charge over 40% or to discharge please let me know.
Did you try a stand alone modbus app for writing the registers and does that work? If yes then HA is the issue
Also which USB adapter are you using to connect to your HA server? I have tried this one which works ok on my laptop/pi zero but nothing when connected to the pi4 with HA OS on it
@sd_dracula RE reading via HA I am sure I had a similar issue at one point just cant remember how I solved it. I would post all my config now but all the code is with a client (yes I know I should have back it up) will post it once I have it back.
Think I would check that you have the setup of the modbus right, something like
modbus:
- name: Hub1
type: serial
method: rtu
port: /dev/ttyUSB0
baudrate: 9600
stopbits: 1
bytesize: 8
parity: N
Yes thatâs what I had for sure and ttyUSB0 was my adapter also.
Could be that the actual sensors were not set up right (didnât quite match the HA modbus examples) so maybe share some of them once you have them so I can compare
I had a similar issue with the stick Iâm using, it works fine with a Mac or my Pi3 but wonât work with my synology NAS where I have HA running, I havenât managed to get to the bottom of the issue annoyingly.
Iâll have to give this a go, multiple slots could be useful.
I think I have charge working, it didnât seem to discharge to the grid though, I just tried again and it discharged to the grid, I think the inverter mightâve already been maxing out with solar earlier. For charge I set the times and set the storage control register:
In terms of writing to the USB port - make sure that the user that is running HA has permissions on the created USB port - usually the easiest way is to add them to the Dialout group (i think thats the one) as it is given write access to the ports on Linux
In terms of the SYnology NAS - i assume you are running this in the Synology version of Docker ? You would have to do some messing around with the bridge network under Docker to give access to the USB port i believe.
Mark the above code was that from an automation? how are you running that code, is it from HA?
update: sorry just realized that you where using python to run that. I am not 100% on how you run that. I did see that you can run python scripts as services is that what you did? If not is it possible to run yours as a service as per following link? Python Scripts - Home Assistant (home-assistant.io)