From ffbef0bcd13bb88e5af672a81f1dd250fbe6fae0 Mon Sep 17 00:00:00 2001 From: PhiBo Date: Tue, 22 Dec 2020 13:28:37 +0100 Subject: [PATCH] Fix KNX issue if 0 kelvin is reported by device (#44392) Co-authored-by: Matthias Alphart Co-authored-by: Franck Nijhof --- homeassistant/components/knx/light.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/knx/light.py b/homeassistant/components/knx/light.py index d9f0f9c0d3a..50d067bf29a 100644 --- a/homeassistant/components/knx/light.py +++ b/homeassistant/components/knx/light.py @@ -86,7 +86,8 @@ class KNXLight(KnxEntity, LightEntity): """Return the color temperature in mireds.""" if self._device.supports_color_temperature: kelvin = self._device.current_color_temperature - if kelvin is not None: + # Avoid division by zero if actuator reported 0 Kelvin (e.g., uninitialized DALI-Gateway) + if kelvin is not None and kelvin > 0: return color_util.color_temperature_kelvin_to_mired(kelvin) if self._device.supports_tunable_white: relative_ct = self._device.current_tunable_white