Skip to content

Commit

Permalink
Fix unnecessary method call (home-assistant#32549)
Browse files Browse the repository at this point in the history
  • Loading branch information
shred86 authored Mar 7, 2020
1 parent e52542c commit ae2e6f9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions homeassistant/components/abode/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,19 @@ def turn_on(self, **kwargs):
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."""
Expand Down

0 comments on commit ae2e6f9

Please sign in to comment.