Jump to content
Flirc Forums

[Windows] How to make your PC SLEEP and WAKE by pressing ONE button on your Remote


Recommended Posts

First off I just want to say that I really enjoy using my flirc, thanks for making such a great product!

That said, I really think this should be the default behavior of the wake command (to also put the computer to sleep when pressed) but that may not be possible so here is my solution.

Sorry this is so long but that's only because it goes step by step by step. :)


Obtain the beta firmware and utility. Current ones as of this writing available 

After you extract the zip you might need to move the firmware file to the same folder the flirc_util.exe file is in.

Open a command prompt and navigate to the folder flirc_util.exe is in.

If you have already set up your remote buttons then you should back up your flirc's config, Type flirc_util saveconfig myConfig 

Then to upgrade the firmware type flirc_util upgrade fw_255.9.bin

You can then reload your config flirc_util loadconfig myConfig.fcfg

You can now record a button to wake up your computer when it is sleeping.

If the button you want to use is already mapped to something you will have to clear it first with flirc_util delete and press the button on your remote that needs to be cleared.

Then record the wake command flirc_util record wake and press the button on your remote you want.

To make the flirc able to wake the computer type flirc_util suspend_detect enable (there are still bugs and error messages when this is enabled but you can mostly ignore them.)

Save your flirc config again now flirc_util saveconfig myConfigWake


At this point you should have a remote that will wake your computer from sleep. Its always good to test things so go ahead and try it out!

So now that that works we need a way to put your computer to sleep.

Eskro has made a great guide on how to do that with a system call shortcut. But we need to put these two together somehow.

So instead of a shortcut to a system call we will make a shortcut to a .bat file that will make the system call and other various things.


Before you go any further you should move the flirc_util.exe and your myConfigWake.fcfg somewhere more organized. Mine are at C:\HTPC\Flirc.


In this folder create a new txt file and name it Sleep.bat

Right click on the Sleep.bat and click edit then paste this into it and save it.

cd c:\HTPC\Flirc
flirc_util loadconfig myConfigWake.fcfg
flirc_util suspend_detect enable
rundll32 powrprof.dll,SetSuspendState

So there is a little bit more in there then just the sleep command but it will soon be clear why.


Next we need a way to run this bat file.

In Eskro's thread some people suggested creating a shortcut in your startmenu or on the desktop that has a shortcut key.

That worked fine for me until I started XBMC and then it wouldn't work any more so I made an AutoHotKey script for it instead and haven't had any more problems.

So go download AutoHotKey and install it.

Make another txt file and name it Sleep.ahk.

Right click on Sleep.ahk and click edit then paste this into it, save it, close it, and double click it to run it.

^!s::Run C:\HTPC\Flirc\Sleep.bat


Also we need to make a shortcut of Sleep.ahk and put that in the startup folder in the startmenu.


The ^!s in the AHK script means ctrl-alt-s. You can make this anything you want, just make it something you are not using already.

We need to setup flirc now to make one of the buttons on your remote press ctrl-alt-s or whatever you made it to be.

Actually we're not going to make just any button do that, we need to make the same button that wakes up your computer to press those keys.

So back to the command prompt!  Type:

cd c:\HTPC\Flirc
flirc_util delete
flirc_util record_api 5 22
flirc_util saveconfig myConfigSleep


If you are not using ctrl-alt-s then you will need to give the record_api command different arguments to reflect your hotkey. You can type flirc_util record_api help for the syntax and you can look up the list of HID codes starting on page 53 of this pdf file.


We need to make one more .bat file that will be run by windows Task Scheduler when windows is coming out of sleep mode.

Create a new .txt file and name it setFlircSleep.bat.

Right click setFlircSleep.bat and click edit and paste this code into it and save it.

cd c:\HTPC\Flirc
flirc_util suspend_detect disable
flirc_util loadconfig myConfigSleep.fcfg


Now hit start and in the search bar type Event Viewer (yes Event Viewer, not Task Scheduler.)

On the left side expand Windows Logs and click on System.

You should have some recent events from when you were testing your wake button with a source listed as "Power-Troubleshooter" and an Event ID of "1".

Right click on one of them and click Attatch Task To This Event.

Click Next, Next, Next, then click browse and find your setFlircSleep.bat file.


One last thing to do is to make a shortcut to setFlircSleep.bat and put that in the startup folder in the startmenu. This is to ensure that in the off chance that your computer loses power while it's sleeping, the remote will still be able to put the computer back to sleep when it turns back on.


The final contents of my c:\HTPC\Flirc folder are:



and both Sleep.ahk and setFlircSleep.bat have shortcuts in the startup folder.


And thats it! Congratulations on setting up sleep/wake on the same button with your flirc!


note: The use of the flirc_util suspend_detect enable and disable commands may be unnecessary with future firmware. They definitely help at the moment but it still might not work every time.

I only tested this on Windows 7 64bit but it should work fine on other versions.

Also I consider this solution a super messy hack (reprogramming the whole flirc config twice every cycle lol) and I hope this functionality will eventually be supported in the main application but its working fine for me and I'm happy with it.

  • Like 7
Link to comment
Share on other sites

  • 3 months later...

This is a great post, if only the firware would work. It redirects to a version full of bugs (on Windows 8 / Intel NUC), where the commands flow in like someone is repeating the press on the buttons. Why can we not download older beta versions (which I understand if the latter versions wouldn't have new bugs).

Link to comment
Share on other sites

Why can we not download older beta versions (which I understand if the latter versions wouldn't have new bugs).

Allows us to make progress by ironing out bugs if everyone is using the same beta.

It gets too confusing for us and users if we keep multiple betas

Link to comment
Share on other sites

  • 8 months later...

Good Morning Teddy,


Thanks for the detailed if frightening method to get the remote to wake/sleep the HTPC with Harmony One.

I am in that situation with an SSD drive storing my Windows 7 OS. I am not an astute or accomplished computer person but I did build my new HTPC by myself after building my first one 7 years ago.


I must admit that I do not want to turn my new HTPC into an anchor by making a programing mistake. How risky is your method for a dweeb rather than a nerd?


B   bltblt@aol.com

Link to comment
Share on other sites

  • 2 months later...

This is a very creative workaround I must say.


Quick question about this method;

Wouldn't the constant reprogramming of the Flirc shorten it's life? I'm not sure what kind of memory is used but I've heard of flash memory that can only be written so many times...

I'm worried that when I start using this method I need to buy a new Flirc every couple of years. (I turn on/off my computer two to three times a day, every day.)


@Chris: What's your take on this?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...