mirror of
https://github.com/basnijholt/adaptive-lighting.git
synced 2026-09-28 21:04:19 +02:00
parent
f9b6753e6d
commit
8696092879
3 changed files with 17 additions and 5 deletions
|
|
@ -8,5 +8,5 @@
|
|||
"iot_class": "calculated",
|
||||
"issue_tracker": "https://github.com/basnijholt/adaptive-lighting/issues",
|
||||
"requirements": ["ulid-transform"],
|
||||
"version": "1.17.1"
|
||||
"version": "1.17.2"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1159,6 +1159,7 @@ class AdaptiveSwitch(SwitchEntity, RestoreEntity):
|
|||
use_transition = "transition" in features and transition > 0
|
||||
if use_transition:
|
||||
service_data[ATTR_TRANSITION] = transition
|
||||
|
||||
if "brightness" in features and adapt_brightness:
|
||||
brightness = round(255 * self._settings["brightness_pct"] / 100)
|
||||
service_data[ATTR_BRIGHTNESS] = brightness
|
||||
|
|
@ -1185,6 +1186,17 @@ class AdaptiveSwitch(SwitchEntity, RestoreEntity):
|
|||
_LOGGER.debug("%s: Setting rgb_color of light %s", self._name, light)
|
||||
service_data[ATTR_RGB_COLOR] = self._settings["rgb_color"]
|
||||
|
||||
required_attrs = [ATTR_RGB_COLOR, ATTR_COLOR_TEMP_KELVIN, ATTR_BRIGHTNESS]
|
||||
if not any(attr in service_data for attr in required_attrs):
|
||||
_LOGGER.debug(
|
||||
"%s: Skipping adaptation of %s because no relevant attributes"
|
||||
" are set in service_data: %s",
|
||||
self._name,
|
||||
light,
|
||||
service_data,
|
||||
)
|
||||
return None
|
||||
|
||||
context = context or self.create_context("adapt_lights")
|
||||
|
||||
self.manager.last_service_data[light] = service_data
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue