pyCEC install on Raspberry Pi

Hi HA guys

I need some assistance (probably quite basic for most here. :slight_smile:) .

I have my main Homeassistant install on an HP microserver running Ubuntu server 17.10

I also have a Raspberry pi (Model B, 512MB) in my lounge, connected to a Samsung TV via HDMI. cec-client is installed and I have a positive good response with this command:

echo scan | cec-client -s -d 1

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: yes
vendor: Samsung
osd string: TV
CEC version: 1.3a
power status: on
language: eng

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

device #4: Playback 1
address: 1.1.0.0
active source: no
vendor: Samsung
osd string: BD Player
CEC version: 1.4
power status: standby
language: ???

device #5: Audio
address: 1.0.0.0
active source: no
vendor: Yamaha
osd string: RX-V775
CEC version: 1.4
power status: on
language: ???

BUT…

I just cant get pyCEC installed / running…and actually have no real idea of how to get it from github correctly.

Anyone that can advise me on the commands to install it, or guide me to a good, simple link explaining how to, I havent found anything yet.

I hope someone can assist me…I keen to get my system running, but this is all a steep learning curve for me.

Thanks in advance.

I’m in the same position.

I have compiled libcec via these instructions and all seemed fine. https://github.com/Pulse-Eight/libcec/blob/master/docs/README.raspberrypi.md

running python3 -m pycec as per pyCEC does not work.

Error for info:

pi@raspberrypi:~/libcec/build $ python3 -m pycec
Traceback (most recent call last):
  File "/usr/lib/python3.5/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/pi/.local/lib/python3.5/site-packages/pycec/__main__.py", line 164, in <module>
    main()
  File "/home/pi/.local/lib/python3.5/site-packages/pycec/__main__.py", line 32, in main
    network = HDMINetwork(CecAdapter("pyCEC", activate_source=False),
  File "/home/pi/.local/lib/python3.5/site-packages/pycec/cec.py", line 20, in __init__
    import cec
ImportError: No module named 'cec'

Thats exactly the same error I received. I cannot find a solution yet with tons of googling…
:frowning:

I think it’s something to do with pointing to the compiled version of libcec, but I can’t figure out what.

Take a look at this Help with PyCec