Provide HDMI CEC devices as objects, especially for use with Home Assistant
Project description
pyCEC
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.
running server
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.
home-assistant with multiple on/off switches
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file pyCEC-0.5.2.tar.gz
.
File metadata
- Download URL: pyCEC-0.5.2.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.10 tqdm/4.64.0 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a086469b08c65a4f2c1fad3b6a559e24dbbd751cbe4ef275bc512002628ed17 |
|
MD5 | f97dca05afa0e94f52f859c0518a6925 |
|
BLAKE2b-256 | f4bbd407b6285f6dd7c30b33568f4af50b3b7c57bc4e9382e7878a20ddefe1be |