Florian Wesch

info-beamer hosted CEC support

Posted May 10 2018 by Florian Wesch

The next info-beamer hosted OS will add easy CEC support.

What is CEC?

To quote from Wikipedia:

Consumer Electronics Control (CEC) is a feature of HDMI designed to allow users to command and control devices connected through HDMI by using only one remote control. For example, by using the remote control of a television set to control a set-top box and or DVD player. Up to 15 devices can be controlled. CEC also allows for individual CEC-enabled devices to command and control each other without user intervention.

In other words: If you connect your Raspberry Pi to a display using HDMI, the Pi of course pushes content on the screen. On top of that, the HDMI connection can also be used the other way around: Button presses from a remote control will be forwarded to the Pi. The new info-beamer hosted feature makes it easy to respond to such button presses in your Lua code.

Receiving data in your Node

Every directory in a info-beamer package is a node. The top level node is the root node and responsible for drawing content on the screen. The running info-beamer program on your device allows nodes to receive data on UDP port 4444. There are different ways this feature can be used.

  • A local process can rapidly update dynamic data that way: It just sends them locally to the info-beamer process. This is a lot better than writing all changes to a file as it avoids SD card writes.
  • You can open up your device to the local network (or the internet) so you can directly receive data from other machines. This is usually not recommended as it opens up your device for abuse.
  • You can use Remote Control Interfaces. They allow you to embed HTML interface directly into device detail pages and you can trigger any action you might think of in your rendering code that way. Just by clicking buttons on the device page and the command is forwarded to your device and locally sent to info-beamer. How awesome is that!
  • And finally, the new CEC feature: Button presses from the HDMI display remote control are now also submitted and you can directly react to them in your display code.

An example

The following code shows the last button pressed as a text on the screen:


local last_pressed = "<Press some keys on your remote control>"

    ["sys/cec/key"] = function(key)
        last_pressed = key

local font = resource.load_font "font.ttf"

function node.render()
    font:write(10, 10, last_pressed, 40, 1,1,1,1)

Running this code captures incoming CEC commands and handles them using the util.data_mapper function. CEC commands are delivered with the sys/cec/key prefix. Running this code and pressing the Blue key on your remote control should show the string BLUE on the screen like this:

CEC is implemented by a lot of different vendors, remote controls differ in regards to button layouts and the buttons they provide. You might want to restrict the button you use to those that are available across remote controls.

Running the code

You can play around with the package by browsing the source or importing the cec test package into your account by clicking the following button:

A real world use case

The Scheduled Player package added support for CEC. You can use the left and right button on your remote control to switch through all configured pages.


info-beamer.com offers the most advanced digital signage platform for the Raspberry Pi. Fully hosted, programmable and easy to use. Learn more...

Get started for free!

Trying out the best digital signage solution for the Raspberry Pi is totally free: Use one device and 1GB of storage completely free of charge. No credit card required.

Follow @infobeamer on twitter to get notified of new blog posts and other related info-beamer news. It's very low traffic so just give it a try.

You can also subscribe to the RSS Feed RSS feed.

Share this post:

Share using Twitter

Questions or comments?
Get in contact!