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 to track dvi monitor's state?

If you have a question or need help, this is the place to be.
Post Reply
etc6849
Posts: 21
Joined: Fri Dec 28, 2012 5:12 pm

How to track dvi monitor's state?

Post by etc6849 »

I'm using windows 7 x64 with a single monitor (connected via DVI).

When I use the python a command to turn off the monitor (from another PC via a TCP socket), event packets are received as shown below (ignore special formatting):

When I turn the monitor off (via Python command: eg.plugins.System.MonitorPowerOff():
<EVENT><Process.Created.igfxsrvc><None>
<EVENT><Process.Destroyed.igfxsrvc><None>

When I turn the monitor on, I see this (via Python command: eg.plugins.System.MonitorPowerOn():
<EVENT><Process.Created.igfxsrvc><None>
<EVENT><Process.Destroyed.igfxsrvc><None>

What I don't see is an EG event that uniquely defines the monitor's state. Is there a plugin that does this?

I've been able to track when windows turns off the monitor by looking for the "System.UnIdle" event (as I've set the idle time-out to be the same as the window's display time-out under the PC's power settings). However, system idle does not help me here. I'd rather not use "system.idle" altogether. Any ideas?
FREE Premise home automation software: http://www.cocoontech.com/wiki/Premise
Download: http://www.mediapcforums.com/node/7
Open-source VRC0P (Z-Wave) driver:
https://code.google.com/p/zwave-driver- ... %2FViziaRF
etc6849
Posts: 21
Joined: Fri Dec 28, 2012 5:12 pm

Re: How to track dvi monitor's state?

Post by etc6849 »

Another interesting point is that powering on the monitor as shown in the last post does seemed to reset the system.idle timer. This isn't a deal breaker though as there are actions that can restart this timer for me.
FREE Premise home automation software: http://www.cocoontech.com/wiki/Premise
Download: http://www.mediapcforums.com/node/7
Open-source VRC0P (Z-Wave) driver:
https://code.google.com/p/zwave-driver- ... %2FViziaRF
etc6849
Posts: 21
Joined: Fri Dec 28, 2012 5:12 pm

Re: How to track dvi monitor's state?

Post by etc6849 »

ok, I think I have something that kind of works, but it is definitely a kludge, so please provide suggestions! I found that if I use sendkeys, the system.unidle event is set (but only if the system has entered idle state).

Is the control key a good key to send?!? I can't think of a program that would use a single control press for anything, but who knows...

The stuff after the <ACTION> tag is the python command being used. The stuff after the <EVENT> tag is the event followed by its payload.
<ACTION>eg.plugins.System.MonitorPowerOn()
<ACTION>eg.plugins.Window.SendKeys(u'{Ctrl}', False)
<EVENT><System.UnIdle><None>
<EVENT><Process.Created.igfxsrvc><None>
<EVENT><Process.Destroyed.igfxsrvc><None>
FREE Premise home automation software: http://www.cocoontech.com/wiki/Premise
Download: http://www.mediapcforums.com/node/7
Open-source VRC0P (Z-Wave) driver:
https://code.google.com/p/zwave-driver- ... %2FViziaRF
piert
Experienced User
Posts: 321
Joined: Tue Jun 14, 2011 2:53 pm

Re: How to track dvi monitor's state?

Post by piert »

What is it that you want to achieve with all of this?
If you want to know the state of the monitor and you always use Python to turn if off/on, couldn't you just count/keep track of your Python commands that power the monitor off/on and store this in a (persistent) variable?
blaher
Experienced User
Posts: 487
Joined: Thu Nov 17, 2011 1:27 am

Re: How to track dvi monitor's state?

Post by blaher »

Does this code work, or is it just for HDMI?

viewtopic.php?f=5&t=2839&start=15#p22967
etc6849
Posts: 21
Joined: Fri Dec 28, 2012 5:12 pm

Re: How to track dvi monitor's state?

Post by etc6849 »

Unfortunately, I think that thread is for when you connect a second monitor (e.g. TV). I did try the plugin mentioned in that thread, but it still didn't work.

What I'm wanting for EG to raise an event whenever my monitor goes to sleep (e.g. Windows turns off my display). The idle time idea I had gives me a little more accuracy, one still doesn't know if the monitor is on or not simply by examining the event log.

Any ideas?
FREE Premise home automation software: http://www.cocoontech.com/wiki/Premise
Download: http://www.mediapcforums.com/node/7
Open-source VRC0P (Z-Wave) driver:
https://code.google.com/p/zwave-driver- ... %2FViziaRF
mickelin
Experienced User
Posts: 85
Joined: Sun Jan 04, 2009 5:54 pm

Re: How to track dvi monitor's state?

Post by mickelin »

One idea would be to let EG control the monitor instead of Windows. Set the Windows monitor sleep time to "Never". In EG you set a timer with desired duration to be triggered on System.Idle and then after the timer has run out, it triggers the monitor off command. In your System.Unidle macro you add the cancellation of an active timer. This way you have total control and always know the power state of your monitor. You could store the current state in a variable as suggested above.
etc6849
Posts: 21
Joined: Fri Dec 28, 2012 5:12 pm

Re: How to track dvi monitor's state?

Post by etc6849 »

Thanks!

This sounds like the best solution I can hope for. It still doesn't handle the case of when the user turns off the monitor using its front button, but oh well.

PS: I'm actually not using EG directly to control the monitor directly, but my home automation system, which in turns talks to EG via a tcp server plug-in I'm working on. I'll post everything once it's complete with instructions!

It will give you guys a lot more control options (GlobalCache, X10 security devices, z-wave etc...) and still allow you to keep your existing EG setup.
FREE Premise home automation software: http://www.cocoontech.com/wiki/Premise
Download: http://www.mediapcforums.com/node/7
Open-source VRC0P (Z-Wave) driver:
https://code.google.com/p/zwave-driver- ... %2FViziaRF
Post Reply