tobiasfaust / SolaxModbusGateway

Modbus RTU to MQTT Gateway
GNU General Public License v3.0
55 stars 17 forks source link

Issues trying to Add Solarmax SGA /Sofar Solar Inverter #17

Closed Dobie007 closed 1 year ago

Dobie007 commented 1 year ago

First of all : Thanks for the great stuff here! I am trying to add my Inverter and am running in to some issues that i don't know how to solve: This is what i have:

In parts things work but: 1) The IdData is seldomly being filled - it actually worked at one instance I currently cannot reproduce. The log file looks strange in that point - no clear request string... 2) I cannot enable any commands although the "enable set commands over MQTT2" is active: The only item that is showing up in MQTT is the inverter status. (Yesterday I had a few to select but not all of my listed objects).

screen screen2 screen3

I nearly made it... Here the latest log file: Log2.txt And the Response i got with the test program. TestResponse.txt register_h.TXT

I would appreciate your help..

tobiasfaust commented 1 year ago

Hi, Something on your Json Definition is not well defined.

`Error: unable to read configdata for inverter ���?␟: NoMemory

Failed to parse JSON Register Data: EmptyInput Failed to parse JSON Register Data: NoMemory `

can you Post your json Definition of Register.h please?

Dobie007 commented 1 year ago

I posted the register.h as text file above..
Github tells me "We dont support that file type" if i drag and drop it here...

May that be caused by the name string I chose?: "Sofar-KTL Solarmax-SGA"

tobiasfaust commented 1 year ago

at first, your definition of "RequestIdData" is wrong. please use:

"RequestIdData": ["#ClientID", "0x04", "0x20", "0x00", "0x00", "0x0B"],

and try again

Dobie007 commented 1 year ago

Hi, thanks for your response.. (its not urgent, you can take your time :-)) I changed it, but it seems to make no difference. This time:

Inverter found: Sofar-KTL Solarmax-SGA Read config data for inverter ���?␟ { That is directly after reset before communication - so which config data does that refer to..? I assume its from the ESP flash...

Further down in the log the IdData request comes ( I set the live data to one every 10s, and the IdData to one every 60s) but I get "no response from client"

This is after I changed the Register file as you advised to:

"Sofar-KTL Solarmax-SGA": {
    "config": {
        "RequestLiveData": [
            ["#ClientID", "0x03", "0x00", "0x00", "0x00", "0x30"]
        ],
        "RequestIdData": ["#ClientID", "0x04", "0x20", "0x00", "0x00", "0x0B"],
        "ClientIdPos": 0,
        "LiveDataFunctionCodePos": 1,

register_h.txt Log3.txt

Could the 9600 Baud be a problem - not sure if I can change that.

After about an hour I finally get an answer but it seems as if the Serial is still not parsed: screen

tobiasfaust commented 1 year ago

Hi, i just committed an update. There was a memory leak in weboutput of "itemconfig" (-> null after Inverterstatus) Another mistake by you was the definition of "id", you forgot a space ;)

So, just clone the repo and test again

Dobie007 commented 1 year ago

Good One!: I can select the items now and they are being passed to MQTT. In other words I can actively use it now.

Only little drawback: The serial number is not decoded in the first attempts to read the "id": The log shows:

Request queue data to inverter: 0x01 0x04 0x20 0x00 0x00 0x0B 0xBA 0x0D Read Data from Queue: no response from client

After a few minutes it gets the id and I have my Serial Number display as well.

Attached is the register.h file (for further reference): register_h.txt

Thanks, I can dismiss the Chinese logger now. :-)

Dobie007 commented 1 year ago

Big THANKS! to Tobias - Everything solved in no time!

tobiasfaust commented 1 year ago

finally added by 9ef955d