From b80b253fa1b840c63415d67b8a6df107cf7bbde3 Mon Sep 17 00:00:00 2001 From: Bas Nijholt Date: Wed, 2 Aug 2023 23:12:13 -0700 Subject: [PATCH] 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 --- custom_components/adaptive_lighting/switch.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/custom_components/adaptive_lighting/switch.py b/custom_components/adaptive_lighting/switch.py index 641ffab6..fd0fb9d1 100644 --- a/custom_components/adaptive_lighting/switch.py +++ b/custom_components/adaptive_lighting/switch.py @@ -1993,6 +1993,13 @@ class AdaptiveLightingManager: if self.manual_control.get(entity_id, False): return + if data.get(ATTR_BRIGHTNESS) == 0: + _LOGGER.warning( + "Turn-on call with zero brightness detected, Adaptive Lighting" + " intercepted this service_call and adjusted it. If you use this as" + " a brightness workaround, please remove it, it is no longer necessary", + ) + try: adaptive_switch = _switch_with_lights(self.hass, [entity_id]) except NoSwitchFoundError: