simon3270 / ginlong-python

Get logging data from Solis Inverter from Ginlong
8 stars 6 forks source link

What next #1

Open PV-Freak opened 3 years ago

PV-Freak commented 3 years ago

Hi Simon I tried your script and so far no failure code ... but other this output ...

Python 3.7.3 (/usr/bin/python3)

%Run simon_logging.py '>log1.txt' Socket created Socket bind complete

i am unable to see any inverter data ... Can you help me in setting it up, or give some advice I am using a raspberry pi Many many THANKS

simon3270 commented 3 years ago

Hi PV!

That looks as though it is working. Is yours a V2 invertor? My code won't work on the newer V4 invertors.

I think it may also be buffering output. If you just run the code on the command line, without redirecting the output, you might see more. Also, is it dark at the moment? I used to try to write code in the evening, but couldn't test it until the sun came up the next morning :-)

The other thing to check is that the invertor is configured to send data to the Pi. I found it much more reliable using UDP rather than TCP.

Good luck! Simon

Edit: Just checked the code - I see that I only support UDP. You would have to change the bind code a little to use TCP. In the code I also talk about setting UDP on 192.168.0.20 - that's just the IP address of my invertor!

PV-Freak commented 3 years ago

Hello Simon

Many thanks for your answer and suggestions. I use a Solis mini 1000 single phase inverter, not one from the V 4G series. Actually, i am unable to set UDP mode, every time after restart the inverter is set again to TCP mode ... I have the newest firmware on the Wlan logger ... it looks like this ... BCEBC7DF-9036-4A8F-A4C9-75F5F49D304F 27961813-8BCB-4CA0-9288-E5E235A830E2 My pi has the ip 192.168.0.140, with port 9999 planned to be used.

At the moment it’s dark here (switzerland) ;) ... So then i must look to recode the script to be able to use TCP protocol ... is that a big thing? A good thing would be also if already the smallest amount of data received would be displayed, so as to be assured that the connection works, not speaking from the difficult decoding of data already ...

Thanks again, and best regards Toni

simon3270 commented 3 years ago

Changing to TCP is not hard (I should have left comments in the code!). I think you just have to change the connection type, then bind and listen for data.

I'll try to find a previous version, which did use TCP, in the morning. I am afraid that there is the distinct possibility that the data format doesn't match any of the 3 different ones I already allow for!!

Edit: corrected typo in first line!

simon3270 commented 3 years ago

I found the TCP version of the ginserv.py that was in the git repo and have added it as ginserv_tcp.py. I'm pretty sure it still works - the data handling code is unchanged from the UDP version. It's a bit clunky - it disconnects from the invertor after every data message, and terminates after a number of messages (I found that the code would hang after a certain number of connections - I think I wasn't freeing something up). The ginserv code doesn't worry about the data format, it just saves whatever the invertor sends so you should get some output whatever the format is. It's the get_data.py and get_tots.py which would need to be changed for the any new format.

Please let me know how you get on!

PV-Freak commented 3 years ago

Hi Simon Many many thanks for your help. I just started to test your TCP script ... it looks very good ... 345B0735-9422-4FA1-B269-BA127B3BA14F The output looks like there are data sent by the logger/inverter, and the connection is made between my pi and the logger/inverter. Very good. Now i have to start decoding the bytes and bits coming in 🧐 I am very curious about the data showing up. I will keep you updated. Best regards Toni

simon3270 commented 3 years ago

From the data you show, it looks very like the LAN stick long message, but without the usual short message you get on the LAN stick (yet another way of working!). Note that I had a typo in gindata.txt - I had the first byte of the long LAN message as '45' - should have been 'a5', like the short message (and yours). Your message is (possibly) 6 bytes shorter than mine, which might be useful to identify other bytes in the message - it's quite hard to work out what some of them are if you only have one invertor to read from.

PV-Freak commented 3 years ago

many thanks simon at the moment it shows this decoded data .... i have to work through it ... A81F76BB-F69D-4586-9E58-A0826BBA6F0F I am happy though ...

simon3270 commented 3 years ago

I think you'll need new section in get_data.py (and get_tots.py). I've listed one of your records against my LAN one, and bytes 47-70 (where the actual electricity data is in mine) are almost all zero on your data!

I can't, at the moment, see where your electricity data is. I'll compare 2 of yours to see.

simon3270 commented 3 years ago

There are a couple of ASCII strings in your data, neither of which are in my LAN-stick data

From looking at the bytes which vary between the three records you show, it looks as though the data is somewhere between byte 2 and byte 30 (if byte 0 is the first byte, the 0xa5).

I've typed those records in by hand from the images you gave. If you'd like me to dig further, would you be happy to attach a file with data?

PV-Freak commented 3 years ago

i would be very happy for your helping hand ...

the two strings are the firmware version of the WLan stick respectively the IP address of the WLan stick/inverter ...

i understand the output.txt file would be helpful for you ... i attach it happely output.txt many thanks

simon3270 commented 3 years ago

Thanks for the file, Toni.

It all looks a bit odd. You sent me 21 records with 99 bytes in each. There are only 7 bytes which are different between the records! (plus the CRC byte at the end). I can't see any pattern yet. To help find some recognisable data, what is the AC voltage and frequency where you are?

PV-Freak commented 3 years ago

Hello Simon the ac voltage at the moment 236V+/- , and the standard frequeny here is 50Hz+/- on my solis homepage i see following parameters ... total generation 156kWh energy generated last month 54kWh energy yesterday 2kWh Inverter serial number 000951015096216 Device WLan Logger serial number 725285694 ... perhaps this helps. best regards

PV-Freak commented 3 years ago

output.txt here one more log file that contains data logged 60min apart this afternoon ....