Some Raspberry Pi code that allows my Roku remote to control my home theater over HDMI-CEC and TCP sockets.
- NAD T778 receiver
- JVC NX7 projector
- Roku Ultra
Allow the Roku remote to control all primary aspects of the theater system.
Roku remote means the physical remote that came with the Roku Ultra, as well as the Roku Android/iOS app.
Primary aspects means:
- Turning both the receiver and projector on and off.
- Controlling the audio volume of the receiver.
- Automatically switching the receivier's input to the correct one for the Roku.
Basically, I want to pick up the Roku remote, hit the power key, and watch a movie. When I'm done, I want to hit the power key again, and have everything go into standby mode.
I should only need the NAD and JVC remotes if I'm doing something unusual.
- Make the Raspberry Pi pretend to be the TV (CEC logical address
0
), since Roku only sends power commands to the TV. - Connect to JVC projector on LAN interface using a TCP socket (JVC projectors do not support CEC).
- Listen to CEC messages on the HDMI-CEC bus, and send messages back to the bus and projector.
- Raspberry Pi Zero W.
- The original cec-fix.
- JVC Interface Specifications, specifically JVC D-ILA® Projector RS232 / LAN / Infrared Remote Control Codes PDF.
- Check out this repo on the Raspberry Pi, as the build references firmware libraries that are only available there.
cd
into the directory andmake
to build it./build/cec-fix PROJECTOR_HOST_IP
to run, wherePROJECTOR_HOST_IP
is the IP address of the JVC projector.CTRL-c
to exit.- To run as a service on boot:
echo "PROJECTOR_HOST_IP=xxx.xxx.xxx.xxx" > .env sudo make install
A note on GPU driver compatibility
The default GPU driver was replaced with DRM V4 V3D on newer distributions of Raspian (at least starting at Bullseye). This appears to be incompatible with the Broadcom CEC APIs used by this project. If you run into trouble, you can disable these newer drivers:
- Open
/boot/config.txt
for editing (e.g.sudo vim /boot/config.txt
). - Replace the line
dtoverlay=vc4-kms-v3d
with#dtoverlay=vc4-kms-v3d
(i.e. comment it out). - Save the file.
- Restart the Raspberry Pi.
sudo make uninstall
This was tested on a Raspberry Pi Zero W running Rapsian Bullseye. Older versions of Raspian should also work, as should similar Raspberry Pi hardware generations (e.g. B, A, B+). However, this has not been verified.
It is possible for other running processes on the Raspberry Pi to control the theater system over a named pipe (FIFO).
When running, a named pipe is created at /tmp/p-cec-fix
. Another process can write to this pipe to turn the system
on and off (assuming the default playback device is at logical address 4).
To turn the system on, and set the active source to Playback Device 1 (logical address 4), write "1" to the pipe.
To turn the system off (set all devices to standby), write "0" to the pipe.
To see an example of a Python process controlling the system in response to Google Assistant voice commands, look at Theater Commander and Theater Commander Server.