Coder Social home page Coder Social logo

Comments (10)

patchedsoul avatar patchedsoul commented on August 27, 2024

When did you do your install? I performed a few updates 2 nights ago, but honestly none of them were related to CEC. I just tested on an AiO install I did last night, and it works correctly:

pi@raspberrypi:~ $ echo scan | cec-client -s -d 1
opening a connection to the CEC adapter...
requesting CEC bus information ...
CEC bus information
===================
device #1: Recorder 1
address:       2.0.0.0
active source: no
vendor:        Pulse Eight
osd string:    CECTester
CEC version:   1.4
power status:  on
language:      eng


currently active source: unknown (-1)
pi@raspberrypi:~ $ 

https://hastebin.com/tohonavawo.cs

What version of Rasbian are you using? Also, looking at the doc page for CEC component, /usr/local/lib is specified as the location. https://home-assistant.io/components/hdmi_cec/

from fabric-home-assistant.

matt-cahill avatar matt-cahill commented on August 27, 2024

From that hastebin it looks like cec gets installed into site-packages but the symlink is made to dist-packages as the docs suggest it should be. For what it's worth the sym-link is dead on my fresh installs both raspbian lite and full.

[localhost] out: Install the project...
[localhost] out: -- Install configuration: ""
[localhost] out: -- Installing: /usr/local/bin/./cec-client-4.0.2
[localhost] out: -- Installing: /usr/local/bin/./cec-client
[localhost] out: -- Installing: /usr/local/bin/./cecc-client-4.0.2
[localhost] out: -- Installing: /usr/local/bin/./cecc-client
[localhost] out: -- Installing: /usr/local/bin/./pyCecClient
[localhost] out: -- Installing: /usr/local/lib/python3.4/site-packages/cec/_cec.so
[localhost] out: -- Set runtime path of "/usr/local/lib/python3.4/site-packages/cec/_cec.so" to ""
[localhost] out: -- Installing: /usr/local/lib/python3.4/site-packages/cec/init.py
[localhost] out: -- Installing: /usr/local/lib/pkgconfig/libcec.pc
[localhost] out: -- Installing: /usr/local/include/libcec/cec.h
[localhost] out: -- Installing: /usr/local/include/libcec/cecc.h
[localhost] out: -- Installing: /usr/local/include/libcec/cecloader.h
[localhost] out: -- Installing: /usr/local/include/libcec/cectypes.h
[localhost] out: -- Installing: /usr/local/include/libcec/version.h
[localhost] out: -- Installing: /usr/local/lib/libcec.so.4.0.2
[localhost] out: -- Installing: /usr/local/lib/libcec.so.4
[localhost] out: -- Installing: /usr/local/lib/libcec.so
[localhost] out: -- Set runtime path of "/usr/local/lib/libcec.so.4.0.2" to ""
[localhost] out:

[localhost] sudo: ldconfig
[localhost] out:
[localhost] out: SSH is enabled and the default password for the 'pi' user has not been changed.
[localhost] out: This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.
[localhost] out:
[localhost] out:

[localhost] sudo: ln -s /usr/local/lib/python3.4/dist-packages/cec /srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages

from fabric-home-assistant.

cbrherms avatar cbrherms commented on August 27, 2024

Yes, I had to manually copy cec over to site-packages (outside the venv) to get the symlink working, but then second issue and lack of initialisation occured.

@jbags81 - latest raspbian Jessie pixel image from raspberry site, installed twice last night with same issue.

While there is the first issue of cec module being installed in wrong folder, or at least symlink being created from wrong location, the main issue is (I believe) an issue with the hdmi_cec component but the issue I opened on HomeAssistant as referenced above has been closed as they believed it's an AIO issue

from fabric-home-assistant.

matt-cahill avatar matt-cahill commented on August 27, 2024

See more discussion on this issue here: https://community.home-assistant.io/t/hdmi-cec-configuration-error/10819

Below is a quick test to show that a v_env set up as per the docs results in not being able to import cec but adjusting the symlink to point at /usr/local/lib/python3.4/site-packages/cec resolves the issue.

Possibly the libcec install location has changed and the home-assistant docs have not been updated to reflect that.

Hope this helps

cheers

Matt

pi@raspberrypi:~ $ ls -al /srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages
total 836
drwxr-xr-x 64 homeassistant homeassistant   4096 Feb  2 09:14 .
drwxr-xr-x  5 homeassistant homeassistant   4096 Feb  2 00:04 ..
drwxr-xr-x  3 homeassistant homeassistant   4096 Feb  2 00:09 aiohttp
drwxr-xr-x  2 homeassistant homeassistant   4096 Feb  2 00:09 aiohttp-1.2.0.dist-info
drwxr-xr-x  2 homeassistant homeassistant   4096 Feb  2 00:05 appdirs-1.4.0.dist-info
-rw-r--r--  1 homeassistant homeassistant  22374 Feb  2 00:05 appdirs.py
drwxr-xr-x  3 homeassistant homeassistant   4096 Feb  2 00:09 async_timeout
drwxr-xr-x  2 homeassistant homeassistant   4096 Feb  2 00:09 async_timeout-1.1.0.dist-info
drwxr-xr-x  4 homeassistant homeassistant   4096 Feb  2 01:06 Babel-2.3.4-py3.4.egg
lrwxrwxrwx  1 homeassistant homeassistant     42 Feb  2 09:14 cec -> /usr/local/lib/python3.4/dist-packages/cec
...
...
drwxr-xr-x  3 homeassistant homeassistant   4096 Feb  2 00:09 yaml
drwxr-xr-x  3 homeassistant homeassistant   4096 Feb  2 00:09 yarl
drwxr-xr-x  2 homeassistant homeassistant   4096 Feb  2 00:09 yarl-0.8.1.dist-info

pi@raspberrypi:~ $ sudo su -s /bin/bash homeassistant

homeassistant@raspberrypi:/home/pi$ source /srv/homeassistant/homeassistant_venv/bin/activate

(homeassistant_venv) homeassistant@raspberrypi:/home/pi$ python
Python 3.4.2 (default, Oct 19 2014, 13:31:11)
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cec
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'cec'
>>>

(homeassistant_venv) homeassistant@raspberrypi:/home/pi$ ln -sf /usr/local/lib/python3.4/site-packages/cec /srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages

(homeassistant_venv) homeassistant@raspberrypi:/home/pi$ python
Python 3.4.2 (default, Oct 19 2014, 13:31:11)
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cec
>>>
(homeassistant_venv) homeassistant@raspberrypi:/home/pi$

from fabric-home-assistant.

cbrherms avatar cbrherms commented on August 27, 2024

@matt-cahill this is the error i'm getting from within homeassistant once a fresh install's symlink has been corrected.

17-02-02 18:15:46 WARNING (Thread-18) [pycec] Not initialized. Waiting for init.
17-02-02 18:15:47 WARNING (Thread-18) [pycec] Not initialized. Waiting for init.
17-02-02 18:15:48 ERROR (Thread-18) [asyncio] Exception in callback setup.<locals>._new_device(<pycec.networ...at 0x6d1d80f0>) at /srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/hdmi_cec.py:297
handle: <Handle setup.<locals>._new_device(<pycec.networ...at 0x6d1d80f0>) at /srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/hdmi_cec.py:297>
Traceback (most recent call last):
  File "/usr/lib/python3.4/asyncio/events.py", line 120, in _run
    self._callback(*self._args)
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/hdmi_cec.py", line 303, in _new_device
    CONF_CUSTOMIZE, {}).get(key, {}).get(CONF_PLATFORM, platform),
AttributeError: 'NodeListClass' object has no attribute 'get'
17-02-02 18:15:48 ERROR (Thread-18) [asyncio] Exception in callback setup.<locals>._new_device(<pycec.networ...at 0x6d1b4690>) at /srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/hdmi_cec.py:297
handle: <Handle setup.<locals>._new_device(<pycec.networ...at 0x6d1b4690>) at /srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/hdmi_cec.py:297>
Traceback (most recent call last):
  File "/usr/lib/python3.4/asyncio/events.py", line 120, in _run
    self._callback(*self._args)
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/hdmi_cec.py", line 303, in _new_device
    CONF_CUSTOMIZE, {}).get(key, {}).get(CONF_PLATFORM, platform),
AttributeError: 'NodeListClass' object has no attribute 'get'

from fabric-home-assistant.

matt-cahill avatar matt-cahill commented on August 27, 2024

Hmm, I'm not seeing the same thing. Unfortunately I think you are seeing two distinct issues here.

This is what i see on my CEC bus on a fresh AiO install with only the sym-link correction applied after that.

pi@raspberrypi:~ $ echo scan | cec-client -s -d 1
opening a connection to the CEC adapter...
requesting CEC bus information ...
CEC bus information
===================
device #0: TV
address:       0.0.0.0
active source: no
vendor:        Sony
osd string:    TV
CEC version:   1.4
power status:  on
language:      eng


device #1: Recorder 1
address:       4.0.0.0
active source: no
vendor:        Pulse Eight
osd string:    CECTester
CEC version:   1.4
power status:  on
language:      eng


device #5: Audio
address:       1.0.0.0
active source: no
vendor:        Sony
osd string:    BD SYSTEM
CEC version:   1.4
power status:  on
language:      ???


device #8: Playback 2
address:       1.0.0.0
active source: no
vendor:        Sony
osd string:    BD SYSTEM
CEC version:   1.4
power status:  on
language:      ???

And I put this in my config.

hdmi_cec:
  devices:
    TV: 0.0.0.0
    Audio: 1.0.0.0

here you can see the install in the log

Feb 03 08:44:58 raspberrypi ip[1282]: INFO:homeassistant.util.package:Attempting install of pyCEC==0.4.12
Feb 03 08:45:16 raspberrypi ip[1282]: INFO:homeassistant.bootstrap:Setting up hdmi_cec
Feb 03 08:45:17 raspberrypi ip[1282]: INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=hdmi_cec>

and a little bit later the devices get set up and everything seems to be working as expected.

Feb 03 08:45:34 raspberrypi ip[1282]: INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: domain=hdmi_cec, service=send_command>
Feb 03 08:45:34 raspberrypi ip[1282]: INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: domain=hdmi_cec, service=volume>
Feb 03 08:45:34 raspberrypi ip[1282]: INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: domain=hdmi_cec, service=update>
Feb 03 08:45:34 raspberrypi ip[1282]: INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: domain=hdmi_cec, service=power_on>
Feb 03 08:45:34 raspberrypi ip[1282]: INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: domain=hdmi_cec, service=standby>
Feb 03 08:45:34 raspberrypi ip[1282]: INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: domain=hdmi_cec, service=select_device>
Feb 03 08:45:34 raspberrypi ip[1282]: INFO:pycec:HDMI network starting...
Feb 03 08:45:34 raspberrypi ip[1282]: WARNING:pycec:Not initialized. Waiting for init.
Feb 03 08:45:34 raspberrypi ip[1282]: INFO:netdisco.service:Scanning
Feb 03 08:45:34 raspberrypi ip[1282]: INFO:pycec.cec:found a CEC adapter:
Feb 03 08:45:34 raspberrypi ip[1282]: INFO:pycec.cec:port:     RPI
Feb 03 08:45:35 raspberrypi ip[1282]: INFO:pycec.cec:vendor:   0x2708
Feb 03 08:45:35 raspberrypi ip[1282]: INFO:pycec.cec:product:  0x1001
Feb 03 08:45:35 raspberrypi ip[1282]: WARNING:pycec:Not initialized. Waiting for init.
Feb 03 08:45:36 raspberrypi ip[1282]: WARNING:pycec:Not initialized. Waiting for init.
Feb 03 08:45:37 raspberrypi ip[1282]: WARNING:pycec:Not initialized. Waiting for init.
Feb 03 08:45:38 raspberrypi ip[1282]: INFO:pycec.cec:connection opened
Feb 03 08:45:38 raspberrypi ip[1282]: INFO:pycec:Looking for new devices...
Feb 03 08:45:39 raspberrypi ip[1282]: INFO:homeassistant.core:Bus:Handling <Event platform_discovered[L]: platform=hdmi_cec, discovered=new=['hdmi_cec.hdmi_0'], service=load_platform.switch>
Feb 03 08:45:39 raspberrypi ip[1282]: INFO:homeassistant.loader:Loaded switch.hdmi_cec from homeassistant.components.switch.hdmi_cec
Feb 03 08:45:39 raspberrypi ip[1282]: INFO:homeassistant.components.switch:Setting up switch.hdmi_cec
Feb 03 08:45:39 raspberrypi ip[1282]: INFO:homeassistant.components.switch.hdmi_cec:Setting up HDMI devices ['hdmi_cec.hdmi_0']
Feb 03 08:45:39 raspberrypi ip[1282]: INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: new_state=<state switch.hdmi_0=unknown; icon=mdi:television, physical_address=None, vendor_id=0, type=TV, type_id=0, friendly_name=TV 0 (), vendor_name=Unknown @ 2017-02-03T08:45:39.028853+13:00>, old_state=None, entity_id=switch.hdmi_0>
Feb 03 08:45:39 raspberrypi ip[1282]: INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: new_state=None, old_state=<state group.all_switches=off; order=11, hidden=True, auto=True, entity_id=('switch.bedroom_speakers', 'switch.bedroom_light', 'switch.matts_blanket', 'switch.garage_door', 'switch.sams_blanket'), friendly_name=all switches @ 2017-02-03T08:45:33.625732+13:00>, entity_id=group.all_switches>
Feb 03 08:45:39 raspberrypi ip[1282]: INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: new_state=<state group.all_switches=off; order=11, hidden=True, auto=True, entity_id=('switch.matts_blanket', 'switch.garage_door', 'switch.bedroom_speakers', 'switch.sams_blanket', 'switch.hdmi_0', 'switch.bedroom_light'), friendly_name=all switches @ 2017-02-03T08:45:39.040619+13:00>, old_state=None, entity_id=group.all_switches>
Feb 03 08:45:39 raspberrypi ip[1282]: INFO:homeassistant.core:Bus:Handling <Event platform_discovered[L]: platform=hdmi_cec, discovered=new=['hdmi_cec.hdmi_5'], service=load_platform.switch>
Feb 03 08:45:39 raspberrypi ip[1282]: INFO:homeassistant.components.switch:Setting up switch.hdmi_cec
Feb 03 08:45:39 raspberrypi ip[1282]: INFO:homeassistant.components.switch.hdmi_cec:Setting up HDMI devices ['hdmi_cec.hdmi_5']
Feb 03 08:45:39 raspberrypi ip[1282]: INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: new_state=<state switch.hdmi_5=unknown; icon=mdi:television, physical_address=None, vendor_id=0, type=TV, type_id=0, friendly_name=TV 5 (), vendor_name=Unknown @ 2017-02-03T08:45:39.608096+13:00>, old_state=None, entity_id=switch.hdmi_5>
Feb 03 08:45:39 raspberrypi ip[1282]: INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: new_state=None, old_state=<state group.all_switches=off; order=11, hidden=True, auto=True, entity_id=('switch.matts_blanket', 'switch.garage_door', 'switch.bedroom_speakers', 'switch.sams_blanket', 'switch.hdmi_0', 'switch.bedroom_light'), friendly_name=all switches @ 2017-02-03T08:45:39.040619+13:00>, entity_id=group.all_switches>
Feb 03 08:45:39 raspberrypi ip[1282]: INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: new_state=<state group.all_switches=off; order=11, hidden=True, auto=True, entity_id=('switch.hdmi_5', 'switch.matts_blanket', 'switch.garage_door', 'switch.bedroom_speakers', 'switch.sams_blanket', 'switch.hdmi_0', 'switch.bedroom_light'), friendly_name=all switches @ 2017-02-03T08:45:39.620976+13:00>, old_state=None, entity_id=group.all_switches>
Feb 03 08:45:39 raspberrypi ip[1282]: INFO:homeassistant.core:Bus:Handling <Event platform_discovered[L]: platform=hdmi_cec, discovered=new=['hdmi_cec.hdmi_8'], service=load_platform.switch>
Feb 03 08:45:39 raspberrypi ip[1282]: INFO:homeassistant.components.switch:Setting up switch.hdmi_cec
Feb 03 08:45:39 raspberrypi ip[1282]: INFO:homeassistant.components.switch.hdmi_cec:Setting up HDMI devices ['hdmi_cec.hdmi_8']

I suggest simplifying your system down to one CEC device and a minimal config and retesting from there.

cheers

Matt

from fabric-home-assistant.

haalpplz avatar haalpplz commented on August 27, 2024

Hey,

Not sure if this is entirely releated but came across this tracker when trying to troubleshoot.

On any version after .36 (Inlcuding .38.1), I get the following error when trying to load to CEC component. In .36, the component worked perfectly with no errors.

Im running a new install of Hassbian 1.1 with the CEC components added via the new script.

Any idea what is going on or what the reolution is?

17-02-12 07:43:29 WARNING (Thread-15) [pycec] Not initialized. Waiting for init.
17-02-12 07:43:30 WARNING (Thread-15) [pycec] Not initialized. Waiting for init.

from fabric-home-assistant.

cbrherms avatar cbrherms commented on August 27, 2024

Hi, there were some major changes to hdmi_cec in .37
Appears one bug is that it doesn't know how to deal with the new customisation format changes and so the devices aren't set up properly during init. Does the issue go away when you remove the customize component from your config?

Issue is currently trackable here:
home-assistant/core#5727

As the problem I opened this issue for is not related to the AIO installer, and is being tracked in the correct git repo, closing this issue so please direct any comments there

from fabric-home-assistant.

haalpplz avatar haalpplz commented on August 27, 2024

@cbrherms It does not . Commented out customize and errors remain.

from fabric-home-assistant.

rayzorben avatar rayzorben commented on August 27, 2024

@haalpplz I had the same thing and found that my libcec was not built with Raspberry Pi support due to having a missing library.

Does cec-client -l work for you ?

from fabric-home-assistant.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.