A REST micro webservice to control devices via the CEC bus in HDMI.
Written in Go with some help from Gin, Go-Flags and cec.go.
Usage:
cec-web [OPTIONS]
Application Options:
-i, --ip= ip to listen on (127.0.0.1)
-p, --port= tcp port to listen on (8080)
-a, --adapter= cec adapter to connect to [RPI, usb, ...]
-n, --name= OSD name to announce on the cec bus (REST Gateway)
The app provides the following JSON based RESTful API:
GET /info
- Information about all the connected devices on the CEC bus
HTTP/1.1 200 OK
{
"Playback":{
"OSDName":"REST Gateway",
"Vendor":"Panasonic",
"LogicalAddress":4,
"ActiveSource":false,
"PowerStatus":"on",
"PhysicalAddress":"f.f.f.f"
},
"TV":{
"OSDName":"TV",
"Vendor":"Panasonic",
"LogicalAddress":0,
"ActiveSource":false,
"PowerStatus":"standby",
"PhysicalAddress":"0.0.0.0"
}
}
GET /power/:device
- Request device power statusPUT /power/:device
- Power on deviceDELETE /power/:device
- Put device in standby
:device
is the name of the device on the CEC bus (see GET /info
)
success (PUT/DELETE); is powered on (GET)
HTTP/1.1 204 No Content
is in standy/no power (GET)
HTTP/1.1 404 Not Found
PUT /volume/up
- Increase volumePUT /volume/down
- Reduce volumePUT /volume/mute
- Mute/unmute audio
HTTP/1.1 204 No Content
PUT /key/:device/:key
- Send key press command followed by key release
:device
is the name of the device on the CEC bus (seeGET /info
):key
is the name (e.g.down
) or the keycode in hex (e.g.0x00
) of a remote key
HTTP/1.1 204 No Content
POST /transmit
- Send a list of CEC commands over the bus
data example:
[
"40:04",
"40:64:00:48:65:6C:6C:6F:20:77:6F:72:6C:64"
]
Hint: Use cec-o-matic to generate commands.