core: hdmi_cec fails with Exception in callback setup.._new_device

The problem

It seems the hdmi_cec integration is broken in HA Core 2022.2. It fails to load.

I am using a custom add-on for pycec, but the hdmi_cec integration won’t even start.

What version of Home Assistant Core has the issue?

core-2022.2.5

What was the last working version of Home Assistant Core?

core-2021.12

What type of installation are you running?

Home Assistant OS

Integration causing the issue

hdmi_cec

Link to integration documentation on our website

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

Diagnostics information

No response

Example YAML snippet

hdmi_cec:
  host: 58c14403-pi-cec
  devices:
    0: TV
    1: Pi
    2: Apple TV

Anything in the logs that might be useful for us?

Logger: homeassistant
Source: components/hdmi_cec/__init__.py:336 
First occurred: 6:09:16 PM (2 occurrences) 
Last logged: 6:09:16 PM

Error doing job: Exception in callback setup.<locals>._new_device(<pycec.networ...at 0x6dd21b68>) at /usr/src/homeassistant/homeassistant/components/hdmi_cec/__init__.py:333
Error doing job: Exception in callback setup.<locals>._new_device(<pycec.networ...at 0x6a82a3d0>) at /usr/src/homeassistant/homeassistant/components/hdmi_cec/__init__.py:333
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/src/homeassistant/homeassistant/components/hdmi_cec/__init__.py", line 336, in _new_device
    hass.data[DOMAIN][key] = device
KeyError: 'hdmi_cec'

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (10 by maintainers)

Most upvoted comments

I can also confirm this issue is fixed. Many thanks.

Latest files from dev works fine for me too

@epenet thanks. Would be nice if there was a more straightforward way of testing changes, other than overriding files in place 😃

I overrode the files in /usr/src/homeassistant/homeassistant/components/hdmi_cec/ with the latest from dev, restarted HA and the errors are gone.

And it works!

I think I’ve got it - should be fixed in #66504 It would be good if someone could test it…