If you own an Nvidia Shield Pro (or similar HDMI-CEC components) and a Denon/Marantz AVR, you have likely encountered the "Zone 2 Bug." During HDMI-CEC handshakes, the Shield mistakenly sends a "Zone 2 Power On" command.
This results in:
- The AVR switching inputs randomly (often to a "Playback" or "Blu-ray" state).
- Your main screen going black while the AVR tries to process the rogue Zone 2 request.
- Secondary speakers (patio/bedroom/office) staying on all night.
Z2K is a lightweight Python sentinel script. It sits on your network and polls your receiver's API every 2 seconds. If it detects a rogue Zone 2 power-on event, it intercepts and kills the command in under 2 seconds, forcing the receiver back to Main Zone stability.
- Network-Capable AVR: Your Denon or Marantz receiver must have an Ethernet port or Wi-Fi.
- Same Local Network: The device running this script (PC, Raspberry Pi, etc.) must be on the same network/subnet as the AVR.
- Static IP: Your AVR should be set to a Static IP so the script does not lose the connection.
- Static IP: In your AVR menu, go to Network > Settings and set DHCP to OFF. Note your IP (e.g., 192.168.xxx.xxx).
- Network Control: Set to "Always On". This allows the script to communicate with the receiver even when it is in standby.
- Download Python 3 from python.org.
- Windowed Mode (Watch the Chaos): Run
python Z2K.py. This opens a command window with a live dashboard and a "SNEAKS KILLED" counter. - Stealth Mode (Always Running): Rename the file to
Z2K.pyw. Double-clicking this will run the script invisibly in the background. - Auto-Start with Windows: Press
Win + R, typeshell:startup, and place a shortcut to yourZ2K.pywfile in that folder.
(Note: I have only physically tested the Windows PC version of this code at the time of this writing; however, the below ports should be straight-forward, generic ports.)
Z2K is perfect for a "set it and forget it" Raspberry Pi build.
- Standard Run:
python3 Z2K.py - Run at Boot: Use
crontab -eand add the line:@reboot python3 /path/to/Z2K.py &
Because this script uses standard TCP sockets over Port 23 (Telnet), it is extremely easy to port to hardware:
- Protocol: Plaintext commands over TCP.
- Trigger: Send
Z2?to poll status. - Action: If response contains
Z2ON, sendZ2OFFthenZ2STANDBY. - This makes it an ideal project for a tiny ESP32 tucked behind your home theater rack.
Once the script is running, you can verify it is working by manually triggering a "Ghost" event:
- Open the Z2K dashboard (Windowed Mode).
- Grab your physical Denon/Marantz remote or use the mobile app.
- Manually turn on Zone 2.
- The Result: You should see the Zone 2 light on your receiver flash on and then immediately click back off within 2 seconds. The "SNEAKS KILLED" counter in the script window will tick up by one.
Q: Does this work with Marantz? A: Yes. Marantz and Denon share the same IP control protocol.
Q: My script says "CONNECTION_ERROR". A: Ensure your PC is not on a Guest Wi-Fi network and that your Windows Firewall is not blocking Python from accessing the local network. Also, verify that Network Control is Always On in the AVR menu.
Q: Will this stop me from using Zone 2 on purpose? A: Yes. Since the script is a Guard, it will kill Zone 2 whenever it sees it. If you want to legitimately use your patio speakers, simply close the script (Ctrl+C) and restart it when you are finished.
I want to track which units this successfully fixes. If you have deployed Z2K, please join the Discussion on GitHub and post your setup:
- Your AVR Model: (e.g., Denon X1800H)
- Your Input Device: (e.g., Nvidia Shield Pro 2019)
- Status: Confirmed Working
Created by KillerQ97