BenPru / luxtronik

Luxtronik integration for Home Assistant
MIT License
66 stars 23 forks source link

2023.9.21-Alpha-Core-Preview some issue with HA API #142

Closed ondras76 closed 8 months ago

ondras76 commented 9 months ago

I was updatet HA Core to 2023.9.2, all working fine except Luxtronik. So I was update Luxtronik to version 2023.9.21-Alpha-Core-Preview. Everything looks OK just menu HA Cloud loading and loading ... and doesn't work. In log can see some problem with API. I don't know if is the problem, but is only issue in log file.

"Logger: homeassistant.components.websocket_api.http.connection Source: components/cloud/google_config.py:153 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 12:30:48 PM (8 occurrences) Last logged: 12:40:08 PM

[139884542836160] Error handling message: Unknown error (unknown_error) Ondrej from 10.0.0.130 (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36) [139883500892096] Error handling message: Unknown error (unknown_error) Ondrej from 10.0.0.130 (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 26, in _handle_async_response await func(hass, connection, msg) File "/usr/src/homeassistant/homeassistant/components/cloud/http_api.py", line 357, in websocket_cloud_status websocket_api.result_message(msg["id"], await _account_data(hass, cloud)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/cloud/http_api.py", line 525, in _account_data google_config = await client.get_google_config() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/cloud/client.py", line 133, in get_google_config await google_conf.async_initialize() File "/usr/src/homeassistant/homeassistant/components/cloud/google_config.py", line 212, in async_initialize await super().async_initialize() File "/usr/src/homeassistant/homeassistant/components/google_assistant/helpers.py", line 106, in async_initialize if not self.enabled: ^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/cloud/google_config.py", line 153, in enabled and not self._cloud.subscription_expired ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/hass_nabucasa/init.py", line 133, in subscription_expired return utcnow() > self.expiration_date + timedelta(days=7) ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/hass_nabucasa/init.py", line 139, in expiration_date raise ValueError( ValueError: Invalid expiration date (2024-08-21) "

BenPru commented 9 months ago

HA Cloud and the log entries have nothing to do with the Luxtronik integration.

ondras76 commented 9 months ago

I don't know, but it happend. I was try 2x, Always after Luxtronik update. Also with older ver. 2023.9.11. I just ask NabuCasa support, I'll let you know.

ondras76 commented 9 months ago

@BenPru please can you look on my log file. I was deleted the Luxtronik integration, last Core update ans all working fine. So I was download againg Luxtronik via HACS and when I connect the HUB the cloud is gone. It's realy something with Luxtronik, after this error is cloud menu off, when I deleted Luxtronik HUB and restart is all good. In the LOG you can see when I add the HUB. On the first line can see the Error Luxtronik int. I was also attach the full log. Thanks for your help. Ondrej.

"Home Assistant Core [139887561064640] Error handling message: Unknown error (unknown_error) Ondrej from 10.0.0.130 (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36) 2:19:14 PM – (ERROR) Home Assistant WebSocket API - message first occurred at 2:19:09 PM and shows up 2 times TemplateError('ValueError: Template error: float got invalid input 'unavailable' when rendering template '{% if states("sensor.pracka_aktualni_spotreba_upr")|float <= 0 %} mdi:washing-machine-off {% else %} mdi:washing-machine {% endif %}' but no default was specified') while processing template 'Template<template=({% if states("sensor.pracka_aktualni_spotreba_upr")|float <= 0 %} mdi:washing-machine-off {% else %} mdi:washing-machine {% endif %}) renders=5>' for attribute '_attr_icon' in entity 'sensor.pracka_stav' 2:19:07 PM – (ERROR) Template - message first occurred at 2:19:07 PM and shows up 6 times Template variable error: 'None' has no attribute 'last_changed' when rendering '{% if is_state("sensor.luxtronik2_outdoor_temperature", 'unknown') %} unknown {% else %} {% if states('sensor.luxtronik2_outdoor_temperature') == states('sensor.luxtronik2_outdoor_temperature', true) %} {{ 'ON' if now().timestamp() - states.sensor.luxtronik2_outdoor_temperature.last_changed.timestamp() > 300 else 'OFF' }} {% else %} {{ 'ON' if states.sensor.luxtronik2_outdoor_temperature.state == 'unknown' else 'OFF' }} {% endif %} {% endif %}' 2:19:07 PM – (ERROR) helpers/template.py - message first occurred at 2:07:00 PM and shows up 15 times Error while processing template: Template<template=({% if states("sensor.pracka_aktualni_spotreba_upr")|float <= 0 %} mdi:washing-machine-off {% else %} mdi:washing-machine {% endif %}) renders=3> 2:19:07 PM – (ERROR) helpers/template.py - message first occurred at 2:19:07 PM and shows up 6 times [139888297971648] Error handling message: Unknown error (unknown_error) Ondrej from 10.0.0.130 (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36) 2:18:48 PM – (ERROR) Home Assistant WebSocket API Error doing job: Exception in callback CloudGoogleConfig._handle_entity_registry_updated() 2:18:38 PM – (ERROR) components/cloud/google_config.py - message first occurred at 2:18:28 PM and shows up 163 times Function get_sensor_data luxtronik_key UNSET is None 2:18:30 PM – (WARNING) Luxtronik (custom integration) - message first occurred at 2:18:30 PM and shows up 4 times Error doing job: Task exception was never retrieved 2:18:30 PM – (ERROR) components/cloud/alexa_config.py - message first occurred at 2:18:28 PM and shows up 158 times Get_device_entity_title key climate.cooling not found in 2:18:29 PM – (WARNING) Luxtronik (custom integration) esp32-cam-1 @ 10.0.0.254: Connection error occurred: esp32-cam-1 @ 10.0.0.254: EOF received 2:18:28 PM – (WARNING) runner.py - message first occurred at 2:10:02 PM and shows up 6 times Unexpected exception when checking if a socket is closed 2:17:41 PM – (ERROR) Luxtronik (custom integration)"

home-assistant_2023-09-24T12-25-44.524Z.log

BenPru commented 9 months ago

You get only template errors. Please read the release notes. Some keys have changed. I think you are using outdated keys in your templates.

ondras76 commented 9 months ago

hi, I was try meke on my second machine rpi, make clean HA instalation with just Luxtronik and the problem is the same with cloud.

AJediIAm commented 9 months ago

I had a similar issue which caused the nabu Casa cloud to malfunction: https://github.com/home-assistant/core/issues/100564 Disabling/enabling the Luxtronik2 integration confirmed my could issue is related to Luxtronik2.

I disabled the integration for a while since I assumed it was something unique to my setup. When I noticed this issue, I checked again with the latest version of the integration (fresh install) and my error now matches the one reported by @ondras76.

Nabu Casa cloud seems to be stable for now, but my Netatmo integration fails to load when Luxtronik2 is enabled. This is consistent with my earlier experience.

Could we keep this issue open to see if there are more users with the same problem and if we have something in common which is could cause this issue?

ondras76 commented 9 months ago

On clean instalation with only Luxtronik, without connected cloud I see the internal HA weather forecast Meteorologisk institutt can't connect.

AJediIAm commented 9 months ago

I have a WZSV 62 K3M which is identified as MSW2-6S in the software. It is a water/water heatpump with cooling and DHW. If we find commonalities with heatspumps which either have or dont have the same issue, we might get clues about the code which causes this.

@BenPru what kind of heatpump do you have? What kind of logs would be interesting to look at?

@BenPru if you want, I can setup a development instance for you and give you access for testing. This offer extends beyond this specific issue.

ondras76 commented 9 months ago

My heat pump is, Alpha Innotec LWDW 9, with luxtronik regulator.

BenPru commented 9 months ago

home-assistant_2023-09-24T12-25-44.524Z.log

You use the states object direkt: 'states.*' - e.g. states.sensor.luxtronik2_outdoor_temperature.state. This is not best practice and cause errors. See the docs. And in the worst case, HA completely hangs up!

In your log file I have found this error: 2023-09-24 14:17:41.757 ERROR (MainThread) [custom_components.luxtronik2] Unexpected exception when checking if a socket is closed Traceback (most recent call last): File "/config/custom_components/luxtronik2/lux_helper.py", line 146, in _is_socket_closed data = sock.recv(16, socket.MSG_DONTWAIT | socket.MSG_PEEK) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ OSError: [Errno 107] Socket not connected

The socket connection to the heatpump is not possible. Is the IP and Port correct in the config? Has anyone else the same error in the log?

ondras76 commented 9 months ago

@BenPru thank you for your comment, propably you right, but like I said today. I was try new instaltion on my second machine, just clean Haos and Luxtronik, the issue is the same. When I connect the Luxtronik hub something happend and cloud can't connect. Also if I have cloud off, some integrations like a internal Meteo.. forecast can't connect. Thank you for your help.

BenPru commented 9 months ago

If the integration can not connect to the heatpump on the network layer an exception is thrown. It is possible that this exception has an impact for ha and other integrations. In older ha versions this was a problem. But normally ha should handle integration errors. Perhaps this is a new problem in 2023.9.2 and higher. It is also possible that the startup order in ha 2023.9.2.>= has changed and it has an impact that template sensors grab values from the luxtronik integration. If one template uses "states,*" it could crash ha. I have the same in the past. In the next days I try to have a look to handle this socket error graceful. But have you checked your config? Have you the same error in the log in your test env?

BenPru commented 9 months ago

@BenPru what kind of heatpump do you have? What kind of logs would be interesting to look at?

Novelan LAD 7 with V2.88.1 (V2.88.3 available) Errors abount luxtronik. (Not from template vars!)

@BenPru if you want, I can setup a development instance for you and give you access for testing. This offer extends beyond this specific issue.

Sorry, I don't have the time to debug remote.

ondras76 commented 9 months ago

If the integration can not connect to the heatpump on the network layer an exception is thrown. It is possible that this exception has an impact for ha and other integrations. In older ha versions this was a problem. But normally ha should handle integration errors. Perhaps this is a new problem in 2023.9.2 and higher.

It is also possible that the startup order in ha 2023.9.2.>= has changed and it has an impact that template sensors grab values from the luxtronik integration. If one template uses "states,*" it could crash ha. I have the same in the past.

In the next days I try to have a look to handle this socket error graceful.

But have you checked your config? Have you the same error in the log in your test env?

.. Like I said, it's clean install. I didn't make any changes in config. This is only issue afrer starting hub luxtronik.

image image image

BenPru commented 9 months ago

.. Like I said, it's clean install. I didn't make any changes in config. This is only issue afrer starting hub luxtronik.

Clean install with only installed but not configured luxtronik integration? And no luxtronik error in the log?

ondras76 commented 9 months ago

.. Like I said, it's clean install. I didn't make any changes in config. This is only issue afrer starting hub luxtronik.

Clean install with only installed but not configured luxtronik integration?

And no luxtronik error in the log?

No any errors without Luxtronik.

BenPru commented 9 months ago

If an integration is not configured HA should not load and use this integration. You get an error without integration configuration, so HA have a big change in the integration handling. But in the ha dev blog nothing was communicated... I try to provide a hotfix in the main branch. Please try this one.

ondras76 commented 9 months ago

If an integration is not configured HA should not load and use this integration. You get an error without integration configuration, so HA have a big change in the integration handling. But in the ha dev blog nothing was communicated... I try to provide a hotfix in the main branch. Please try this one.

sorry was also this when the Luxtronik running Screenshot 2023-10-01 233531

ondras76 commented 9 months ago

If an integration is not configured HA should not load and use this integration.

You get an error without integration configuration, so HA have a big change in the integration handling. But in the ha dev blog nothing was communicated...

I try to provide a hotfix in the main branch. Please try this one.

I don't have any problem when the integration not configured, the problem is only when IS configured.

idominiki commented 9 months ago

Same problem here

idominiki commented 9 months ago

Any news regarding a functional version for HA 2023.10?

I tested both alpha version and main brunch. Installation of the integration is no problem. If I want to configure the heatpump (Alpha innotec SWCV) I got a timeout, than ha restarts and nothing happened.

Heating season is before and I want to track my energy.

Thanks!

BenPru commented 9 months ago

Any news regarding a functional version for HA 2023.10?

No, I have no news. But thanks for your input. I try to reconf my test env. I have tried to activate every optional entity but all works fine in my envs... I can't produce any error. Do you have something in your logs?

idominiki commented 9 months ago

Any news regarding a functional version for HA 2023.10?

No, I have no news. But thanks for your input. I try to reconf my test env. I have tried to activate every optional entity but all works fine in my envs... I can't produce any error. Do you have something in your logs?

As home assistant is restarting immediately after configuration I will try to catch logs tomorrow.

idominiki commented 9 months ago

This is the output from homeassistant.log while I want to configure the luxtronik host.

2023-10-08 17:12:31.999 ERROR (MainThread) [aiohttp.server] Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request resp = await request_handler(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle resp = await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 117, in impl return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 227, in forwarded_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, 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 31, in headers_middleware response = await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 148, in handle result = await handler(request, **request.match_info) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/websocket_api/http.py", line 50, in get return await WebSocketHandler(request.app["hass"], request).async_handle() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/websocket_api/http.py", line 276, in async_handle await wsock.prepare(request) File "/usr/local/lib/python3.11/site-packages/aiohttp/web_ws.py", line 138, in prepare payload_writer = await super().prepare(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/web_response.py", line 421, in prepare return await self._start(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/web_response.py", line 429, in _start await self._write_headers() File "/usr/local/lib/python3.11/site-packages/aiohttp/web_response.py", line 502, in _write_headers await writer.write_headers(status_line, self._headers) File "/usr/local/lib/python3.11/site-packages/aiohttp/http_writer.py", line 130, in write_headers self._write(buf) File "/usr/local/lib/python3.11/site-packages/aiohttp/http_writer.py", line 75, in _write raise ConnectionResetError("Cannot write to closing transport") ConnectionResetError: Cannot write to closing transport 2023-10-08 17:12:32.018 ERROR (MainThread) [aiohttp.server] Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request resp = await request_handler(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle resp = await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 117, in impl return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 227, in forwarded_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, 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 31, in headers_middleware response = await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 148, in handle result = await handler(request, **request.match_info) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/websocket_api/http.py", line 50, in get return await WebSocketHandler(request.app["hass"], request).async_handle() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/websocket_api/http.py", line 276, in async_handle await wsock.prepare(request) File "/usr/local/lib/python3.11/site-packages/aiohttp/web_ws.py", line 138, in prepare payload_writer = await super().prepare(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/web_response.py", line 421, in prepare return await self._start(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/web_response.py", line 429, in _start await self._write_headers() File "/usr/local/lib/python3.11/site-packages/aiohttp/web_response.py", line 502, in _write_headers await writer.write_headers(status_line, self._headers) File "/usr/local/lib/python3.11/site-packages/aiohttp/http_writer.py", line 130, in write_headers self._write(buf) File "/usr/local/lib/python3.11/site-packages/aiohttp/http_writer.py", line 75, in _write raise ConnectionResetError("Cannot write to closing transport") ConnectionResetError: Cannot write to closing transport 2023-10-08 17:12:32.025 ERROR (MainThread) [aiohttp.server] Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request resp = await request_handler(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle resp = await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 117, in impl return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 227, in forwarded_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, 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 31, in headers_middleware response = await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 148, in handle result = await handler(request, **request.match_info) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/websocket_api/http.py", line 50, in get return await WebSocketHandler(request.app["hass"], request).async_handle() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/websocket_api/http.py", line 276, in async_handle await wsock.prepare(request) File "/usr/local/lib/python3.11/site-packages/aiohttp/web_ws.py", line 138, in prepare payload_writer = await super().prepare(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/web_response.py", line 421, in prepare return await self._start(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/web_response.py", line 429, in _start await self._write_headers() File "/usr/local/lib/python3.11/site-packages/aiohttp/web_response.py", line 502, in _write_headers await writer.write_headers(status_line, self._headers) File "/usr/local/lib/python3.11/site-packages/aiohttp/http_writer.py", line 130, in write_headers self._write(buf) File "/usr/local/lib/python3.11/site-packages/aiohttp/http_writer.py", line 75, in _write raise ConnectionResetError("Cannot write to closing transport") ConnectionResetError: Cannot write to closing transport 2023-10-08 17:12:32.030 ERROR (MainThread) [aiohttp.server] Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request resp = await request_handler(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle resp = await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 117, in impl return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 227, in forwarded_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, 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 31, in headers_middleware response = await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 148, in handle result = await handler(request, **request.match_info) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/websocket_api/http.py", line 50, in get return await WebSocketHandler(request.app["hass"], request).async_handle() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/websocket_api/http.py", line 276, in async_handle await wsock.prepare(request) File "/usr/local/lib/python3.11/site-packages/aiohttp/web_ws.py", line 138, in prepare payload_writer = await super().prepare(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/web_response.py", line 421, in prepare return await self._start(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/web_response.py", line 429, in _start await self._write_headers() File "/usr/local/lib/python3.11/site-packages/aiohttp/web_response.py", line 502, in _write_headers await writer.write_headers(status_line, self._headers) File "/usr/local/lib/python3.11/site-packages/aiohttp/http_writer.py", line 130, in write_headers self._write(buf) File "/usr/local/lib/python3.11/site-packages/aiohttp/http_writer.py", line 75, in _write raise ConnectionResetError("Cannot write to closing transport") ConnectionResetError: Cannot write to closing transport 2023-10-08 17:12:32.046 ERROR (MainThread) [aiohttp.server] Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request resp = await request_handler(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle resp = await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 117, in impl return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 227, in forwarded_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware return await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, 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 31, in headers_middleware response = await handler(request) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 148, in handle result = await handler(request, **request.match_info) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/websocket_api/http.py", line 50, in get return await WebSocketHandler(request.app["hass"], request).async_handle() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/websocket_api/http.py", line 276, in async_handle await wsock.prepare(request) File "/usr/local/lib/python3.11/site-packages/aiohttp/web_ws.py", line 138, in prepare payload_writer = await super().prepare(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/web_response.py", line 421, in prepare return await self._start(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/web_response.py", line 429, in _start await self._write_headers() File "/usr/local/lib/python3.11/site-packages/aiohttp/web_response.py", line 502, in _write_headers await writer.write_headers(status_line, self._headers) File "/usr/local/lib/python3.11/site-packages/aiohttp/http_writer.py", line 130, in write_headers self._write(buf) File "/usr/local/lib/python3.11/site-packages/aiohttp/http_writer.py", line 75, in _write raise ConnectionResetError("Cannot write to closing transport") ConnectionResetError: Cannot write to closing transport 2023-10-08 17:12:43.312 ERROR (MainThread) [aiohomekit.controller.coap.connection] Decryption failed, desynchronized? Counter=239/240 2023-10-08 17:12:43.312 ERROR (MainThread) [aiohomekit.controller.coap.connection] Failed flailing attempts to resynchronize, self-destructing in 3, 2, 1...

The problem is, as soon as I send the IP and Port, home assistant closing its connection. Hangs up for 5 minutes and restart.

This is the supervisor log output: Bildschirmfoto 2023-10-08 um 17 10 24

ondras76 commented 9 months ago

The problem is, as soon as I send the IP and Port, home assistant closing its connection. Hangs up for 5 minutes and restart.

This is the supervisor log output:

Bildschirmfoto 2023-10-08 um 17 10 24

BenPru commented 9 months ago

Please vote this comment: 👍🏽 I have this behavior and my heatpump has a cooling option 👎🏽 I have this behavior and my heatpump has NO cooling option

BenPru commented 9 months ago

Please try 2023.10.9-Alpha-Core-Preview

idominiki commented 9 months ago

Please try 2023.10.9-Alpha-Core-Preview

Sadly same behavior for me.

After I sent the form, ha doesn't respond anymore. image

BenPru commented 9 months ago

Please vote this comment: 👍🏽 I have this behavior and I use the Home Assistant Cloud from Nabu Casa 👎🏽 I have this behavior and I don't use the Home Assistant Cloud from Nabu Casa

BenPru commented 9 months ago

Now I'm totally confused...

Sadly same behavior for me.

Can you provide a current log as file attachment?

idominiki commented 9 months ago

Now I'm totally confused...

Sadly same behavior for me.

Can you provide a current log as file attachment?

Here is my latest homeassistant.log home-assistant.log

BenPru commented 9 months ago

Please, everbody who is involved with this issue, please check what you don't have an old yaml config with luxtronik2 sensors. If so please disable or delete the regarding yaml config lines.

Please vote this comment: 👍🏽 I have this behavior and I have template sensors using luxtronik sensors 👎🏽 I have this behavior and I don't have template sensors using luxtronik sensors

idominiki commented 9 months ago

I just removed all config lines regarding luxtronik2 sensor.

Same behavior. Can't configure the integration.

idominiki commented 9 months ago

I GOT IT WORKING!!

Guys, please check your web server from your heat pump. My hangs up so I can't login remotely:

image

Restart your heat pump or re-enable DHCP in settings.

After the restart, I can setup the integration without any problems!

A big shout to @BenPru, sorry for the confusion but a big thanks for your support!!!

ondras76 commented 9 months ago

I GOT IT WORKING!!

Guys, please check your web server from your heat pump. My hangs up so I can't login remotely:

image

Restart your heat pump or re-enable DHCP in settings.

After the restart, I can setup the integration without any problems!

A big shout to @BenPru, sorry for the confusion but a big thanks for your support!!!

what web server you mean?

idominiki commented 9 months ago

I GOT IT WORKING!!

Guys, please check your web server from your heat pump. My hangs up so I can't login remotely:

image

Restart your heat pump or re-enable DHCP in settings.

After the restart, I can setup the integration without any problems!

A big shout to @BenPru, sorry for the confusion but a big thanks for your support!!!

what web server you mean?

The integrated web server in your heat pump. If you open the pi address your heat pump in any browser, you can also control your heat pump.

My Webserver hangs up. If you see just a loading screen without a field to enter pin, your Webserver hangs up, too.

So I restarted my heat pump. After restart, all is working now.

BenPru commented 9 months ago

Yes, I have the same about two years ago. After firmware upgrade the network config could be wrong. It is known by AIT... Please check your network config after every firmware upgrade. Perhaps you can also check it with a mobile app e.g. Luxprobe.


The Webserver is not very stable and since x.88.x it is more unstable. If you connect to the websocket and make some more requests, it crashes very fast.


I will create a new version with own error handling in the config flow.

BenPru commented 9 months ago

I think I can produce it or something like this. If I use Port 80 for the connection, the connection seems to be valid but the returned data responses in the length calculation a very high length. In the data processing the loop runs very, very long and ha run in a timeout. I add a max data length or a timeout. But this is in the code of the underlying Bouni\Luxtronik module.

idominiki commented 9 months ago

Hey @BenPru

Version 2023.10.9 is working for me. Bildschirmfoto 2023-10-10 um 19 17 16

Version 2023.10.10 can't load the integration and home assistant is restarting directly after start. Bildschirmfoto 2023-10-10 um 07 05 40

BenPru commented 9 months ago

Version 2023.10.10 can't load the integration and home assistant is restarting directly after start.

I have changed some params in the main branch to test:

Please test the main branch and give feedback.

idominiki commented 9 months ago

Version 2023.10.10 can't load the integration and home assistant is restarting directly after start.

I have changed some params in the main branch to test:

  • Rollback socket_close result True>False in error case
  • Increase socket timeout 10>100
  • Increase max data length

Please test the main branch and give feedback.

Changes doesn't help. Home Assistant startup is much slower / unresponsive. Many integrations has status "initializing".

image image
BenPru commented 9 months ago

Please try 2023.10.11-Beta and check that all is fixed finally. Thank you for your input and tests.

idominiki commented 9 months ago

Please try 2023.10.11-Beta and check that all is fixed finally. Thank you for your input and tests.

Sadly no: Errors during setup. But Home Assistant is starting normally. Reloading Integration doesn't fix.

image image
idominiki commented 9 months ago

Please try 2023.10.11-Beta and check that all is fixed finally.

Thank you for your input and tests.

v2023.10.12-beta load the integration but two devices can't be setup. image Bildschirmfoto 2023-10-12 um 08 29 40 Bildschirmfoto 2023-10-12 um 08 29 33

rhammen commented 8 months ago

Please try 2023.10.11-Beta and check that all is fixed finally. Thank you for your input and tests.

v2023.10.12-beta load the integration but two devices can't be setup.

See #149 , will be fixed with #150

ondras76 commented 8 months ago

@BenPru Just let you know, I was try new release 2023.10.13 and stil the same, about my problem with the cloud, can't connect to the cloud. log whe I try connect the cloud, just say againg, is it clean HAos with just Luxtronik integration.

"Log details (ERROR) Logger: homeassistant.components.websocket_api.http.connection Source: components/cloud/google_config.py:153 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 2:38:11 PM (1 occurrences) Last logged: 2:38:11 PM

[546959756352] Error handling message: Unknown error (unknown_error) rpi from 10.0.0.130 (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 26, in _handle_async_response await func(hass, connection, msg) File "/usr/src/homeassistant/homeassistant/components/cloud/http_api.py", line 357, in websocket_cloud_status websocket_api.result_message(msg["id"], await _account_data(hass, cloud)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/cloud/http_api.py", line 525, in _account_data google_config = await client.get_google_config() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/cloud/client.py", line 133, in get_google_config await google_conf.async_initialize() File "/usr/src/homeassistant/homeassistant/components/cloud/google_config.py", line 212, in async_initialize await super().async_initialize() File "/usr/src/homeassistant/homeassistant/components/google_assistant/helpers.py", line 106, in async_initialize if not self.enabled: ^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/cloud/google_config.py", line 153, in enabled and not self._cloud.subscription_expired ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/hass_nabucasa/init.py", line 133, in subscription_expired return utcnow() > self.expiration_date + timedelta(days=7) ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/hass_nabucasa/init.py", line 139, in expiration_date raise ValueError( ValueError: Invalid expiration date (2023-10-24)"

BenPru commented 8 months ago

@BenPru Just let you know, I was try new release 2023.10.13 and stil the same, about my problem with the cloud, can't connect to the cloud. log whe I try connect the cloud, just say againg, is it clean HAos with just Luxtronik integration.

Please try the new timeout config values.

ondras76 commented 8 months ago

@BenPru Just let you know, I was try new release 2023.10.13 and stil the same, about my problem with the cloud, can't connect to the cloud. log whe I try connect the cloud, just say againg, is it clean HAos with just Luxtronik integration.

Please try the new timeout config values.

Can you tell me how much and direction.

BenPru commented 8 months ago

@ondras76 Please test different timeouts and package lengths for your case: image

At the moment we have no stable release for HA>=2023.9.*. I would like to release a stable version. The other response is that it is now running for all others. Only in your case it isn't and I can not see any luxtronik errors in your log.

ludeeus commented 8 months ago

HA Cloud and the log entries have nothing to do with the Luxtronik integration.

Took a quick look at the code, because of several reports of this now. Because this part https://github.com/BenPru/luxtronik/blob/576736e5c92cbce5f47d3523766f821e706bde8f/custom_components/luxtronik/base.py#L91 sets an invalid code for the entire runtime (all of HA and its integrations) it is the cause of that log entry (and failure).