mirror of
https://github.com/basnijholt/adaptive-lighting.git
synced 2026-09-11 22:34:04 +02:00
Make sure that 'settings' dict is populated when switch is off
Closes #249 and #190
This commit is contained in:
parent
61fff3e95b
commit
26797b677d
1 changed files with 5 additions and 0 deletions
|
|
@ -793,6 +793,11 @@ class AdaptiveSwitch(SwitchEntity, RestoreEntity):
|
|||
if "transition" in features:
|
||||
service_data[ATTR_TRANSITION] = transition
|
||||
|
||||
# The switch might be off and not have _settings set.
|
||||
self._settings = self._sun_light_settings.get_settings(
|
||||
self.sleep_mode_switch.is_on, transition
|
||||
)
|
||||
|
||||
if "brightness" in features and adapt_brightness:
|
||||
brightness = round(255 * self._settings["brightness_pct"] / 100)
|
||||
service_data[ATTR_BRIGHTNESS] = brightness
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue