/cec-web-api

Simple HTTP server to control connected HDMI-CEC devices

Primary LanguageJavaScriptMIT LicenseMIT

cec-web-api

License npm Downloads Donate Donate

Requires CEC capable device (e.g. Raspberry Pi or USB-CEC adapter).
Additionally cec-client must be installed. On Raspbian it is included in cec-utils package.

Installation

API can be used as both core node module or a binary app.
Install it as an app system-wide with below command:

sudo npm install cec-web-api -g

Start server with:

cec-web-api [port] [--hdmi-ports=<number>]

Port number is optional (default: 8080).
Number of HDMI ports in TV (used for changeSource function) can also be specified (default: 3).

Usage

Requests to your host will return controller object. Navigate through it like usual in JavaScript replacing dots with slashes. Use ?value=x to pass args to available functions. Below example shows how to switch dev0 (TV) HDMI source to a second port.

http://ip:port/dev0/changeSource?value=2

For more info on HDMI-CEC usage and available functions visit cec-controller GitHub page.

Donation

If you like my work please support it by buying me a cup of coffee :-)

PayPal