Balint Korosi
updated gamingtech

Fixing Steam Machine HDMI-CEC: My TV Kept Coming Back On After Sleep

I put my Steam Machine to sleep. The TV goes black. Three seconds later it's back, glowing, with Samsung's "check device power, turn on the device" screen, and the bastard stays there until I get up and find the remote.

It's annoying AF, especially that I paid a fortune for this supposedly top tier fucking Samsung TV (designed for gaming). 

The TV doesn't have internet access, because I only use it for gaming, and the TV manufacturers' anti-consumer, privacy violating crusade does not bolster my confidence in them. In other words: fuck 'em. 

So the only thing left that can talk to it is the HDMI cable, which means HDMI-CEC, whose only job is to turn on and off the TV. When it feels like it - at best. It's infuriating, because when I plop down on the couch to do some quality time gaming, finding the remote in my office chaos is the last thing I want to do. 

My Steam Controller turns the Steam Machine on and CEC turn-on DOES work. 

BUT when I put the Machine into Sleep, the TV turns off for a split second then comes back on. And what do I do? Do unpaid bug hunting for billion dollar companies to do their fucking job for free if I want to enjoy their product to their full extent. Brilliant.

Update 2026-11-08

The Steam Machine also started waking itself back up a few seconds after sleep. Different bug, same script fixes it: jump to the update.

The Setting That Was Off

In Settings > Power > HDMI CEC there's an option for turning the TV off when the Steam Machine sleeps. On mine it was off. Turning the TV on at wake was on, which is why half of it worked.

Switched it on. Put it to sleep. TV came back AGAIN. 

Of course it did.

A Tenth of a Second

So I went through the logs, and the Steam Machine DOES try. It writes "Putting TV in standby", and a tenth of a second later the whole system freezes to go to sleep, before the message has left the box. The TV never hears "go to sleep". It just loses its picture, and Samsung's answer to losing its picture is the nag screen.

A tenth of a second.

sigh Am I going to get up and find the remote every night over a tenth of a second? Absolutely not.

The Fix

A tiny background service that does what SteamOS should: before every sleep it tells the system "hold on", sends the TV to sleep itself, waits until the message is actually out, then lets go. Controller, Steam menu, whatever, the TV goes off now and stays off.

Code's below, but first, the only question that matters:

Does Your TV Even Listen?

On the Steam Machine in Desktop Mode, open Konsole, and send the TV to sleep by hand:

cec-ctl -d /dev/cec0 --to 0 --standby

Mine (Samsung QN90) switched off on the spot. If yours does too, your TV is fine, the problem is on the SteamOS side, and the fix below should work whatever brand you've got. If it ignores you, stop here, this probably won't help.

The Code

The script, saved as ~/.local/bin/tv-standby-on-sleep.py:

#!/usr/bin/python3
# Puts the TV in CEC standby before the Steam Machine sleeps.
import os, subprocess
import dbus
from dbus.mainloop.glib import DBusGMainLoop
from gi.repository import GLib

DBusGMainLoop(set_as_default=True)
bus = dbus.SystemBus()
logind = dbus.Interface(bus.get_object("org.freedesktop.login1", "/org/freedesktop/login1"),"org.freedesktop.login1.Manager")
lock = None

def take_lock():
    global lock
    if lock is None:
        lock = logind.Inhibit("sleep", "tv-standby", "Put TV in standby", "delay").take()

def on_prepare(going_to_sleep):
    global lock
    if going_to_sleep:
        subprocess.run(["cec-ctl", "-d", "/dev/cec0", "--to", "0", "--standby"],
                       stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, timeout=4)
        # Drop the CEC address so CEC traffic can't wake the box right back up
        subprocess.run(["cec-ctl", "-d", "/dev/cec0", "--clear"],
                       stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, timeout=2)
        if lock is not None:
            os.close(lock)
            lock = None
    else:
        take_lock()

bus.add_signal_receiver(on_prepare, "PrepareForSleep", "org.freedesktop.login1.Manager")
take_lock()
GLib.MainLoop().run()

The service that runs it, saved as ~/.config/systemd/user/tv-standby.service:

[Unit]
Description=Put TV in CEC standby before sleep

[Service]
ExecStart=%h/.local/bin/tv-standby-on-sleep.py
Restart=on-failure

[Install]
WantedBy=default.target

Switch it on:

chmod +x ~/.local/bin/tv-standby-on-sleep.py
systemctl --user daemon-reload
systemctl --user enable --now tv-standby.service

Everything it needs is already on SteamOS, so no sudo, nothing outside your home folder, so an update shouldn't wipe it.

If you changed your mind (why would you?):

systemctl --user disable --now tv-standby.service
rm ~/.local/bin/tv-standby-on-sleep.py ~/.config/systemd/user/tv-standby.service

So

The TV stays off the internet, turns on when I pick up the controller, and turns off when I put it down. Which is what it should have done from day one. You're welcome, Valve and Samsung. 

Update 2026-11-08: It Woke Itself Back Up

Six weeks later, a new trick. Half the time I put it to sleep, it woke right back up three seconds later. TV off, TV on, Steam Machine staring at me.

Luckily this ain't my stupid TV, so the fix is possible. The Steam Machine has a small chip that handles HDMI-CEC for it, and it keeps listening while the box sleeps. Any CEC message on the cable while the box still has its CEC address, the TV answering, another console saying hi, and the chip wakes the whole box up. Whether a message lands in that first split second is luck, hence "half the time" (got a PS5 hooked up to the same TV. Jailbroken, mind you, because fuck Sony and their anticonsumer practices. I faithfully sank thousands of dollars into their pocket over the decades, but my purchases with PS5 stop. Fuck 'em). 

The proof, if you want to check yours: right after it bounces, run

cat /sys/power/pm_wakeup_irq

1 or 9 means that chip woke it. Turning off "wake on CEC" in the settings didn't help. It's the same bug as GitHub #2626, still open (at the time of writing).

The fix is one more line in the script above (already in it): after it sends the TV to sleep, it drops the box's CEC address, so the chip stops listening. SteamOS takes the address back on wake by itself. Before the change, 6 of 12 test sleeps bounced. After it, 10 of 10 stayed asleep.

One more: if the TV stops reacting to CEC altogether, pull its plug for a minute. Mine got stuck and ignored both the Steam Machine and the PS5 until I did.

Tested on SteamOS 3.8.28 and a Samsung QN90. The wake fix on SteamOS 3.9.5.