(Tutorial) PC on/off and Activity Monitor with SmartThings

With Event Ghost, you can take an “Event” (Lightning Bolt), listed under the Log section on the left and click and drag it to an “Action” (we will be using macros), listed (installed) under the Configuration section.

Once you have Send Event to Event Ghost App installed and configured with a VS, you will see that Event sent from SmartThings on the left side, (HTTP.ST.Study PC.switch.off) then click and drag that to the right side macro, in my case, (Forced: Turn Off Computer)

Remember to save you Event Ghost file!

Setup Screens for PC Shutdown in Event Ghost:

In this Screen Shot, HTTP…switch.on is not doing anything in Event Ghost as this Action (Lightning Bolt) is not tied to any command (Macro) on the right side of the screen. However, ST will send both the on and off actions for any switch that you want the “Send Events Events to Event Ghost” App to monitor in EventGhost. Either the on or off Action can be tied to whatever command you like. For PC Shutdown, the HTTP…switch.off Action will be tied to the Shutdown Macro as you see on the right side of the Screen Shot.

I opened up Port 82 in my router configuration for my Study PC Local IP address (192.168.1.xxx). This is needed in order for EventGhost to receive Events from the ST Cloud. Then I configured the Send Events to Event Ghost App with the same information.

So when Study PC switch changes to “Off”, Event Ghost will receive the command and execute the Forced: Turn Off Computer.

The “On” command for the VS is done via CoRE with this Piston:

The problem is, if you turn off/on the computer manually then your VS looses sync. That is fixed with Host Pinger.
Hint (You can even create the VS in Host Pinger first)

Step 9-Setup with Screen Shots for Mouse Activity in Event Ghost:

Look at Screenshot showing the Python Scripts for Mouse Monitoring towards right bottom

Finally, to get the PC Activity Switch going, all you need is to find the End Points of your VS (Easily done with the Alexa Cloud Interface App) then put it in the Python Script listed above “import urllib; urllib.urlopen(‘http://some smartthings address’)” and apply it to the macro where mouse is idled or un-idled.

To be super clear, in Event Ghost, you will make a folder and call it PC Activity. In that folder, you will create a python macro: Configuration -> Add Folder -> Add Macro. Open the EventGhost tree and Select ‘Python Command’, then hit ‘OK’. Press ‘OK’ at this screen. This is where you will put the full Python Script including the End Point Address for idle or un-idle that matches with your VS on or off status.

Example 1. import urllib; urllib.urlopen(‘your End Point Address goes in between these two apostrophes’)

Example 2. import urllib; urllib.urlopen(‘http://graph.api.smartthings.com/api/smartapps/installations/numbersandletters/switches/numbersandletters/on?access_token=numbersandletters’)

Select your Virtual Switch (VS)

Here is where you get your VS End Points to put in the Python Script

That’s it!

Here is a Piston that I use to Auto Turn Off my PC if it is On and no one is on it or in the room.

2 Likes