MichaluxPL / Sofar_LSW3

Get MODBUS data from Sofar (K-TLX) inverter through LSW-3 or LSE module
GNU General Public License v3.0
94 stars 45 forks source link

Sofar Solar HYD PH3 Support #40

Closed pixellos closed 2 years ago

pixellos commented 2 years ago

Hi,

on Python 3.10.4 it seems to return strange errors

image

MichaluxPL commented 2 years ago

Hi,

You haven;t received a correct response from the logger/inverter (it's way too short - Data received need to contain a lot more data). Script throws an error because it can't convert a character, that won't normally appear in a correct response. It's most probably an indication of wrong register rages configuration.

pixellos commented 2 years ago

Would it be safe to do scanner, that will try all addresses in a loop, or there is possibility that some addresses will try to write/change sth?

MichaluxPL commented 2 years ago

Don't know how would You like to make such a scan in a loop, since You have to ask logger for some range of adreses at a time. I'd suggest getting proper MODBUS specs for Your inverter and getting correct address ranges from there (AFAIK manufacturers are willing to provide it per request). Currently this script uses function 3 to get data from an inverter. This one is only for reading, so I guess accidental overwriting anything is not something You should be worried about :)

pixellos commented 2 years ago

Okay, thanks, will try to hack something in next few days.

pixellos commented 2 years ago

Hi, got specs,

As image I set up registerhw_start, end to

registerhw_start=0x0400
registerhw_end=0x047F

SOFARHWMap.xml

[
{
"directory": "solar",
"items": [
{
"titleEN": "Software Version",
"titlePL": "Wersja oprogramowania",
"registers": ["0x0453","0x0454"],
"optionRanges": [],
"value_type": "SV"
},
{
"titleEN": "Hardware Version",
"titlePL": "Wersja sprzętu",
"registers": ["0x44D","0x44E"],
"optionRanges": [],
"value_type": "HV"
}
]
}
]

SofarHYD.ES.ME3000SP.Modbus.protocol.pdf Those are ranges i used. image

But still

Data sent:  bytearray(b'\xa5\x17\x00\x10E\x00\x00\xd8<Xh\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x04\x04@\x00@\xf1\x1e\x00\x15')
Data received:  b'\xa5\x10\x00\x10\x15\x00g\xd8<Xh\x02\x01\xce\x8a@\x011\x19\x00\x00\xf0";a\x05\x00\t\x15'
Hex string received: A5 10 00 10 15 00 67 D8 3C 58 68 02 01 CE 8A 40 01 31 19 00 00 F0 22 3B 61 05 00 09 15

Is there possibility that protocol in logger was changed? inverter_sn=175xxxx08 is my one. Software is LSW3_14_270A_1.08, i heard that there is 1.30, maybe its too old?

MichaluxPL commented 2 years ago

Where did You get those numbers from ? Attached SofarHYD.ES.ME3000SP.Modbus.protocol.pdf tells something totally different. I guess configured range is much to big for HW data. Please attach here MODBUS specs for Your inverter. About changed logger protocol - I think somebody wrote something about it on elektroda.pl.

pixellos commented 2 years ago

{ "titleEN": "Software Version", "titlePL": "Wersja oprogramowania", "registers": ["0x0453","0x0454"], "optionRanges": [], "value_type": "SV" }, This one is from

image

 {
        "titleEN": "Hardware Version",
        "titlePL": "Wersja sprzętu",
        "registers": ["0x44D","0x44E"],

From image

@Edit

Was tring to find post U mentioned, probably this one https://www.elektroda.pl/rtvforum/topic3698233-150.html#19936860 In that case i'm doomed :/

MichaluxPL commented 2 years ago

Yep, that's the one. If You send me MODBUS specs, I can look at it and suggest something ... Your choice of course :)

pixellos commented 2 years ago

I got it - it was mentioned in elektroda - different devices are having different codes - in this one is 0104, for my one 0003, now working on scraping an documentation XLSX to get all adresses and to clean up code a bit.

MichaluxPL commented 2 years ago

This is exactly why I've suggested to get full MODBUS specs for Your device :) Glad You've nailed it down ;)

MichaluxPL commented 2 years ago

Did You manage to figure out the function number to read production data (for Your Inverter) ?

pixellos commented 2 years ago

Yes, but amount of changes made my code not in line with that repo, so created new one. https://github.com/pixellos/codereinvented.automation.py/tree/master

image data i receive seems in line with solarman and what i can see in inverter.

Thanks!

pixellos commented 2 years ago

Just uploaded file with registries, if U want U can reuse it in Ur solution after changing format https://github.com/pixellos/codereinvented.automation.py/blob/master/cache/hyd3ph_g9_2021.json