mirror of
https://github.com/basnijholt/adaptive-lighting.git
synced 2026-09-12 06:44:04 +02:00
simplify calculation
This commit is contained in:
parent
fe6ed9fb2c
commit
2b891c5521
1 changed files with 2 additions and 3 deletions
|
|
@ -489,8 +489,7 @@ class AdaptiveSwitch(SwitchEntity, RestoreEntity):
|
|||
return self._sleep_colortemp
|
||||
if self._percent > 0:
|
||||
delta = self._max_colortemp - self._min_colortemp
|
||||
percent = self._percent / 100
|
||||
return (delta * percent) + self._min_colortemp
|
||||
return (delta * self._percent / 100) + self._min_colortemp
|
||||
return self._min_colortemp
|
||||
|
||||
def _calc_brightness(self) -> float:
|
||||
|
|
@ -501,7 +500,7 @@ class AdaptiveSwitch(SwitchEntity, RestoreEntity):
|
|||
if self._percent > 0:
|
||||
return self._max_brightness
|
||||
delta_brightness = self._max_brightness - self._min_brightness
|
||||
percent = (100 + self._percent) / 100
|
||||
percent = 1 + self._percent / 100
|
||||
return (delta_brightness * percent) + self._min_brightness
|
||||
|
||||
def _is_disabled(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue