WindowsDevicePortalWrapper icon indicating copy to clipboard operation
WindowsDevicePortalWrapper copied to clipboard

HL2 set sleep settings fails

Open artsouflMS opened this issue 5 years ago • 1 comments

Hello,

I am building a tool for HL2.

I am using the command below to set the sleep settings in HL2 through my tool.

"https://127.0.0.1:10443/api/power/cfg/SCHEME_CURRENT/SUB_SLEEP/STANDBYIDLE?ValueAC=1800&ValueDC=1800";

After running the above command, in the device portal, I can see that both on battery and plugged in values are set to 30 min, as expected. Though my device goes to sleep after few min, maybe 3 or 5 minutes. So all the leds are switched off, near the power button.

If I set the settings manually through the device portal, then everything works as expected, the device goes to sleep after 30 min. Is there sth in the command that I am using wrong? In HL1 it seems like it is working, but not in HL2.

Any advice?

artsouflMS avatar May 20 '20 14:05 artsouflMS

Hi, when you want to reproduce what the device portal's web interface does, it's a good idea to look at the http calls that are made in the developer tools of your browser. You would have seen that when changing the sleep settings, there are 3 POST calls.

$"/api/power/cfg/SCHEME_CURRENT/SUB_SLEEP/STANDBYIDLE?ValueAC={pluggedinTimeout}&ValueDC={batteryTimeout}"
$"/api/power/cfg/SCHEME_CURRENT/SUB_VIDEO/VIDEOIDLE?ValueAC={pluggedinTimeout}&ValueDC={batteryTimeout}"
"/api/power/activecfg?scheme=SCHEME_CURRENT"

chris03 avatar Jul 17 '20 13:07 chris03