Danielhiversen / flux_led

A utility for controlling Flux WiFi Smart LED Light Bulbs
GNU Lesser General Public License v3.0
158 stars 144 forks source link

Fix fallback to old ledenet protocol with asyncio #129

Closed bdraco closed 3 years ago

bdraco commented 3 years ago

Fixes

2021-10-13 20:41:47 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Fairy Lights for flux_led
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/tasks.py", line 492, in wait_for
    fut.result()
asyncio.exceptions.CancelledError

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

Traceback (most recent call last):
  File "/Users/bdraco/home-assistant/venv/lib/python3.9/site-packages/flux_led/aiodevice.py", line 165, in _async_determine_protocol
    full_msg = await asyncio.wait_for(
  File "/opt/homebrew/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/tasks.py", line 494, in wait_for
    raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/bdraco/home-assistant/homeassistant/config_entries.py", line 304, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/Users/bdraco/home-assistant/homeassistant/components/flux_led/__init__.py", line 146, in async_setup_entry
    await device.async_setup(_async_state_changed)
  File "/Users/bdraco/home-assistant/venv/lib/python3.9/site-packages/flux_led/aiodevice.py", line 44, in async_setup
    await self._async_determine_protocol()
  File "/Users/bdraco/home-assistant/venv/lib/python3.9/site-packages/flux_led/aiodevice.py", line 169, in _async_determine_protocol
    self.close()
AttributeError: 'AIOWifiLedBulb' object has no attribute 'close'