From e7ab71ef1a4bbd99ea99ab118745f817cd0a2a07 Mon Sep 17 00:00:00 2001 From: Joakim Rydell Date: Wed, 8 Nov 2017 23:52:48 +0000 Subject: [PATCH] Fixed inverted color temperature slider by modifying color temp conversion functions. --- aurora.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/aurora.py b/aurora.py index aec45f8..693f28a 100644 --- a/aurora.py +++ b/aurora.py @@ -50,10 +50,12 @@ def brightness_scale_hass_to_nanoleaf(range_value): def color_temp_scale_nanoleaf_to_hass(range_value): # Hass uses 154-500, Aurora uses 1200-6500 - return ((range_value - 1200) / 5300) * 346 + 154 + orig_value = ((range_value - 1200) / 5300) * 346 + 154 + return 500+154 - orig_value def color_temp_scale_hass_to_nanoleaf(range_value): - return int(((range_value - 154) / 346) * 5300 + 1200) + orig_value = int(((range_value - 154) / 346) * 5300 + 1200) + return 6500+1200 - orig_value class AuroraLight(Light): """Representation of a Nanoleaf Aurora inside Home Assistant.""" @@ -149,4 +151,3 @@ def update(self): self._color_temp = color_temp_scale_nanoleaf_to_hass(self._light.color_temperature) self._rgb_color = self._rgb_color -