core icon indicating copy to clipboard operation
core copied to clipboard

adding goodwe to homeassistant breaks SEMS portal

Open rflx18 opened this issue 1 year ago • 87 comments

The problem

hi, once i add the goodwe inverter do the homeassistant it breaks the SEMS portal, it stops updating SEMS portal, i tried to update interval in only 2 minutes but even like this it breaks, as soon as i add the homeassistant integration SEMS stop working. any workaround or im the only one facing this problem?

What version of Home Assistant Core has the issue?

2023.10.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Goodwe

Link to integration documentation on our website

No response

Diagnostics information

if i remove Goodwe integration, SEMS start working.

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

rflx18 avatar Oct 11 '23 12:10 rflx18

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.

(message by CodeOwnersMention)


goodwe documentation goodwe source (message by IssueLinks)

home-assistant[bot] avatar Oct 11 '23 14:10 home-assistant[bot]

INVERTER: GW15K-ET

Facing the same issue, tried different polling intervals from 30 seconds to 5 minutes.

The green COM LED on the inverter blinks, signaling "Server error".

Only disabling the home assistant updates and restarting the inverter (or it's WiFi module) restores connectivity with the SEMS portal.

sergioafeo avatar Oct 14 '23 07:10 sergioafeo

Same here.

Baeda73 avatar Oct 14 '23 17:10 Baeda73

yup, confirming the issue, inverter is offline in SEMS portal after last HA update

EDIT:

I tried changing the default DNS and the inverter returned online again. This can be done from either the app, connected to the inverter ap or the web interface via the inverter ip address. hope it helps someone

roby70cr avatar Oct 17 '23 07:10 roby70cr

same here.

I installed a GoodWe 3600-SBP-20 inverter some days ago.

I added the goodwe integration this evening at around 19:12 immediately stopped all communication to the SEMS portal.

Disabling the integration an restarting the inverter did fix the SEMS connection (but of corse no data in homeassistant.

Ventusfahrer avatar Oct 17 '23 19:10 Ventusfahrer

yup, confirming the issue, inverter is offline in SEMS portal after last HA update

EDIT:

I tried changing the default DNS and the inverter returned online again. This can be done from either the app, connected to the inverter ap or the web interface via the inverter ip address. hope it helps someone

Didn't work for me, portal is still not receiving data while integration to HA is enabled.

lordjson avatar Oct 18 '23 11:10 lordjson

yup, confirming the issue, inverter is offline in SEMS portal after last HA update

EDIT:

I tried changing the default DNS and the inverter returned online again. This can be done from either the app, connected to the inverter ap or the web interface via the inverter ip address. hope it helps someone

Where did you change the default DNS? What did you change it to?

sergioafeo avatar Oct 18 '23 15:10 sergioafeo

yup, confirming the issue, inverter is offline in SEMS portal after last HA update

EDIT:

I tried changing the default DNS and the inverter returned online again. This can be done from either the app, connected to the inverter ap or the web interface via the inverter ip address. hope it helps someone

Where did you change the default DNS? What did you change it to?

In the web ui, changed it to 8.8.4.4.

lordjson avatar Oct 18 '23 15:10 lordjson

Where did you change the default DNS? What did you change it to?

web_page

find the ip address, open it in a web browser, click on advanced, I set up a static ip address and changed the DNS server (as lordjson said previously, you can use 8.8.4.4 or 8.8.8.8

roby70cr avatar Oct 18 '23 15:10 roby70cr

Where did you change the default DNS? What did you change it to?

web_page

find the ip address, open it in a web browser, click on advanced, I set up a static ip address and changed the DNS server (as lordjson said previously, you can use 8.8.4.4 or 8.8.8.8

That's what I did but didn't work.

lordjson avatar Oct 18 '23 15:10 lordjson

try your router address

roby70cr avatar Oct 18 '23 15:10 roby70cr

Thanks for the explanation. Unfortunately it didn't work. So far the only work around is to reduce the polling frequency of HA to 10 minutes or more. Better than nothing. Sadly, such low frequency does not allow for any interesting active control automations.

sergioafeo avatar Oct 18 '23 17:10 sergioafeo

I'm sure you did it, did you restart inverter wifi module and integration? Just checking

roby70cr avatar Oct 18 '23 17:10 roby70cr

Yes, both restarted, even restarted home assistant for good measure. It seems like the WiFi module is not programmed to receive Modbus UDP packets while sending to the SEMS portal. With increased poll frequency, the higher the likelihood of sending a request while the sending process is ongoing, corrupting or interrupting the inverter's response. I have started debugging the goodwe python package that is used by this extension. On some cases Modbus read requests are ignored completely (and timeout) or, more interestingly, an invalid response (100s of bytes instead of the 19 expected) is returned. As if a read request ends up intercepting the packet that the inverter had prepared for the SEMS portal.

sergioafeo avatar Oct 18 '23 17:10 sergioafeo

try your router address

Doesn't work either. Everything was restarted.

lordjson avatar Oct 19 '23 07:10 lordjson

No change after upgrading HA to 2023.10.5.

The connection from the inverter to the SEMS portal immediately terminates after activating the Goodwe integration.

This does not happen when using the command line tool https://pypi.org/project/goodwe/

Ventusfahrer avatar Oct 23 '23 18:10 Ventusfahrer

HA integration is using that goodwe library. Does the command line works (does not break SEMS) even when executed in those regular intervals ?

mletenay avatar Oct 24 '23 07:10 mletenay

HA integration is using that goodwe library. Does the command line works (does not break SEMS) even when executed in those regular intervals ?

well, this was a very good hint and may point us to the root cause of problem!

I first just played around with the example code:

import asyncio
import goodwe


async def get_runtime_data():
    ip_address = '192.168.1.14'

    inverter = await goodwe.connect(ip_address)
    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}")


asyncio.run(get_runtime_data())

if you run this python script more even more often, it does not look to cause a probllem.

Then in modified it to automate some more stress, and repeat the get_runtime_data() more often without leaving the process to

repeat = 0
while repeat < int(sys.argv[1]):
    asyncio.run(get_runtime_data())
    print(f'#{repeat}: {datetime.datetime.now()}')
    repeat += 1
    time.sleep(int(sys.argv[2]))

A rerun of the script with repeat number of 100 and a sleep time of 3 seconds the script crashed with following exception:

meter_apparent_power_total: 		 Meter Apparent Power Total = -801 VA
meter_type: 		 Meter Type = 2 
meter_sw_version: 		 Meter Software Version = 5 
#64: 2023-10-24 12:29:50.103678
Traceback (most recent call last):
  File "/home/peter/nextcloud/dev/GoodWe/Modbustest/modbustest.py", line 20, in <module>
    asyncio.run(get_runtime_data())
  File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/peter/nextcloud/dev/GoodWe/Modbustest/modbustest.py", line 11, in get_runtime_data
    inverter = await goodwe.connect(ip_address)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/peter/bin/python3p/lib/python3.11/site-packages/goodwe/__init__.py", line 52, in connect
    return await discover(host, timeout, retries)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/peter/bin/python3p/lib/python3.11/site-packages/goodwe/__init__.py", line 106, in discover
    raise InverterError(
goodwe.exceptions.InverterError: Unable to connect to the inverter at host=192.168.221.222, or your inverter is not supported yet.
Failures=[MaxRetriesException(), RequestFailedException('No valid response received even after 3 retries', 1), RequestFailedException('No valid response received even after 3 retries', 1), RequestFailedException('No valid response received even after 3 retries', 1)]

The exception is the same when I restart the inverter using the web-interface. Maybe it indicates a crash of the controler of the inverter?

But after this error I need to restart the inverter manually (via web-interface) in order to get it back to SEMS. But today I have the problem, that the SoC Curve keeps "0" even the right value is signaled in the Battery Symbol.

Hours later the inverter updates SEMS with statistics data and the SoC Line is showing the right results. Very strange

Ventusfahrer avatar Oct 24 '23 11:10 Ventusfahrer

Yes, it seems that "too frequent" requests to inverter cause it to fail and probably disconnect from network. The major issue is that this behavior is not that common, most of the inverters seem to behave properly and do not fail. And so far nobody was able to identify if it is inverter or firmware or local network specific issue.

mletenay avatar Oct 25 '23 18:10 mletenay

well, "too frequent" updates. But what is too frequent? 1 minute?

In the integration documentation I already found this hint, disabled the automatical update and implemented the sugested automation triggering the update of the goodwe entities every 1 minute.

It does not last 10 minutes until the com-LED of the inverter starts blinking which indicates that the connection to sems is lost.

Network issues are very unlikely, the inverter is located with a distance of less than one meter to the WLAN router, the signal qualitiy is very good.

Ventusfahrer avatar Oct 25 '23 19:10 Ventusfahrer

I was able to sniff the network traffic of the inverter.

we can see that the inverter is re-establishing the network connection. (DhCP-Calls to the router) and after that re-connecting to tcp.goodwe-power.com. Bildschirmfoto vom 2023-10-25 22-41-51

Ventusfahrer avatar Oct 25 '23 20:10 Ventusfahrer

I have the same issue with the following goodwe devices:

  • GW15K-ET
  • GW5K-DT

5erv3 avatar Oct 26 '23 06:10 5erv3

even if I reduce the poll rate to 2 Minutes the connection breaks within about 20 minutes.

At the moment I have the impression, that as soon a regular SEMS-Communication sequence is mixed/interrupted by a modbus-udp call the trouble starts. As soon as you stop the modbus-udp calls for 5 minutes the inverter is connecting back to the SEMS portal and is uploading statistic data from the timespan it was not connected to the portal. Looks very much as a firmware issue of the inverter.

At the moment I am testing following:

trigger the poll interval via an automation - you can vary the time between polls. another automation running every hour stopping the poll automation for 5 minutes.

Ventusfahrer avatar Oct 26 '23 06:10 Ventusfahrer

I suspect it is firmware specific but have no proof/explanation. The default polling is 30s. There are more than 1100 installations out there and I believe most work just fine. I have 10K-ET inverter and I am running it with 10s polling for 3 years without any problem :-(

mletenay avatar Oct 26 '23 08:10 mletenay

I have a GW8K-DT and I am experiencing this problem. I have tried to change the polling interval without success, and if I start poll locally it will not establish a working connection to SEMS until the inverter is restarted even-though I stop the polling.

I suspect that this is a quite common problem but that there are users like me that thinks that it is more important to fetch the data locally in HA, and they never use the SEMS app/portal. But I still think that it would be good if both interfaces works in parallel.

git-joen avatar Oct 28 '23 11:10 git-joen

I've got what looks to be the same issue, started only a few days ago. The inverter GW5000 is disconnecting from my WLAN.

If I reset the W/L interface via the panel on the front then it reconnects and starts providing data for a short period of time before it drops off the network again.

I've also tried resetting the WLAN interface via the buttons on the inverter which temporarily fixes it before failing again.

I've found that if I block internet access for the inverter then data resumes flowing through to HA but instead of failing within minutes it continues for up to 2 hours.

I have a backup from 2 months ago so will restore to it and see if it corrects the problem.

banemonster avatar Nov 04 '23 09:11 banemonster

Same issue here Goodwe GW8K-ET

rocco12378 avatar Nov 08 '23 20:11 rocco12378

I've solved my problem, it appears it wasn't related to this issue although the symptoms were similar.

I have a Ubiquiti Amplifi HD router at the far end of the house with a satellite meshpoint closer to the inverter.

It turned out the setting a setting on the router was enabled to direct all traffic to the main router.

In the morning my inverter would turn on and connect to the wifi via the meshpoint, it was then directed to connect to the router, this would initially be successful however some time later the connection would drop. Possibly this was due to wifi congestion from other devices or neighbours.

Once the wifi connection dropped it wouldn't re-establish unless I used the 'wifi reset' option on the inverter or restarted the whole inverter.

As soon as I disabled the router steering option on my Amplifi HD router and restarted the inverter the issue dissapeared.

I'm unsure if this option was enabled automatically during a firmware update on my router, but it's possible.

banemonster avatar Nov 08 '23 21:11 banemonster

Tested it with the lastest FW on GW15K-ET, still the same issue. After some minutes, SEMS connection is lost.

5erv3 avatar Nov 16 '23 09:11 5erv3

even if I reduce the poll rate to 2 Minutes the connection breaks within about 20 minutes.

At the moment I have the impression, that as soon a regular SEMS-Communication sequence is mixed/interrupted by a modbus-udp call the trouble starts. As soon as you stop the modbus-udp calls for 5 minutes the inverter is connecting back to the SEMS portal and is uploading statistic data from the timespan it was not connected to the portal. Looks very much as a firmware issue of the inverter.

At the moment I am testing following:

trigger the poll interval via an automation - you can vary the time between polls. another automation running every hour stopping the poll automation for 5 minutes.

@Ventusfahrer did this work for you?

5erv3 avatar Nov 16 '23 09:11 5erv3