Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

How can I IR blast on TV when computer resumes?

If you have a question or need help, this is the place to be.
Post Reply
nzdreamer55
Posts: 10
Joined: Sat Jan 04, 2014 5:33 pm

How can I IR blast on TV when computer resumes?

Post by nzdreamer55 »

Hello everyone,

I just found EventGhost (so cool!) and have been able to set up my windows 7 x64 Home Premium machine with it. I have a USB-UIRT as an IR receiver and blaster. Found the plug-in and have created a macro that when I push the "Power" button on my remote control, Eventghost will blast the power toggle to turn on my TV and my soundbar. The problem is that I would like to automatically turn on those things when my computer comes out of stanby. I could just watch for this event, but my computer will come out of standby for other reasons such as to serve media to a portable device. In this case I would hate for the TV to come on.

Right now I have programmed the USB-UIRT internal memory (there are 4 slots) to remember the "Power" IR command from my remote control and this then wakes the computer but because the computer is in standby it does not forward the command to eventghost only pulls it out of standby. The computer will not respond to any other commands unless it is from a keyboard or mouse while in sleep mode and then it will just wake the computer. There is no recording of received events from the USB-UIRT until after it wakes the computer within Eventghost.

I know that I could just use a different button to launch the macro to turn on the TV or I could press the "Power" button once to wake the computer and then another time to turn on the TV once Eventghost is "aware" of events, but I would love an elegant solution when waking the PC via the USB-UIRT. It would be cool if it would then turn on the TV, but if the computer got any other signal (wake up timers, WOL packets, etc) then it would not turn on the TV.

I fear if I link the power toggle with the Resume event, then my TV will be turning on like a Ghost!

Thanks for any help you can give this newbie :-)

-S
bruinlax
Posts: 26
Joined: Thu Sep 29, 2011 4:31 pm

Re: How can I IR blast on TV when computer resumes?

Post by bruinlax »

could you use a script that parses the powercfg -lastwake shell command?

e.g. something like (but please use regex to parse the reason fro the Event Trigger{:

import subprocess
cmd = subprocess.Popen('powercfg -lastwake', shell=True, stdout=subprocess.PIPE)
for line in cmd.stdout:
eg.TriggerEvent(line)



then based on the new event if the last wake was from the USB-UIRT - turn on the TV?

OR why can't you just use the "ON" command from the TV remote to program the "ON" in the USB-UIRT?

OR just get a harmony or cheap remote with macros to fire two commands
nzdreamer55
Posts: 10
Joined: Sat Jan 04, 2014 5:33 pm

Re: How can I IR blast on TV when computer resumes?

Post by nzdreamer55 »

I love your first idea. That is very sleek, but this is way beyond my skill set. I'm not even sure I know what is meant by parse the powercfg state. I though that at first the second idea would work, but in reality I need more than just one thing turned on so I could send the IR command to turn on the TV and use it to wake the computer, but then I still need send ir commands to turn on my STB and speaker bar. Maybe I could use the detected device of my TV and then start another macro to power on the other things. That way if the TV is off and the computer comes on, the other things including the TV will not be turned on.

I have a harmony remote and well the commands are just really slow. My WMC remote just seems to be much faster and more responsive to the buttons.

Thanks for the ideas I really appreciate it.

-S
bruinlax
Posts: 26
Joined: Thu Sep 29, 2011 4:31 pm

Re: How can I IR blast on TV when computer resumes?

Post by bruinlax »

step 1), put your computer to sleep
step 2), wake it up using your USB-UIRT
then go to commandline
and type powercfg -lastwake

see what it outputs. the script i wrote pretty much will just output an event based on it.(very literally)


then compare that to what it outputs when it wakes up from the network. if they are different, then you could use it to trigger your IR stuff.

all you would do is add an action - (python script) and copy and paste the code, and adjust accordingly. it doesn't require you to install an IDE or anything.


btw- python is really easy, and an awesome language. i knew none of it before i started with eventghost, and i'm so thankful that this program is written in it. it makes writing scripts like this really easy.
nzdreamer55
Posts: 10
Joined: Sat Jan 04, 2014 5:33 pm

Re: How can I IR blast on TV when computer resumes?

Post by nzdreamer55 »

Thanks again for the help. Sorry for the delay in getting back. So I followed your instructions and powered on my computer 3 times using three different ways (the USB-UIRT, a keyboard connected via USB dongle, and via a magic packet WOL).

Code: Select all

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\Kira>powercfg -lastwake
Wake History Count - 1
Wake History [0]
  Wake Source Count - 1
  Wake Source [0]
    Type: Device
    Instance Path: USB\ROOT_HUB\4&265d5acf&0
    Friendly Name:
    Description: USB Root Hub
    Manufacturer: (Standard USB Host Controller)

C:\Users\Kira>powercfg -lastwake
Wake History Count - 1
Wake History [0]
  Wake Source Count - 1
  Wake Source [0]
    Type: Device
    Instance Path: USB\ROOT_HUB\4&265d5acf&0
    Friendly Name:
    Description: USB Root Hub
    Manufacturer: (Standard USB Host Controller)

C:\Users\Kira>powercfg -lastwake
Wake History Count - 1
Wake History [0]
  Wake Source Count - 1
  Wake Source [0]
    Type: Device
    Instance Path: PCI\VEN_10EC&DEV_8168&SUBSYS_84321043&REV_06\4&789b33d&0&00A9

    Friendly Name:
    Description: Realtek PCIe GBE Family Controller
    Manufacturer: Realtek

C:\Users\Kira>
So it looks like I could use the USB aspect, but I'm not sure how to write the script that you provided. Could you take another look at what I have and point me in the right diection?

Thank you once again.

-S
barnabas1969
Experienced User
Posts: 133
Joined: Sat Feb 04, 2012 1:42 am

Re: How can I IR blast on TV when computer resumes?

Post by barnabas1969 »

I used to use powercfg to determine why the computer woke. The problem was that powercfg would sometimes hang. So, I found a new way.

Basically, it involves creating a scheduled task (in the Windows Task Scheduler) that fires when the computer wakes due to user intervention (the USB port in your case). The Task Scheduler then fires an event in EventGhost (the Action in your Task Scheduler task will be something like "C:\Program Files\EventGhost\eventghost.exe -e System.WokeByUserIntervention"). This event can then be used to trigger a macro in EG.

Here's a link to a thread where I discuss it:

http://www.thegreenbutton.tv/forums/vie ... =22&t=4948
Post Reply