Help with PyCec

Has anyone been able to get PyCec to work: https://github.com/konikvranik/pyCEC? Reading the instructions it says you don’t need libcec but as soon as you run the module it breaks because libcec is not there???

I have a raspberry pi zero that I would like to hook to a tv and then call it from home assistant. Has anyone ever got this to work?

I could install libcec but is seems it installs in python2.7 which pycec is not made for. Is there anyway to install libcec in Python3? That would also fix this most likely.

Finally does anyone know of another way to get this working maybe another tool that is well documented?

Thanks!

Nevermind I got it to work. The documentation for all of this is insanely bad. So pycec claims it does not need libcec (cec) but it fails without it. Libcec installs for python2.7 by default so I had to use this commit: https://github.com/Pulse-Eight/libcec/pull/409/commits/feacdd32ce458f31752606e904b8cc4e3c8487a3. Either install his repo instead of the official one when you follow the compile instructions: https://github.com/Pulse-Eight/libcec/blob/master/docs/README.raspberrypi.md or make the changes to the official repository after you clone it.

Once you get libcec for Python3 then python3 -m pycec will work.

Again it’s crazy the crumb trail you have to go on for this.

followed instruction and now pycec server is running on pi3 connected to TV. thank you
However, HA is not communicating with the pycec server.
Pycec send commands to HA, I got the switches created for my connected devices.
But when I toggle the switch, nothing happens. also I see no commands received at pycec server
not sure whats the issue

1 Like

Do you have a solution by now?

Hi Guys,

I have similar issues, I cannot used the HDMI integration in HA:

2021-11-09 01:28:53 ERROR (SyncWorker_0) [homeassistant] Error doing job: Exception in callback CecAdapter.power_on_devices()
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/local/lib/python3.9/site-packages/pycec/cec.py", line 51, in power_on_devices
    self._adapter.PowerOnDevices)
AttributeError: 'NoneType' object has no attribute 'PowerOnDevices'

Can you guide me in the issue please?