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

adding goodwe to homeassistant breaks SEMS portal #101817

Open
rflx18 opened this issue Oct 11, 2023 · 125 comments
Open

adding goodwe to homeassistant breaks SEMS portal #101817

rflx18 opened this issue Oct 11, 2023 · 125 comments
Assignees

Comments

@rflx18
Copy link

rflx18 commented Oct 11, 2023

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
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.

(message by CodeOwnersMention)


goodwe documentation
goodwe source
(message by IssueLinks)

@sergioafeo
Copy link

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
Copy link

Baeda73 commented Oct 14, 2023

Same here.

@roby70cr
Copy link

roby70cr commented Oct 17, 2023

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
Copy link

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
Copy link

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
Copy link

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
Copy link

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
Copy link

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
Copy link

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
Copy link

try your router address

@sergioafeo
Copy link

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
Copy link

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

@sergioafeo
Copy link

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
Copy link

try your router address

Doesn't work either. Everything was restarted.

@Ventusfahrer
Copy link

Ventusfahrer commented Oct 23, 2023

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
Copy link
Contributor

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

@Ventusfahrer
Copy link

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
Copy link
Contributor

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
Copy link

Ventusfahrer commented Oct 25, 2023

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
Copy link

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
Copy link

5erv3 commented Oct 26, 2023

I have the same issue with the following goodwe devices:

  • GW15K-ET
  • GW5K-DT

@Ventusfahrer
Copy link

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
Copy link
Contributor

mletenay commented Oct 26, 2023

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
Copy link

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
Copy link

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
Copy link

Same issue here Goodwe GW8K-ET

@GIJOE-SA
Copy link

@mletenay Unfortunately still having the same issue after changing it to 0 on my side.

@roboco6
Copy link

roboco6 commented May 29, 2024

Hello @RalfWinter,

I cannot find settings-->integrations-->Goodwe Inverter-->configure.

What am I doing wrong?

Bildschirmfoto 2024-05-29 um 23 47 51
Bildschirmfoto 2024-05-29 um 23 13 18

Thank you in advance!

Rasmus

Hello @Dwayneohara , we take all the money you can spare :-))) Just kidding....did you try to extend the polling interval to 180 seconds? In my case this helped a lot. You do that by going into settings-->integrations-->Goodwe Inverter-->configure, following window pops up:

@Dwayneohara
Copy link

Got mine working, and the Magic 127second Polling interval suggested on some of the forums is stable for me , Just like @roboco6 screen shots above i'm connected but sadly the import / export values never work, is there a trick to getting them to work ?

@garv3
Copy link

garv3 commented May 29, 2024

@roboco6 Not sure, but maybe this is only available with the experimental version of the integration. Which one did you install?

@5erv3
Copy link

5erv3 commented May 30, 2024

@garv3
There is another bug for this issue, still unresolved unfortunately:
#105061

@RalfWinter
Copy link

What am I doing wrong?

As @garv3 said, you have the official version installed, you need to uninstall and install the custom version from HACS. Then it looks like this:
Screenshot_20240530_083809_Home Assistant

@mletenay
Copy link
Contributor

@Dwayneohara @5erv3 There are no differences in provided sensors between HA and HACS.
They are identical in this aspect.
And the #105061 is still open, since it is not integration problem.
Somehow some of the larger inverters do not provide those values (or are not configured to do so ?).

@roboco6
Copy link

roboco6 commented May 30, 2024

Thank you @RalfWinter and @garv3 for your help! I managed to intall the experimental version and the magic 127s polling interval seems (not sems...haha) to work for me!

@fcaputo
Copy link

fcaputo commented Jun 20, 2024

I'm with a GW29.9K-ET and I have the same issue. I wonder, why this should have something todo with the polling interval. I sniffed the traffic from PVMaster and it's polling every 3 seconds without breaking anything. Would it help If I upload the pcapng files?

@fcaputo
Copy link

fcaputo commented Jun 20, 2024

I can't find the optional settings. I only have the system options:
Bildschirmfoto 2024-06-20 um 18 09 51

@RalfWinter
Copy link

You have the official Goodwe integration installed which has no configuration option, you need the custom Integration from HACS, then you can configure the polling interval:
Screenshot_20240620_184734_Home Assistant~2

@fcaputo
Copy link

fcaputo commented Jun 20, 2024

Thanks. Unfortunately i can't find any tutorial how to install via HACS.

@RalfWinter
Copy link

You need to uninstall the official version first and then go into HACS and add the experimental version.

@AlexStasse
Copy link

AlexStasse commented Aug 2, 2024

Another data point here:
GW8500-MS-30 Inverter (MS G3 series).
Default integration broke SEMS.
Experimental integration with 1 minute polling broke SEMS.
Experimental integration with 10 minute polling doesn't break SEMS.
The magic 127 second polling time also works, I could check a shorter time but good enough for me.

@oddife
Copy link

oddife commented Sep 30, 2024

Another Inverter here:
GW8000-SDT-20 Inverter
Default integration broke SEMS.
Experimental integration with 1 minute polling broke SEMS.
The magic 127 second polling time also does not work.

@kineticscreen
Copy link

Another Inverter here: GW8000-SDT-20 ... The magic 127 second polling time also does not work.

Have found with the GW5000-SDT-20 and GW8KAU-DT that an update frequency of 151 seconds works for both. It does reduce the update frequency of SEMS to between 3 - 6 minutes

Unfortunately for all the sensors this integration produces (46 for each inverter) I don't get any consumption data from either the grid nor the PV, and can't t connect directly to the (3 phase) Homekit HK3000

@oddife
Copy link

oddife commented Sep 30, 2024

Another Inverter here: GW8000-SDT-20 ... The magic 127 second polling time also does not work.

Have found with the GW5000-SDT-20 and GW8KAU-DT that an update frequency of 151 seconds works for both. It does reduce the update frequency of SEMS to between 3 - 6 minutes

Unfortunately for all the sensors this integration produces (46 for each inverter) I don't get any consumption data from either the grid nor the PV, and can't t connect directly to the (3 phase) Homekit HK3000

Will try this today and report

@oddife
Copy link

oddife commented Oct 1, 2024

Another Inverter here: GW8000-SDT-20 ... The magic 127 second polling time also does not work.

Have found with the GW5000-SDT-20 and GW8KAU-DT that an update frequency of 151 seconds works for both. It does reduce the update frequency of SEMS to between 3 - 6 minutes
Unfortunately for all the sensors this integration produces (46 for each inverter) I don't get any consumption data from either the grid nor the PV, and can't t connect directly to the (3 phase) Homekit HK3000

Will try this today and report

can confirm this works on my inverter

@kineticscreen
Copy link

kineticscreen commented Oct 1, 2024

can confirm this works on my inverter

I've got an even better solution for you that I've been testing today:

If you're also running the SEMS Cloud integration, turn off automatic polling on this API Integration, and manually trigger it via an automation every time the SEMS sensors update. By polling straight after SEMS has updated, you necessarily avoid a clash, and thus can get the maximum update rate possible.

Here's the most basic version of the automation:

alias: Manual Trigger GoodWe API Update
description: "Locally polls the GoodWe inverter immediately after SEMS does"
trigger:
  - platform: state
    entity_id:
      - sensor.[inverter sensor provided by GoodWe Cloud SEMS integration]
condition: []
action:
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
  - action: homeassistant.update_entity
    metadata: {}
    data:
      entity_id:
        - sensor.[inverter sensor provided by the local API integration]
mode: restart

@oddife
Copy link

oddife commented Oct 1, 2024

can confirm this works on my inverter

I've got an even better solution for you that I've been testing today:

If you're also running the SEMS Cloud integration, turn off automatic polling on this API Integration, and manually trigger it via an automation every time the SEMS sensors update. By polling straight after SEMS has updated, you necessarily avoid a clash, and thus can get the maximum update rate possible.

Here's the most basic version of the automation:

alias: Manual Trigger GoodWe API Update
description: "Locally polls the GoodWe inverter immediately after SEMS does"
trigger:
  - platform: state
    entity_id:
      - sensor.[inverter sensor provided by GoodWe Cloud SEMS integration]
condition: []
action:
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
  - action: homeassistant.update_entity
    metadata: {}
    data:
      entity_id:
        - sensor.[inverter sensor provided by the local API integration]
mode: restart

Can you please clarify this (- sensor.[inverter sensor provided by the local API integration]) I'm confused.

@kineticscreen
Copy link

kineticscreen commented Oct 1, 2024

For this I'm assuming you have both of these integrations set up and provided data about your inverter
image

So the idea is you trigger the native Goodwe integration to update when the SEMS API one does. To do so, you just force home assistant to update any sensor that comes from that integration - for example your current solar production - that's what I'm trying to indicate with the square brackets in that entity. i.e. sensor.active_power
Any sensor will do, because whatever it is it will force the integration to poll the inverter.

@oddife
Copy link

oddife commented Oct 1, 2024

For this I'm assuming you have both of these integrations set up and provided data about your inverter image

So the idea is you trigger the native Goodwe integration to update when the SEMS API one does. To do so, you just force home assistant to update any sensor that comes from that integration - for example your current solar production - that's what I'm trying to indicate with the square brackets in that entity. i.e. sensor.active_power Any sensor will do, because whatever it is it will force the integration to poll the inverter.

Copy got it, inverter sends data to semsportal every 5 minutes so this will poll data after that.

@LAPDragnet
Copy link

How often does the SEMS Cloud integration typically update its values?

@oddife
Copy link

oddife commented Oct 2, 2024

How often does the SEMS Cloud integration typically update its values?

The update points on the SEMS portal graphs is every 5 minutes.

@kineticscreen
Copy link

Ah OK, I'm dealing with 2 inverters, and they both update SEMS every 2 minutes, but 1 minute apart.

@oddife
Copy link

oddife commented Oct 2, 2024

Ah OK, I'm dealing with 2 inverters, and they both update SEMS every 2 minutes, but 1 minute apart.

Ah that's reason you can use the previous script to update once SEMS API does, unfortunately for me it will be every five minutes which is bad.

@LAPDragnet
Copy link

Ah OK, I'm dealing with 2 inverters, and they both update SEMS every 2 minutes, but 1 minute apart.

Ah that's reason you an use the previous script to update one SEMS API does, unfortunately for me it will be very five minutes which is bad.

Same here, I am spoiled now with only 15-20s between updates ;-)

(I also have a SolarEdge inverter which works fine with both local and cloud integration at the same time. The local integration updates about every 25s.)

@kineticscreen
Copy link

Ah OK, I'm dealing with 2 inverters, and they both update SEMS every 2 minutes, but 1 minute apart.

Ah that's reason you can use the previous script to update once SEMS API does, unfortunately for me it will be every five minutes which is bad.

You could still use a variation of it - get the automation to update when SEMS does, and then get it to wait and loop to update say 3 times over 4 minutes, and then let the automation get triggered again by SEMS to restart.

That way you can still poll more often than every 5 minutes, but still have it wait to start the sequence by the SEMS triggering, rather than just hoping that your frequency of updates doesn't clash.

@kineticscreen
Copy link

The update points on the SEMS portal graphs is every 5 minutes.

Oh I think you'll find that it actually is updating more frequently than that - they just have the graph in the UI limited to 5 minute increments.

Set up the SEMS integration in HA and you'll see exactly how frequently the sensors update.

@oddife
Copy link

oddife commented Oct 2, 2024

The update points on the SEMS portal graphs is every 5 minutes.

Oh I think you'll find that it actually is updating more frequently than that - they just have the graph in the UI limited to 5 minute increments.

Set up the SEMS integration in HA and you'll see exactly how frequently the sensors update.

Ahh will try that asap, since I'm new to home assistant that script goes in automations.yaml right.

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