Skip to content

Commit b80b253

Browse files
authored
Warning when calling light.turn_on with brightness=0 (#678)
* Do not update the call when calling light.turn_on with brightness=0 * Simplify * issue warning instead
1 parent e0e04da commit b80b253

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

custom_components/adaptive_lighting/switch.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1993,6 +1993,13 @@ async def _service_interceptor_turn_on_handler( # noqa: PLR0911
19931993
if self.manual_control.get(entity_id, False):
19941994
return
19951995

1996+
if data.get(ATTR_BRIGHTNESS) == 0:
1997+
_LOGGER.warning(
1998+
"Turn-on call with zero brightness detected, Adaptive Lighting"
1999+
" intercepted this service_call and adjusted it. If you use this as"
2000+
" a brightness workaround, please remove it, it is no longer necessary",
2001+
)
2002+
19962003
try:
19972004
adaptive_switch = _switch_with_lights(self.hass, [entity_id])
19982005
except NoSwitchFoundError:

0 commit comments

Comments
 (0)