When HA fails to start (for whatever reason), no task is created. However, it still triggers the entry.async_on_unload callback where it tries to cancel this task:
2024-05-14 05:53:12.347 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/config/custom_components/enphase_envoy/__init__.py", line 240, in _async_stop
await _cancel_realtime_task(task)
File "/config/custom_components/enphase_envoy/__init__.py", line 255, in _cancel_realtime_task
task.cancel()
^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'cancel'
I've added type annotations to make the problem clearer.
When HA fails to start (for whatever reason), no task is created. However, it still triggers the
entry.async_on_unload
callback where it tries to cancel this task:I've added type annotations to make the problem clearer.