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

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

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

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


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.

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/", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.5/", line 85, in _run_code
    exec(code, run_globals)
  File "/home/pi/.local/lib/python3.5/site-packages/pycec/", line 164, in <module>
  File "/home/pi/.local/lib/python3.5/site-packages/pycec/", line 32, in main
    network = HDMINetwork(CecAdapter("pyCEC", activate_source=False),
  File "/home/pi/.local/lib/python3.5/site-packages/pycec/", 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…

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