hass-workstation-service
hass-workstation-service copied to clipboard
Dedicated Sleep Command Options and more
I saw the discussion on Reddit regarding sleep commands and the issues that come with hibernation. A little Google-fu yielded this Superuser discussion and a Microsoft tool that can be utilized for a proper dedicated sleep command, but it would require users to install a dependency (psshutdown.exe).
https://superuser.com/questions/42124/how-can-i-put-the-computer-to-sleep-from-command-prompt-run-menu/395497#395497
https://docs.microsoft.com/en-us/sysinternals/downloads/psshutdown
The command seems to only work for me when including the accepteula portion:
psshutdown -d -t 0 -accepteula
There's also the potential for further extensibility with pstools.
Thanks for creating an issue!
A way to depend on other software in an intuitive way would be pretty nice! I've also been thinking about some sort of add-on implementation so people can extend this application easily.
FYI for the sysinternals suite of power tools, they all require you to accept an EULA on first invocation only (in my experience). If it's a GUI tool, the tool presents a GUI dialog to accept the EULA, then sets a registry key. If you invoke the command with the -accepteula
argument, I believe you only need to do so the first time, and it should result in the same registry key getting set as using the GUI.
Im not developer but is it worth seeing how IotLink is doing it? https://gitlab.com/iotlink/iotlink
psshutdown
requires a bash with admin privileges, which HASS W cannot (?) do.
NirSoft's nircmd.exe standby
command works however, and doesn't need admin privileges (so can be created in HASS W). This is what I'm currently using.
There is a UserDLL windows-native method for suspend
as well, but it's very complicated and has a risk of failing. It may also need elevated privileges.