improved brightness handling
This commit is contained in:
@@ -141,7 +141,9 @@ class SmartLight(SmartSwitch):
|
||||
# light_brightness_pct: build ordered evaluator list, run initial pass
|
||||
if "light_brightness_pct" in self.args:
|
||||
self.always_change_brightness = False
|
||||
|
||||
if isinstance(self.args["light_brightness_pct"], int):
|
||||
self.light_brightness_pct = self.args["light_brightness_pct"]
|
||||
else:
|
||||
for key in self.args["light_brightness_pct"]:
|
||||
if key == 'always_change_brightness':
|
||||
self.always_change_brightness = bool(self.args["light_brightness_pct"][key])
|
||||
@@ -183,7 +185,7 @@ class SmartLight(SmartSwitch):
|
||||
# EventHandler callback for on_events_with_transition. Jumps to 1 %
|
||||
# first so the ramp always starts from a known low level, then
|
||||
# transitions to the configured brightness over transition_time seconds.
|
||||
def on_turn_on_with_transition(self, event_name, data, kwargs, event_category):
|
||||
def on_turn_on_with_transition(self, event_name, data, event_category):
|
||||
transition_time = self.args["on_events_with_transition"][event_category]["transition_time"]
|
||||
brightness_pct = self.args["on_events_with_transition"][event_category]["brightness_pct"]
|
||||
self.log(f"Turn on at {brightness_pct}% with a transition of {transition_time}s")
|
||||
|
||||
Reference in New Issue
Block a user