Presence Sensor based on pings

I’m a new convert from Vera to SmartThings. With Vera, I used a ping sensor to detect when my TVs are on and the presence of my phones. The SmartThings app on my phone has replaced the phone presence, but I haven’t found a good solution to detect when my TVs are on. I have searched the forums, and I haven’t seen mention of a ping presence sensor, but I figured I would ask to see if anyone knows of one that already exists?

I know I could use a power meter outlet, but I’d rather not have to buy an additional piece of hardware just to detect when my TV is on.

Thanks!

I use an Aeon Energy switch for this purpose. I can see that it draws power, so when the TV or something in the entertainment center comes on. I do the standard turning down or off the lights.

I have a linux server running a shell script that flips virtual tiles on and off based on my computer screensavers. It would be easy enough to check pings instead of the screensaver.

1 Like

For example:

create a scripts folder in your home directory and place these two files inside, making them both executable. Then you just need to make a cron job for myping.sh.

ping_test.sh

#!/bin/sh
ping -c 1 "$1" >/dev/null

myping.sh

#!/bin/sh
if ~/scripts/ping_test.sh <ip or host to ping>; then
  curl https://graph.api.smartthings.com/url_to_your_device_on
else 
  curl https://graph.api.smartthings.com/url_to_your_device_off
fi

So there is no auth required to flip the switch just the Url?

You have to enable oAuth on a basic endpoint smartapp. Here is a good example

ok feel better now, would hate someone watching my traffic to find the path for stuff. already have the willis with support changing setting without confirming the identity of the person they are live chatting with

Using an external script is interesting. I already setup Tasker integration, so that would be pretty similar. As far a I can tell from the Tasker tutorial, the REST commands can only flip a switch. I’d really prefer it to function as a presence sensor instead of a switch. Do you know if it’s possible to toggle a virtual presence sensor based on a REST call?

Yep. You just need to expose the presence as an endpoint. Some code near this end of this

I am working on using my computers screen lock state as a virtual motion detector. Sometimes I sit motionless in my office working at the computer and the lights go out. If my computer is unlocked during office hours, the lights stay on.

1 Like

I have a pretty bad solution. Relies on IFTTT and an expensive Nest Secure (Guard) system. My cell phone has to be on, internet has to be working, etc. Sucks

Background: Nest Guard will send a notification to my cell if the power is cut and that it is switching to battery. I am trying to leverage that. I assume it works similarly for an IOS device – I don’t have one.

  • Setup a trigger on IFTTT applet for and “Android Device” service where you can tell if an app got a notification – which in this case is “Nest”. The keyword to look for is “backup” in the notification.
  • My action is to turn on/off a SmartThings switch (or whatever else) which can trigger other things.

Sorry, I am embarrassed to even type this up in public. Just frustrating that this is not natively supported.

PS: I am a newbie on SmartThings V3 – haven’t used earlier versions.