Getting wake lock status into HA
Hi! I am so glad to see someone has adopted this, since the project itself has been a life-saver in so many situations. I am trying to get my wake lock state into home assistant to have one more thing to check to make a decision if the system should be suspended or not - and I did see a powershell sensor has been integrated, which is really helpful for that, because now I just could do an "powercfg -requests | Select-String -Pattern "PROCESS"" or something as a quick hack - unfortunately powercfg requires admin rights and before I break my fingers to work around it: has anyone a better idea how to do it?
Solution:Jump to solution
you can also right click -> properties -> compatibility -> tick run as admin
16 Replies
Help us Help Others!
To help others find answers, you can mark your question as solved via
Right click solution message -> Apps -> ✅ Mark Solution
Help us Help You!
Please don't delete messages or posts because it makes it impossible to understand what happened. If you don't want your messages to be seen then don't post here.
Please provide us with the version number of your client.
You can find it in the HA device info page after 'Firmware'.
@Amadeo
@DrR0x
pretty sure the satellite service has admin privileges? have you tried that? i could be wrong though
Solution
you can also right click -> properties -> compatibility -> tick run as admin
the only way to do admin commands is through the task scheduler, i think. Im pretty sure although the sattellite is installed system wide it does no have the ability to run admin commands for security reasons
Nope, my way works fine
if you run the program as admin it is admin I assumed, and it seems to have the privileges for this at least
(This is not satellite, it is via right click -> Properties -> compat -> run as admin )
oh thats good to know
ill archive this thread because it doesnt mention this on the old docs
wait for koshi to see it, or does it stay here as a notification? I don't know discord very well
oh no, i'll just add it to my list of resources on a separate app 🤣
i wish discord had the ability to do that though
I have seen it and can confirm it works - just running the whole hass.agent as admin. Though in an ideal world it could be configured on a case-by-case basis like its done in the windows task scheduler. However, there are probably more important things to implement, since this way is working nicely 🙂 thanks a lot @DrR0x @barrelltitor !
I don't know if that's really possible without having hass agent have admin permissions as it would need someone else to escalate
If you use software to remote control your computer I'd say that's trust enough to give it admin perms, just be careful not to remotely delete stuff
yeah - its either running as admin all the time and dropping the privileges internally for most of the stuff - or requiring the user to give credentials for the specific sensor/command. Which then would need to be saved leading to other problems...
another idea would be to integrate an internal sensor for the wake lock without - without the powershell requirement. However, it seems that this information isn't exposed over any documented API...
@Amadeo What's your opinion?
I'll take a look if this can be somehow obtained in userland level
On the second topic (service/client and user/admin/system) perms - I've already thought about this (at least moving from system to admin user but that definetly won't happen with 2.X, maybe with 3.X )