Possible to trigger based on a web page status?

I have a dedicated Windows machine setup as a security camera NVR. Occasionally, the machine freezes, which is obviously problematic for a security system. The software running on the machine acts as a web server, so the web page it generates can be used as a proxy to detect when the system is hung. I have the machine setup to automatically start on power, so the machine can be rebooted by cycling the electrical outlet it’s plugged into.

So in a nutshell I need an electrical outlet that will shut off and back on when a webpage is down. I’ve actually already solved the problem through a combination of Uptime Robot->Gmail->ifttt.com->Belkin WeMo outlet. The problem is that the ifttt functionality is not dependable. It only triggers around 50% of the time. I see that the SmartThings suite has an electrical outlet and is supposed to have more robust trigger functionality than ifttt. I’m willing to purchase and setup the system if it will provide a totally dependable solution to this problem. Has anyone successfully implemented something like this?

I can have CoRE return the response status code in a variable and then you can trigger off that. Perhaps check every 5 minutes or so?

1 Like

I suspect you might be able to do: Uptime Robot -> CoRE.

And if you wanted to write groovy, you could make a SmartApp that rebooted when an http request was issued that returned an error. Sounds like a great idea for a new SmartApp.

I see ady is faster on the draw. His suggestion is even better. Boy CoRE really becoming a swiss army knife. Nice!

I know you might buy something based on this, so please don’t hold me responsible… but… I am quite sure this would work 10 times better than what you are doing now. ST has issues from time to time, but they are likely one hundredth of what you are dealing with using your current setup.

Also, realizing that you are not even a user yet, we should explain that CoRE is THE community rule engine for SmartThings. It can do just about anything.

Good luck, come share the fun with our community. :slight_smile:

1 Like

Depending upon your setup you may want to consider something like kiwi cattools to manage maintenance. Or even scheduled reboots within the windows OS at a convenient time.

Not sure I would want to wait for a windows host to hang and hard reboot it like that as a plan to maintain, as that can lead to further problems until total breakdown. I probably wouldn’t care if it was a VM where I had snapshots but not a physical host.

Thanks for the quick replies everyone. I’m actually a software engineer, so the whole system seems like something I could have a lot of fun with. The NVR machine is just my main concern right now.

I actually do have the machine set up to reboot via the OS every 24 hours. But when I say the machine hangs, it’s completely frozen. The screen displays a still image of the exact time it froze, and it doesn’t respond to anything. A hard reboot is the only option. The OS reboot won’t trigger when it’s frozen. I’ve tried a lot of things to solve the hanging issue, and I’m still working on it, but haven’t hit upon the correct solution yet.

1 Like

Welcome to our little corner of the world, just hang on… It’s very addictive here.

Coming from the hardware side of the freezing machine…

…what What exactly are you running? Machine specs please. What OS, cpu, hard drive, MB, and ram… Oh, and the NIC.

Or is this a store bought branded machine?

The machine is a couple of years old now, but I built it with relatively high end components at the time.

Intel Core i7-4770
Kingston Technology HyperX Blu 8GB 1333MHz DDR3
Gigabyte GIGABYTE GA-B85M-D3H LGA 1150 Intel Motherboard
Western Digital Red 3 TB NAS Hard Drive
Windows 10

Using the integrated graphics and ethernet on the motherboard, as well as HDMI out to a television.

Have you thought about a different version? I’ve been having trouble with win 10. Not for freezing, but my wifi keeps dropping off…

It could be something as simple and strange as that.

Hmmm. I’ve not looked into wemo, but presumably its devices react to http command strings.
Gotta wonder why IFTTT is unreliable for such a system: it should be as reliable as any other status checker _ trigger system.

@tigerguy I’ve added four system variables to CoRE:

$httpStatusCode - number, represents the HTTP Status Code, where 200 is OK
$httpStatusOk - true/false - true when $httpStatusCode == 200

irellevant to your case:
$iftttStatusCode - number, same as $httpStatusCode, but for IFTTT requests
$iftttStatusOk - true/false, same as $httpStatusOk, but for IFTTT requests

Technically, you can make a web request and then run actions depending on one of the two variables. Though if your computer/web server is not responding, ST may timeout and never get to do anything… But it’s worth a shot.