core: HUE ZeroDivisionError

The problem

Since my update to core 2024.4.4 I see division by zero errors. My HUE setup has not changed over the last months.

What version of Home Assistant Core has the issue?

Core-2024.4.4

What was the last working version of Home Assistant Core?

Core-2024.4.3

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Hue

Link to integration documentation on our website

https://www.home-assistant.io/integrations/hue/

Diagnostics information

According my logbook, errors started after an innr PL 110 led was switched on: image

That is a dimmable light only. No colors, no color temperature. Properties of this light in dev tools:

supported_color_modes:
  - brightness
color_mode: null
brightness: null
mode: normal
dynamics: none
friendly_name: Aanrecht
supported_features: 40

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant
Source: util/color.py:633
First occurred: 12:46:33 (131 occurrences)
Last logged: 19:19:18

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohue/v2/controllers/base.py", line 247, in _handle_event
    callback(evt_type, cur_item)
  File "/usr/src/homeassistant/homeassistant/components/hue/v2/entity.py", line 138, in _handle_event
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1051, in __async_calculate_state
    capability_attr = self.capability_attributes
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 1027, in capability_attributes
    max_color_temp_kelvin = self.max_color_temp_kelvin
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 1005, in max_color_temp_kelvin
    return color_util.color_temperature_mired_to_kelvin(self.min_mireds)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/color.py", line 633, in color_temperature_mired_to_kelvin
    return math.floor(1000000 / mired_temperature)
                      ~~~~~~~~^~~~~~~~~~~~~~~~~~~
ZeroDivisionError: division by zero

Additional information

The light was unresponsive for new commands. The electronics got into some error state. After power cycling the light, these where the properties, with a responsive light:

supported_color_modes:
  - brightness
color_mode: brightness
brightness: 255
mode: normal
dynamics: none
friendly_name: Aanrecht
supported_features: 40

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 1
  • Comments: 16

Most upvoted comments

Got the same division by zero error, on the same code line.

home assistant versions: Core 2024.12.0 Supervisor 2024.11.4 Operating System 14.0 Frontend 20241127.4

This is a fresh HAOS install (vmm on synology nas).

Error from homeassistant log: … File “/usr/src/homeassistant/homeassistant/util/color.py”, line 633, in color_temperature_mired_to_kelvin return math.floor(1000000 / mired_temperature) ^~~~~~~~~~~ ZeroDivisionError: division by zero