mirror of
https://github.com/basnijholt/adaptive-lighting.git
synced 2026-09-12 06:44:04 +02:00
simplify calc_brightness
This commit is contained in:
parent
8605578301
commit
56a5a49f64
1 changed files with 9 additions and 11 deletions
|
|
@ -301,18 +301,16 @@ class CircadianSwitch(SwitchEntity, RestoreEntity):
|
|||
def calc_brightness(self):
|
||||
if self._disable_brightness_adjust is True:
|
||||
return None
|
||||
elif self.is_sleep():
|
||||
_LOGGER.debug(f"{self._name} in Sleep mode")
|
||||
return self._sleep_brightness
|
||||
elif self._cl.data["percent"] > 0:
|
||||
return self._max_brightness
|
||||
else:
|
||||
if self.is_sleep():
|
||||
_LOGGER.debug(f"{self._name} in Sleep mode")
|
||||
return self._sleep_brightness
|
||||
else:
|
||||
if self._cl.data["percent"] > 0:
|
||||
return self._max_brightness
|
||||
else:
|
||||
return (
|
||||
(self._max_brightness - self._min_brightness)
|
||||
* ((100 + self._cl.data["percent"]) / 100)
|
||||
) + self._min_brightness
|
||||
return (
|
||||
(self._max_brightness - self._min_brightness)
|
||||
* ((100 + self._cl.data["percent"]) / 100)
|
||||
) + self._min_brightness
|
||||
|
||||
def update_switch(self, transition=None):
|
||||
if self._cl.data is not None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue