CEC Adapter — Waking the TV When PC Resumes from Sleep

Modified on Thu, 30 Apr at 1:23 PM

By default, the USB-CEC Adapter will power on the TV when libCECTray starts — typically when the PC first boots. However, if the PC goes to sleep and then resumes, libCECTray is already running and does not restart, so the TV is not automatically powered on again on resume.

This article explains how to use Windows Task Scheduler to trigger a CEC power-on command whenever the PC wakes from sleep.

If your issue is the opposite — the PC is waking from sleep when it should stay asleep — see CEC Adapter — PC Waking from Sleep instead.

How It Works

Windows Task Scheduler can trigger a script or command when a specific system event occurs — including the system resuming from sleep. By creating a task that fires on the wake event and runs a cec-client command to power on the TV, the TV will turn on automatically every time the PC wakes up.


Setting Up the Task

1
Create the power-on commandThe command to power on the TV via CEC is:
(echo on 0 & echo quit) | cec-client -d 1
Save this as a .bat batch file — for example, C:\Scripts\cec-wake.bat. Make sure the path to cec-client is correct (it is typically in C:\Program Files\Pulse-Eight\USB-CEC Adapter\). You may need to specify the full path:
(echo on 0 & echo quit) | "C:\Program Files\Pulse-Eight\USB-CEC Adapter\cec-client.exe" -d 1
Test the batch file manually first by double-clicking it — the TV should turn on.
2
Open Task SchedulerPressWin + S, search forTask Scheduler, and open it.
3
Create a new taskIn the right-hand panel, clickCreate Task(not Create Basic Task — the full Create Task gives more options).
4
General tabGive the task a name such as CEC TV Wake on Resume. Under Security options, selectRun whether user is logged on or notand checkRun with highest privileges.
5
Triggers tab — add the wake event triggerClickNew. SetBegin the tasktoOn an event. Set:
  • Log:System
  • Source:Power-Troubleshooter
  • Event ID:1
This event fires every time Windows resumes from sleep. Click OK.
6
Actions tab — add the CEC commandClickNew. SetActiontoStart a program. Browse to and select the .bat file you created in Step 1. Click OK.
7
Settings tabUnderIf the task is already running, set it toRun a new instance in parallel. This prevents the task being skipped if it is triggered twice in quick succession. Click OK and enter your Windows password when prompted.
8
Test the taskPut the PC to sleep manually (Start → Power → Sleep) and then wake it. The TV should power on within a few seconds of the PC resuming. If it does not, right-click the task in Task Scheduler and selectRunto test it directly.
Some TVs need a short delay after wake before accepting CEC commands. If the TV does not respond, try adding a delay at the start of the batch file using timeout /t 5 /nobreak before the cec-client command. This gives Windows a few seconds to fully initialise the USB-CEC Adapter after resume before the command is sent.
Task running but TV not responding?
Contact Pulse-Eight support with your TV make and model, libcec version, and a description of what happens when the task fires.

UK: 01202 413 610 | US: (858) 748-8250 | support@pulse-eight.com

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article