How can I monitor the usage state of my PC, ignoring remote usage?

I monitor my PC state to run some automations. The most basic version is using ping to turn on/off lights depending on the state of the PC.

I want to take this a bit further. I’d like to turn off the lights when the PC has been locked for a couple of minutes. So far, so good. I found various programs that can tell HA if my PC is locked or not. However, it doesn’t look like any of these programs can differentiate between me actually being at my PC, or controlling it via Microsoft Remote Desktop.

I feel like it should be possible to differentiate, since the PC is ‘unlocked’/available in the MS RD app, while staying locked physically. Does anyone know of a way to tell if a PC is actually unlocked, or used remotely?

Perhaps this is too low tech.
An LDR on the screen?

You can probably open up the screen and place it on the inside of the screen where some light bleeds out.

I must admit, it’s a creative solution, but it’s definitely not my preferred method. I can’t imagine that this info can’t be extracted from the PC easily, it’s not an Apple product after all :wink: .

Maybe somebody who knows more about WMI Queries knows if one of those queries can extract this info?

You probably can using the windows API somehow.
But the problem is finding where that is and finding a way to send this information.

I would just pick up a screwdriver and be done with it in an hour using ESP-Home.

Which is why I asked on a forum. There’s plenty of people out there for whom this is a trivial question, it’s only a matter of connecting my question to their knowledge.

That works if you have all the parts in stock, and are willing to mess with your monitor. I don’t, and I’m not, not for something trivial like this at least, which should be easily doable in software.

Understand.

Just giving you another option in case you do not find this information.
Add a power monitoring socket on the screen.

1 Like

Have you tried IOT Link ?

I’ve looked at it, but despite the good range of customizability I didn’t see anything that I thought would allow me to see if the PC was used remotely or not. Now I’m looking at it again though, I may be able to use the screen resolution to differentiate between the local and the remote sessions.