bodyscape / cielo_home

Integration with Cielo Home
Apache License 2.0
44 stars 10 forks source link

Threading issue with schedule_update_ha_state #40

Closed christopherharper77 closed 5 months ago

christopherharper77 commented 6 months ago

Getting this error in Home Assistant Core

After this I'm unable to set temperature until HA is restarted.

Logger: root Source: helpers/entity.py:904 First occurred: December 16, 2023 at 11:52:57 PM (100 occurrences) Last logged: 10:21:11 AM

Uncaught thread exception Traceback (most recent call last): File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner self.run() File "/usr/local/lib/python3.11/threading.py", line 1401, in run self.function(*self.args, **self.kwargs) File "/config/custom_components/cielo_home/cielohomedevice.py", line 874, in dispatch_state_updated listener.state_updated() File "/config/custom_components/cielo_home/entity.py", line 37, in state_updated self.schedule_update_ha_state(False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 904, in schedule_update_ha_state self.hass.loop.call_soon_threadsafe(self.async_write_ha_state) ^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'loop'

jimladino commented 6 months ago

I am having the same issue. Unfortunately I do not have a solution to contribute.

bodyscape commented 6 months ago

How to reproduce it guys?

christopherharper77 commented 6 months ago

I have an automation that is setting the temperature on 4 air handlers at the same time. It tends to work a handful of times before the issue arises, and then once it does it continues to not work. Perhaps jimladino had a simpler trigger?

bodyscape commented 5 months ago

try the version 1.6.6