c0un7-z3r0 / hass-phoniebox

An Phoniebox integration for Home Assistant
MIT License
3 stars 1 forks source link

Phoniebox Integration runing into an error that cause an infinite loop in HA core-starting job #41

Closed MacWyver closed 3 months ago

MacWyver commented 3 months ago

Integration version: v0.3.3

Core-Version: 2024.6.0

Core-Log:

2024-06-11 07:51:20.328 ERROR (MainThread) [homeassistant] Error doing job: Task was destroyed but it is pending! (<Task pending name='Task-2868' coro=<BaseSelectorEventLoop._accept_connection2() running at /usr/local/lib/python3.12/asyncio/selector_events.py:213>>) 2024-06-11 07:51:20.324 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback <_asyncio.TaskStepMethWrapper object at 0x7fa38cb933d0>() (None) 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) RuntimeError: Cannot enter into task <Task pending name='Task-2869' coro=<BaseSelectorEventLoop._accept_connection2() running at /usr/local/lib/python3.12/asyncio/selector_events.py:213>> while another task <Task finished name='Task-2107' exception=RuntimeError("Detected that custom integration 'phoniebox' calls async_write_ha_state from a thread other than the event loop, which may cause Home Assistant to crash or data to corrupt. For more information, see https://developers.home-assistant.io/docs/asyncio_thread_safety/#async_write_ha_state at custom_components/phoniebox/sensor.py, line 106: async_add_devices((sensor,), True). Please report it to the author of the 'phoniebox' custom integration.")> is being executed. 2024-06-11 07:51:23.896 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback Task.task_wakeup() (None) 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) RuntimeError: Cannot enter into task <Task cancelling name='track time interval 30.0' coro=<async_setup_entry..send_keepalive() running at /config/custom_components/comfoconnect/init.py:152> wait_for= cb=[set.remove()]> while another task <Task finished name='Task-2107' exception=RuntimeError("Detected that custom integration 'phoniebox' calls async_write_ha_state from a thread other than the event loop, which may cause Home Assistant to crash or data to corrupt. For more information, see https://developers.home-assistant.io/docs/asyncio_thread_safety/#async_write_ha_state at custom_components/phoniebox/sensor.py, line 106: async_add_devices((sensor,), True). Please report it to the author of the 'phoniebox' custom integration.")> is being executed.

c0un7-z3r0 commented 3 months ago

Hi @MacWyver, thanks for the report. Currently trying to investigating the issue.

I have already a potential fix for this issue. Currently fixing the other deprecations