PowerScheduler++ 1.4.0.x - Stable versions for MediaPortal 1.4 (1 Viewer)

CyberSimian

Test Group
  • Team MediaPortal
  • June 10, 2013
    2,849
    1,771
    Southampton
    Home Country
    United Kingdom United Kingdom
    I am using MP 1.9.0 pre, with the "aMPed" and "DefaultWide" skins, on 32-bit Vista.

    Does PowerScheduler use the Windows function "SetThreadExecutionState()"? I scanned the PowerScheduler source, but could not find any references to this function. If PS does not use this function, what does it use to stop the system from sleeping or hibernating?

    The reason that I am asking this is to try to find a solution to an intermittent failure that I am experiencing. My hardware does not work correctly with sleep, but it does work correctly with hibernation. Unfortunately, hibernation has poor usability for an HTPC, so to circumvent this poor usability I use a tool that I wrote myself, called HIBERMON ("Hibernation Monitor", not to be confused with any other tool of the same name available elsewhere on the internet). This tool worked without problem for two years with Windows Media Center, but when used with Media Portal it exposes some sort of "window of opportunity" in PowerScheduler's algorithm that allows Vista to hibernate the system just as a recording is starting (not every time -- I would estimate about 5% of unattended recordings fail in this way).

    The way that I would expect it to work is this:
    (1) "x" minutes before a recording is about to start, the HTPC wakes from hibernation.
    (2) PS immediately uses "SetThreadExecutionState()" with the ES_CONTINUOUS, ES_SYSTEM_REQUIRED, and ES_AWAYMODE_REQUIRED flags to prevent the system sleeping or hibernating.
    (3) The x-minute pre-record period then passes ("x" is 4 minutes in my case).
    (4) The recording starts at the published start time less pre-padding, and continues until the published end time plus post-padding.
    (5) PS then uses "SetThreadExecutionState()" with only the ES_CONTINUOUS flag (not sure about this), to allow the system to return to sleep or hibernation.

    With the above algorithm, there is no window of opportunity that would allow Vista to hibernate the system near the start of the recording. So what is PowerScheduler doing that does seem to allow this? Thanks for any info.

    -- from CyberSimian in the UK
     

    flurfunk

    Portal Pro
    June 20, 2009
    233
    4
    35
    Viersen
    Home Country
    Germany Germany
    Is it possible to prevent my Client from Standby while a record is running? Even when I press the "powerToogle" button on my Harmony One, my pc should not go into standby while its recording. Didnt find this option so far
     

    RicoHTPC

    MP Donator
  • Premium Supporter
  • February 4, 2011
    1,441
    172
    Cuxhaven
    Home Country
    Germany Germany
    That should be possible, of course.
    What have you configured for pressing the power button within the energy options?
    What have you set under the "media-playing" section (don't know the exact name because I don't have access to Win7 right now)
    within the energy options?
     

    CyberSimian

    Test Group
  • Team MediaPortal
  • June 10, 2013
    2,849
    1,771
    Southampton
    Home Country
    United Kingdom United Kingdom
    Is it possible to prevent my Client from Standby while a record is running? Even when I press the "PowerToggle" button on my Harmony One, my pc should not go into standby while its recording.
    Some points:

    (1) If you are using sleep for your standby state (power state "S3"), you should enable "Away Mode".

    (2) If you are using hibernation for your standby state (power state "S4"), you should disable the power button on the remote control. The reason for this is that hibernation causes the HTPC to hibernate immediately, terminating prematurely any recordings that are in progress, "Away Mode" has no effect on hibernation.

    (3) Both "Away Mode" and the action of the power button on the remote control (sleep or hibernation) are set in the Windows power plan; go to:

    Start > Control Panel > Power Options > Change plan settings > Change advanced power settings

    Then expand the settings-trees for "Power buttons and lid" (to set the action of the power button on the remote control), and "Multimedia settings" + "When sharing media" (set set "Away Mode").

    (4) You may be able to request these settings in "PowerScheduler", so look first through the "PowerScheduler" tabs in "TV Server Configuration" before modifying the power plan via "Control Panel". (I use "expert mode" in "PowerScheduler", and am not familiar with the "PowerScheduler" settings.)

    -- from CyberSimian in the UK
     

    doveman

    Portal Pro
    February 12, 2008
    2,326
    178
    Home Country
    United Kingdom United Kingdom
    Is it possible to prevent my Client from Standby while a record is running? Even when I press the "PowerToggle" button on my Harmony One, my pc should not go into standby while its recording.
    Some points:

    (1) If you are using sleep for your standby state (power state "S3"), you should enable "Away Mode".

    Would this prevent the PC going to sleep when pausing playback of media on a Raspberry Pi running XBMC/Kodi?

    My brother has a problem where the PC goes to sleep almost as soon as he pauses playback on the RPi, even though the timeout is set to 30mins, so it seems the timer is not reset at all during playback. I've set the PS network monitor to something like 50KB/s, which keeps it awake whilst the media is playing (I'm using an NFS server to share the media to the RPi) but once it's paused, obviously the network activity ceases and thus PS no longer prevents the PC from sleeping.

    He reckons I fixed this for him once before but I can't recall for the life of me what I did!
     

    CyberSimian

    Test Group
  • Team MediaPortal
  • June 10, 2013
    2,849
    1,771
    Southampton
    Home Country
    United Kingdom United Kingdom
    My brother has a problem where the PC goes to sleep almost as soon as he pauses playback on the RPi, even though the timeout is set to 30mins, so it seems the timer is not reset at all during playback. I've set the PS network monitor to something like 50KB/s, which keeps it awake whilst the media is playing (I'm using an NFS server to share the media to the RPi) but once it's paused, obviously the network activity ceases and thus PS no longer prevents the PC from sleeping.
    I have never used MP in a configuration with separate client and server computers, so I am probably not the right person to advise you. However...

    Looking at the "PowerScheduler" settings in "TV Server Config", there are two settings that might be relevant:

    (1) On the "Ping Monitor" tab, enable "Do not put the computer to sleep while any hosts are active", and specify the IP address of the client computer (the Raspberry Pi). If the client uses a dynamic IP address, change it to use a static IP address.

    If I have understood this setting correctly, it should prevent the server PC from sleeping as long as the Pi remains awake. You will need to configure the Pi so that it does not wake when it receives a ping or magic packet over the network.

    (2) On the "Advanced" tab, disable "PowerScheduler forces system to go to standby when idle". What I think that this change will do is stop PS sleeping the server immediately, and instead allow the Windows sleep timeout to expire before Windows puts the system to sleep. If you have specified a sleep timeout of 30 minutes, that should be the time that will elapse before the server sleeps. (I am not entirely sure about this -- it depends what PowerScheduler on the server does when delivering video to a client.)

    To be able to use the settings described above, you need to change PowerScheduler to work in "Expert Mode" instead of "Plug & Play Mode".

    -- from CyberSimian in the UK
     

    doveman

    Portal Pro
    February 12, 2008
    2,326
    178
    Home Country
    United Kingdom United Kingdom
    Thanks but I don't think that's going to work for this setup.

    The Pi stays on all the time, being a low-power device, so if I relied on the Ping Monitor the PC would never sleep. I'm not sure if it even sends out pings but if it could be made to do so only when video was playing (or paused) that would solve the problem. I don't believe that's possible though.

    I'm already using the Windows sleep timeout rather than allowing PS to force sleep but what seems to happen is that the Network Monitor prevents sleep whilst it detects network activity but doesn't also reset the Windows sleep timer, so as soon as the network activity sleeps, Windows sees that it's been x minutes since it last received user input and goes to sleep.

    What I might have to do as a workaround is set PS to not sleep when a certain program (e.g. Notepad++) is open and then tell my brother to open that before watching videos on the Pi and close it after. It's not how I fixed the problem before and is a bit clumsy but as I haven't got a clue what I did before, it will have to do for now.
     

    CyberSimian

    Test Group
  • Team MediaPortal
  • June 10, 2013
    2,849
    1,771
    Southampton
    Home Country
    United Kingdom United Kingdom
    The Pi stays on all the time, being a low-power device, so if I relied on the Ping Monitor the PC would never sleep.
    I have never used a Raspberry Pi, and am not familiar with its standby capabilities. Does it not have a standby state somewhere between completely-on and completely-off? Anyway, here is a possible solution using PowerScheduler's ping support:

    (1) You connect the MP client to the MP server using wired networking.

    (2) You insert a dumb network hub in the connection between the client and server, i.e. client connects to the hub, and the hub connects to the server.

    (3) You connect the power supply for the network hub into the slave socket of a mains-power master/slave switch; I have this one:
    http://www.amazon.co.uk/TrickleStar-E2752-TV-Tricklesaver-Accessories/dp/B003EYULT4

    but I believe that that model has been discontinued. The current TrickleStar range includes a multisocket power strip:
    http://www.tricklestar.com/intl/advanced-powerstrip-5xx.html

    Other makes are available, but I would recommend buying one that has adjustable sensitivity. Note: don't make the mistake of buying this one:
    http://www.amazon.co.uk/TrickleStar-E2750-PC-TrickleSaver-Accessories/dp/B003EYULTO

    (4) You plug the TV into the master socket of the mains-power master/slave switch.

    So, the way this works is that when the TV is switched off, the power to the network hub is also switched off. That will break the connection between the MP server and the MP client, with the result that pings sent by the server will no longer generate a response. Hence the server will think that the client is no longer connected, and the server should then transition to sleep. When the TV is switched on, power is supplied to the network hub, enabling the connection between the client and the server to be re-established (but obviously you need to do something to wake the server from sleep; maybe the MP client has that capability built in?).

    -- from CyberSimian in the UK
     
    Last edited:

    doveman

    Portal Pro
    February 12, 2008
    2,326
    178
    Home Country
    United Kingdom United Kingdom
    Thanks CyberSimian, that's an interesting workaround that would not have occurred to me. I've actually got one of those master/slave powerplugs that I've been struggling to find a use for and an old 100Mbit hub somewhere, which will be fine for the Pi as that only has 100Mb Ethernet anyway, so this will actually be a cost-free solution for me :)

    Luckily the Pi does do WoL when accessing the server, so that's not a problem. It doesn't really have a standby state, as it uses so little power it's pretty pointless and whilst the software can be unloaded, which puts it into a sort of ultra-low power mode, it requires a power-cycle to get it back up again (and with no power button, that means pulling the USB power lead or switching it off at the wall) , so it's not worth using!
     

    Users who are viewing this thread

    Top Bottom