Hello,
I will try to add my 3 cents quickly, as I read and read data from the inverter in different ways.
I have a SUN2000 4.6KTL L1, most likely with a smart dongle for Wifi (or maybe built-in wifi?).
The inverter was sending all data to the Fusionolar portal from the beginning, connecting through my Wifi network
However, downloading data from the portal is too slow for me (update every 2-3 minutes or something), besides, I don't like too many clouds, so I wanted to take this data directly (using pymodbus and throw it into homeassistant).
First, I connected normally using the IP address (which the inverter got from my network), on port 502.
This solution generally worked and I tried to keep modbus connected all the time, but the inverter sometimes disconnected and had a few minutes breaks.
After installing a LUNA battery and a smartmeter connected with a modbus cable, it completely stopped working. That is, the inverter continues to connect to my wifi network and send data to the Fusionolar portal, but port 502 is closed, and there is no possibility to download data. I read somewhere that it's because the smartmeter "consumes" the modbus port that was previously available over IP (I'm not sure if it makes sense, but there is no connection, and nothing has changed). It is equally likely that the installer updated the firmware and the modbus port was closed.
However, I have read that by connecting to the inverter's wifi (SUN2000-HVxxxxxx and password Changeme) it is still possible to extract this data.
So I did, but at first it did not want to work ... until it turned out that apart from the fact that there is of course a different IP (the one that the inverter gives itself, because now it works as an access point) (the inverter's IP is now 192.168.200.1) but also the access port is different, now it is 6607.
So connecting to the inverter WIFI with a separate wifi connection, and connecting pymodbus to address 192.168.200.1 on port 6607 works !!! Problem #52: Now, as before, I tried to keep the wifi connection and the modbus connection all the time... unfortunately, by keeping the modbus connection, it blocks the inverter from sending data to fusionsolar (so they are out of date and there are warnings).
Similarly, when pymodbus is connected, the application on the phone will not connect either.
Solution: Wifi is constantly connected, but the modbus connection is established only when needed, every 30 seconds, and then immediately disconnected (downloading data is not all 5 seconds). In this way, in the fusion solar portal, everything also appears beautifully, and I have fresh data every 30-40 seconds.
ip_inverter="192.168.200.1"
portnr=6607
client = ModbusClient(ip_inverter, port=portnr, unit_id=0)
client.connect()
time.sleep(1)
What is important for me is unit_id=0, and one second of sleep after connecting, because if it is not there, there are very often problems with reading registers.
If I manage everything somehow, and someone is interested, I will post my script on github, because I have autodiscovery to homeassistant and sending mqtt.
EDIT 1: I don't have access to the installer account at all... So I can't dig too much.
EDIT 2: An alternative is the Modbus-ESP32 adapter on the cable, which means that all adventures with firmwares, wifi, etc. are out.
Maybe even additionally, you can save some registers in the inverter via cable modbus (which is unlikely to be possible via wifi).