home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
70.56k stars 29.48k forks source link

adding goodwe to homeassistant breaks SEMS portal #101817

Open rflx18 opened 10 months ago

rflx18 commented 10 months ago

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

home-assistant[bot] commented 10 months ago

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)

sergioafeo commented 10 months ago

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.

Baeda73 commented 10 months ago

Same here.

roby70cr commented 10 months ago

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

Ventusfahrer commented 10 months ago

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.

lordjson commented 10 months ago

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.

sergioafeo commented 10 months ago

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?

lordjson commented 10 months ago

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.

roby70cr commented 10 months ago

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

lordjson commented 10 months ago

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.

roby70cr commented 10 months ago

try your router address

sergioafeo commented 10 months ago

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.

roby70cr commented 10 months ago

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

sergioafeo commented 10 months ago

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.

lordjson commented 10 months ago

try your router address

Doesn't work either. Everything was restarted.

Ventusfahrer commented 10 months ago

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/

mletenay commented 10 months ago

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

Ventusfahrer commented 10 months ago

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

mletenay commented 10 months ago

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.

Ventusfahrer commented 10 months ago

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 commented 10 months ago

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

5erv3 commented 10 months ago

I have the same issue with the following goodwe devices:

Ventusfahrer commented 10 months ago

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.

mletenay commented 10 months ago

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 :-(

git-joen commented 10 months ago

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.

banemonster commented 9 months ago

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.

rocco12378 commented 9 months ago

Same issue here Goodwe GW8K-ET

banemonster commented 9 months ago

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.

5erv3 commented 9 months ago

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

5erv3 commented 9 months ago

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?

Ventusfahrer commented 9 months ago

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?

yes, it's working with following automations (for a better portability in yaml - format):

alias: 7vBatterySensorsUpdate
description: "triggers reading of the GW-Inverter all sensor values (entity-id has to be one (any) of the PV-Inverter-sensors"
trigger:
  - platform: time_pattern
    hours: "*"
    minutes: "*"
    seconds: /15
condition: []
action:
  - service: homeassistant.update_entity
    data: {}
    target:
      entity_id: sensor.pv1_power
mode: single

The trigger-interval (currently 15 seconds) can be even shorter, but that is not necessary in my case.

The second automation disables the first one every hour for 4 minutes. This time is in my environment sufficient for the inverter to reconnect to SEMS and update all information without having a gap in the data.

alias: Goodwe Sems Update Pause
description: "turns off reading sensor values per modbus for 4 minutes"
trigger:
  - platform: time_pattern
    hours: /1
condition: []
action:
  - service: automation.turn_off
    data:
      stop_actions: true
    target:
      entity_id: automation.7vbatterysensorsupdate
  - delay:
      hours: 0
      minutes: 4
      seconds: 0
      milliseconds: 0
  - service: automation.turn_on
    data: {}
    target:
      entity_id: automation.7vbattery
mode: single
roccolord commented 9 months ago

I have the same problem. Connected a GW15KT-DT (firmware 15.15.52) to my HA Green, SEMS data stopped almost instantly. Disable Goodwe integration in HA, data resumed to SEMS by itself after a couple of minutes.

smileyman-1 commented 8 months ago

I have the same issue on a GW10KT-DT: If the interval is less than 180 seconds, the SEMS portal doesn't receive any information. I suspect that the WIFI module (OEM manufacturer: Hi-Flying) needs to be set to Multi-Connection (Socket-B-Connection or Multi-TCP Link Connection)?! According to the documentation, the module should support this, but so far, I haven't been able to send AT commands to the WIFI module; otherwise, we could try that. It should work via TCPUDPbg (http://www.hi-flying.com/applications-1), but unfortunately, I'm unable to establish a connection. Perhaps it would work via the COM port?

garv3 commented 8 months ago

I've got the same problem here with my GW25K-ET! Just won't connect to SEMS Portal if the integration is enabled.

smileyman-1 commented 8 months ago

I have a GW10KT-DT. With firmware version 19, SEMS was no longer usable at intervals of less than 180 seconds. With firmware version 20 (available since last week), it works even with an interval of 131 seconds. At an interval of 130 seconds, SEMS still updates, but the latest value is always the same as the one before. Below 130 seconds, it doesn't work at all.

schumi7604 commented 8 months ago

Same here with a 5 months old GW10KT-DT. After disabling the Goodwe Integration the Flashing yellow light indicating that No Internet was available disappeared and now info is back on Sems. When using Home Wizard, you are able to get some info via that Integration. But no direct info from the Inverter.

roccolord commented 7 months ago

I have a GW10KT-DT. With firmware version 19, SEMS was no longer usable at intervals of less than 180 seconds. With firmware version 20 (available since last week), it works even with an interval of 131 seconds. At an interval of 130 seconds, SEMS still updates, but the latest value is always the same as the one before. Below 130 seconds, it doesn't work at all.

Just an offtopic question, where do you find the new firmwares for the inverter?

smileyman-1 commented 7 months ago

Just an offtopic question, where do you find the new firmwares for the inverter?

https://drive.google.com/drive/folders/110hBxoNVC4M9F_GK5sKP7uq_aDNxwstZ

damianocosco commented 7 months ago

Hi, i have the same problem on GW6000-ES-20. does anyone have any news? Thank you

tuomasva commented 7 months ago

Hi, i have the same problem on GW6000-ES-20.

does anyone have any news? Thank you

just disable the automatic polling and create an update automation yourself for example every 3-4min or lower until you find the sweet spot. I have it as 3 min with my GW6000ES20

There is currently no real fix, just good workarounds.

Raupinger commented 6 months ago

Hi there. I'm having this issue as well. Is there any good way to do a polling automation that updates all entities of the inverter? tried selecting the device but that doesn't do anything.

tuomasva commented 6 months ago

Hi there. I'm having this issue as well. Is there any good way to do a polling automation that updates all entities of the inverter? tried selecting the device but that doesn't do anything.

Yes, mentioned in the thread above, just read all messages carefully. You need to only poll one, and it will update all, but it is all in the messages above.

Ventusfahrer commented 6 months ago

As I really do not like HomeAssistants Autmations I am using Node-Red as long as possible.

image

Represents the needed functionality in Node-Red. Why so complicate? Well, if calling the automation when the device isn't online will generate unnecessary errors in HomeAssistant logfiles. Therefore I am stoping the automation, whenever the device isn't online and restarting it if it is online again.

You will find the flow in the attached zip-file for download and import into your Node-Red installation.

GoodWeUpdateEntities.zip

Have fun with it!

roby70cr commented 6 months ago

.... Have fun with it!

I downloaded the file and imported but the flow keeps throwing in errors...

Ventusfahrer commented 6 months ago

orted but the flow keeps throwing in errors...

Did you adjust the parameters in the blue nodes to fit your installation?

roby70cr commented 6 months ago

Did you adjust the parameters in the blue nodes to fit your installation?

Yes, but probably need to double check

GIJOE-SA commented 5 months ago

Hi, i have the same problem on GW6000-ES-20. does anyone have any news? Thank you

Also upgraded to the new G2 from my old ES and now have this issue. Tried to log a call with Goodwe but got this response:

"Perhaps you can only use one app a time. We honestly can not provide a resolve when using a third party monitoring app. If the G2 wifi dongle is working on the inverter there is nothing else we can assist with."

tuomasva commented 5 months ago

Hi, i have the same problem on GW6000-ES-20. does anyone have any news? Thank you

Also upgraded to the new G2 from my old ES and now have this issue. Tried to log a call with Goodwe but got this response:

"Perhaps you can only use one app a time. We honestly can not provide a resolve when using a third party monitoring app. If the G2 wifi dongle is working on the inverter there is nothing else we can assist with."

Did you try this workaround: https://github.com/home-assistant/core/issues/101817#issuecomment-1887492434

GIJOE-SA commented 5 months ago

Did you try this workaround: #101817 (comment)

Hi tuomasva, I have implemented the workaround, thank you for posting it. I did make one change which I found somewhere on the forum. I am updating sensors every 10 seconds and then disabling the sensor updates for 3 minutes every 57 minutes which seems to be enough to update SEMS Cloud with data.

RalfWinter commented 4 months ago

I also experienced the issue (GW15K-ET). For me it was sufficient to increase the polling interval from 10 seconds to 180 seconds. Not nice, but now the inverter does not lose the connection to SEMS.