Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Goodwe integration not working with LAN module #114173

Open
ivik opened this issue Mar 25, 2024 · 84 comments
Open

Goodwe integration not working with LAN module #114173

ivik opened this issue Mar 25, 2024 · 84 comments

Comments

@ivik
Copy link

ivik commented Mar 25, 2024

The problem

I have a GW15K-ET which works fine with HA GoodWe integration when using the Wifi module.
But as soon as I change to the LAN/WIFI module then HA is not able to find it anymore.

I remove everything and start new integration, I give it the LAN IP and it says "Unknown error occurred"
Same if I give it Wifi IP from the LAN/Wifi module.

But If I remove everything again, change to only Wifi module and give it the IP then it works great.

LAN/Wifi module works as I can see data in SEMS portal.

I found some info in the logs, please see below

What version of Home Assistant Core has the issue?

core-2024.3.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

GoodWe inverter

Link to integration documentation on our website

https://www.home-assistant.io/integrations/goodwe

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

File "/usr/src/homeassistant/homeassistant/components/goodwe/config_flow.py", line 36, in async_step_user
    inverter = await connect(host=host, retries=10)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/goodwe/__init__.py", line 52, in connect
    return await discover(host, timeout, retries)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/goodwe/__init__.py", line 72, in discover
    response = await DISCOVERY_COMMAND.execute(host, timeout, retries)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/goodwe/protocol.py", line 109, in execute
    await response_future
  File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 1228, in _read_ready
    data, addr = self._sock.recvfrom(self.max_size)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ConnectionRefusedError: [Errno 111] Connection refused

Additional information

No response

@home-assistant
Copy link

Hey there @mletenay, @starkillerOG, mind taking a look at this issue as it has been labeled with an integration (goodwe) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of goodwe can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign goodwe Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


goodwe documentation
goodwe source
(message by IssueLinks)

@RalfWinter
Copy link

I had the LAN module in my GW15K-ET and in general it works. The problem is the change of IP address. I preferred to use the already discovered instance in order to keep the data. Just go into the directory where your configuration.yaml lives, cd into to .storage and edit core.config_entries where you search for your old WiFi address of the Goodwe and change it to the LAN IP address. Restart HA and your inverter is back in business.

@starkillerOG starkillerOG removed their assignment Mar 30, 2024
@ivik
Copy link
Author

ivik commented Apr 5, 2024

I will try it out, not sure if there was a IP change problem, this happened when I setup a new integration using the IP I got from the LAN module. But I will try your solution later today and update the ticket if it works.

@ivik
Copy link
Author

ivik commented Apr 5, 2024

I just tried it out and it did not work. As soon as the LAN module is connected (updated IP in HA as you wrote and restarted HA) it cannot send anything to HA, nothing is recived. Even trying to reload the device in HA did not help or adding a new one using the LAN IP.

Instead SEMS Portal start working again which stops working when using the WIFI module (does not matter to me).

Not sure which LAN module you have, I have the new one, version 2 which is a LAN/Wifi module. But when using the module which only has Wifi then its works again with HA.

From what I understand this integration uses UDP modbus but the new LAN/Wifi module (version 2) seems to be using TCP modbus. But I could be wrong or perhaps that doesn't even matter?

@RalfWinter
Copy link

How did you configure the LAN/WiFi module?
I configured it via the SEMS portal app on the mobile phone. It is important to only configure the LAN-side, Wifi is not configured to connect to your home Wifi.

@ivik
Copy link
Author

ivik commented Apr 8, 2024

What do you mean with configure? I just insert LAN cable in to the module and use the LAN IP in HA.
I don't use the Wifi IP at all. I will look again when I get home later today, but pretty sure there was nothing to play around with when it comes to LAN. Are you sure you mean SEMS Portal app or do you mean the SolarGo app?

The SolarGo app had some settings for Wifi or LAN. I'm sure I have tried to shutdown wifi and only have settings for LAN but it did not help.

@RalfWinter
Copy link

You need to select LAN as the "Internet access port" within SEMS Portal WiFi-configuration (I know, "WIFI-configuration" is a bit misleading...). You may want to watch the Goodwe Configuration video of the Wii-Fi+LAN-kit on youtube
Good luck!

@savagejimmy85
Copy link

I am having what seems to be the exact same issue with my inverter - GW5000-DNS-30. Worked fine with the wifi module while I waited for the LAN/Wifi module to arrive.
Now that the LAN module is installed I am getting the same "Unknown error occurred" when re-adding the integration.
Running on VM HassOS

@savagejimmy85
Copy link

Looking into this further the only open port that I can find is TCP 502 with nmap. I no longer have the wifi only module to compare this to but I suspect @ivik has hit the nail on the head that its not using UDP anymore, just TCP

@savagejimmy85
Copy link

Apologies, I have found port 48899 open

@mletenay
Copy link
Contributor

48899 is the "discovery" port of the module itself.
UDP/8899 is the port for the inverter (modbus) protocol.
TCP/502 is indeed the modbus/TCP, until now not used/supported by goodwe inverters.

It should not be a rocket science to add TCP support, but since I don't have such interface at hand, it might be a bit difficult to implement it in blind or over some mock ...

@mletenay
Copy link
Contributor

What is exactly the LAN/WIFI module type/version ?
I have already collected few bucks on my Buy-me-a-coffee so I might have enough soon to buy that module myself, so I can add proper support for it ...

@mletenay
Copy link
Contributor

I finally found some doc regarding the 2.0 version of the WIFI/LAN module - https://www.memodo.cz/media/pdf/a4/e4/21/sa-e-20230921-001statement_of_wifilan_kit-20_2b87cc807f18fb171fecf24308f64207.pdf
It seems I will not be able to buy/test it locally, since it supports only ET15+ and ES G2 :-(

Can you confirm it is the 2.0 version you have ?

@RalfWinter
Copy link

Hello @mletenay , what me concerns I received the old version.

@treecamp
Copy link

I just got my WIFI/LAN module today, I set it up as LAN, and gave it a static IP, and got it connected now with the GoodWe HA integration. I don't think it's the latest version though, I got the module from the company that placed my inverter, so i didn't ordered it myself.

I added some pictures below, i'll let y'all know if it stays stable. If i can answer any questions, let me know.

image
image

@ivik
Copy link
Author

ivik commented Apr 17, 2024

Sorry I have been away for awhile and not been able to test the given suggestion. I will see if I can try it out later today.
I have added some pics on the Wifi/Lan module v2.

20240417_132858
20240417_132920

@ivik
Copy link
Author

ivik commented Apr 17, 2024

I finally found some doc regarding the 2.0 version of the WIFI/LAN module - https://www.memodo.cz/media/pdf/a4/e4/21/sa-e-20230921-001statement_of_wifilan_kit-20_2b87cc807f18fb171fecf24308f64207.pdf It seems I will not be able to buy/test it locally, since it supports only ET15+ and ES G2 :-(

Can you confirm it is the 2.0 version you have ?

Yes I have version 2, please check above pictures.

@mletenay
Copy link
Contributor

So to summarize it:
There are (at least) 2 versions of the WIFI/LAN kit

  1. V1 - product number GA10081-69-00P
  • compatible with most inverters
  • no bluetooth
  • uses UDP for both WIFI and LAN
  • works fine with HA
  1. V2 - product number WLA0000-01-00P
  • compatible only with ET15+ and ES G2 models (aka platform 745).
  • with bluetooth
  • uses modbus/TCP instead of UDP
  • does not work with HA (yet)

@ivik
Copy link
Author

ivik commented Apr 17, 2024

I think the summarization is correct. The v2 seems to be working with TCP/modbus instead of TCP.

If it helps, I can connect the new v2 again and give you raw data on output but you need to help me a bit and tell me what I need and what I should do. I have not worked with modbus before but if you can dumb it down a bit perhaps I could help extract data?

I tried downloading a windows app to check the modbus connection but the app was a freeware and in half Chinese and half bad english so I could not understand what I needed to do in order to get any meaningful data out of it.

I also tried to do what Ralf suggested but that does not work since the v2 only handle configuration using bluetooth and not wifi.
It does not have AP for wifi the way the older models do.

For now I'm using the Wifi only kit which works fine, no SEMS portal access anymore (don't care, SEMS sucks anyway) but it would be nice to get of Wifi and use LAN instead...

@mletenay
Copy link
Contributor

@ivik I have started coding the TCP support, but it make take couple of days/week until I have something usable.
At some point I would need help with testing, so if you can setup python and checkout the https://github.com/marcelblijleven/goodwe so you can test the communication, it will help a lot.
(There is this in inverter_check.py script which is used for basic testing).

@ivik
Copy link
Author

ivik commented Apr 19, 2024

Sure thing, just let me know when you have anything ready for test.
I have a little bit of knowledge around Python so it should not be a problem.

@mletenay
Copy link
Contributor

@ivik So, I implemented the Modbus/TCP protocol and tested it as much as I could on simple mocks.
Now the real testing is necessary.
Please checkout the code and try to execute the https://github.com/marcelblijleven/goodwe/blob/master/tests/inverter_check.py script (adjusting the IP and the port to 502).

@ivik
Copy link
Author

ivik commented Apr 24, 2024

Not much is happening, it prints couple rows and nothing else happens. I have waited 5 min before I killed the script:

2024-04-24 17:04:11,179 init(54) - DEBUG: Using selector: SelectSelector
2024-04-24 17:04:11,180 discover(70) - DEBUG: Probing inverter at 192.168.0.23.
2024-04-24 17:04:11,180 _send_request(67) - DEBUG: Sending: aa55c07f0102000241
2024-04-24 17:08:18,181 _retry_mechanism(77) - DEBUG: Failed to receive response to aa55c07f0102000241 in time (247s).
2024-04-24 17:08:18,181 _send_request(67) - DEBUG: Sending: aa55c07f0102000241 - retry #1/1
2024-04-24 17:12:25,182 discover(101) - DEBUG: Probing ET inverter at 192.168.0.23.
2024-04-24 17:12:25,182 _ensure_lock(123) - DEBUG: Creating lock instance for current event loop.
2024-04-24 17:12:25,182 _send_request(67) - DEBUG: Sending: READ 33 registers from 35000 (f70388b800213ac1)
2024-04-24 17:16:32,188 _retry_mechanism(77) - DEBUG: Failed to receive response to READ 33 registers from 35000 (f70388b800213ac1) in time (247s).
2024-04-24 17:16:32,188 _send_request(67) - DEBUG: Sending: READ 33 registers from 35000 (f70388b800213ac1) - retry #1/1

But this is done using the Goodwe python from PIP.
I suspected you have changed the code and downloaded the your entire project and tried the script again, but then it fails on importing the Goodwe module:

(goodwe_test) PS C:\Users\Erfan\anaconda3\envs\goodwe_test\goodwe-master> python.exe .\tests\inverter_check.py
Traceback (most recent call last):
File "C:\Users\Erfan\anaconda3\envs\goodwe_test\goodwe-master\tests\inverter_check.py", line 8, in
import goodwe
ModuleNotFoundError: No module named 'goodwe'
(goodwe_test) PS C:\Users\Erfan\anaconda3\envs\goodwe_test\goodwe-master>

The line above the import error tells the path to the Goodwe module (non PIP version) but it says:

sys.path.insert(0, '../../goodwe')

Should I not be:

sys.path.insert(0, '../goodwe')

I tried that as well but still same error....

@mletenay
Copy link
Contributor

@ivik The ../../ stuff assumes you are running it from test directory as python inverter_check.py, if you run it from parent, then yes you have to adjust it.
Anyway to the real problem - it seems it skipped or you did not pass it the "ET" as family parameter and it tried to do the discovery stuff which is not really supported with Modbus/TCP.
I did tweak the code so when connecting to TCP/502 it should now automatically assume ET family.
Please re-test.

@ivik
Copy link
Author

ivik commented May 2, 2024

I tried again, after couple of attampts it started to try DT family inverter and I killed the script.
But as you see it started with assuming ET family:

2024-05-02 20:42:30,327 init(54) - DEBUG: Using selector: SelectSelector
2024-05-02 20:42:30,327 discover(70) - DEBUG: Probing inverter at 192.168.0.23.
2024-05-02 20:42:30,327 _send_request(67) - DEBUG: Sending: aa55c07f0102000241
2024-05-02 20:46:37,340 _retry_mechanism(77) - DEBUG: Failed to receive response to aa55c07f0102000241 in time (247s).
2024-05-02 20:46:37,340 _send_request(67) - DEBUG: Sending: aa55c07f0102000241 - retry #1/1
2024-05-02 20:50:44,342 _retry_mechanism(81) - DEBUG: Max number of retries (1) reached, request aa55c07f0102000241 failed.
2024-05-02 20:50:44,342 discover(101) - DEBUG: Probing ET inverter at 192.168.0.23.
2024-05-02 20:50:44,342 _ensure_lock(123) - DEBUG: Creating lock instance for current event loop.
2024-05-02 20:50:44,342 _send_request(67) - DEBUG: Sending: READ 33 registers from 35000 (f70388b800213ac1)
2024-05-02 20:54:51,348 _retry_mechanism(77) - DEBUG: Failed to receive response to READ 33 registers from 35000 (f70388b800213ac1) in time (247s).
2024-05-02 20:54:51,348 _send_request(67) - DEBUG: Sending: READ 33 registers from 35000 (f70388b800213ac1) - retry #1/1
2024-05-02 20:58:58,354 _retry_mechanism(81) - DEBUG: Max number of retries (1) reached, request READ 33 registers from 35000 (f70388b800213ac1) failed.
2024-05-02 20:58:58,354 discover(101) - DEBUG: Probing DT inverter at 192.168.0.23.
2024-05-02 20:58:58,354 _ensure_lock(123) - DEBUG: Creating lock instance for current event loop.
2024-05-02 20:58:58,354 _send_request(67) - DEBUG: Sending: READ 40 registers from 30001 (7f03753100280409)

@mletenay
Copy link
Contributor

Thanks for the feedback, I'm going to analyze it.
I will also adjust the config dialog so it will be easier to change IP and protocol via UI.

Anyway, this github ticket is fine place to collect feedback and discussion, but sometime it might be more efficient to talk directly.
So just reminder for those who do not know - we have a discord channel and I've just created dedicated TCP related sub-channel here - https://discord.com/channels/758315145922740234/1239152054040268850

@mletenay
Copy link
Contributor

@xrsprint @ivik Something quite odd is happening there.
At this point I do not know whose bug it is, but what seems to happen is that the inverter replies with some garbage after proper payload.
First request is fine, second has 512 bytes of additional garbage, 2nd 1024 bytes of garbage etc.
(The garbage contains e.g. IP address of HA as ascii string and "modbus_tcp" string as well ???).
It smell a lot like some buffer overflow on goodwe side, but it's just a guess at this moment.
I have 2 potential fixes/workarounds in mind (use proper modbus tx counters and option to close connection after every request).
Hoping to implement them tomorrow ...

@ivik
Copy link
Author

ivik commented May 13, 2024

@mletenay

I have not seen output like the one @xrsprint have displayed. Not sure if we have the same issue or we are talking about 2 different issues. We have different inverters so there could be different issues/bugs we are talking about.

But let me know when you have new code and I will try it out. If possible, create a script that does sensor reads each 10s or whatever and I will have it go for couple of minutes and see what happens. Perhaps you could put the update time in a variable which I could play around with if needed.

@xrsprint
Copy link

and if anyone wants me to run any scrips, more than happy to, might need a couple of pointers on how to run it 📦

@mletenay
Copy link
Contributor

@xrsprint @ivik I have made some adjustments to the code.

  • Modbus/TCP protocol now uses sequential request transaction identifiers - should be optional, but won't hurt and may help.
  • There is now possibility to force 1 request per connection, i.e. the TCP connection is closed after each request. This is not recommended by the standard, but can help us troubleshooting.

If you checkout the latest sources from the https://github.com/marcelblijleven/goodwe, you can find new python script stability_check.py in the tests folder. It should connect to the TCP server and send request every 5 seconds in a loop.
You should obviously adjust the IP and you can fiddle with params - e.g. the timeout and the keep_alive (commented out by default).

@xrsprint
Copy link

Thanks for that @mletenay i will give this a go this afternoon and report back. Im still not sure how to run scripts but will update the source and let you know

Thanks again for the great work and will revert back !

@ivik
Copy link
Author

ivik commented May 14, 2024

@mletenay
I tried the discord link but it does not work. Please send invite to: erfan8882

I downloaded the new code. I ran it and it worked but had strange output:
Same request output over and over again, I have attached the first 2:

C:\python\goodwe\tests> python.exe .\stability_check.py
2024-05-14 23:15:55,566 init(54) - DEBUG: Using selector: SelectSelector
2024-05-14 23:15:55,566 connect(55) - DEBUG: Connecting to None family inverter at 192.168.0.23:502.
2024-05-14 23:15:55,566 _ensure_lock(56) - DEBUG: Creating lock instance for current event loop.
2024-05-14 23:15:55,566 _connect(213) - DEBUG: Opening connection.
2024-05-14 23:15:55,582 connection_made(229) - DEBUG: Connection opened.
2024-05-14 23:15:55,582 _send_request(311) - DEBUG: Sending: READ 33 registers from 35000 (000100000006f70388b80021)
2024-05-14 23:15:55,613 data_received(250) - DEBUG: Received: 000100000045f7034200003a980001393031354b455454323334573036373200000000000000000000000700071b9c0008019130343036322d30372d53303030323032302d30382d533031
2024-05-14 23:15:55,613 _send_request(311) - DEBUG: Sending: READ 6 registers from 47547 (000200000006f703b9bb0006)
2024-05-14 23:15:55,629 data_received(250) - DEBUG: Received: 00020000000ff7030c000000000000000000000000
2024-05-14 23:15:55,629 _send_request(311) - DEBUG: Sending: READ 6 registers from 47589 (000300000006f703b9e50006)
2024-05-14 23:15:55,660 data_received(250) - DEBUG: Received: 00030000000ff7030cffff00000000000000000000
2024-05-14 23:15:55,660 connect(57) - DEBUG: Connected to inverter , S/N:9015KETT234W0672.
2024-05-14 23:15:55,660 get_runtime_data(38) - INFO: ################################
2024-05-14 23:15:55,660 get_runtime_data(39) - INFO: Request 1
2024-05-14 23:15:55,660 get_runtime_data(40) - INFO: ################################
2024-05-14 23:15:55,660 _send_request(311) - DEBUG: Sending: READ 125 registers from 35100 (000400000006f703891c007d)
2024-05-14 23:15:55,707 data_received(250) - DEBUG: Received: 0004000000fdf703fa18050e170f36000000000000000000000000000000000000000000000000000000000000000000000000091e0002138400000000092500001386ffffffff091b00001384ffffffff0001fffffffefffffc450000002e0000002e000f00000a31000000000000000f00001386000000000000000f0000001e0000000000000000028c0000001c0000011100000000000003be0000014a0069010d0000134d09b50000000000000000000000040029000000000000000000006d1b000003db00006d1a000006a203da0000022700000001d47a01ee0000020b00000000012e000000080000000000000000021100000000020401c8000000000000
2024-05-14 23:15:55,707 _send_request(311) - DEBUG: Sending: READ 58 registers from 36000 (000500000006f7038ca0003a)
2024-05-14 23:15:55,738 data_received(250) - DEBUG: Received: 000500000177f703740007003b000a00000001fd74ffe3feeefc4501acffa1ffebffadffad13850000000000000000fffffd74ffffffe3fffffeeefffffc45000000910000008100000099000001acfffffd52ffffff7dfffffeb5fffffb83000200050000000000000000000000000000091909220917001d0005000e9103001e0000000000000000028c0000001c0000011100000000000003be0000014a0069010d0000134d09b50000000000000000000000040029000000000000000000006d1b000003db00006d1a000006a203da0000022700000001d47a01ee0000020b00000000012e000000080000000000000000021100000000020401c8000000000000976200000500000006f7038ca0003afbfd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
2024-05-14 23:15:55,738 _send_request(311) - DEBUG: Sending: READ 61 registers from 35301 (000600000006f70389e5003d)
2024-05-14 23:15:55,785 data_received(250) - DEBUG: Received: 00060000017df7037a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000409300930093000000000ffffffff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000787b00000000028c0000001c0000011100000000000003be0000014a0069010d0000134d09b50000000000000000000000040029000000000000000000006d1b000003db00006d1a000006a203da0000022700000001d47a01ee0000020b00000000012e000000080000000000000000021100000000020401c8000000000000976200000600000006f70389e5003dab26000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
2024-05-14 23:16:00,785 get_runtime_data(38) - INFO: ################################
2024-05-14 23:16:00,785 get_runtime_data(39) - INFO: Request 2
2024-05-14 23:16:00,785 get_runtime_data(40) - INFO: ################################
2024-05-14 23:16:00,785 _send_request(311) - DEBUG: Sending: READ 125 registers from 35100 (000700000006f703891c007d)
2024-05-14 23:16:00,817 data_received(250) - DEBUG: Received: 0007000001fdf703fa18050e170f3b000000000000000000000000000000000000000000000000000000000000000000000000091c000113840000000009240000138300000000091c0000138500000000000100000000fffffc170000001600000017001000000a31000000000000001000001386000000000000000f0000001e000000000000000002960000001c0000013600000000000003dc0000014a0069010d0000134d09b50000000000000000000000040029000000000000000000006d1b000003db00006d1a000006a203da0000022700000001d47a01ee0000020b00000000012e000000080000000000000000021100000000020401c8000000000000835d00000700000006f703891c007d7ae70000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
2024-05-14 23:16:00,817 _send_request(311) - DEBUG: Sending: READ 58 registers from 36000 (000800000006f7038ca0003a)
2024-05-14 23:16:00,848 data_received(250) - DEBUG: Received: 000800000277f703740007003b000a00000001fd6affe4fecafc1701b1ffa1ffebffabffad13840000000000000000fffffd6affffffe4fffffecafffffc1700000095000000810000009a000001b1fffffd48ffffff7dfffffe95fffffb59000200050000000000000000000000000000091809220915001e0005000fe039001e000000000000000002960000001c0000013600000000000003dc0000014a0069010d0000134d09b50000000000000000000000040029000000000000000000006d1b000003db00006d1a000006a203da0000022700000001d47a01ee0000020b00000000012e000000080000000000000000021100000000020401c8000000000000835d00000800000006f7038ca0003afbfd00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003139322e3136382e302e33000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
2024-05-14 23:16:00,848 _send_request(311) - DEBUG: Sending: READ 61 registers from 35301 (000900000006f70389e5003d)
2024-05-14 23:16:00,895 data_received(250) - DEBUG: Received: 00090000027df7037a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000409300930093000000000ffffffff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000787b0000000002960000001c0000013600000000000003dc0000014a0069010d0000134d09b50000000000000000000000040029000000000000000000006d1b000003db00006d1a000006a203da0000022700000001d47a01ee0000020b00000000012e000000080000000000000000021100000000020401c8000000000000835d00000900000006f70389e5003dab2600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003139322e3136382e302e33000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

But then I changed your script a bit and added output for actual sensor values, I made this change:

`
async def get_runtime_data():
inverter = await goodwe.connect(host='192.168.0.23', port=502, family='ET', timeout=1, retries=3)
# inverter.keep_alive = False

i = 1
while True:
    logger.info("################################")
    logger.info("          Request %d", i)
    logger.info("################################")
    #await inverter.read_runtime_data()
    runtime_data = await inverter.read_runtime_data()
    for sensor in inverter.sensors():
        if sensor.id_ in runtime_data:
            print(f"{sensor.id_}: \t\t {sensor.name} = {runtime_data[sensor.id_]} {sensor.unit}")        
    await asyncio.sleep(5)
    i += 1

`

That made it more interesting, it was able to do the output of all sensors for 7 runs but it then crasched:

2024-05-14 23:22:18,699 get_runtime_data(38) - INFO: ################################
2024-05-14 23:22:18,699 get_runtime_data(39) - INFO: Request 7
2024-05-14 23:22:18,699 get_runtime_data(40) - INFO: ################################
2024-05-14 23:22:18,699 _send_request(311) - DEBUG: Sending: READ 125 registers from 35100 (001600000006f703891c007d)
2024-05-14 23:22:18,731 data_received(250) - DEBUG: Received: 0016000005fdf703fa18050e171611000000000000000000000000000000000000000000000000000000000000000000000000090b0002138800000000091200001389ffffffff091200001384000000000001ffffffffffffefd00000002d0000002e000f00000a31000000000000001000001386000000000000000f0000001e0000000000000000078500000438000004720000000000001031000001470069010a0000134e09b50000000000000000000000040029000000000000000000006d1b000003db00006d1a000006a203da0000022700000001d47c01f00000020b00000000012e000000080000000000000000021100000000020401c8000000000000716b00001600000006f703891c007d7ae700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003139322e3136382e302e330000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001002c36ec0a800030000000000000000000000000000000000000000000201f60000000000000000000000000000000000000000000000000306000010000000010000007ae7000000000000000000000000000080b3fd3f0c000000000000000000000000000000f0b2fd3f39000000fcb1fd3f0000000000000000000000000000000000000000000000000cb4fd3f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a5a5a5a5a5a5a5a5a5a5a5a5a5a5a57001000090aefd3f00b4fd3f450f0700a03cfc3fa03cfc3f74b4fd3f983cfc3f14000000fcc7fd3ffcc7fd3f74b4fd3f0000000005000000709cfd3f6d6f646275735f74637000b07300272c31ef721dcc226b886cfa6c50a0fbc300ffffff7f60b4fd3f0e0000000000000005000000000000008813ff3f8c440d4080000000c067fb3f2868fb3f9068fb3f000000000000000001000000000000000000000000000000481d004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003f5c00000000000000e8b5fd3f00000000000000000000000000b6fd3fffffffff00b6fd3f00b6fd3f0000000014b6fd3fffffffff14b6fd3f14b6fd3f010000000100000000000000ffff000200000000b8e41b68018e174bffff3fb30000000014000000e48afc3f589cfd3ff70026067033413f60b6fd3f5c0000000000000060b6fd3f00000000000000000000000078b6fd3fffffffff78b6fd3f78b6fd3f000000008cb6fd3fffffffff
2024-05-14 23:22:18,731 _send_request(311) - DEBUG: Sending: READ 58 registers from 36000 (001700000006f7038ca0003a)
2024-05-14 23:22:18,731 validate_modbus_tcp_response(248) - DEBUG: Response is command failure: ILLEGAL FUNCTION.
2024-05-14 23:22:18,731 data_received(260) - DEBUG: Received exception response: 8cb6fd3f8cb6fd3f010000000100000000000000ffff008b00000000fa5acfd301f2ecfbffff3fb300000000040600000000000024b7fd3f63006300800001000000000000000000f1f7c0a80003c0a800176ec3f601b0c7bfeabcdf2ee0501020fdf9
Traceback (most recent call last):
File "C:\python\goodwe\tests\stability_check.py", line 50, in
asyncio.run(get_runtime_data())
File "C:\Users\Erfan\anaconda3\envs\goodwe_test\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users\Erfan\anaconda3\envs\goodwe_test\lib\asyncio\base_events.py", line 649, in run_until_complete
return future.result()
File "C:\python\goodwe\tests\stability_check.py", line 42, in get_runtime_data
runtime_data = await inverter.read_runtime_data()
File "C:\python\goodwe\tests..\goodwe\et.py", line 591, in read_runtime_data
raise ex
File "C:\python\goodwe\tests..\goodwe\et.py", line 580, in read_runtime_data
response = await self._read_from_socket(self._READ_METER_DATA_EXTENDED)
File "C:\python\goodwe\tests..\goodwe\inverter.py", line 123, in _read_from_socket
result = await command.execute(self._protocol)
File "C:\python\goodwe\tests..\goodwe\protocol.py", line 409, in execute
response_future = await protocol.send_request(self)
File "C:\python\goodwe\tests..\goodwe\protocol.py", line 277, in send_request
await response_future
File "C:\python\goodwe\tests..\goodwe\protocol.py", line 249, in data_received
if self.command.validator(data):
File "C:\python\goodwe\tests..\goodwe\protocol.py", line 602, in
lambda x: validate_modbus_tcp_response(x, cmd, offset, value),
File "C:\python\goodwe\tests..\goodwe\modbus.py", line 249, in validate_modbus_tcp_response
raise RequestRejectedException(failure_code)
goodwe.exceptions.RequestRejectedException: ILLEGAL FUNCTION

I also tried to change the sleep time to 10s and tried again, it had the same crash as above after run number 6.

2024-05-14 23:32:40,963 get_runtime_data(38) - INFO: ################################
2024-05-14 23:32:40,963 get_runtime_data(39) - INFO: Request 6
2024-05-14 23:32:40,963 get_runtime_data(40) - INFO: ################################
2024-05-14 23:32:40,964 _send_request(311) - DEBUG: Sending: READ 125 registers from 35100 (001300000006f703891c007d)
2024-05-14 23:32:41,022 data_received(250) - DEBUG: Received: 0013000005fdf703fa18050e172028000000000000000000000000000000000000000000000000000000000000000000000000091300011384ffffffff09150000138900000000091b0000138a000000000001ffffffffffffef7f0000001700000017000f00000a31000000000000001000001386000000000000000f0000001e0000000000000000073f0000049b000004a5000000000000108400000143006901050000134e09b50000000000000000000000040029000000000000000000006d1b000003db00006d1a000006a203da0000022700000001d48401f80000020b00000000012e000000080000000000000000021100000000020401c80000000000007d1100001300000006f703891c007d7ae700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003139322e3136382e302e330000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001002c4ccc0a800030000000000000000000000000000000000000000000201f60000000000000000000000000000000000000000000000000306000010000000010000007ae7000000000000000000000000000080b3fd3f0c000000000000000000000000000000f0b2fd3f39000000fcb1fd3f0000000000000000000000000000000000000000000000000cb4fd3f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a5a5a5a5a5a5a5a5a5a5a5a5a5a5a57001000090aefd3f00b4fd3f088e1000a03cfc3fa03cfc3f74b4fd3f983cfc3f14000000fcc7fd3ffcc7fd3f74b4fd3f0000000005000000709cfd3f6d6f646275735f74637000b07300272c31ef721dcc226b886cfa6c50a0fbc300ffffff7f60b4fd3f0e0000000000000005000000000000008813ff3f8c440d4080000000c067fb3f2868fb3f9068fb3f000000000000000001000000000000000000000000000000481d004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003f5c00000000000000e8b5fd3f00000000000000000000000000b6fd3fffffffff00b6fd3f00b6fd3f0000000014b6fd3fffffffff14b6fd3f14b6fd3f010000000100000000000000ffff000200000000b8e41b68018e174bffff3fb30000000014000000e48afc3f589cfd3ff70026067033413f60b6fd3f5c0000000000000060b6fd3f00000000000000000000000078b6fd3fffffffff78b6fd3f78b6fd3f000000008cb6fd3fffffffff
2024-05-14 23:32:41,023 _send_request(311) - DEBUG: Sending: READ 58 registers from 36000 (001400000006f7038ca0003a)
2024-05-14 23:32:41,024 validate_modbus_tcp_response(248) - DEBUG: Response is command failure: ILLEGAL FUNCTION.
2024-05-14 23:32:41,024 data_received(260) - DEBUG: Received exception response: 8cb6fd3f8cb6fd3f010000000100000000000000ffff008b00000000fa5acfd301f2ecfbffff3fb300000000040600000000000024b7fd3f63006300800001000000000000000000f1d6c0a80003c0a80017ccc4f601b1c905332f36c48050109df7bc
Traceback (most recent call last):
File "C:\python\goodwe\tests\stability_check.py", line 50, in
asyncio.run(get_runtime_data())
File "C:\Users\Erfan\anaconda3\envs\goodwe_test\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users\Erfan\anaconda3\envs\goodwe_test\lib\asyncio\base_events.py", line 649, in run_until_complete
return future.result()
File "C:\python\goodwe\tests\stability_check.py", line 42, in get_runtime_data
runtime_data = await inverter.read_runtime_data()
File "C:\python\goodwe\tests..\goodwe\et.py", line 591, in read_runtime_data
raise ex
File "C:\python\goodwe\tests..\goodwe\et.py", line 580, in read_runtime_data
response = await self._read_from_socket(self._READ_METER_DATA_EXTENDED)
File "C:\python\goodwe\tests..\goodwe\inverter.py", line 123, in _read_from_socket
result = await command.execute(self._protocol)
File "C:\python\goodwe\tests..\goodwe\protocol.py", line 409, in execute
response_future = await protocol.send_request(self)
File "C:\python\goodwe\tests..\goodwe\protocol.py", line 277, in send_request
await response_future
File "C:\python\goodwe\tests..\goodwe\protocol.py", line 249, in data_received
if self.command.validator(data):
File "C:\python\goodwe\tests..\goodwe\protocol.py", line 602, in
lambda x: validate_modbus_tcp_response(x, cmd, offset, value),
File "C:\python\goodwe\tests..\goodwe\modbus.py", line 249, in validate_modbus_tcp_response
raise RequestRejectedException(failure_code)
goodwe.exceptions.RequestRejectedException: ILLEGAL FUNCTION

@xrsprint
Copy link

Hi Everyone

i tried and tired, but still couldnt figure out how to run the scripts, but i uninstalled and re-installed the app to the new Lan module and was getting the same thing

only thing I also noticed is in the integration logbook, every five seconds the timestamp is updated, an on each fouth update is when we loose the entities, then on the next update they come back

hope this helps in some way :)

@mletenay
Copy link
Contributor

mletenay commented May 15, 2024

@ivik The output confirms previous observation - there is more and more garbage at the end of response until it crashes.
Can you try now while un-commenting the '# inverter.keep_alive = False' ?

Use this invite link - https://discord.gg/TaXyWXT

@mletenay
Copy link
Contributor

@ivik I have added standard pymodbus library version to stability_check.py to find out whether my code is wrong or not.
Checkout the latest sources, install pymodbus (pip install pymodbus) and comment the get_runtime_data and uncomment the pymodbus above instead.

@mletenay
Copy link
Contributor

Just FYI - I've collected data both via my code and standard pymodbus.
Will analyze it further, but so far it really seems Goodwe has bug in Modbus/TCP implementation (kind of buffer overflow?).
They add illegal gargabe at the end of subsequent responses until something internally overflows and their interface crashes !
Modbus specification explicitly recommends the TCP connection should be kept open for subsequent requests, but they are not able to handle it.
If the TCP connection is closed after every single request, the inverter seems to work fine and responds properly !

@mletenay
Copy link
Contributor

Just FYI - see the announcement on discord - the v0.9.9.20 is out there and should be production ready with the "keep alive" flag turned off.

@ivik
Copy link
Author

ivik commented May 28, 2024

Hi, sorry for late reply, been busy lately.
I finally downloaded the latest version, first it did not want to work. I had to delete the inverter from HA and then restart and then it start working.

I have 5s polling and it has been working great the last 5min.
If no issues for couple of days I will close this ticket!

@ha-reporting2023
Copy link

You need to select LAN as the "Internet access port" within SEMS Portal WiFi-configuration (I know, "WIFI-configuration" is a bit misleading...). You may want to watch the Goodwe Configuration video of the Wii-Fi+LAN-kit on youtube
Good luck!

If you only configure the LAN part then your Goodwe will continue to broadcast the internal WIFI ssid, and worse, it starts to function as an access point. Connecting to the internal WIFI will get you access to the wired LAN segment and even the internet.

@mletenay
Copy link
Contributor

@ivik Do not close it yet, the code is still in HACS only and has to mature a bit to port it to core HA.

@ivik
Copy link
Author

ivik commented Jun 1, 2024

Just wanted to report in, it still works great!

@RalfWinter
Copy link

Great! Thanks.

@ivik
Copy link
Author

ivik commented Jun 8, 2024

Still going strong, no issues at all! Close this ticket whenever you feel it's time to close it but for me it all works great!
Thx for all the help!

@ivik
Copy link
Author

ivik commented Jun 28, 2024

I will create a new ticket directly under the goodwe integration page but something has happened the last couple of 3-4 days. It looses connection couple of times each minute. I have also tried using different version of the goodwe code, still same issue, all the way back to 0.9.9.25.

I will add more info under a new created ticket: mletenay/home-assistant-goodwe-inverter#292

@RalfWinter
Copy link

I received the version 2.0 of the Wifi/LAN Kit, installed it Tuesday and works perfect with the modbus setting. The only thing I recognized: regardless of polling interval below 20 seconds: it will not poll shorter than 20 seconds, bug or feature?

@ivik : did you check for changes in your environment? New firmware versions?

@ivik
Copy link
Author

ivik commented Jun 28, 2024

For me it works with 5s interval. I changed to 10s to see if it behaves better after the issue, did not make a difference. Not sure about new firmware updates.

I received a new Goodwe unit (same model as before) and updated it to the newest version of everything. Could have been some new firmware that was updated but pretty sure it was the same as old the old unit (arm v8).

@ivik
Copy link
Author

ivik commented Jun 28, 2024

I checked the firmware, the arm seems to be newer version that came out 29 may.

Screenshot_20240628_214937_SolarGo

@RalfWinter
Copy link

I would ask Goodwe support for an update. I received updates this week for my ET15, here is what I have:
Screenshot_20240630_215054_SolarGo

But be aware that "three phased balanced output" must be off with my versions, if on the WR stops to charge battery and push energy to grid intermittently.

BTW, your communication module version seems quite old in case you have the LAN/Wifi 2.0 installed.

@ivik
Copy link
Author

ivik commented Jun 30, 2024

How do i get the coms module updated, when i use the solargo app no new updates are displayed.

@RalfWinter
Copy link

I received my updates due to an open ticket (my ET 15 pushed >100 watts into grid when on battery).

You could register there and open a ticket to get the latest updates pushed:
https://goodwetechnology.zendesk.com/hc/en-gb

@ivik
Copy link
Author

ivik commented Jul 15, 2024

Goodwe updated firmware, ARM and Communication module, I did not get new DSP firmware and the communication module is not v 2.0.1 but it is newer then the one I had before. So far it looks and works good. I will continue talks with Goodwe and see if I can get a new DSP firmware and newer Communication module firmware.

Communication module firmware, I had: v1.2.32 but now I got: v1.3.53
ARM firmware, I had: v08.401 but now I got: v09.403
But DSP is still the old one: v07.7068

@UserChristian
Copy link

I have the same problem with my Goodwe Hybrid Inverter (ET 25k) and the latest DSP firmware is already installed on my system.
image
It doesn't seem to be due to the communication, because I can query a few common addresses via Modbus Poll.
image

@fever3
Copy link

fever3 commented Oct 8, 2024

Is there any solution to the issue using the v2 WIFI/LAN Module?

I'm using a GW20K-ET inverter with the v2 WIFI/LAN Module (WLA0000-01-00P) and have the same issue.
SEMS portal or connecting to the inverter using the goodwe Python lib (https://github.com/marcelblijleven/goodwe) works.

@mletenay
Copy link
Contributor

mletenay commented Oct 8, 2024

Not sure what problem you are referring to, but the V2 is supported in the experimental HACS version of the integration - https://github.com/mletenay/home-assistant-goodwe-inverter.
It will be ported to core HA integration in next few weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants