Windows PC as Switch? (When logged in?)

project_power

#1

I’d want to have a virtual device on my SmartThings (A switch i guess?) where when my Windows PC is logged in it is On, otherwise it is off. So i can trigger events based on when somebody uses the PC or not.

i feel like this MUST be something somebody has done before. However i can’t seem to find any information on it anywhere.

I can’t use the conventional method of an actual Power outlet device, as the computer is left running 24/7 (as i imagine most peoples desktop PCs are these days) as they’re on the same network id imagine it should be relatively trivial to do, just basically notify SmartThings on logon and logout. Has it been done? Or if not what would be the best way to go about doing it? I have programming experience so would be able to delve in if necessary. i just feel like this must have been one of the first things somebody did with SmartThings. I’m amazed i haven’t been able to find anything


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #2

Do a forum search on “EventGhost”… There are several Topics.

I’m using it for a few functions, some integrated with SmartThings pretty easily.

This Topic may not be the most relevant one, but … well, not a bad place to start…


(Chris) #3

I’d have said a Windows Scheduled Task using multiple triggers might be the best bet.

They support:

  • At log on
  • On connection to user session
  • On disconnect from user session
  • On workstation lock
  • On workstation unlock

It’d be a matter of calling a script or program that maybe pokes a SmartApp HTTP endpoint that has a virtual child presence device attached to it that gets updated.

You could go mental probably and associate multiple virtual presence devices based on the people logging in, so not only could you know if the computer was logged in, but who was logged in.

That’s how I’d probably approach it at least :slight_smile:


(Nicholas Wilde) #4

I’m actually working on a project now that is able to monitor any network device via its mac address on the network using a virtual switch and a Raspberry Pi. I just got it working last night and so it still needs debugging and documentation. Feel free to take a look.

MAC Address Monitor

It’s based off of @Fuzzyligic 's ASUSWRT Wifi Presence except I’m using a Raspberry Pi instead of a router.

So far I’ve been able to get monitor my WiFi connected TV but having troubles with my MacBook.


(Alex Lee) #5

I managed to get this set up on my Windows 10 PC.

I used this smart app code (I think I slightly modified it) -> https://github.com/SmartThingsCommunity/Code/blob/master/smartapps/hackathon-demo/restful-switch.groovy

With the help of this guide -> http://docs.smartthings.com/en/latest/smartapp-web-services-developers-guide/authorization.html

Installed Windows cURL -> https://curl.haxx.se/download.html

Created 2 .bat files to run the right cURL command for logon and logoff and configured within Windows 10 using something like this -> http://www.nextofwindows.com/how-to-run-a-script-or-command-at-logoff-in-windows-7-8

I had to set a slight 2 minute delay for logon script to run consistently -> http://www.thewindowsclub.com/configure-logon-script-delay-windows