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

ECU-C sometimes restart triggers, but never turns back on #250

Open
gratjetost opened this issue Apr 20, 2024 · 10 comments
Open

ECU-C sometimes restart triggers, but never turns back on #250

gratjetost opened this issue Apr 20, 2024 · 10 comments
Labels
ECU-C APsystems ECU-C

Comments

@gratjetost
Copy link

gratjetost commented Apr 20, 2024

Im running 1.4.2 on a ECU-C with firmware 1.2.11
Sometimes a restart is triggered and the whole ECU-C breaks down. (no IP address, no access to dashboard)
Only option is to go there and turn it off and on again.
There is no reason why the restart triggers.
In this example it just restarted in the middle of the day.
Running in LAN cable, WIFI not enabled at all.

image
image
image

@HAEdwin
Copy link
Collaborator

HAEdwin commented Apr 21, 2024

Please provide some info from the home-assistant.log. How often is the cache being used and what are the current integration settings (query interval, number of configured retries)? A restart is only initialized after the specified number of retries. If a good query occured the counter is being reset.

@gratjetost
Copy link
Author

gratjetost commented Apr 21, 2024

`2024-04-20 12:11:11.755 WARNING (SyncWorker_33) [custom_components.apsystems_ecur] Using cached data from last successful communication from ECU. Exception error: 'NoneType' object does not support item assignment
2024-04-20 12:16:28.766 WARNING (SyncWorker_63) [custom_components.apsystems_ecur] Using cached data from last successful communication from ECU. Exception error: 'NoneType' object does not support item assignment
2024-04-20 12:21:44.775 WARNING (SyncWorker_38) [custom_components.apsystems_ecur] Using cached data from last successful communication from ECU. Exception error: 'NoneType' object does not support item assignment
2024-04-20 12:26:59.755 WARNING (SyncWorker_39) [custom_components.apsystems_ecur] Using cached data from last successful communication from ECU. Exception error: 'NoneType' object does not support item assignment
2024-04-20 12:32:14.757 WARNING (SyncWorker_40) [custom_components.apsystems_ecur] Using cached data from last successful communication from ECU. Exception error: 'NoneType' object does not support item assignment
2024-04-20 12:32:14.758 WARNING (SyncWorker_40) [custom_components.apsystems_ecur] Communication with the ECU failed after 5 repeated attempts.
2024-04-20 12:42:29.813 WARNING (SyncWorker_62) [custom_components.apsystems_ecur] Using cached data from last successful communication from ECU. Invalid data error: [Errno 113] Host is unreachable
2024-04-20 12:47:32.821 WARNING (SyncWorker_32) [custom_components.apsystems_ecur] Using cached data from last successful communication from ECU. Invalid data error: [Errno 113] Host is unreachable
2024-04-20 12:52:35.829 WARNING (SyncWorker_57) [custom_components.apsystems_ecur] Using cached data from last successful communication from ECU. Invalid data error: [Errno 113] Host is unreachable
2024-04-20 12:57:38.805 WARNING (SyncWorker_2) [custom_components.apsystems_ecur] Using cached data from last successful communication from ECU. Invalid data error: [Errno 113] Host is unreachable
2024-04-20 13:02:41.813 WARNING (SyncWorker_13) [custom_components.apsystems_ecur] Using cached data from last successful communication from ECU. Invalid data error: [Errno 113] Host is unreachable
2024-04-20 13:05:23.695 ERROR (MainThread) [homeassistant.components.homewizard.coordinator] Error fetching homewizard data: Timeout occurred while connecting to the HomeWizard Energy device
2024-04-20 13:07:44.821 WARNING (SyncWorker_32) [custom_components.apsystems_ecur] Using cached data from last successful communication from ECU. Invalid data error: [Errno 113] Host is unreachable
2024-04-20 13:07:48.895 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 83, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 88, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/diagnostics/__init__.py", line 274, in get
    data = await info.device_diagnostics(hass, config_entry, device)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/apsystems_ecur/diagnostics.py", line 28, in async_get_device_diagnostics
    diag_data = {"entry": async_redact_data(ecu.ecu.dump_data(), TO_REDACT)}
                                            ^^^^^^^^^^^^^^^^^
AttributeError: 'APSystemsSocket' object has no attribute 'dump_data'
2024-04-20 13:43:57.562 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 350, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "aiohttp/_http_parser.pyx", line 557, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message:
  Invalid method encountered:

    b'\x16\x03\x01'
      ^`
      
      `entity_id,state,last_changed

binary_sensor.ecu_using_cached_data,off,2024-04-13T06:18:24.388Z
binary_sensor.ecu_using_cached_data,on,2024-04-14T08:12:57.767Z
binary_sensor.ecu_using_cached_data,off,2024-04-14T08:18:12.769Z
binary_sensor.ecu_using_cached_data,on,2024-04-14T09:26:36.761Z
binary_sensor.ecu_using_cached_data,off,2024-04-14T09:31:52.762Z
binary_sensor.ecu_using_cached_data,on,2024-04-14T09:37:02.767Z
binary_sensor.ecu_using_cached_data,off,2024-04-14T09:42:17.766Z
binary_sensor.ecu_using_cached_data,on,2024-04-14T17:50:57.760Z
binary_sensor.ecu_using_cached_data,off,2024-04-16T16:55:12.769Z
binary_sensor.ecu_using_cached_data,on,2024-04-16T19:32:42.760Z
binary_sensor.ecu_using_cached_data,off,2024-04-16T19:37:57.767Z
binary_sensor.ecu_using_cached_data,on,2024-04-19T14:50:32.767Z
binary_sensor.ecu_using_cached_data,off,2024-04-19T14:55:47.765Z
binary_sensor.ecu_using_cached_data,on,2024-04-19T15:16:43.766Z
binary_sensor.ecu_using_cached_data,off,2024-04-19T15:21:58.767Z
binary_sensor.ecu_using_cached_data,on,2024-04-20T10:11:11.766Z
binary_sensor.ecu_using_cached_data,off,2024-04-20T11:12:59.764Z
binary_sensor.ecu_using_cached_data,on,2024-04-20T21:59:27.773Z
binary_sensor.ecu_using_cached_data,off,2024-04-20T22:04:43.855Z
binary_sensor.ecu_using_cached_data,on,2024-04-21T10:46:17.768Z
binary_sensor.ecu_using_cached_data,off,2024-04-21T10:51:34.901Z
`

image

Hope this is enough. The LAN connection itself is stable.
The only thing I maybe missed. at the configuration you have to specify a SSID and password. Not able to leave it blank. Should I fill in the LWA settings?
But I dont have the ECU-C connected to wifi.

@HAEdwin
Copy link
Collaborator

HAEdwin commented May 3, 2024

Sorry for the late response,.. you can specify random parameters for SSID and Password if connected by ethernet. Have you allready tried to reboot the ECU? It would be strange if the ECU does not receive an IP-Address from you DHCP server. Is it a fixed IP-Address (assigned IP-address based on MAC address from the ECU)?

@gratjetost
Copy link
Author

Its is a fixed IP address. MAC address is linked to the DHCP table on my router.
Yes I did reboot the ECU. because when it goes into that restart mode the only option I have is turn off the power and reboot the ECU.
When it is in that restart "loop". there is also no IP address assigned at all. So I also can't connect to the local webpage of the ECU.

@HAEdwin
Copy link
Collaborator

HAEdwin commented May 3, 2024

Does the ECU-C have an option to switch between WiFi and Ethernet? Could it be that you are able to connect using the WiFi connection after restart (when correct SSID and Password are applied) although ethernet is connected? It would mean that the ECU switched to WiFi operation and that somehow must be avoided. I'm hoping someone else owning an ECU-C can help out here...

@gratjetost
Copy link
Author

the ECU-C can run LAN and WLAN simultaneously
But when a restart is triggered it completely dies out. No WAN and no LAN IP address.
Its completely gone from the local dashboard. And I just checked its also gone in the APS website.

@HAEdwin
Copy link
Collaborator

HAEdwin commented May 3, 2024

It would be weird if neither a WLAN nor a LAN IP-address is assigned to the ECU. Have you looked at the DHCP table to see if the ECU received another IP-Address somehow? Are the MAC addresses still the same for both WLAN and LAN interface on the ECU?

@HAEdwin
Copy link
Collaborator

HAEdwin commented May 3, 2024

If you encounter the issue of the cache being used very often, try to reposition the ECU or externa antennas if possible. Sometimes bringing them too close to WiFi AP's causes interference because 2.4Ghz WiFi and Zigbee share the same 2.4Ghz band.
Last option would be to change the "215" value on line 87 of init.py into a random value like "111" to prevent the integration from rebooting the ECU. You could then use a smartplug to reboot the ECU using a HA automation. I hope other ECU-C owners can share their experiences with the reboot method.

@HAEdwin HAEdwin added the ECU-C APsystems ECU-C label May 3, 2024
@gratjetost
Copy link
Author

It would be weird if neither a WLAN nor a LAN IP-address is assigned to the ECU. Have you looked at the DHCP table to see if the ECU received another IP-Address somehow? Are the MAC addresses still the same for both WLAN and LAN interface on the ECU?

It is really gone, No DHCP issues. MAC addresses are linked in the DHCP table for Wifi and LAN connection. There is no option it will receive a different IP address.
Zigbee is 868 MHz. so it cannot interfere with the Wifi.
the ECU-C is hard-wired to the 3 phases. not really an option to add a smart switch between that.
I'll try to change the value in init.py and give it a go.

@gratjetost
Copy link
Author

gratjetost commented May 15, 2024

Update from my site:
edited the init.py file line 87 from 215 to 115.
This night it went offline again. But only on HA. the local dashboard was still up and running.
Errors from the HA logging:
image
image

After a reboot of HA, the ECU goes unavailable. with a warning in the logging:
image

Doing a power cycle of the ECU-C and it works again.
The cache is messing something up I can't put my finger on.

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

No branches or pull requests

2 participants