core: Exception in Google Assistant with ESPHome binary light in 2021.4.3

The problem

Repro:

Actual:

2021-04-11 19:37:24 ERROR (MainThread) [homeassistant.components.google_assistant.smart_home] Error serializing light.tour_eiffel
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/google_assistant/helpers.py", line 517, in sync_serialize
    device["attributes"].update(trt.sync_attributes())
  File "/usr/src/homeassistant/homeassistant/components/google_assistant/trait.py", line 385, in sync_attributes
    "temperatureMaxK": color_util.color_temperature_mired_to_kelvin(
  File "/usr/src/homeassistant/homeassistant/util/color.py", line 513, in color_temperature_mired_to_kelvin
    return math.floor(1000000 / mired_temperature)
ZeroDivisionError: float division by zero

https://github.com/home-assistant/core/blob/2021.4.3/homeassistant/components/google_assistant/trait.py#L381 The light doesn’t support color temperature, so it’s not expected that this condition is true.

What is version of Home Assistant Core has the issue?

core-2021.4.3

What was the last working version of Home Assistant Core?

core-2021.3.4

What type of installation are you running?

Home Assistant Container

Integration causing the issue

google_assistant

Link to integration documentation on our website

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

Example YAML snippet

The esphome yaml file:


(...)
light:
  - platform: binary
    name: "Tour Eiffel"
    id: lumieres_2
    output: output_2
output:
  - platform: esp8266_pwm
    id: output_2
    pin: D3


### Anything in the logs that might be useful for us?

_No response_

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 20 (8 by maintainers)

Most upvoted comments

Update:

  • I renamed the device so it’d get a new unique id, and another one triggered the exception after I restarted HA. The new one that trigger the same stack trace is a ESPHome monochromatic light. So this rules out that this is caused by binary.
  • Thanks a lot @frenck for trying to reproduce and @emontnemery for the help with diagnosing. I’m sorry you spent time on this.
  • I’m currently reading https://www.home-assistant.io/integrations/debugpy/, will try diagnosing myself in the next coming days (may have to wait for the weekend though).