Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HUE ZeroDivisionError #116258

Open
erkr opened this issue Apr 26, 2024 · 2 comments
Open

HUE ZeroDivisionError #116258

erkr opened this issue Apr 26, 2024 · 2 comments
Assignees

Comments

@erkr
Copy link

erkr commented Apr 26, 2024

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
@home-assistant
Copy link

Hey there @balloob, @marcelveldt, mind taking a look at this issue as it has been labeled with an integration (hue) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of hue can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign hue Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


hue documentation
hue source
(message by IssueLinks)

@erkr
Copy link
Author

erkr commented May 8, 2024

The event was a one-off. Didn't happen again. But guarding the code,at the spot where the exceptions came from, against divisions by zero is always a good idea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants