Skip to content

Commit

Permalink
Fix WiZ bulb being offline if kelvin limits cannot be obtained
Browse files Browse the repository at this point in the history
- Setup is now retried later in case the wifi was
  unstable for a moment during setup

Requires sbidy/pywizlight#121

Changelog: sbidy/pywizlight@v0.5.5...v0.5.6

Fixes
```
2022-02-10 18:07:19 ERROR (MainThread) [homeassistant.components.light] Error while setting up wiz platform for light
Traceback (most recent call last):
  File "/Users/bdraco/home-assistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
    await asyncio.shield(task)
  File "/Users/bdraco/home-assistant/homeassistant/components/wiz/light.py", line 69, in async_setup_entry
    async_add_entities([WizBulbEntity(wiz_data, entry.title)])
  File "/Users/bdraco/home-assistant/homeassistant/components/wiz/light.py", line 94, in __init__
    bulb_type.kelvin_range.max
AttributeError: NoneType object has no attribute max
```
  • Loading branch information
bdraco committed Feb 11, 2022
1 parent bed5002 commit 41b6b96
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions homeassistant/components/wiz/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
try:
scenes = await bulb.getSupportedScenes()
await bulb.getMac()
# ValueError gets thrown if the bulb type
# cannot be determined on the first try.
# This is likely because way the library
# processes responses and can be cleaned up
# in the future.
except WizLightNotKnownBulb:
# This is only thrown on IndexError when the
# bulb responds with invalid data? It may
# not actually be possible anymore
_LOGGER.warning("The WiZ bulb type could not be determined for %s", ip_address)
return False
except (ValueError, *WIZ_EXCEPTIONS) as err:
raise ConfigEntryNotReady from err
except (WizLightNotKnownBulb, *WIZ_EXCEPTIONS) as err:
raise ConfigEntryNotReady(f"{ip_address}: {err}") from err

async def _async_update() -> None:
"""Update the WiZ device."""
Expand Down

0 comments on commit 41b6b96

Please sign in to comment.