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

hdmi_cec errors on startup #12846

Open
jjlawren opened this Issue Mar 2, 2018 · 23 comments

Comments

Projects
None yet
@jjlawren
Contributor

jjlawren commented Mar 2, 2018

Home Assistant release (hass --version):
0.64.2

Python release (python3 --version):
3.6.3

Component/platform:
hdmi_cec

Description of problem:
Errors during initialization of component. Component works (mostly) properly after startup.

Expected:
No errors.

Problem-relevant configuration.yaml entries and steps to reproduce:

hdmi_cec:
  platform: media_player
  devices:
    TV: 0.0.0.0
    Receiver: 2.0.0.0
    RPi: 2.1.0.0

Traceback (if applicable):

2018-03-02 12:45:03 WARNING (ThreadPoolExecutor-1_0) [pycec] Not initialized. Waiting for init.
2018-03-02 12:45:04 WARNING (ThreadPoolExecutor-1_0) [pycec] Not initialized. Waiting for init.
2018-03-02 12:45:05 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/home/homeassistant/.localpython/lib/python3.6/asyncio/tasks.py", line 180, in _step
    result = coro.send(None)
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 260, in _async_add_entity
    msg)
homeassistant.exceptions.HomeAssistantError: Entity id already exists: media_player.hdmi_0
2018-03-02 12:45:06 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/home/homeassistant/.localpython/lib/python3.6/asyncio/tasks.py", line 180, in _step
    result = coro.send(None)
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 260, in _async_add_entity
    msg)
homeassistant.exceptions.HomeAssistantError: Entity id already exists: media_player.hdmi_5
@schmittx

This comment has been minimized.

Contributor

schmittx commented Mar 3, 2018

I have the same error, seems to be related to the entity registry. Rolling back to 0.62 eliminated this error and restored full function.

@webworxshop

This comment has been minimized.

Contributor

webworxshop commented Mar 8, 2018

I am experiencing this too, but for me the description doesn't quite cover it. I am unable to switch any of the HDMI switches, though their state is correctly reported.

@Minims

This comment has been minimized.

Minims commented Mar 8, 2018

Same issue here. Unable to switch hdmi devices. Remove homeassistant.log and entity registry files does not help. Using 0.64.3 on raspbian stretch

@azgooon

This comment has been minimized.

azgooon commented Mar 10, 2018

I am having the same issue on Python 3.5.3, HA 0.65.1 on raspbian stretch

@rev3r4nt

This comment has been minimized.

rev3r4nt commented Mar 11, 2018

Also get this issue with 0.65.2.

@mobster1940

This comment has been minimized.

mobster1940 commented Mar 12, 2018

Hi guys, I have the same error, what's strange is that if you call the hmdi_cec service, it works flawlessly

@azgooon

This comment has been minimized.

azgooon commented Mar 17, 2018

Regrettably I cannot say that it works flawlessly :( It does turn on TV/OFF TV most of the time but also negatively affects automation as events happening in a short period of time and depend on each other are getting distraction and next thing I see if script timeout and whatever was left to execute does not get triggered.

Does anyone perhaps from the developers know how this can be fixed or what would be worth trying as a temporary workaround?

Thanks in advance.

@Minims

This comment has been minimized.

Minims commented Apr 19, 2018

I still have this issue on 0.67.1.

My cec switch give the correct status, but i can make an action to power my TV for example. If i call directly cec-client it works. Any update about this problem ?

Traceback (most recent call last):
  File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
    result = coro.send(None)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py", line 252, in _async_add_entity
    msg)
homeassistant.exceptions.HomeAssistantError: Entity id already exists: switch.hdmi_0
2018-04-18 20:03:16 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
    result = coro.send(None)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py", line 252, in _async_add_entity
    msg)
homeassistant.exceptions.HomeAssistantError: Entity id already exists: switch.hdmi_4
2018-04-18 20:03:17 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
    result = coro.send(None)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py", line 252, in _async_add_entity
    msg)
homeassistant.exceptions.HomeAssistantError: Entity id already exists: switch.hdmi_8

@chimpy

This comment has been minimized.

chimpy commented May 18, 2018

I have this on 0.69.1 too.

@Minims

This comment has been minimized.

Minims commented May 23, 2018

Here is how I make it worked, it is not the right way, but it has resolved my issue.

homeassistant@rpi3:~$ diff -u  /srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py.old  /srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py
--- /srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py.old 2018-05-23 19:09:34.692849510 +0200
+++ /srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py     2018-05-23 19:09:59.252695151 +0200
@@ -299,6 +299,8 @@
         if not valid_entity_id(entity.entity_id):
             raise HomeAssistantError(
                 'Invalid entity id: {}'.format(entity.entity_id))
+        elif 'hdmi' in entity.entity_id:
+            msg = 'Entity id is CEC: {}'.format(entity.entity_id)
         elif entity.entity_id in component_entities:
             msg = 'Entity id already exists: {}'.format(entity.entity_id)
             if entity.unique_id is not None:
homeassistant@rpi3:~$
@Genemills

This comment has been minimized.

Genemills commented Jun 1, 2018

any fix for this yet? not sure how to implement the above?

@Minims

This comment has been minimized.

Minims commented Jun 2, 2018

still no news, that's why I have add 2 lines to entity_platform.py provide by home assistant, to make it works.

@Genemills

This comment has been minimized.

Genemills commented Jun 2, 2018

where are you accessing this file and how? configurator is not seeing it

@Minims

This comment has been minimized.

Minims commented Jun 2, 2018

mine is located here : /srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py because I have installed in this location with venv python.

@Genemills

This comment has been minimized.

Genemills commented Jun 2, 2018

weird...my /srv folder is blank when i try to access it through configurator

@Minims

This comment has been minimized.

Minims commented Jun 2, 2018

How have you install haas ? Try /usr/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py or /usr/local/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py

@Genemills

This comment has been minimized.

Genemills commented Jun 2, 2018

I get as far as /usr/lib/python3.6/site-packages/ but there is no homeassistant folder.
I have Hass.io installed on Rpi3

@zwodee

This comment has been minimized.

zwodee commented Jun 15, 2018

still open?
same here rpi3 hassbian 71.0

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
result = coro.send(None)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py", line 308, in _async_add_entity
msg)
homeassistant.exceptions.HomeAssistantError: Entity id already exists: switch.hdmi_0

@Minims

This comment has been minimized.

Minims commented Jun 15, 2018

Yes, still have the issue in the last version :/

@lurkie

This comment has been minimized.

lurkie commented Sep 1, 2018

I'm also having the "Not initialized. Waiting for init." error in the log. Further, when I do a echo scan | cec-client -s -d 1, I get the following, and that goes on for a couple of seconds:

$ echo scan | cec-client -s -d 1
opening a connection to the CEC adapter...
ERROR:   [             116]	RegisterLogicalAddress - CEC is being used by another application. Run "tvservice --off" and try again.
ERROR:   [             116]	Open - vc_cec could not be initialised
ERROR:   [             116]	could not open a connection (try 1)
ERROR:   [            1116]	RegisterLogicalAddress - CEC is being used by another application. Run "tvservice --off" and try again.
ERROR:   [            1116]	Open - vc_cec could not be initialised
ERROR:   [            1116]	could not open a connection (try 2)
ERROR:   [            2116]	RegisterLogicalAddress - CEC is being used by another application. Run "tvservice --off" and try again.
ERROR:   [            2116]	Open - vc_cec could not be initialised
ERROR:   [            2116]	could not open a connection (try 3)

When I run tvservice --off, i see the message 'Powering off HDMI', and a new cec-client scan can now run successfully. My Home Assistant can load hdmi_cec again as well.

HTH for someone.

@upscore

This comment has been minimized.

upscore commented Sep 23, 2018

Hello,

Any news on this issue? I'm starting to use Home Assistant, but I cannot find a way to make it work...

@Minims - I applied your solution, but to do so I had to enter as a root user through the container. However, I don't know how to make that change permanently... And even though I can edit the file, I believe that it needs to somehow be reloaded since the mere edit and trying again continues to fail.

Could you please elaborate just a little more on how did you manage to make it work? What changes did you do and the exact process you went through?

Thanks!

@Minims

This comment has been minimized.

Minims commented Sep 25, 2018

I have to do it every time I upgrade home-assistant version. Very painful. I can't make a PR, but I still think this fix is the not good. But I don't why it still and why no one check this issue :/

Last diff for 0.78.3

--- /srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py.old	2018-08-29 18:52:03.239380759 +0200
+++ /srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py	2018-09-25 20:10:20.822662830 +0200
@@ -327,8 +327,6 @@
         if not valid_entity_id(entity.entity_id):
             raise HomeAssistantError(
                 'Invalid entity id: {}'.format(entity.entity_id))
-        elif 'hdmi' in entity.entity_id:
-            msg = 'Entity id is CEC: {}'.format(entity.entity_id)
         elif entity.entity_id in component_entities:
             msg = 'Entity id already exists: {}'.format(entity.entity_id)
             if entity.unique_id is not None:


@nstrelow

This comment has been minimized.

nstrelow commented Oct 24, 2018

Puh, this is frustrating. I cannot make edits helpers in hassio. Everytime I restart it resets it.
To be expected with docker I guess.

Please fix this issue

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