mirror of
https://github.com/basnijholt/adaptive-lighting.git
synced 2026-09-11 22:34:04 +02:00
simplify calc_ct and calc_rgb
This commit is contained in:
parent
643d69bbf8
commit
3be5f44488
1 changed files with 3 additions and 8 deletions
|
|
@ -283,16 +283,11 @@ class CircadianSwitch(SwitchEntity, RestoreEntity):
|
|||
return is_sleep
|
||||
|
||||
def calc_ct(self):
|
||||
if self.is_sleep():
|
||||
return color_temperature_kelvin_to_mired(self._sleep_colortemp)
|
||||
else:
|
||||
return color_temperature_kelvin_to_mired(self._cl.data["colortemp"])
|
||||
col_temp = self._sleep_colortemp if self.is_sleep() else self._cl.data["colortemp"]
|
||||
return color_temperature_kelvin_to_mired(col_temp)
|
||||
|
||||
def calc_rgb(self):
|
||||
if self.is_sleep():
|
||||
return color_temperature_to_rgb(self._sleep_colortemp)
|
||||
else:
|
||||
return color_temperature_to_rgb(self._cl.data["colortemp"])
|
||||
return self.calc_ct()
|
||||
|
||||
def calc_xy(self):
|
||||
return color_RGB_to_xy(*self.calc_rgb())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue