mirror of
https://github.com/basnijholt/adaptive-lighting.git
synced 2026-09-12 06:44:04 +02:00
move lines into if statement
This commit is contained in:
parent
2f5b92f80a
commit
6050e99189
1 changed files with 3 additions and 3 deletions
|
|
@ -333,9 +333,6 @@ class CircadianSwitch(SwitchEntity, RestoreEntity):
|
|||
if self._attributes["brightness"] is not None
|
||||
else None
|
||||
)
|
||||
mired = int(self.calc_ct()) if self._lights_ct is not None else None
|
||||
rgb = tuple(map(int, self.calc_rgb())) if self._lights_rgb is not None else None
|
||||
xy = self.calc_xy() if self._lights_xy is not None else None
|
||||
|
||||
for light in lights:
|
||||
if not is_on(self.hass, light):
|
||||
|
|
@ -349,6 +346,7 @@ class CircadianSwitch(SwitchEntity, RestoreEntity):
|
|||
# Set color of array of ct.
|
||||
if self._lights_ct is not None and light in self._lights_ct:
|
||||
which = "CT"
|
||||
mired = int(self.calc_ct()) if self._lights_ct is not None else None
|
||||
if mired is not None:
|
||||
service_data[ATTR_COLOR_TEMP] = mired
|
||||
if brightness is not None:
|
||||
|
|
@ -357,6 +355,7 @@ class CircadianSwitch(SwitchEntity, RestoreEntity):
|
|||
# Set color of array of rgb.
|
||||
elif self._lights_rgb is not None and light in self._lights_rgb:
|
||||
which = "RGB"
|
||||
rgb = tuple(map(int, self.calc_rgb())) if self._lights_rgb is not None else None
|
||||
if rgb is not None:
|
||||
service_data[ATTR_RGB_COLOR] = rgb
|
||||
if brightness is not None:
|
||||
|
|
@ -365,6 +364,7 @@ class CircadianSwitch(SwitchEntity, RestoreEntity):
|
|||
# Set color of array of xy.
|
||||
elif self._lights_xy is not None and light in self._lights_xy:
|
||||
which = "XY"
|
||||
xy = self.calc_xy() if self._lights_xy is not None else None
|
||||
if xy is not None:
|
||||
service_data[ATTR_XY_COLOR] = xy
|
||||
if brightness is not None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue