Purpose of this project is to provide object API to libcec for home-assistant hdmi_cec module as primary goal and to make TCP <=> HDMI bridge to control HDMI devices over TCP network as a secondary goal.
libcec
dependency [1]
libcec must be installed [2] for
this module to work in direct mode. Follow the installation instructions
for your environment, provided at the link. libcec
installs Python 3
bindings by default as a system Python module. If you are running pyCEC
in a Python virtual
environment, make sure it
can access the system module, by either symlinking it or using the
--system-site-packages
flag.
[1] | 💡 When using pyCEC as a network client, libcec is not needed. |
[2] | pip3 install cec . This will fail. Compile libcec instead. |
You can run pyCEC
server which will provide bridge between HDMI CEC port
and TCP network by exexcuting python3 -m pycec
. Server will bind to
default port 9526
on all interfaces.
Then you can connect by client part of pyCEC
without need of libcec or
HDMI port on client's machine. Just use TcpAdapter
instead of
CecAdapter
.
You can also connect to 9526
by NetCat and send CEC commands directly.
You can not only add a hdmi_cec instance to home-assistant with specified host for remote control of your TV, but also add switches for multiple TVs to turn on or off:
switch:
- platform: telnet
switches:
some_device_id:
name: "Some Device Name"
resource: xxx.xxx.xxx.xxx
port: 9526
command_on: '10:04'
command_off: '10:36'
command_state: '10:8f'
value_template: '{{ value == "01:90:00" }}'
timeout: 1