BenPru / luxtronik

Luxtronik integration for Home Assistant
MIT License
76 stars 28 forks source link

RuntimeError: Caught blocking call to sleep with args (1.0,) inside the event loop - WP nicht steuerbar #259

Closed DonPrimo12 closed 1 week ago

DonPrimo12 commented 3 months ago

FW der WP: V3.87.0 HA Core: 2024.7.1 Supervisor: 2024.06.2 HA OS: 12.4 Integrationsversion: Laut Einstellungen 2023.11.30, habe aber 2024.01.10 heruntergeladen (Anzeigefehler?)

Ich kann alle gewünschten Sensoren/ Entitäten sehen. Allerdings kann ich keine Werte verändern (zB BW Soll), es erscheint immer wieder der Fehler "Fehler beim Aufrufen des Diensts number/set_value. Write: Error communicating with device."

Hat jemand eine Ahnung, woran das liegen kann? Leider kann ich so keine Automationen schreiben.

Grüße!

dickdahm commented 3 months ago

Bei mir ist es mir diesem HA build genauso. Entitäten auslesbar, aber zB Aktivierung BW oder Heizmodus läuft auf Fehler. Scheinbar triggert er die WP, aber meldet nicht zurück. WW Temperatur wird nicht aktualisiert. Habe darauf hin neueste beta der Integration versucht damit gings leider auch nicht.

Es wird ein Fehler eingeblendet, leider sehe ich ihn im log nicht mehr

TechSaiyajin commented 3 months ago

I have had the same problem since yesterday Changes are not sent to the heat pump.

WP Firmware: V2.88.3

Core: 2024.7.1 Supervisor: 2024.06.2 Operating System: 12.4

robotnikz commented 3 months ago

same here

Alkaramazov commented 3 months ago

Hello, Same here. I think we can rename this issue : "Problem with Core version 2024.7.1" ... I'm definitely sure it was working just before I updated HA Core.

HP Firmware: V3.89.5

Core 2024.7.1 Supervisor 2024.06.2 Operating System 12.4

Error Log :

Logger: homeassistant.components.websocket_api.http.connection Source: components/websocket_api/commands.py:241 integration: Home Assistant WebSocket API (documentation, issues) First occurred: 13:22:19 (6 occurrences) Last logged: 15:23:26

[546956953344] Unexpected exception [546957408816] Unexpected exception

Traceback (most recent call last): File "/config/custom_components/luxtronik2/coordinator.py", line 155, in _write self.client.write() File "/config/custom_components/luxtronik2/lux_helper.py", line 223, in write self._read_write(write=True) File "/config/custom_components/luxtronik2/lux_helper.py", line 254, in _read_write self._write() File "/config/custom_components/luxtronik2/lux_helper.py", line 279, in _write time.sleep(WAIT_TIME_WRITE_PARAMETER) File "/usr/src/homeassistant/homeassistant/util/loop.py", line 192, in protected_loop_func raise_for_blocking_call( File "/usr/src/homeassistant/homeassistant/util/loop.py", line 158, in raise_for_blocking_call raise RuntimeError( RuntimeError: Caught blocking call to sleep with args (1.0,) inside the event loop by custom integration 'luxtronik2' at custom_components/luxtronik2/lux_helper.py, line 279: time.sleep(WAIT_TIME_WRITE_PARAMETER). (offender: /config/custom_components/luxtronik2/lux_helper.py, line 279: time.sleep(WAIT_TIME_WRITE_PARAMETER)), please create a bug report at https://github.com/BenPru/luxtronik/issues For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#sleep

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 241, in handle_call_service response = await hass.services.async_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2731, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2774, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 999, in entity_service_call single_response = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1071, in _handle_entity_call result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/number/init.py", line 120, in async_set_value await entity.async_set_native_value(native_value) File "/config/custom_components/luxtronik2/number.py", line 116, in async_set_native_value data = await self.coordinator.async_write( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/luxtronik2/coordinator.py", line 112, in async_write return await self._async_read_or_write(True, parameter, value) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/luxtronik2/coordinator.py", line 118, in _async_read_or_write data = self._write(parameter, value) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/luxtronik2/coordinator.py", line 163, in _write raise UpdateFailed("Write: Error communicating with device") from err homeassistant.helpers.update_coordinator.UpdateFailed: Write: Error communicating with device

AJediIAm commented 3 months ago

I created a test instance using the 2024.7.0 backup and the same issue occurs there as well.

Dispute the error, it appears the heat pump is controllable. I changes the temperature and away mode. Both changes gave an error, but the heat pump was set to the new temperature and mode.

HP Firmware: V3.89.4 Core 2024.7.0 Supervisor 2024.06.2 Operating System 12.4

[281472498627440] Unexpected exception Traceback (most recent call last): File "/config/custom_components/luxtronik2/coordinator.py", line 155, in _write self.client.write() File "/config/custom_components/luxtronik2/lux_helper.py", line 223, in write self._read_write(write=True) File "/config/custom_components/luxtronik2/lux_helper.py", line 254, in _read_write self._write() File "/config/custom_components/luxtronik2/lux_helper.py", line 279, in _write time.sleep(WAIT_TIME_WRITE_PARAMETER) File "/usr/src/homeassistant/homeassistant/util/loop.py", line 192, in protected_loop_func raise_for_blocking_call( File "/usr/src/homeassistant/homeassistant/util/loop.py", line 158, in raise_for_blocking_call raise RuntimeError( RuntimeError: Caught blocking call to sleep with args (1.0,) inside the event loop by custom integration 'luxtronik2' at custom_components/luxtronik2/lux_helper.py, line 279: time.sleep(WAIT_TIME_WRITE_PARAMETER). (offender: /config/custom_components/luxtronik2/lux_helper.py, line 279: time.sleep(WAIT_TIME_WRITE_PARAMETER)), please create a bug report at https://github.com/BenPru/luxtronik/issues For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#sleep

BenPru commented 3 months ago

Please try the current main branch from today.

AJediIAm commented 3 months ago

Please try the current main branch from today.

I see the main branch, but I'm unable to select it. Maybe the release is not yet ready...

dickdahm commented 3 months ago

Please try the current main branch from today.

I see the main branch, but I'm unable to select it. Maybe the release is not yet ready...

I have the same problem, too. I can select every build including beta releases but not main. @BenPru can you explain how to get this done?

AJediIAm commented 3 months ago

Beware of https://github.com/BenPru/luxtronik/issues/260 The integration fails to load after the update.

I updated my test instance manually. The update is not yet available in HACS.

DonPrimo12 commented 3 months ago

Same here, Im unable to select "main" in the version selector.

@BenPru any advice?

Also I would like to give special thanks to you, Ben! Its super helpful how fast you react to all of your communities issues.

I will definitely tip your work and I suggest anyone who Ben helped to do so, too! His work is invaluable for all of us!

BenPru commented 3 months ago

Same here, Im unable to select "main" in the version selector.

@BenPru any advice?

Changing Things to async ist a bigger Change. Perhaps I can make IT at the end of the next week.

BenPru commented 3 months ago

As short-term workaround a have removed the sleep in the main branch. So it should work at the moment. But the written value is not visible immediately. It is update in the next update interval after 60 seconds.


To install the main branch you can not use the HACS Gui. See the HACS Docs! You have to use the HACS service. E.g.:

service: update.install
target:
  entity_id: update.luxtronik_update
data:
  version: main
AJediIAm commented 3 months ago

Thanks BenPru. I really appreciate the effort you put into this and I understand you have other things to do as well.

Removing line 280 from lux_helper.py actually works perfectly. The new value is visible instantly, even if it affects another entity.

My advise is to comment out the line with a "#" in your favorite HA config edition and wait for the next update.

02curls commented 1 month ago

in my case commenting out the line 279 # time.sleep(WAIT_TIME_WRITE_PARAMETER) in lux_helper.py helps

BenPru commented 1 week ago

Seems to be fixed.

AJediIAm commented 1 week ago

The issue re-emerged in 2024.9.30. (Maybe also earlier versions)

Screenshot_20240930-225331