hugobloem / stateful_scenes

Stateful Scenes in Home Assistant (Home Kit scene compatible)
MIT License
52 stars 6 forks source link

v1.0.3beta1 bug - AttributeError: 'NoneType' object has no attribute 'create_task' #81

Closed pgale closed 6 months ago

pgale commented 6 months ago

I think this is a separate bug to the device_id previously logged.

Created three new scenes from Hue scenes. They all share the same lights and are in the same room.

I have some mushroom template cards setup as buttons that set a Hue scene. The icon has a conditional colour that I set from the stateful scene switch that your integration creates. I noticed that one of them was taking a while to respond and saw the error below.

It sometimes works, sometimes not but generates quite a few of these errors each time it seems.

Logger: homeassistant
Source: helpers/entity.py:1208
First occurred: 14:05:35 (108 occurrences)
Last logged: 14:12:46

Error doing job: Future exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/stateful_scenes/StatefulScenes.py", line 291, in update_callback
    self.schedule_update(True)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1208, in schedule_update_ha_state
    self.hass.create_task(
    ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'create_task'