Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions aurora.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down Expand Up @@ -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