diff --git a/custom_components/myhome/light.py b/custom_components/myhome/light.py index 91ed3b2..db4fa6b 100644 --- a/custom_components/myhome/light.py +++ b/custom_components/myhome/light.py @@ -217,12 +217,16 @@ def handle_event(self, message: OWNLightingEvent): self._gateway_handler.log_id, message.human_readable_log, ) - self._attr_is_on = message.is_on - if ColorMode.BRIGHTNESS in self._attr_supported_color_modes and message.brightness is not None: - self._attr_brightness_pct = message.brightness - self._attr_brightness = percent_to_eight_bits(message.brightness) - - if self._off_icon is not None and self._on_icon is not None: - self._attr_icon = self._on_icon if self._attr_is_on else self._off_icon - - self.async_schedule_update_ha_state() + #This should be in try block as message.is_on can throw error for unsupported message types (like for some dimensions) + try: + self._attr_is_on = message.is_on + if ColorMode.BRIGHTNESS in self._attr_supported_color_modes and message.brightness is not None: + self._attr_brightness_pct = message.brightness + self._attr_brightness = percent_to_eight_bits(message.brightness) + + if self._off_icon is not None and self._on_icon is not None: + self._attr_icon = self._on_icon if self._attr_is_on else self._off_icon + + self.async_schedule_update_ha_state() + except TypeError: + pass \ No newline at end of file