From 12ea3620fa8b6c56e4b67a10fbd4294b59f22851 Mon Sep 17 00:00:00 2001 From: Nico Dreher <13905639+nicodreher@users.noreply.github.com> Date: Thu, 28 Nov 2024 19:30:13 +0100 Subject: [PATCH] Fix calculating brightness percentage of 0% causing bad request Add lower limit for brightness to 1%. fixes #208 --- custom_components/bosch_shc/light.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/bosch_shc/light.py b/custom_components/bosch_shc/light.py index ad257bd..85be207 100644 --- a/custom_components/bosch_shc/light.py +++ b/custom_components/bosch_shc/light.py @@ -102,7 +102,7 @@ def turn_on(self, **kwargs): brightness = kwargs.get(ATTR_BRIGHTNESS) if brightness is not None and self._device.supports_brightness: - self._device.brightness = round(brightness * 100 / 255) + self._device.brightness = max(round(brightness * 100 / 255), 1) if color_temp_kelvin is not None and self._device.supports_color_temp: self._device.color = color_util.color_temperature_kelvin_to_mired(