- Updated: December 15, 2025
- 8 min read
DIY HDMI‑CEC Home Theater Automation: Raspberry Pi Keeps Audio on Receiver
A DIY HDMI‑CEC home‑theater solution can be built with a Raspberry Pi that monitors the HDMI‑CEC bus and automatically sends the missing System Audio Mode request, guaranteeing that your Denon AVR always receives audio from consoles without manual intervention.
Turn Your Living‑Room Chaos into Seamless Audio with a Simple Raspberry Pi Hack
If you’ve ever wrestled with a home‑theater that “forgets” to route sound through your receiver when a game console or streaming box wakes up, you’re not alone. The culprit is often a missing System Audio Mode request on the HDMI‑CEC bus. This article walks you through a proven, DIY fix that restores reliable audio routing using a Raspberry Pi, cec‑client, and a few lines of Python. By the end, you’ll have a self‑healing system that works for any HDMI‑CEC‑compatible device—no more manual toggles, no more lag.
We’ll also sprinkle in relevant UBOS platform overview insights, showing how the same automation principles can be extended to broader AI‑driven workflows.

What the Original Setup Looked Like
The typical configuration that sparked this solution includes:
- Samsung TV (ARC, not eARC) – the central display and CEC master.
- Denon AVR‑X1700H – the audio hub that should receive the
Set System Audio Modecommand. - Apple TV – the only device that reliably triggers the correct CEC handshake.
- Multiple consoles (PS5, Xbox Series X, Nintendo Switch) – they wake the TV, switch inputs, but leave the AVR asleep.
In this topology, the TV correctly switches inputs, yet the audio stays on the TV’s built‑in speakers because the Denon never receives the System Audio Mode request. The result? A frustrating “no sound” moment every time you launch a game.
For a visual reference, see the original HDMI‑CEC tutorial that first described the problem.
Why Consoles Fail to Send the System Audio Mode Request
HDMI‑CEC defines a set of logical addresses and opcodes. In a healthy chain, a playback device (e.g., Apple TV) sends:
Active Source (0x82)– announces itself as the current source.System Audio Mode Request (0x70)– asks the TV to hand audio over to the AVR.Set System Audio Mode (0x72)– the AVR acknowledges and activates ARC.
Consoles typically emit only the Active Source frame. The missing 0x70 request means the TV never tells the AVR to switch to ARC, leaving the audio stuck on the TV speakers.
Apple TV, by contrast, includes a vendor‑specific payload that somehow triggers the Denon to send the 0x72 frame automatically. Replicating that proprietary handshake is brittle, so we opt for a more reliable approach: inject the missing System Audio Mode Request ourselves.
The Raspberry Pi Fix: Monitoring and Auto‑Sending the 15:70:00:00 Command
By connecting a Raspberry Pi to an unused HDMI input on the Denon AVR, we can become a passive participant on the CEC bus. The Pi runs cec‑client in a long‑lived process, watches for any Active Source frames from playback devices, and immediately replies with the magic 15:70:00:00 packet:
15:70:00:00 # Recorder (Pi) → Audio System (Denon): System Audio Mode Request
This single command is all the AVR needs to turn ARC on and route audio correctly. The solution is lightweight, cost‑effective (a $35 Pi + cheap HDMI cable), and runs silently in the background.
For those already using Workflow automation studio on UBOS, the same logic can be wrapped in a visual flow, enabling non‑programmers to deploy the fix across multiple rooms.
Step‑by‑Step Guide: From Hardware to Running Code
1. Gather the Required Hardware
- Raspberry Pi 4 (or Pi 3) with power supply.
- Micro‑HDMI to HDMI cable (≈ $7).
- Micro‑SD card (8 GB+), pre‑flashed with Raspberry Pi OS Lite.
- Network connection (Ethernet or Wi‑Fi) for remote access.
2. Connect the Pi to the AVR
Plug the micro‑HDMI end into the Pi and the HDMI end into any free input on the Denon AVR (e.g., HDMI 4). The Pi will not interfere with video signals; it only listens and transmits CEC frames.
3. Install libCEC and cec‑client
sudo apt update
sudo apt install -y cec-utils
4. Verify Device Detection
Run a quick scan to ensure the Pi sees all participants:
echo "scan" | cec-client -s -d 1
You should see entries for the TV (0x0), AVR (0x5), Apple TV (0x8), and each console (0x4, 0xB, etc.).
5. Capture a “good” CEC trace
Power on Apple TV, then run:
cec-client -d 8
Note the 5f:72:01 line (Set System Audio Mode) that appears after Apple TV’s Active Source. This is the reference behavior.
6. Write the Python watchdog
Save the following script as cec_auto_audio.py:
#!/usr/bin/env python3
import subprocess
import re
import time
# Start cec-client in interactive mode
proc = subprocess.Popen(
["cec-client", "-d", "8"],
stdout=subprocess.PIPE,
stdin=subprocess.PIPE,
text=True,
bufsize=1,
)
last_set_mode = 0
def send_system_audio_request():
proc.stdin.write("tx 15:70:00:00\n")
proc.stdin.flush()
pattern_active = re.compile(r"([0-9A-F]+):82:")
pattern_set_mode = re.compile(r"5f:72:")
while True:
line = proc.stdout.readline()
if not line:
break
# Detect Active Source from any playback device
if pattern_active.search(line):
# If we haven't seen a Set System Audio Mode recently, send request
now = time.time()
if now - last_set_mode > 5: # debounce 5 seconds
send_system_audio_request()
# Track when AVR acknowledges
if pattern_set_mode.search(line):
last_set_mode = time.time()
The script watches for any Active Source (0x82) frame and, if the AVR hasn’t already announced Set System Audio Mode (0x72), it injects the missing request.
7. Make the Script Run at Boot
Create a systemd service:
[Unit]
Description=HDMI‑CEC Auto Audio Service
After=network.target
[Service]
ExecStart=/usr/bin/python3 /home/pi/cec_auto_audio.py
Restart=always
User=pi
[Install]
WantedBy=multi-user.target
Enable and start it:
sudo systemctl enable cec_auto_audio.service
sudo systemctl start cec_auto_audio.service
8. Test the Automation
Power off the AVR and TV, then turn on a console (e.g., PS5). Within a second, the AVR should power on and ARC should engage, delivering audio to your speakers automatically.
If you prefer a no‑code approach, the same logic can be built inside Web app editor on UBOS using a visual block that runs the cec-client command and reacts to its output.
Why This DIY Fix Beats Traditional Automation
- Instant response: The Pi reacts as soon as a console announces itself, eliminating the 30‑second lag typical of HomeKit or smart‑plug triggers.
- Zero video interference: Because the Pi only uses the CEC side‑channel, video quality remains untouched.
- Scalable: Add more playback devices (e.g., a future streaming stick) without re‑configuring scenes—just plug them in.
- Cost‑effective: A single Pi handles all CEC monitoring for the entire house, replacing multiple IR blasters or expensive HDMI‑CEC repeaters.
- Open‑source and transparent: The Python script can be audited, modified, or extended to suit niche needs (e.g., auto‑switching to a “quiet mode” at night).
For enterprises or makers looking to embed similar logic into larger AI workflows, the Enterprise AI platform by UBOS offers pre‑built connectors for CEC devices, allowing you to orchestrate audio routing alongside lighting, HVAC, or security automations.
From HDMI‑CEC to AI‑Powered Templates
The same pattern of “listen → detect → act” is the backbone of many AI‑driven automations on UBOS. For example, you can combine the CEC monitor with the UBOS templates for quick start to create a dashboard that visualizes device states in real time.
A few ready‑made templates that complement this project:
- AI SEO Analyzer – automatically audit your home‑theater blog posts for ranking.
- AI Video Generator – create tutorial videos of your setup with synthetic voiceovers.
- AI Chatbot template – add a voice‑controlled assistant that can trigger the Pi script via voice commands.
By leveraging the AI marketing agents, you could even auto‑publish a status update to your social channels whenever a new device is added to the CEC bus.
Cost, Support, and Where to Get Help
The hardware cost is roughly $45 total. UBOS offers a pricing plan that includes unlimited access to the Workflow Automation Studio, which can host the Python watchdog as a managed service—ideal if you prefer a cloud‑managed approach.
Need community assistance? The UBOS partner program connects you with experts who can review your script, suggest security hardening, or integrate the solution into a broader smart‑home ecosystem.
Wrap‑Up: A Reliable, Low‑Cost HDMI‑CEC Fix
By turning a modest Raspberry Pi into a CEC watchdog, you eliminate the audio‑routing hiccup that plagues many home‑theater setups. The solution is fast, transparent, and extensible—perfect for DIY enthusiasts and for integration into larger AI‑driven automation platforms like UBOS.
Ready to give your home theater the reliability it deserves? Grab a Pi, follow the steps above, and explore UBOS’s solutions for SMBs or UBOS for startups to scale the idea across multiple rooms or even commercial venues.
Share your results in the comments, and let the community know how the automation improved your movie nights!
Andrii Bidochko
CTO UBOS
Andrii Bidochko is an AI entrepreneur and researcher focused on AI agents, reinforcement learning, and autonomous systems. He writes about the technologies shaping the future of machine intelligence, from frontier models and agent architectures to real-world AI applications.