Fix unnecessary method call (#32549)

This commit is contained in:
shred86 2020-03-07 07:13:39 -08:00 committed by GitHub
parent e52542c4d7
commit ae2e6f9d2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -42,16 +42,19 @@ class AbodeLight(AbodeDevice, Light):
self._device.set_color_temp(
int(color_temperature_mired_to_kelvin(kwargs[ATTR_COLOR_TEMP]))
)
return
if ATTR_HS_COLOR in kwargs and self._device.is_color_capable:
self._device.set_color(kwargs[ATTR_HS_COLOR])
return
if ATTR_BRIGHTNESS in kwargs and self._device.is_dimmable:
# Convert Home Assistant brightness (0-255) to Abode brightness (0-99)
# If 100 is sent to Abode, response is 99 causing an error
self._device.set_level(ceil(kwargs[ATTR_BRIGHTNESS] * 99 / 255.0))
else:
self._device.switch_on()
return
self._device.switch_on()
def turn_off(self, **kwargs):
"""Turn off the light."""