karpach / remote-shutdown-pc

Remote Shutdown Manager is a windows application, which gives an ability to shutdown, suspend, hibernate PC or turn screen off using HTTP GET request.
326 stars 47 forks source link

Enhancement Request: Provide Power Status and Events #39

Open kay2thebee opened 1 year ago

kay2thebee commented 1 year ago

This is a great tool and I'm using it in conjunction with TAustin's Smartthings Edge driver with great success. Thank you!

Clients like TAustin's and end users like myself could benefit from having insight into power management on the system. As it stands, I'm only able to control the PC power state (and thus the associated devices in my scheme) when it is fully active (e.g., not suspended or pending user log in). The ability to learn about events and the current power management parameters would greatly increase the utility that's already here.

Here's a potential approach:

  1. Subscribe to Win32 power events: suspend, hibernate, shut down as well as resume from suspend/hibernate, and power up as well as changes to the active power plan (not sure if there's a Win32 event for that last one). There may be more such events of interest, like starting and ending versions of these and even one indicating that the system is up but pending user log in.
  2. As was suggested earlier, provide a setting such that the system can WoL from a suspended state.
  3. Respond to shutdown and other requests with success/failure or, better, a status code.
  4. Support an event subscription model to report PC power events to network clients. Client's like TAustin's PC Control Driver would subscribe to relevant RSM power events.

With these in place, clients like the PC controller can know what’s going on and a) have the ability to reflect that status to their clients in turn as well as b) issue more appropriate power events in more situations.

These changes would obviously increase the scope of your tool beyond the handling shutdown requests and basic monitoring into a more complete solution, yet still in the realm of supporting shutdown and power state monitoring.

Thanks again for this tool and for your consideration of these or even better possibilities.

MichaelWoodc commented 1 month ago

There's an app systembridge I've taken to using in conjunction with this app to provide what you are interested in via home assistant