Using Mac as a Motion sensor? (Working on computer mode)


#1

I have two motion sensors in my study, but i find that i am too stationary when I am using my computer.

Is there a way to link my mac to smartthings so that it sends an “active” signal to my coRE piston and keep my room “active”?


(Bobby) #2

Put it on a power outlet, it’s the most reliable method.

https://m.lowes.com/pd/Iris-120-Volt-White-Smart-Plug-Works-with-Amazon-Alexa/999925330


#3

I get away with one with just the occasional issue. What I have thought about doing is putting one under my desk pointing at my chair. I’m thinking that will work well.

Otherwise I’d go with Bobby’s suggestion.


(Kurt Sanders) #4

This is a bit more complicated, but one could theoretically create a CRON job on the MAC to execute a CURL HTTP GET command to a SmartThings RESTAPI every X mins. No cost for firmware, but more certainly complicated.

When the mac sleeps, it would stop sending the CURL command to the DTH or SmartApp.


#5

Thanks Bobby.

Not sure if that will work, my mac is always on standby (never shutdown)…


#6

this is a great idea… I can probably look at making one.

Surprised no one done that already.


(Bobby) #7

If you find the standby usage (say is 30 watts), , then if > 30 w = you are working, so you don’t want to turn the lights off. My TVs and computers are on power outlets just for this reason. Lights go off when power returns to standby thresholds.


(Joe) #8

Someone attempted something like this already. It may not be what what you’re looking for, but take a look.


(Joe) #9

Another thing you can do is look into automator to send an command to webCore when ever you hit certain keys on your keyboard or have a mode change as long as a certain app is open.


(Joe) #10

You may be able to do something with Alfred also.


#11

Quick update for everyone. I didn’t manage to see what Keo posted before I went ahead and built it anyway.

The solution is slightly different from what Keo’s link described

Here is what I did and tested working

  • Wrote a custom SmartApps to accept a command via REST API
  • Added a simulated motion sensor on Smartthings
  • Setup a crontab job on mac to ping the custom SmartApps which refreshes the motion sensor with an active status every other minute

So far, everything seems to be working great. Thanks, guys.

If anyone is interested, i will post a detailed step-by-step and share my smartapps on GitHub.


(Kurt Sanders) #12

Glad that solution is working for you.

One other suggestion, you could verify that the Mac is locally connected to your Home LAN by adding a few code lines to the crontab script to ping a local ping-able device. If the script receives a ping response from the ping, the MAC is connected to the Home LAN and then updates the SmartApp RESTAPI to indicate motion status.


(Ron Talley) #13

This is exactly how I have all of my “PCs” working. I said PC because I use a program called EventGhost which monitors PC activities and can send to ST or ST can send event to EventGhost to have the PC execute local tasks…

I also use HostPinger to Ping the IP Address of various network device, including my Mac, to see if they are on or off. This App then sets the status of on/off (Switches) for Network Devices that are linked to ST. The IP of my Mac is inactive when in standby…

Basically, for my PC Motion Device, EventGhost monitors mouse movements. If the mouse is inactive for 3 minutes then the PC Motion Switch turns off. If the mouse is active then it is on. Works perfect!

There are aslo alternatives to EventGhost such as HammerSpoon. Don’t know if there is a bridge to ST but I am sure there is something similar out there. These are just simple Python scripts.

Here’s the Tutorial as a starting point. Again, you will have to find the EventGhost Alternative that can be incorporated into ST.


#14

sweet, thanks guys!