Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug fix: 'dimming' param is not returned in progressive scenes like w… #32

Merged
merged 1 commit into from
Dec 25, 2020

Conversation

angadsingh
Copy link
Contributor

…ake-up

I had overlooked this earlier. This seems to be an issue since the beginning. If your rhythm has a 'wake-up' scene or if you set your light to 'wake-up' or any of the 'progressive scenes', i.e. 'wake-up' or 'bedtime', then the 'dimming' param is not returned by the lights in getPilot :)

this causes an exception in pywizlight, thus causing the light to become unavailable:

2020-12-21 19:43:46 ERROR (MainThread) [homeassistant.helpers.entity] Update for light.living_room_lamp_3_wiz_a55ec9 fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_device_update
    raise exc
  File "/config/custom_components/wiz_light/light.py", line 211, in async_update
    self.update_brightness()
  File "/config/custom_components/wiz_light/light.py", line 245, in update_brightness
    if self._light.state.get_brightness() is None:
  File "/config/custom_components/wiz_light/wizlight.py", line 197, in get_brightness
    return self.percent_to_hex(self.pilotResult['dimming'])
KeyError: 'dimming'

this small fix fixes this

…ake-up

I had overlooked this earlier. This seems to be an issue since the beginning. If your rhythm has a 'wake-up' scene or if you set your light to 'wake-up' or any of the 'progressive scenes', i.e. 'wake-up' or 'bedtime', then the 'dimming' param is not returned by the lights in getPilot :)

this causes an exception in pywizlight, thus causing the light to become unavailable:
```
2020-12-21 19:43:46 ERROR (MainThread) [homeassistant.helpers.entity] Update for light.living_room_lamp_3_wiz_a55ec9 fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_device_update
    raise exc
  File "/config/custom_components/wiz_light/light.py", line 211, in async_update
    self.update_brightness()
  File "/config/custom_components/wiz_light/light.py", line 245, in update_brightness
    if self._light.state.get_brightness() is None:
  File "/config/custom_components/wiz_light/wizlight.py", line 197, in get_brightness
    return self.percent_to_hex(self.pilotResult['dimming'])
KeyError: 'dimming'
```
this small fix fixes this
@angadsingh
Copy link
Contributor Author

ps: @sbidy congratulations on the first release!

@sbidy sbidy merged commit 284cb54 into sbidy:master Dec 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants