[RELEASE] SmartPing - Monitor your website uptime visually!


(Jason Botello) #1

Hello SmartThings Community folk! I recently got the urge to monitor a few of my personal websites through SmartThings and change my LED light strip colors if the server went down for a period of time. It’s nothing too special, but I’m not familiar with another SmartApp like this so hopefully it can be useful to someone! :slight_smile:

Right now it can trigger switches, dimmers, setLevel, setColor, alarms, sirens, and strobes so if you have the right number devices, you can probably successfully annoy your neighbors. Hopefully I’ll get some time in the future to expand upon it. Feel free to contribute if you have improvements!

Service Manager: https://github.com/jasonbio/SmartThingsPersonal/blob/master/smartapps/jasonbio/smartping/smartping.src/smartping.groovy
Child SmartApp: https://github.com/jasonbio/SmartThingsPersonal/blob/master/smartapps/jasonbio/smartping/smartping-automation.src/smartping-automation.groovy


(Michael Hess) #2

Sweet, will this allow local ping or only from the cloud?


(Jason Botello) #3

Cloud only right now, although implementing a hubAction wouldn’t be terribly difficult


(Michael Hess) #4

That would be cool, then I can monitor my influx db VM, and various other devices. Plus it would make for a very simple presence sensor, if ping to my kids phone stopped, they are gone! Or killed the battery again…Just setup a virtual switch to trigger for that.


(Marc) #5

This! I was debating installing WRT on my Asus router but didn’t want to mess around with it since it’s working so well. If you create a DHCP reservation in your router, and then use this smartapp to ping that IP, you can then use it as presence. We might have finally found a simple solution to the awful mobile presence reliability! Please add local IP pinging support!


(Jason Botello) #6

You technically SHOULD be able to input an IP address and port as the URL and it will pass validation. I’m not sure if it will actually succeed in a request - but maybe give it a try?


(Marc) #7

The problem is, to use it as a presence sensor, you would need to put the switch back to it’s original state when the URL is back online, correct?


(Marc) #8

Can you see what I am doing wrong? It’s not turning off the virtual switch and I don’t see anything in the IDE logs. How often does it ping?


(Jason Botello) #9

What exactly are you trying to do? The purpose of the SmartApp is to detect when a URL or IP address is not resolving. Basically, it’s looking for a URL that doesn’t give a response header of 200 - then it performs the triggers.

It looks like you’re trying to use it to do something else, which it probably doesn’t support right now. I doubt a simple GET request to an internal IP address will do what you want - can you give me more information about what’s needed? PUT? POST? Request body?


(Marc) #10

Ok, I misunderstood what the app was doing and didn’t look at the code(I took the name of the app with Ping it literally). I thought it actually pings the URL and tries to get a reply ICMP. Unless I host a web server on my iPhone, this isn’t going to work :frowning:


(Jason Botello) #11

You’re not totally wrong, that is essentially what happens except this is setup for an HTTP ping. Different methods can easily be applied, like PUT, POST, DELETE, and a request body if you need more magic to happen :slight_smile:


(The fish is still dead.) #12

It’s also worth noting that the ST cloud won’t be able to reach 192.168.1.68 even if you do have an HTTP server running at that address. RFC1918 addresses are not routable outside your home network.

To do this, you would need to either expose the device to the internet (unwise) or modify the SmartApp to use hubAction() to make the connection.


(Michael Hess) #13

Yeah hubAction() with a post or get would still need a small app on the phone hosting a page to give an expected response. Or something…


(Marc) #14

Yes, it’s been a long day. I am thinking the hub would ping but forgot you need the hubAction command.


(The fish is still dead.) #15

If you’ve got an always-on machine at home that you could run a web server on, it would be pretty trivial to write a script that you could hit via HTTP which would then ping the address and output accordingly.


(Tim Slagle) #16

(Thenoname) #17

It would be pretty awesome if someone could modify it so if it detects your Internet is down, it would turn an outlet off and on to cycle the router/modem.


(The fish is still dead.) #18

If your internet is down, the cloud can’t talk to your hub to control any outlets.


(Jason Botello) #19

Heh, this was actually the initial intended use of the SmartApp but @btk is right, without a way for the cloud to talk to the hub, there’s no way for this to work.


(The fish is still dead.) #20

So, how 'bout some local execution for custom SmartApps, eh?

Wink, wink.