mirror of
https://github.com/home-assistant/core.git
synced 2025-08-05 05:35:11 +02:00
Improved readability
Co-Authored-By: Otto Winter <otto@otto-winter.com>
This commit is contained in:
@@ -68,7 +68,8 @@ class AveaLight(Light):
|
|||||||
else:
|
else:
|
||||||
if ATTR_BRIGHTNESS in kwargs:
|
if ATTR_BRIGHTNESS in kwargs:
|
||||||
bright_percent = round((kwargs.get(ATTR_BRIGHTNESS, 255)/255)*100)
|
bright_percent = round((kwargs.get(ATTR_BRIGHTNESS, 255)/255)*100)
|
||||||
self._light.set_brightness(round(4095 * (bright_percent / 100)));
|
bright = round((kwargs[ATTR_BRIGHTNESS] / 255) * 4095)
|
||||||
|
self._light.set_brightness(bright)
|
||||||
if ATTR_HS_COLOR in kwargs:
|
if ATTR_HS_COLOR in kwargs:
|
||||||
rgb = color_util.color_hs_to_RGB(*kwargs[ATTR_HS_COLOR])
|
rgb = color_util.color_hs_to_RGB(*kwargs[ATTR_HS_COLOR])
|
||||||
self._light.set_rgb(round(255 * (rgb[0] / 100)), round(255 * (rgb[1] / 100)), round(255 * (rgb[2] / 100)));
|
self._light.set_rgb(round(255 * (rgb[0] / 100)), round(255 * (rgb[1] / 100)), round(255 * (rgb[2] / 100)));
|
||||||
|
Reference in New Issue
Block a user