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

Not working since v0.9.9.18 #280

Open
kolossboss opened this issue May 10, 2024 · 67 comments
Open

Not working since v0.9.9.18 #280

kolossboss opened this issue May 10, 2024 · 67 comments

Comments

@kolossboss
Copy link
Contributor

Hi,

for me, the integration is not working since [v0.9.9.18].
I got either no data and the entities shows unavailable and the Integration is initializing or the entities shows a value but did not update for hours.
If I went back to v0.9.9.17 everything went normal again.
I'm running an GW3648-EM Inverter.

Not sure, how I help solving this issue.

Thats the only Log entry:

Error fetching GoodWe data: ('No valid response received even after 6 retries', 4)

@Legnava89
Copy link

I have the same problem. The entity sensor.today_s_pv_generation and sensor.today_battery_charge are not updated always after midnight.
if I go back to version v0.9.9.17, everything is fine.
It doesn't work since v0.9.9.18.
I have a GW10K-ET converter

@mletenay
Copy link
Owner

mletenay commented May 10, 2024

@Legnava89 this is probably the problem of #279 #281

@kolossboss Could you please set the log level to DEBUG and provide the logs ?

@Legnava89
Copy link

@mletenay Yes, it's the same problem as here

@mletenay
Copy link
Owner

@kolossboss Could you please enable debug log and attach the log output ?

@kolossboss
Copy link
Contributor Author

Hi, thanks for reply. Sorry for late response.
I can do that, this evening.I came back from holiday today.

@kolossboss
Copy link
Contributor Author

Hi, today I enabled the debug log and installed the latest version.

thats the output.

Home Assistant Core
2024-05-14 21:04:04.106 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration goodwe which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-05-14 21:04:16.712 DEBUG (MainThread) [goodwe] Connecting to ES family inverter at 192.168.2.114:8899.
2024-05-14 21:04:16.712 DEBUG (MainThread) [goodwe.protocol] Creating lock instance for current event loop.
2024-05-14 21:04:16.713 DEBUG (MainThread) [goodwe.protocol] Sending: aa55c07f0102000241
2024-05-14 21:04:16.904 DEBUG (MainThread) [goodwe.protocol] Response has unexpected length: 77, expected 86.
2024-05-14 21:04:16.904 DEBUG (MainThread) [goodwe.protocol] Received invalid response: aa557fc001824d313131314a4757333634382d454d20233130000000000000000000000000003933363438454d553139435830303034333630303431302d30343030302d3131023431302d3032
2024-05-14 21:04:16.904 DEBUG (MainThread) [goodwe.protocol] Sending: aa55c07f0102000241 - retry #1/6
2024-05-14 21:04:17.320 DEBUG (MainThread) [goodwe.protocol] Response has unexpected length: 16, expected 86.
2024-05-14 21:04:17.320 DEBUG (MainThread) [goodwe.protocol] Received invalid response: aa557fc001824d313131314a47573336
2024-05-14 21:04:17.320 DEBUG (MainThread) [goodwe.protocol] Sending: aa55c07f0102000241 - retry #2/6
2024-05-14 21:04:17.745 DEBUG (MainThread) [goodwe.protocol] Response has unexpected length: 82, expected 86.
2024-05-14 21:04:17.745 DEBUG (MainThread) [goodwe.protocol] Received invalid response: aa557fc001824d313131314a4757333634382d454d20233130000000000000000000000000003933363438454d553139435830303034333630303431302d30343030302d3131023431302d30323033342d31
2024-05-14 21:04:17.745 DEBUG (MainThread) [goodwe.protocol] Sending: aa55c07f0102000241 - retry #3/6
2024-05-14 21:04:18.161 DEBUG (MainThread) [goodwe.protocol] Response has unexpected length: 32, expected 86.
2024-05-14 21:04:18.161 DEBUG (MainThread) [goodwe.protocol] Received invalid response: aa557fc001824d313131314a4757333634382d454d2023313000000000000000
2024-05-14 21:04:18.162 DEBUG (MainThread) [goodwe.protocol] Sending: aa55c07f0102000241 - retry #4/6
2024-05-14 21:04:18.584 DEBUG (MainThread) [goodwe.protocol] Received: aa557fc001824d313131314a4757333634382d454d20233130000000000000000000000000003933363438454d553139435830303034333630303431302d30343030302d3131023431302d30323033342d313918102a
2024-05-14 21:04:18.585 DEBUG (MainThread) [goodwe] Connected to inverter GW3648-EM, S/N:93648EMU19CX0004.
2024-05-14 21:04:18.585 DEBUG (MainThread) [goodwe.protocol] Sending: aa55c07f0106000245
2024-05-14 21:04:18.819 DEBUG (MainThread) [goodwe.protocol] Response has unexpected length: 74, expected 149.
2024-05-14 21:04:18.819 DEBUG (MainThread) [goodwe.protocol] Received invalid response: aa557fc001868c052500000003040001000211000300500110006f005f00cd00005300536402000001091b001a0002138201091b0001025a138201020173000000000001292c00005423
2024-05-14 21:04:18.819 DEBUG (MainThread) [goodwe.protocol] Sending: aa55c07f0106000245 - retry #1/6
2024-05-14 21:04:19.124 DEBUG (MainThread) [goodwe.protocol] Response has unexpected length: 76, expected 149.
2024-05-14 21:04:19.124 DEBUG (MainThread) [goodwe.protocol] Received invalid response: aa557fc001868c09ac00000202cc0001000211000300500110006e005f00cd00005300536402000001091b00190002138301091b00010249138301020173000000000001292c0000542300fc
2024-05-14 21:04:19.125 DEBUG (MainThread) [goodwe.protocol] Sending: aa55c07f0106000245 - retry #2/6
2024-05-14 21:04:19.600 DEBUG (MainThread) [goodwe.protocol] Response has unexpected length: 31, expected 149.
2024-05-14 21:04:19.600 DEBUG (MainThread) [goodwe.protocol] Received invalid response: aa557fc001868c052b00000002f40001000211000300500110006d005f00cd
2024-05-14 21:04:19.600 DEBUG (MainThread) [goodwe.protocol] Sending: aa55c07f0106000245 - retry #3/6
2024-05-14 21:04:20.080 DEBUG (MainThread) [goodwe.protocol] Response has unexpected length: 21, expected 149.
2024-05-14 21:04:20.080 DEBUG (MainThread) [goodwe.protocol] Received invalid response: aa557fc001868c0628000002030a00010002110003
2024-05-14 21:04:20.080 DEBUG (MainThread) [goodwe.protocol] Sending: aa55c07f0106000245 - retry #4/6
2024-05-14 21:04:20.556 DEBUG (MainThread) [goodwe.protocol] Response has unexpected length: 10, expected 149.
2024-05-14 21:04:20.557 DEBUG (MainThread) [goodwe.protocol] Received invalid response: aa557fc001868c06de00
2024-05-14 21:04:20.558 DEBUG (MainThread) [goodwe.protocol] Sending: aa55c07f0106000245 - retry #5/6
2024-05-14 21:04:21.046 DEBUG (MainThread) [goodwe.protocol] Response has unexpected length: 117, expected 149.
2024-05-14 21:04:21.046 DEBUG (MainThread) [goodwe.protocol] Received invalid response: aa557fc001868c0708000002000000010002110003005001100076005f00cd00005300536402000001091b001c0003138201091b0001026b138201020173000000000001292c0000542300fc00df000264fe025c01003000000000010000030303000040000018050e150318000000000000000000
2024-05-14 21:04:21.046 DEBUG (MainThread) [goodwe.protocol] Sending: aa55c07f0106000245 - retry #6/6
2024-05-14 21:04:21.523 DEBUG (MainThread) [goodwe.protocol] Response has unexpected length: 71, expected 149.
2024-05-14 21:04:21.523 DEBUG (MainThread) [goodwe.protocol] Received invalid response: aa557fc001868c039300000002da00010002110003005001100079005f00cd00005300536402000001091a001c0000138301091a0001025c138201020173000000000001292c00
2024-05-14 21:04:21.523 DEBUG (MainThread) [goodwe.protocol] Max number of retries (6) reached, request aa55c07f0106000245 failed.
2024-05-14 21:04:21.524 DEBUG (MainThread) [custom_components.goodwe.coordinator] No response received (streak of 1)
2024-05-14 21:04:21.524 DEBUG (MainThread) [custom_components.goodwe.coordinator] Finished fetching GoodWe data in 2.939 seconds (success: True)
2024-05-14 21:04:21.525 DEBUG (MainThread) [goodwe.protocol] Socket closed.
2024-05-14 21:04:21.568 DEBUG (MainThread) [goodwe.protocol] Sending: aa55c07f0109000248
File "/usr/local/lib/python3.12/site-packages/goodwe/protocol.py", line 111, in datagram_received
File "/usr/local/lib/python3.12/site-packages/goodwe/protocol.py", line 408, in <lambda>
File "/usr/local/lib/python3.12/site-packages/goodwe/protocol.py", line 428, in _validate_response
2024-05-14 21:05:21.556 ERROR (MainThread) [homeassistant.components.number] Setup of platform goodwe is taking longer than 60 seconds. Startup will proceed without waiting any longer.
2024-05-14 21:05:21.557 ERROR (MainThread) [homeassistant.components.select] Setup of platform goodwe is taking longer than 60 seconds. Startup will proceed without waiting any longer.
2024-05-14 21:05:21.569 ERROR (MainThread) [homeassistant.components.switch] Setup of platform goodwe is taking longer than 60 seconds. Startup will proceed without waiting any longer.
2024-05-14 21:07:41.463 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=({% if states('sensor.goodwe_pgrid')|float < 0 %}
{{ (states('sensor.goodwe_pgrid')|float * -1)|round(0) }}
ValueError: Template error: float got invalid input 'unknown' when rendering template '{% if states('sensor.goodwe_pgrid')|float < 0 %}
{{ (states('sensor.goodwe_pgrid')|float * -1)|round(0) }}
homeassistant.exceptions.TemplateError: ValueError: Template error: float got invalid input 'unknown' when rendering template '{% if states('sensor.goodwe_pgrid')|float < 0 %}
{{ (states('sensor.goodwe_pgrid')|float * -1)|round(0) }}
2024-05-14 21:07:41.467 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: float got invalid input 'unknown' when rendering template '{% if states('sensor.goodwe_pgrid')|float < 0 %}
{{ (states('sensor.goodwe_pgrid')|float * -1)|round(0) }}
{% endif %}' but no default was specified') while processing template 'Template<template=({% if states('sensor.goodwe_pgrid')|float < 0 %}
{{ (states('sensor.goodwe_pgrid')|float * -1)|round(0) }}
2024-05-14 21:07:41.467 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=({% if states('sensor.goodwe_pgrid')|float > 0 %}
{{ states('sensor.goodwe_pgrid')|float }}
ValueError: Template error: float got invalid input 'unknown' when rendering template '{% if states('sensor.goodwe_pgrid')|float > 0 %}
{{ states('sensor.goodwe_pgrid')|float }}
homeassistant.exceptions.TemplateError: ValueError: Template error: float got invalid input 'unknown' when rendering template '{% if states('sensor.goodwe_pgrid')|float > 0 %}
{{ states('sensor.goodwe_pgrid')|float }}
2024-05-14 21:07:41.469 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: float got invalid input 'unknown' when rendering template '{% if states('sensor.goodwe_pgrid')|float > 0 %}
{{ states('sensor.goodwe_pgrid')|float }}
{% endif %}' but no default was specified') while processing template 'Template<template=({% if states('sensor.goodwe_pgrid')|float > 0 %}
{{ states('sensor.goodwe_pgrid')|float }}
2024-05-14 21:07:41.470 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=({% if (states('sensor.goodwe_house_consumption')|float - states('sensor.goodwe_pback_up')|float) > 0 %}
{{ (states('sensor.goodwe_house_consumption')|float - states('sensor.goodwe_pback_up')|float)|round(0) }}
ValueError: Template error: float got invalid input 'unknown' when rendering template '{% if (states('sensor.goodwe_house_consumption')|float - states('sensor.goodwe_pback_up')|float) > 0 %}
{{ (states('sensor.goodwe_house_consumption')|float - states('sensor.goodwe_pback_up')|float)|round(0) }}
homeassistant.exceptions.TemplateError: ValueError: Template error: float got invalid input 'unknown' when rendering template '{% if (states('sensor.goodwe_house_consumption')|float - states('sensor.goodwe_pback_up')|float) > 0 %}
{{ (states('sensor.goodwe_house_consumption')|float - states('sensor.goodwe_pback_up')|float)|round(0) }}
2024-05-14 21:07:41.472 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: float got invalid input 'unknown' when rendering template '{% if (states('sensor.goodwe_house_consumption')|float - states('sensor.goodwe_pback_up')|float) > 0 %}
{{ (states('sensor.goodwe_house_consumption')|float - states('sensor.goodwe_pback_up')|float)|round(0) }}
{% endif %}' but no default was specified') while processing template 'Template<template=({% if (states('sensor.goodwe_house_consumption')|float - states('sensor.goodwe_pback_up')|float) > 0 %}
{{ (states('sensor.goodwe_house_consumption')|float - states('sensor.goodwe_pback_up')|float)|round(0) }}
2024-05-14 21:07:41.473 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=({% set battery_capacity = 14 %} {% set battery_current = (battery_capacity * (states('sensor.goodwe_battery_soc')|int/100))|round(2) %} {{ battery_current }}) renders=2>
ValueError: Template error: int got invalid input 'unknown' when rendering template '{% set battery_capacity = 14 %} {% set battery_current = (battery_capacity * (states('sensor.goodwe_battery_soc')|int/100))|round(2) %} {{ battery_current }}' but no default was specified
homeassistant.exceptions.TemplateError: ValueError: Template error: int got invalid input 'unknown' when rendering template '{% set battery_capacity = 14 %} {% set battery_current = (battery_capacity * (states('sensor.goodwe_battery_soc')|int/100))|round(2) %} {{ battery_current }}' but no default was specified
2024-05-14 21:07:41.474 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unknown' when rendering template '{% set battery_capacity = 14 %} {% set battery_current = (battery_capacity * (states('sensor.goodwe_battery_soc')|int/100))|round(2) %} {{ battery_current }}' but no default was specified') while processing template 'Template<template=({% set battery_capacity = 14 %} {% set battery_current = (battery_capacity * (states('sensor.goodwe_battery_soc')|int/100))|round(2) %} {{ battery_current }}) renders=4>' for attribute '_attr_native_value' in entity 'sensor.battery_available'
2024-05-14 21:07:41.475 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=({% set battery_capacity = 14 %} {% set battery_current = (battery_capacity * (states('sensor.goodwe_battery_soc')|int/100))|round(2) %} {% set battery_to_charge = (battery_capacity - battery_current)|round(2) %} {{ battery_to_charge }}) renders=2>
ValueError: Template error: int got invalid input 'unknown' when rendering template '{% set battery_capacity = 14 %} {% set battery_current = (battery_capacity * (states('sensor.goodwe_battery_soc')|int/100))|round(2) %} {% set battery_to_charge = (battery_capacity - battery_current)|round(2) %} {{ battery_to_charge }}' but no default was specified
homeassistant.exceptions.TemplateError: ValueError: Template error: int got invalid input 'unknown' when rendering template '{% set battery_capacity = 14 %} {% set battery_current = (battery_capacity * (states('sensor.goodwe_battery_soc')|int/100))|round(2) %} {% set battery_to_charge = (battery_capacity - battery_current)|round(2) %} {{ battery_to_charge }}' but no default was specified
2024-05-14 21:07:41.476 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unknown' when rendering template '{% set battery_capacity = 14 %} {% set battery_current = (battery_capacity * (states('sensor.goodwe_battery_soc')|int/100))|round(2) %} {% set battery_to_charge = (battery_capacity - battery_current)|round(2) %} {{ battery_to_charge }}' but no default was specified') while processing template 'Template<template=({% set battery_capacity = 14 %} {% set battery_current = (battery_capacity * (states('sensor.goodwe_battery_soc')|int/100))|round(2) %} {% set battery_to_charge = (battery_capacity - battery_current)|round(2) %} {{ battery_to_charge }}) renders=4>' for attribute '_attr_native_value' in entity 'sensor.battery_tocharge'

This are the diagnostic informations

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2024.5.3",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.12.2",
    "docker": true,
    "arch": "x86_64",
    "timezone": "Europe/Berlin",
    "os_name": "Linux",
    "os_version": "6.6.29-haos",
    "supervisor": "2024.05.1",
    "host_os": "Home Assistant OS 12.3",
    "docker_version": "25.0.5",
    "chassis": "embedded",
    "run_as_root": true
  },
  "custom_components": {
    "sonoff": {
      "documentation": "https://github.com/AlexxIT/SonoffLAN",
      "version": "3.7.3",
      "requirements": [
        "pycryptodome>=3.6.6"
      ]
    },
    "bambu_lab": {
      "documentation": "https://github.com/greghesp/ha-bambulab",
      "version": "2.0.21",
      "requirements": []
    },
    "presence_simulation": {
      "documentation": "https://github.com/slashback100/presence_simulation",
      "version": "4.8",
      "requirements": []
    },
    "alexa_media": {
      "documentation": "https://github.com/alandtse/alexa_media_player/wiki",
      "version": "4.10.0",
      "requirements": [
        "alexapy==1.27.10",
        "packaging>=20.3",
        "wrapt>=1.14.0"
      ]
    },
    "scheduler": {
      "documentation": "https://github.com/nielsfaber/scheduler-component",
      "version": "v0.0.0",
      "requirements": []
    },
    "goecharger_mqtt": {
      "documentation": "https://github.com/syssi/homeassistant-goecharger-mqtt",
      "version": "0.23.0",
      "requirements": []
    },
    "sems": {
      "documentation": "https://github.com/TimSoethout/goodwe-sems-home-assistant",
      "version": "5.0.0",
      "requirements": []
    },
    "xiaomi_cloud_map_extractor": {
      "documentation": "https://github.com/PiotrMachowski/Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor",
      "version": "v2.2.0",
      "requirements": [
        "pillow",
        "pybase64",
        "python-miio",
        "requests",
        "pycryptodome"
      ]
    },
    "hacs": {
      "documentation": "https://hacs.xyz/docs/configuration/start",
      "version": "1.34.0",
      "requirements": [
        "aiogithubapi>=22.10.1"
      ]
    },
    "goecharger": {
      "documentation": "https://github.com/cathiele/homeassistant-goecharger",
      "version": "0.25.3",
      "requirements": [
        "goecharger==0.0.16"
      ]
    },
    "robonect": {
      "documentation": "https://github.com/geertmeersman/robonect",
      "version": "v1.6.4",
      "requirements": [
        "aiorobonect>=1.0.2",
        "jsonpath"
      ]
    },
    "myuplink": {
      "documentation": "https://github.com/jaroschek/home-assistant-myuplink",
      "version": "1.2.2",
      "requirements": []
    },
    "webrtc": {
      "documentation": "https://github.com/AlexxIT/WebRTC",
      "version": "v3.5.2",
      "requirements": []
    },
    "ui_lovelace_minimalist": {
      "documentation": "https://ui-lovelace-minimalist.github.io/UI/",
      "version": "v1.3.9",
      "requirements": [
        "aiofiles==0.8.0",
        "aiogithubapi>=22.2.4"
      ]
    },
    "fontawesome": {
      "documentation": "https://github.com/thomasloven/hass-fontawesome",
      "version": "2.2.1",
      "requirements": []
    },
    "sems2mqtt": {
      "documentation": "https://github.com/bouwew/sems2mqtt",
      "version": "0.4.9",
      "requirements": []
    },
    "epex_spot": {
      "documentation": "https://github.com/mampfes/ha_epex_spot",
      "version": "2.3.5",
      "requirements": [
        "beautifulsoup4"
      ]
    },
    "nodered": {
      "documentation": "https://zachowj.github.io/node-red-contrib-home-assistant-websocket/guide/custom_integration/",
      "version": "4.0.0",
      "requirements": []
    },
    "goodwe": {
      "documentation": "https://github.com/mletenay/home-assistant-goodwe-inverter",
      "version": "1.0.0",
      "requirements": [
        "goodwe==0.4.1"
      ]
    },
    "auto_backup": {
      "documentation": "https://github.com/jcwillox/hass-auto-backup",
      "version": "1.4.1",
      "requirements": []
    },
    "nibe": {
      "documentation": "https://github.com/elupus/hass_nibe",
      "version": "1.7.3",
      "requirements": [
        "nibeuplink==1.3.0"
      ]
    },
    "alarmo": {
      "documentation": "https://github.com/nielsfaber/alarmo",
      "version": "v1.10.1",
      "requirements": []
    }
  },
  "integration_manifest": {
    "domain": "goodwe",
    "name": "GoodWe Inverter",
    "codeowners": [
      "@mletenay",
      "@starkillerOG",
      "@fizcris"
    ],
    "config_flow": true,
    "documentation": "https://github.com/mletenay/home-assistant-goodwe-inverter",
    "iot_class": "local_polling",
    "issue_tracker": "https://github.com/mletenay/home-assistant-goodwe-inverter/issues",
    "loggers": [
      "goodwe"
    ],
    "requirements": [
      "goodwe==0.4.1"
    ],
    "version": "1.0.0",
    "is_built_in": false
  },
  "data": {
    "config_entry": {
      "entry_id": "54d99f3bd051bf49d4f9283c8da5de67",
      "version": 1,
      "minor_version": 1,
      "domain": "goodwe",
      "title": "GoodWe",
      "data": {
        "host": "192.168.2.114",
        "model_family": "ES"
      },
      "options": {
        "scan_interval": 5,
        "network_retries": 6,
        "network_timeout": 30
      },
      "pref_disable_new_entities": false,
      "pref_disable_polling": false,
      "source": "user",
      "unique_id": "93648EMU19CX0004",
      "disabled_by": null
    },
    "inverter": {
      "model_name": "GW3648-EM",
      "rated_power": 0,
      "firmware": "1111J",
      "arm_firmware": null,
      "dsp1_version": 11,
      "dsp2_version": 11,
      "dsp_svn_version": null,
      "arm_version": 19,
      "arm_svn_version": null
    }
  }
}

@mletenay
Copy link
Owner

Hmm, that is odd. It seems you are receiving truncated/incomplete responses.
Are you sure 0.9.9.17 works properly ? Can you try again ?

@kolossboss
Copy link
Contributor Author

Yes,
I went back to v0.9.9.17 and everything works fine again.

@mletenay
Copy link
Owner

mletenay commented May 15, 2024

There were changes in the code, but the log files look like problem is on network layer, not application.
I do not have explanation for it (yet).
One minor thing, you have timeout value 30 and scan rate 5 - it makes little sense - timeout should be lower than scan rate.

Did you try also the v0.9.9.19 version?

@kolossboss
Copy link
Contributor Author

I always have problems with the network connection. All Goodwe entities, shows sometimes unavailable for a short time. In the past I played a lot with these retry and timeout settings and scan rate 5 and timeout 30 works ok^^
Now I set to scan rate 15 and timeout 10 and will test.
I can also test this with the newer version.
And yes. I tried v0.9.9.18 and 19.
Both same issue.

@kolossboss
Copy link
Contributor Author

Ok I tried again v0.9.9.19 with the new scan rate and timeout settings.
But still not working. All entities are unavailable.
I went back to 17 and it starts working again

@mletenay
Copy link
Owner

That's unfortunate, since I do not have an explanation for that.
What HW are you running on ?
Can you try to test just plain python scripts outside HA ?

@kolossboss
Copy link
Contributor Author

The hardware, HA is running on?
A simple Intel Celeron Mini PC with N5105 CPU and Home Assistant OS.
My network hardware is completely unifi devices, and I have no other network issues at all.

Yes, I think I can run a Python script.

@mletenay
Copy link
Owner

mletenay commented May 16, 2024

Ok, let's try to isolate the problem.
Install pyhton3 (preferably on other machine than HA), install git.
Checkout the library - git clone https://github.com/marcelblijleven/goodwe.git
Then try to run inverter_check.py from tests folder - adjusting the IP address and family to 'ES'

Edit: Actually, no need for git - just download the sources directly - https://github.com/marcelblijleven/goodwe/archive/refs/heads/master.zip

@kolossboss
Copy link
Contributor Author

Hi,
I run the script. I adjusted the family to EM because I have an GW3648-EM Inverter. Hope this is correct.

Thats the output:

2024-05-16 20:38:22,219 __init__(59) - DEBUG: Using selector: KqueueSelector
2024-05-16 20:38:22,219 connect(55) - DEBUG: Connecting to EM family inverter at 192.168.2.114:8899.
2024-05-16 20:38:22,219 _ensure_lock(56) - DEBUG: Creating lock instance for current event loop.
2024-05-16 20:38:22,220 _send_request(163) - DEBUG: Sending: aa55c07f0102000241
2024-05-16 20:38:22,538 _validate_response(465) - DEBUG: Response has unexpected length: 11, expected 86.
2024-05-16 20:38:22,538 datagram_received(130) - DEBUG: Received invalid response: aa557fc001824d31313131
2024-05-16 20:38:22,538 _send_request(161) - DEBUG: Sending: aa55c07f0102000241 - retry #1/3
2024-05-16 20:38:22,965 _validate_response(465) - DEBUG: Response has unexpected length: 69, expected 86.
2024-05-16 20:38:22,965 datagram_received(130) - DEBUG: Received invalid response: aa557fc001824d313131314a4757333634382d454d20233130000000000000000000000000003933363438454d553139435830303034333630303431302d30343030302d31
2024-05-16 20:38:22,966 _send_request(161) - DEBUG: Sending: aa55c07f0102000241 - retry #2/3
2024-05-16 20:38:23,384 datagram_received(127) - DEBUG: Received: aa557fc001824d313131314a4757333634382d454d20233130000000000000000000000000003933363438454d553139435830303034333630303431302d30343030302d3131023431302d30323033342d313918102a
2024-05-16 20:38:23,385 connect(57) - DEBUG: Connected to inverter GW3648-EM, S/N:93648EMU19CX0004.
Identified inverter
- Model: GW3648-EM
- SerialNr: 93648EMU19CX0004
- Rated power: 0
- A/C output type: None
- Firmware: 1111J
- ARM firmware: None
- Modbus version: None
- DSP1 version: 11
- DSP2 version: 11
- DSP svn version: None
- Arm version: 19
- ARM svn version: None

2024-05-16 20:38:23,386 __init__(59) - DEBUG: Using selector: KqueueSelector
2024-05-16 20:38:23,386 _ensure_lock(56) - DEBUG: Creating lock instance for current event loop.
2024-05-16 20:38:23,386 close_transport(186) - DEBUG: Failed to close transport.
2024-05-16 20:38:23,387 _send_request(163) - DEBUG: Sending: aa55c07f0106000245
2024-05-16 20:38:23,861 _validate_response(465) - DEBUG: Response has unexpected length: 34, expected 149.
2024-05-16 20:38:23,861 datagram_received(130) - DEBUG: Received invalid response: aa557fc001868c04a600010002f4000200020e00030050011801c2005f00cd000056
2024-05-16 20:38:23,862 _send_request(161) - DEBUG: Sending: aa55c07f0106000245 - retry #1/3
2024-05-16 20:38:24,347 _validate_response(465) - DEBUG: Response has unexpected length: 108, expected 149.
2024-05-16 20:38:24,348 datagram_received(130) - DEBUG: Received invalid response: aa557fc001868c02b500010003e6000200020e00030050011801c2005f00cd00005600566402000001092f005a0004138601092f000208691385010201b50000000000012b090000545300ba00710002662a088e0100300000000001000003be030000400000180510142518
2024-05-16 20:38:24,348 _send_request(161) - DEBUG: Sending: aa55c07f0106000245 - retry #2/3
2024-05-16 20:38:24,627 _validate_response(465) - DEBUG: Response has unexpected length: 97, expected 149.
2024-05-16 20:38:24,627 datagram_received(130) - DEBUG: Received invalid response: aa557fc001868c029100010003fb000200020e00030050011801c1005f00cd000056005664020000010930005900041385010930000208731385010201b50000000000012b090000545300ba00710002662a08870100300000000001000003bf03
2024-05-16 20:38:24,627 _send_request(161) - DEBUG: Sending: aa55c07f0106000245 - retry #3/3
2024-05-16 20:38:24,995 _validate_response(465) - DEBUG: Response has unexpected length: 50, expected 149.
2024-05-16 20:38:24,996 datagram_received(130) - DEBUG: Received invalid response: aa557fc001868c04ab00010002e0000200020e00030050011801be005f00cd00005600566402000001092c005a0004138501
2024-05-16 20:38:24,996 _retry_mechanism(177) - DEBUG: Max number of retries (3) reached, request aa55c07f0106000245 failed.
2024-05-16 20:38:24,996 connection_lost(117) - DEBUG: Socket closed.
Traceback (most recent call last):
  File "/Users/macminiserver/test/goodwe/tests/inverter_check.py", line 62, in <module>
    response = asyncio.run(inverter.read_runtime_data())
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/Users/macminiserver/test/goodwe/tests/../../goodwe/goodwe/es.py", line 206, in read_runtime_data
    response = await self._read_from_socket(self._READ_DEVICE_RUNNING_DATA)
  File "/Users/macminiserver/test/goodwe/tests/../../goodwe/goodwe/inverter.py", line 128, in _read_from_socket
    raise RequestFailedException(f'No valid response received even after {self._protocol.retries} retries',
goodwe.exceptions.RequestFailedException: ('No valid response received even after 3 retries', 1)

@mletenay
Copy link
Owner

I've just release both library and HACS integration with new support for fragmented packets.
Let's hope it will help in your setup.

@kolossboss
Copy link
Contributor Author

Hi,
Thanks for the update, but its still not working.
Now, the whole integration is not loading correct.

Thats the log.

Logger: homeassistant.config_entries
Quelle: config_entries.py:575
Erstmals aufgetreten: 06:12:32 (1 Vorkommnisse)
Zuletzt protokolliert: 06:12:32

Error setting up entry GoodWe for goodwe
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 575, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/goodwe/__init__.py", line 31, in async_setup_entry
    protocol = entry.options.get(CONF_PROTOCOL, entry.data[CONF_PROTOCOL])
                                                ~~~~~~~~~~^^^^^^^^^^^^^^^
KeyError: 'protocol'

@kolossboss
Copy link
Contributor Author

I installed v0.9.9.21.
But there is still something wrong.

  • The integration is now called without "experimental" in der Integration tab.
  • It still show v0.9.9.20 in the Integration tab
  • Entities still not available or not updating
  • Cant click on configuration (screenshot)

Log:

Home Assistant Core
2024-05-17 08:41:18.101 WARNING (SyncWorker_6) [homeassistant.loader] We found a custom integration goodwe which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
File "/usr/local/lib/python3.12/site-packages/goodwe/protocol.py", line 130, in datagram_received
File "/usr/local/lib/python3.12/site-packages/goodwe/protocol.py", line 468, in <lambda>
File "/usr/local/lib/python3.12/site-packages/goodwe/protocol.py", line 488, in _validate_response
File "/config/custom_components/goodwe/config_flow.py", line 69, in async_step_init
File "/config/custom_components/goodwe/config_flow.py", line 69, in async_step_init
2024-05-17 08:47:06.376 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: float got invalid input 'unavailable' when rendering template '{% if is_state('sensor.goodwe_battery_mode', '3') %}
{{ states('sensor.goodwe_pbattery1')|float * -1}}
{% endif %}' but no default was specified') while processing template 'Template<template=({% if is_state('sensor.goodwe_battery_mode', '3') %}
{{ states('sensor.goodwe_pbattery1')|float * -1}}
{% endif %}) renders=6>' for attribute '_attr_native_value' in entity 'sensor.goodwe_battery_charge'
2024-05-17 08:47:06.380 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% set battery_capacity = 14 %} {% set battery_current = (battery_capacity * (states('sensor.goodwe_battery_soc')|int/100))|round(2) %} {{ battery_current }}' but no default was specified') while processing template 'Template<template=({% set battery_capacity = 14 %} {% set battery_current = (battery_capacity * (states('sensor.goodwe_battery_soc')|int/100))|round(2) %} {{ battery_current }}) renders=6>' for attribute '_attr_native_value' in entity 'sensor.battery_available'
2024-05-17 08:47:06.382 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{% set battery_capacity = 14 %} {% set battery_current = (battery_capacity * (states('sensor.goodwe_battery_soc')|int/100))|round(2) %} {% set battery_to_charge = (battery_capacity - battery_current)|round(2) %} {{ battery_to_charge }}' but no default was specified') while processing template 'Template<template=({% set battery_capacity = 14 %} {% set battery_current = (battery_capacity * (states('sensor.goodwe_battery_soc')|int/100))|round(2) %} {% set battery_to_charge = (battery_capacity - battery_current)|round(2) %} {{ battery_to_charge }}) renders=6>' for attribute '_attr_native_value' in entity 'sensor.battery_tocharge'
2024-05-17 08:47:06.385 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: float got invalid input 'unavailable' when rendering template '{% if states('sensor.goodwe_pgrid')|float < 0 %}
{{ (states('sensor.goodwe_pgrid')|float * -1)|round(0) }}
{% endif %}' but no default was specified') while processing template 'Template<template=({% if states('sensor.goodwe_pgrid')|float < 0 %}
{{ (states('sensor.goodwe_pgrid')|float * -1)|round(0) }}
2024-05-17 08:47:06.387 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: float got invalid input 'unavailable' when rendering template '{% if states('sensor.goodwe_pgrid')|float > 0 %}
{{ states('sensor.goodwe_pgrid')|float }}
{% endif %}' but no default was specified') while processing template 'Template<template=({% if states('sensor.goodwe_pgrid')|float > 0 %}
{{ states('sensor.goodwe_pgrid')|float }}
2024-05-17 08:47:06.393 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: float got invalid input 'unavailable' when rendering template '{% if (states('sensor.goodwe_house_consumption')|float - states('sensor.goodwe_pback_up')|float) > 0 %}
{{ (states('sensor.goodwe_house_consumption')|float - states('sensor.goodwe_pback_up')|float)|round(0) }}
{% endif %}' but no default was specified') while processing template 'Template<template=({% if (states('sensor.goodwe_house_consumption')|float - states('sensor.goodwe_pback_up')|float) > 0 %}
{{ (states('sensor.goodwe_house_consumption')|float - states('sensor.goodwe_pback_up')|float)|round(0) }}
2024-05-17 08:47:06.395 DEBUG (MainThread) [custom_components.goodwe.coordinator] No response received (streak of 1)
2024-05-17 08:47:06.401 DEBUG (MainThread) [goodwe] Connecting to ES family inverter at 192.168.2.114:8899.
2024-05-17 08:47:06.401 DEBUG (MainThread) [goodwe.protocol] Creating lock instance for current event loop.
2024-05-17 08:47:06.404 DEBUG (MainThread) [goodwe.protocol] Sending: aa55c07f0102000241
2024-05-17 08:47:06.596 DEBUG (MainThread) [goodwe.protocol] Received: aa557fc001824d313131314a4757333634382d454d20233130000000000000000000000000003933363438454d553139435830303034333630303431302d30343030302d3131023431302d30323033342d313918102a
2024-05-17 08:47:06.597 DEBUG (MainThread) [goodwe] Connected to inverter GW3648-EM, S/N:93648EMU19CX0004.
2024-05-17 08:47:06.597 DEBUG (MainThread) [goodwe.protocol] Sending: aa55c07f0106000245
2024-05-17 08:47:07.070 DEBUG (MainThread) [goodwe.protocol] Response has unexpected length: 50, expected 149.
2024-05-17 08:47:07.070 DEBUG (MainThread) [goodwe.protocol] Received invalid response: aa557fc001868c0ef10007020f3a0007020209000300500116006c005f00cd00001700176403000001093a00030005138b01
2024-05-17 08:47:07.070 DEBUG (MainThread) [goodwe.protocol] Sending: aa55c07f0106000245 - retry #1/6
2024-05-17 08:47:07.556 DEBUG (MainThread) [goodwe.protocol] Response has unexpected length: 100, expected 149.
2024-05-17 08:47:07.556 DEBUG (MainThread) [goodwe.protocol] Received invalid response: aa557fc001868c0f050007020f4d0007020209000300500116006c005f00cd00001700176403000001093a00030005138c01093a00010004138b010201560000000000012b4b0000545f0027002e00026673ffee01003000000000010000fe7603000800
2024-05-17 08:47:07.557 DEBUG (MainThread) [goodwe.protocol] Sending: aa55c07f0106000245 - retry #2/6
2024-05-17 08:47:08.039 DEBUG (MainThread) [goodwe.protocol] Received: aa557fc001868c0ef50007020f740007020209000300500116006c005f00cd00001700176403000001093700020003138b01093700010004138c010201560000000000012b4b0000545f0027002e00026673ffe901003000000000010000fe67030008000000180511082e0600000000000000000000000000000000000000000000000000008de8000076f60200000000000012df
2024-05-17 08:47:08.040 DEBUG (MainThread) [custom_components.goodwe.coordinator] Finished fetching GoodWe data in 1.443 seconds (success: True)
2024-05-17 08:47:08.043 DEBUG (MainThread) [goodwe.protocol] Sending: aa55c07f0109000248
2024-05-17 08:47:08.301 DEBUG (MainThread) [goodwe.protocol] Response has unexpected length: 39, expected 95.
2024-05-17 08:47:08.301 DEBUG (MainThread) [goodwe.protocol] Received invalid response: aa557fc00189560000000000000000000000000001000100000001000a00de02300085004001bd
2024-05-17 08:47:08.302 DEBUG (MainThread) [goodwe.protocol] Sending: aa55c07f0109000248 - retry #1/6
2024-05-17 08:47:08.585 DEBUG (MainThread) [goodwe.protocol] Response has unexpected length: 92, expected 95.
2024-05-17 08:47:08.586 DEBUG (MainThread) [goodwe.protocol] Received invalid response: aa557fc00189560000000000000000000000000001000100000001000a00de02300085004001bd0013000f000000000000ffff0214001e001e00811194000000000000023f00000000000000000000000001f401f401bd000b000000
2024-05-17 08:47:08.586 DEBUG (MainThread) [goodwe.protocol] Sending: aa55c07f0109000248 - retry #2/6
2024-05-17 08:47:09.021 DEBUG (MainThread) [goodwe.protocol] Received: aa557fc00189560000000000000000000000000001000100000001000a00de02300085004001bd0013000f000000000000ffff0214001e001e00811194000000000000023f00000000000000000000000001f401f401bd000b0000000c0c56
2024-05-17 08:47:09.023 DEBUG (MainThread) [goodwe.protocol] Sending: aa55c07f0109000248
2024-05-17 08:47:09.451 DEBUG (MainThread) [goodwe.protocol] Received: aa557fc00189560000000000000000000000000001000100000001000a00de02300085004001bd0013000f000000000000ffff0214001e001e00811194000000000000023f00000000000000000000000001f401f401bd000b0000000c0c56
2024-05-17 08:47:09.453 DEBUG (MainThread) [goodwe.protocol] Sending: aa55c07f0109000248
2024-05-17 08:47:09.881 DEBUG (MainThread) [goodwe.protocol] Response has unexpected length: 39, expected 95.
2024-05-17 08:47:09.881 DEBUG (MainThread) [goodwe.protocol] Received invalid response: aa557fc00189560000000000000000000000000001000100000001000a00de02300085004001bd
2024-05-17 08:47:09.881 DEBUG (MainThread) [goodwe.protocol] Sending: aa55c07f0109000248 - retry #1/6
2024-05-17 08:47:10.309 DEBUG (MainThread) [goodwe.protocol] Received: aa557fc00189560000000000000000000000000001000100000001000a00de02300085004001bd0013000f000000000000ffff0214001e001e00811194000000000000023f00000000000000000000000001f401f401bd000b0000000c0c56
2024-05-17 08:47:10.311 DEBUG (MainThread) [goodwe.protocol] Sending: aa55c07f0109000248
2024-05-17 08:47:10.746 DEBUG (MainThread) [goodwe.protocol] Received: aa557fc00189560000000000000000000000000001000100000001000a00de02300085004001bd0013000f000000000000ffff0214001e001e00811194000000000000023f00000000000000000000000001f401f401bd000b0000000c0c56
2024-05-17 08:47:10.747 DEBUG (MainThread) [goodwe.protocol] Sending: READ 6 registers from 47547 (f703b9bb00068427)
2024-05-17 08:47:10.779 DEBUG (MainThread) [goodwe.protocol] Received: aa55f7030c00000937007ffff600640000542a
2024-05-17 08:47:10.780 DEBUG (MainThread) [goodwe.protocol] Sending: aa55c07f0109000248
2024-05-17 08:47:11.115 DEBUG (MainThread) [goodwe.protocol] Response has unexpected length: 49, expected 95.
2024-05-17 08:47:11.115 DEBUG (MainThread) [goodwe.protocol] Received invalid response: aa557fc00189560000000000000000000000000001000100000001000a00de02300085004001bd0013000f000000000000
2024-05-17 08:47:11.115 DEBUG (MainThread) [goodwe.protocol] Sending: aa55c07f0109000248 - retry #1/6
2024-05-17 08:47:11.548 DEBUG (MainThread) [goodwe.protocol] Response has unexpected length: 90, expected 95.
2024-05-17 08:47:11.549 DEBUG (MainThread) [goodwe.protocol] Received invalid response: aa557fc00189560000000000000000000000000001000100000001000a00de02300085004001bd0013000f000000000000ffff0214001e001e00811194000000000000023f00000000000000000000000001f401f401bd000b00
2024-05-17 08:47:11.549 DEBUG (MainThread) [goodwe.protocol] Sending: aa55c07f0109000248 - retry #2/6
2024-05-17 08:47:11.984 DEBUG (MainThread) [goodwe.protocol] Response has unexpected length: 78, expected 95.
2024-05-17 08:47:11.985 DEBUG (MainThread) [goodwe.protocol] Received invalid response: aa557fc00189560000000000000000000000000001000100000001000a00de02300085004001bd0013000f000000000000ffff0214001e001e00811194000000000000023f000000000000000000
2024-05-17 08:47:11.985 DEBUG (MainThread) [goodwe.protocol] Sending: aa55c07f0109000248 - retry #3/6
2024-05-17 08:47:12.420 DEBUG (MainThread) [goodwe.protocol] Received: aa557fc00189560000000000000000000000000001000100000001000a00de02300085004001bd0013000f000000000000ffff0214001e001e00811194000000000000023f00000000000000000000000001f401f401bd000b0000000c0c56
2024-05-17 08:47:12.423 DEBUG (MainThread) [goodwe.protocol] Sending: READ 6 registers from 47547 (f703b9bb00068427)
2024-05-17 08:47:12.450 DEBUG (MainThread) [goodwe.protocol] Received response fragment: aa55f7030c0000093700
2024-05-17 08:48:08.048 ERROR (MainThread) [homeassistant.components.number] Setup of platform goodwe is taking longer than 60 seconds. Startup will proceed without waiting any longer.
Bildschirm­foto 2024-05-17 um 08 51 09

@mletenay
Copy link
Owner

Aaaaaaagh.
Try v0.9.9.22 and then in config UI disable the "TCP keep alive"

@kolossboss
Copy link
Contributor Author

Sorry man...its still not working 🙃

I can now configure the Integration. I disabled TCP keep alive. I also changed Inverter family to "EM". But the family is not saving. It always goes back to "ES".

Home Assistant Core
2024-05-17 09:54:39.358 WARNING (SyncWorker_3) [homeassistant.loader] We found a custom integration goodwe which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-05-17 09:54:43.568 DEBUG (MainThread) [goodwe] Connecting to ES family inverter at 192.168.2.114:8899.
2024-05-17 09:54:43.568 DEBUG (MainThread) [goodwe.protocol] Creating lock instance for current event loop.
2024-05-17 09:54:43.568 DEBUG (MainThread) [goodwe.protocol] Sending: aa55c07f0102000241
2024-05-17 09:54:43.872 DEBUG (MainThread) [goodwe.protocol] Response has unexpected length: 78, expected 86.
2024-05-17 09:54:43.873 DEBUG (MainThread) [goodwe.protocol] Received invalid response: aa557fc001824d313131314a4757333634382d454d20233130000000000000000000000000003933363438454d553139435830303034333630303431302d30343030302d3131023431302d303230
2024-05-17 09:54:43.873 DEBUG (MainThread) [goodwe.protocol] Sending: aa55c07f0102000241 - retry #1/6
2024-05-17 09:54:44.294 DEBUG (MainThread) [goodwe.protocol] Response has unexpected length: 30, expected 86.
2024-05-17 09:54:44.294 DEBUG (MainThread) [goodwe.protocol] Received invalid response: aa557fc001824d313131314a4757333634382d454d202331300000000000
2024-05-17 09:54:44.328 DEBUG (MainThread) [goodwe.protocol] Sending: aa55c07f0102000241 - retry #2/6
2024-05-17 09:54:44.720 DEBUG (MainThread) [goodwe.protocol] Received: aa557fc001824d313131314a4757333634382d454d20233130000000000000000000000000003933363438454d553139435830303034333630303431302d30343030302d3131023431302d30323033342d313918102a
2024-05-17 09:54:44.726 DEBUG (MainThread) [goodwe] Connected to inverter GW3648-EM, S/N:93648EMU19CX0004.
2024-05-17 09:54:44.726 DEBUG (MainThread) [goodwe.protocol] Sending: aa55c07f0106000245
2024-05-17 09:54:45.281 DEBUG (MainThread) [goodwe.protocol] Response has unexpected length: 113, expected 149.
2024-05-17 09:54:45.281 DEBUG (MainThread) [goodwe.protocol] Received invalid response: aa557fc001868c0e830013020f1000100202160003005001200190005f00cd00002c002c6403000001093b001e0011138801093b0001036f1388010201ca0000000000012b4b00005460002700370002667cfc4c01003000000000010000fc5d03000800000018051109352b0000000000
2024-05-17 09:54:45.290 DEBUG (MainThread) [goodwe.protocol] Sending: aa55c07f0106000245 - retry #1/6
File "/usr/local/lib/python3.12/site-packages/goodwe/protocol.py", line 130, in datagram_received
File "/usr/local/lib/python3.12/site-packages/goodwe/protocol.py", line 468, in <lambda>
File "/usr/local/lib/python3.12/site-packages/goodwe/protocol.py", line 488, in _validate_response
2024-05-17 09:59:40.901 DEBUG (MainThread) [custom_components.goodwe.coordinator] No response received (streak of 1)
2024-05-17 09:59:40.902 DEBUG (MainThread) [custom_components.goodwe.coordinator] Finished fetching GoodWe data in 296.176 seconds (success: True)
2024-05-17 09:59:40.903 DEBUG (MainThread) [goodwe.protocol] Socket closed.
2024-05-17 09:59:40.942 DEBUG (MainThread) [goodwe.protocol] Sending: aa55c07f0109000248
File "/usr/local/lib/python3.12/site-packages/goodwe/protocol.py", line 130, in datagram_received
File "/usr/local/lib/python3.12/site-packages/goodwe/protocol.py", line 468, in <lambda>
File "/usr/local/lib/python3.12/site-packages/goodwe/protocol.py", line 488, in _validate_response
2024-05-17 10:00:40.930 ERROR (MainThread) [homeassistant.components.number] Setup of platform goodwe is taking longer than 60 seconds. Startup will proceed without waiting any longer.
2024-05-17 10:00:40.930 ERROR (MainThread) [homeassistant.components.select] Setup of platform goodwe is taking longer than 60 seconds. Startup will proceed without waiting any longer.
2024-05-17 10:00:40.942 ERROR (MainThread) [homeassistant.components.switch] Setup of platform goodwe is taking longer than 60 seconds. Startup will proceed without waiting any longer.
Bildschirmfoto 2024-05-17 um 10 02 38

@mletenay
Copy link
Owner

There's new version out there, please re-test.

@kolossboss
Copy link
Contributor Author

Sorry still not working with 0.9.9.23.
v0.9.9.17 still works fine.

Its not possible the change Inverter Family to EM. It always goes back to ES. Not sure if this is a problem. In the log it says connecting to EM family

Thats the log:

2024-05-20 10:06:50.675 WARNING (SyncWorker_6) [homeassistant.loader] We found a custom integration goodwe which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-05-20 10:07:02.092 DEBUG (MainThread) [goodwe] Connecting to EM family inverter at 192.168.2.114:8899.
2024-05-20 10:07:02.092 DEBUG (MainThread) [goodwe.protocol] Creating lock instance for current event loop.
2024-05-20 10:07:02.093 DEBUG (MainThread) [goodwe.protocol] Sending: aa55c07f0102000241
2024-05-20 10:07:02.271 DEBUG (MainThread) [goodwe.protocol] Received: aa557fc001824d313131314a4757333634382d454d20233130000000000000000000000000003933363438454d553139435830303034333630303431302d30343030302d3131023431302d30323033342d313918102a
2024-05-20 10:07:02.272 DEBUG (MainThread) [goodwe] Connected to inverter GW3648-EM, S/N:93648EMU19CX0004.
2024-05-20 10:07:02.272 DEBUG (MainThread) [goodwe.protocol] Sending: aa55c07f0106000245
2024-05-20 10:07:02.756 DEBUG (MainThread) [goodwe.protocol] Received response fragment: aa557fc001868c0e72000b020ea4000b0202130003005001050044005f00cd0000280028640300000109280011000413870109280001017213860102019e0000000000012d54000054a80001002700
2024-05-20 10:11:52.403 DEBUG (MainThread) [custom_components.goodwe.coordinator] No response received (streak of 1)
2024-05-20 10:11:52.403 DEBUG (MainThread) [custom_components.goodwe.coordinator] Finished fetching GoodWe data in 290.131 seconds (success: True)
2024-05-20 10:11:52.437 DEBUG (MainThread) [goodwe.protocol] Sending: aa55c07f0109000248
2024-05-20 10:11:52.619 DEBUG (MainThread) [goodwe.protocol] Received another response fragment: aa557fc00189560000000000000000000000000001000100000001000a00de02300085004001bd0013000f000000000000ffff0214001e001e00811194000000000000023f00000000000000000000000001f401f401bd000b0000000c.
2024-05-20 10:11:52.619 DEBUG (MainThread) [goodwe.protocol] Received response fragment: aa557fc001868c0e72000b020ea4000b0202130003005001050044005f00cd0000280028640300000109280011000413870109280001017213860102019e0000000000012d54000054a80001002700aa557fc00189560000000000000000000000000001000100000001000a00de02300085004001bd0013000f000000000000ffff0214001e001e00811194000000000000023f00000000000000000000000001f401f401bd000b0000000c
2024-05-20 10:12:52.438 ERROR (MainThread) [homeassistant.components.number] Setup of platform goodwe is taking longer than 60 seconds. Startup will proceed without waiting any longer.
2024-05-20 10:12:52.439 ERROR (MainThread) [homeassistant.components.select] Setup of platform goodwe is taking longer than 60 seconds. Startup will proceed without waiting any longer.
2024-05-20 10:12:52.454 ERROR (MainThread) [homeassistant.components.switch] Setup of platform goodwe is taking longer than 60 seconds. Startup will proceed without waiting any longer.
Bildschirm­foto 2024-05-20 um 10 17 14

@mletenay
Copy link
Owner

ES and EM is the same stuff, so not issue.
But I'm running out of ideas :-(

@jiriknez
Copy link

From version 0.9.9.18 I have problem with 10ET, that after 15-30 minutes integration terminates with this error. Every 30 minutes I have to reload config or restart HA.

Error doing job: Exception in callback _SelectorDatagramTransport._read_ready()
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/goodwe/protocol.py", line 131, in datagram_received
if self.command.validator(data):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/goodwe/protocol.py", line 579, in
lambda x: validate_modbus_rtu_response(x, cmd, offset, value),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/goodwe/modbus.py", line 206, in validate_modbus_rtu_response
raise RequestRejectedException(failure_code)
goodwe.exceptions.RequestRejectedException: ILLEGAL DATA ADDRESS

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run
self._context.run(self._callback, *self._args)
File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 1238, in _read_ready
self._protocol.datagram_received(data, addr)
File "/usr/local/lib/python3.12/site-packages/goodwe/protocol.py", line 149, in datagram_received
self.response_future.set_exception(ex)
asyncio.exceptions.InvalidStateError: invalid state

home-assistant_goodwe_2024-05-20T09-25-48.662Z.log

@kolossboss
Copy link
Contributor Author

ES and EM is the same stuff, so not issue.

But I'm running out of ideas :-(

If there is any way I can help you, feel free to ask.
I can test all new versions, if I can always downgrade to v0.9.9.17

I really need this integration.😬

@dl6dbh
Copy link

dl6dbh commented May 20, 2024

i have tree gw5048es . i have the same poblem

i have downgrade to 9.9.22 its running now for more than 12h.
with 9.9.23 t stoped after round 30 min

@mletenay
Copy link
Owner

@jiriknez Your issue seems to be of different kind.
Please try the fresh release and if the problem persists, file a separate ticket so I can track it properly.

@mletenay
Copy link
Owner

@kolossboss I cannot find anything in the code which would explain this behavior.
At this moment I see only one way - you should checkout the git repo and start reverting back to the last commit which will work for you.
Then I can look at it once again and try to figure out what the h***...

@kolossboss
Copy link
Contributor Author

I'm not exactly sure what you mean. I'm not so familiar with github.
Last working Version is v0.9.9.17.
In v0.9.9.18 is only one commit.

Also,
In the release notes you describes a "major Rewrite of the communication protocol"

I have no clue what to do...

@mletenay
Copy link
Owner

I will give you exact instructions, don't worry.
But I guess using discord channel will be more efficient that this github issue.

@mletenay
Copy link
Owner

Yeah, but the code which is in HACS will one day get into core HA, so will have the problem then until it gets fixed ;-)

@kolossboss
Copy link
Contributor Author

kolossboss commented May 26, 2024

@mletenay
ok, today I looked at my terminal output from 22-05 again.
Its really hard to tell when it gets any better.

Maybe at head 573a64b I get a better response.

I also added the whole file. Maybe you can finde something.

Terminal_output_goodwe.txt

Edit:
I have uploaded the whole log to chatgpt and ask for when the response time gets better.
Result:

It start to get better at 21:27:37:
This is head: 7846c88

Maybe that helps :-)

@mletenay
Copy link
Owner

Hmm, I'm afraid I do not see any relevant correlation there.
The incomplete packets seem to be completely random, no commit/version seems to stand out.
I have reviewed the code changes once again and I do not see anything which could explain change of behavior in this aspect.

You receive broken/truncated UDP packets and I have no idea why.
My guts would blame network infrastructure, but I don't have any rational explanation for that.

@kolossboss
Copy link
Contributor Author

Does it makes any sense to go down any further with the commit?

Its hard to believe that's an only network issue, because v0.9.9.17 is working just fine :-)

Today I updated to v0.9.9.26. It takes a long time until the integration is initialized, but then I get partial values. But the update rate is 3-5 minutes, and sometimes the entities are unavailable for several minutes.

Is there anything else I can do to help you?

update to v0 9 9 26

@mletenay
Copy link
Owner

I see but I do not understand why.
Did you try both checked/unchecked "Keep Alive" toggle ?

@kolossboss
Copy link
Contributor Author

Sorry for late response.

Yes, I tried all settings.
I also thought "Keep Alive" is only for the TCP Protocol.

@mletenay
Copy link
Owner

Yes, it's named that way and it is meant mostly for TCP.
But there is also a subtle change of behavior for UDP.
Could you please retry the v0.9.9.26 with both keep-alive on and off, since there was a bug there in some prev releases.

@kolossboss
Copy link
Contributor Author

I tried with Keep Alive on.
Also not working. Same behaviour.

@mletenay
Copy link
Owner

Just for the record, KeepAlive ON is new behavior, with KeepAlive OFF it should behave (for UDP) the same way as in 0.9.9.17.

@kolossboss
Copy link
Contributor Author

yes should😁

For me:
0.9.9.17 Works

0.9.9.26 not working with keep alive off
0.9.9.27 not working with keep alive on.

image

@smileyman-1
Copy link

@kolossboss
I have the same inverter (GW3648-EM). The current versions, e.g. 0.9.9.26, work perfectly for me.
I have connected the original WLAN stick (version 1). WLAN is provided by an AVM FritzBox.
Do you have the latest firmware on the inverter and WLAN stick?

@kolossboss
Copy link
Contributor Author

Hi,

Since the beginning, I have had connection reliability problems with my inverter (losing WiFi connection indicated by a blinking LED, SolarGo sometimes not working, etc.). So, I contacted Goodwe Support, and they installed the LAN module instead.

It has gotten much better, but it’s still not perfect. I thought these reliability problems were by design and not a real issue, because the data is sent to the SEMS portal just fine.

Maybe there is a general problem with my inverter... but why does v0.9.9.17 work well enough?

In the web interface, the firmware shows V1.0.14.
In SolarGo, the firmware shows V111J.
In the SEMS portal, the firmware shows 3111119.

@smileyman-1
Copy link

The WiFi module is running very stably for me. Despite being polled every second by Home Assistant, SEMS is also being filled with data. Sometimes the WiFi LED flashes and reports that it has no connection to SEMS. However, this only happens very rarely and resolves itself. I cannot see any failures in SEMS, and Home Assistant is still receiving current data without any problems.

The inverter firmware does not seem to be up to date in my opinion. I have a 1314J (which is also on Goodwe's GoogleDrive).

1.0.14 is only the version of the web interface and not the module firmware. I don't currently know the version for the LAN stick. For the WiFi module it is 1.1.3.10.

@kolossboss
Copy link
Contributor Author

kolossboss commented Jun 10, 2024

Hi,
thanks for reply.
Where can I find the LAN stick version?
And how can I upgrade the Inverter? The Goodwe Support told me, they can do this remotely, but they never did.
Maybe this will solve my issues.

Edit:
Ok I found a manual and the googledrive.
I think I need the Bluetooth dongle to upgrade the Firmware, but I couldn't find a site where I could order the dongle.

@smileyman-1
Copy link

There are three updates for the inverter: ARM, DSP, communication module (WLAN 1.0, WLAN 2.0 or LAN)
ARM and DSP is the firmware of the inverter itself. Support can update this remotely; but only if the Home Assistant does not regularly query data internally via Modbus.
You can also update this yourself. However, a Goodwe Bluetooth stick is required for this with the EM series. - Do you have one?
You can find the ARM and DSP firmware here: https://drive.google.com/drive/folders/110hBxoNVC4M9F_GK5sKP7uq_aDNxwstZ
This can be installed via SolarGo if you have connected the Bluetooth stick instead of the WLAN or LAN module (reboot necessary to change). In the best case, SolarGo will also find the firmware itself. (SolarGo sometimes shows after the update that there is a new firmware and wants to install the same one again and again - just ignore that.)
There are also instructions from Goodwe for this whole procedure. If necessary, I can find them for you.
The aim is to have the ARM and DSP up to date first.
The communication module should also be updated to the latest version. Unfortunately, I only know the WLAN module 1.0, which is supplied as standard. I have the latest firmware for that. This is usually provided by the support. Unfortunately, I don't know it for the LAN module.
The WLAN module is originally manufactured by hi-flying.com. If necessary, there are also current versions here (which are unfortunately not compatible with SolarGo).

@smileyman-1
Copy link

The Bluetooth stick is included with some series. Unfortunately not with the EM series.
You can borrow one from an electrician if necessary. - Unfortunately it cannot be ordered (I have already discussed this with Goodwe).
What area are you in? I have one here.

@kolossboss
Copy link
Contributor Author

I do not have an usb dongle.

I'm from germany (plz 212xx 30km südlich von Hamburg)
Maybe you can borrow me the stick?

@smileyman-1
Copy link

Yes, we should find a solution.
Are you in the Discord group? Under what name?
Or how can I contact you?

@kolossboss
Copy link
Contributor Author

Yes,
I have discord.
My username ist SloppolS#2191

Thanks a lot.

@dl6dbh
Copy link

dl6dbh commented Jun 12, 2024

give ist an disscord server platform for the integration ?
im run 9.9.25, quit good

@JaniSchlumpf
Copy link

JaniSchlumpf commented Jun 13, 2024

Just to add that version 0.9.9.27 works fine for me and I am not seeing the issues mentioned above. I recently switched from the official HA version to experimental as I was not able to set Eco mode. Everything works really well with 0.9.9.27 for me. As I am also having an EM inverter justed wanted to share my setup:

GW5048-EM
Firmware DSP: 1314L / 410-04000-13 (seems the latest from the GoogleDrive).
Firmware ARM: 2034 (not sure if it is the latest as GoogleDrive holds sub-versions 19 and 20).
Goodwe WiFi / Lan Kit 1.0 (with USB - got this exchanged by GoodWe because the original WiFi Stick failed).
Connected via ethernet to my HA running on VM.

Would strongly suggest to apply for a firmware update with GoodWe support. They can be a little reluctant I learned myself, just keep asking :-) .
Regarding bluetooth dongle - got mine from Kleinanzeigen.de , always worth a try.

@mletenay
Copy link
Owner

... just to let you know, I'm still trying to figure out what the heck is going on there.
Fortunately, one nice gentleman from Czechia send me one Wifi kit and one LAN kit to play with.
The Wifi kit (fw 1.1.2.1) works like a charm but the LAN kit (fw 1.0.14) is unreliable as hell and I get tons of truncated UDP packets like you do.
Which is actually a good news, since I can finally investigate it locally and it increases a chance I will be able to explain and potentially fix it.

@kolossboss
Copy link
Contributor Author

kolossboss commented Jun 16, 2024

Hi, thanks for all the help.

I also get the Bluetooth USB Dongle from a very kind guy here Germany (thanks @smileyman-1 ).

I tried every to update to the latest firmware. But in SolarGo, the update menu was not displayed, and in PVMaster, I couldn't select the firmware or it wasn't recognized when I placed it in the share folder. I tried it with both iOS and Android.

I contacted GoodWe support, and they opened a ticket to upgrade the inverter's firmware. However, I have not received a response so far.

@smileyman-1 also sent me a WiFi stick with firmware version 1.1.2.1. Today, I installed this stick, and it's working great so far! No issues with v0.9.9.27, and I'm getting new sensor updates every 10 seconds (or even every second) in HA. I've never had such a stable connection before.

So, my LAN stick is definitely also an issue.

Now I'm waiting for the inverter update, or maybe I'll find a way to upgrade the LAN stick with a better working firmware.

edit:
@JaniSchlumpf The WiFi / Lan Kit also sounds like a good alternative. Maybe I can get one, too :-)

@JaniSchlumpf
Copy link

JaniSchlumpf commented Jun 16, 2024

Just for the record: my "WiFi / Lan Kit 1.0" is on firmware V1.2.1.19 (Boot:V1.1.4) . No idea if this is the latest version. Anyway - it runs just fine with my setup.

@mletenay
Copy link
Owner

So, I have tested it a lot today and came to these conclusions:

  1. The troubles seem to be caused by the Wifi or LAN dongle, inverter firmware and network infrastructure are most likely not the problem.
  2. LAN Box (5-pin, E20-GDW-0001 P/N: 151-30054-00), fw 1.0.14 is buggy as hell and close to unusable.
  3. WiFi Box (5-pin, fw 1.1.1.2) and Wifi Kit (USB, fw 1.1.2.1) work perfectly fine with 5s polling and SEMS still getting updates.
  4. The LAN box is sending randomly truncated responses. The truncation happens somewhere inside the modbus reading logic, since the IP/UDP layer sends proper packets with valid length and checksum, the payload being sent is already truncated.
  5. The LAN box seems to be failing more often when the same socket (UDP source port) is being re-used. (That might be the difference to 0.9.9.17). When socket is always closed, the chance the inverter will send proper response increases.
  6. I have adjusted the code, so the "keep-alive" is now OFF by default to both UDP and TCP. I have also adjusted the code to close the socket even between the re-tries to increase the chance the inverter/dongle will send the proper request.
  7. I have released the library and updated HACS master to contain these changes, it can be tested if it helps.
  8. There is fw 1.0.15 for the LAN box dongle out there, I will try to get it somehow, to see if it is any better than the 1.0.14 I have now.

@smileyman-1
Copy link

I can confirm most of the points.
The only thing that looks different for me is point 3: The WiFi Kit 1.0 can be queried every second by HA without any problems, but complete data is only delivered to SEMS at an interval of > 180 seconds.

@janchlebek
Copy link

I can confirm most of the points. The only thing that looks different for me is point 3: The WiFi Kit 1.0 can be queried every second by HA without any problems, but complete data is only delivered to SEMS at an interval of > 180 seconds.

But that is OK in my opinion - update frequency of SEMS depends on when the inverter decides to send data and is configured by Goodwe. It has nothing to do with HA polling.

@mletenay
Copy link
Owner

@janchlebek SEMS update frequency is controlled by register 47006 (default 12, *5s = 1m) and no, for some users out there, when HA polls too frequently, SEMS somehow stops receiving updates.
@smileyman-1 I did not observe that, but can plug it in and re-test again. What do you mean by "complete data" ? Is there something specific I should look at ?

@janchlebek
Copy link

@janchlebek SEMS update frequency is controlled by register 47006 (default 12, *5s = 1m) and no, for some users out there, when HA polls too frequently, SEMS somehow stops receiving updates.

Ah, did not know this is configurable. Thanks for clarifying.

@smileyman-1
Copy link

smileyman-1 commented Jun 17, 2024

@janchlebek SEMS update frequency is controlled by register 47006 (default 12, *5s = 1m) and no, for some users out there, when HA polls too frequently, SEMS somehow stops receiving updates. @smileyman-1 I did not observe that, but can plug it in and re-test again. What do you mean by "complete data" ? Is there something specific I should look at ?

Generally, these modules (and the ne WLAN-Kit 2.0) exist:
image

GA10081-22-00P is connected to my Goodwe GW3648-EM. - SEMS works perfectly even with a one-second update interval.

GA10081-44-00P is connected to my Goodwe GW10KT-DT. - SEMS works perfectly from 180 seconds. Between 131 - 180 seconds, only some data is transferred to SEMS (Inverter is partially offline. The last values, etc. are missing in the chart.). Between 1 - 130 seconds, no data is transferred to SEMS.

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

No branches or pull requests

10 participants