[Deprecated] Web Pinger

I can't connect to anything there, either using the IP or that pseudo-dns name. Is the ":ip" supposed to be that, or should it be the actual ip address to ping instead of the letters "i" and "p"?

(I get redirected to a login page which always fails.)

Should be the actual IP address. For 192.168.1.47 (http://hubitat.local/hub/networkTest/ping/192,168,1,47) it returns:

PING 192.168.1.47 (192.168.1.47) 1250(1278) bytes of data. 1258 bytes from 192.168.1.47: icmp_seq=1 ttl=64 time=265 ms 1258 bytes from 192.168.1.47: icmp_seq=2 ttl=64 time=6.34 ms 1258 bytes from 192.168.1.47: icmp_seq=3 ttl=64 time=6.63 ms 1258 bytes from 192.168.1.47: icmp_seq=4 ttl=64 time=3.45 ms 1258 bytes from 192.168.1.47: icmp_seq=5 ttl=64 time=4.51 ms --- 192.168.1.47 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4009ms rtt min/avg/max/mdev = 3.454/57.181/264.987/103.909 ms

Do you know of a way to get this into a true false rule?

You’d have to parse the response to validate, so a little work to create a true/false but doable.

I would target the % packet loss, and make your call based on it. So locate the % in the string, back up 2 positions if that character isn’t a space then you can either evaluate further or say false (i.e. if you have 33% packet loss is it a good test or a bad test).

Funny you should ask!

The obvious regexp is (to turn the switch off if the ping worked; so the off regexp) would be just "0% packet loss".

I think maybe this is not usable with hub security on. Does anybody actually run with hub security off? Esepcially anybody with say locks controlled by the hub?

And also maybe incompatible with https-always? If I access the url via http I get redirected to the login page (and then returned there each time I click login), if I access it via https I just get a single line of text returned saying "error".

Yeah, the question of where to draw the line is (as it often is in real-world testing!) the interesting one.

For local ping I think I would argue that any packet loss was an error; it just shouldn't be happening. Then I'd monitor for a few months and see if the real world agreed with me.

If security is enabled you’ll need to log into the hub before the call. Ran into the same issue with a driver I wrote, and we borrowed the code from dman2306’s Rebooter app.

1 Like

I already am logged into the hub in my browser; but when I access that URL I get redirected away anyway?

Do see how to go through login and get the cookie, anyway, but Firefox or Chrome should be handling that automatically once I'm logged in and it's not happening. Grrrr.

Nope, even with hub security and https-everywhere turned off I just get errors? (one line appears in the browser window, the word "error")

@dd-b Threw this together real quick, but might work for you:

https://raw.githubusercontent.com/thebearmay/hubitat/main/hubPing.groovy

cant open

I fat fingered the link, try it now.

1 Like

Ok, it works and it pings internal device. Now how do I use this in RM to cause a device to turn off.

And thanks for your assistance

Out of respect for bptWorld let’s move this conversation over to the new thread I created (I’ll send you the link) and I’ll ask @bobbyD if he’ll consider splitting off the last 4-5 posts here.

Wow, I was considering doing something like that as a test, but emotionally don't really believe in the ping capability in the hub since I haven't gotten it to work yet (yeah, emotional reactions aren't particularly reliable guides to reality!), so I hadn't done it yet, hadn't even started.

And now I don't have to. Thank you so much!

Not sure it's really wise to enable my lazy impulses too often, though :slight_smile:

1 Like

I installed this app - seems what I need but not getting expected results. check url and if fails turn a switch off. This works. When I turn the switch back on it never does it again. Is this a valid test? The url is not available for testing purposes. Seems to do a one and done.

Additionally, I'd like to be able to turn the switch back on after 5 minutes or so but I am trying to validate the first part.
thanks for any help.

Can someone take a look and see what I'm missing here. I have three pings set up.
1 - pings my router.
2 - pings google.com.
3 - pings 1.1.1.1.
If I shut down the router, web pinger sees that none of the 3 are reachable and turns on the switches associated with each child, as I expected. If I leave the router running and pull the power on my cable modem, web pinger still thinks it can reach Google.com and 1.1.1.1, not what I expected.

Logs attached when modem was unplugged.

Child rules attached.

What am I not seeing here.

Summary





For some reason when I get a successful ping (timed or manual) my "on if ok" switch just gets toggled. Meaning one successful ping turns it on and the following one turns it off and so on.

I'm having an issue with the Auto-Reset Switches feature. It is runs every X seconds regardless of whether the Website is up or down. It should only run once and only after it has either turned On (or Off) the switch.
I am trying to power cycle my router using the ZigBee smart switch it is plugged into if your app detects that the internet is down. I have configured it to Turn Off my Router Switch if it the request to the site failed. I then want the Switch to turn back on 30 seconds later so I have the Auto-Reset function set to 30.

However what is happening is that the Auto-Reset function is running every 30 seconds all the time. If the Router is On, the Auto-Reset turns the Router Switch Off (not plugged into Router yet for testing). Then when the app next checks to see if it can reach the website and finds it, it turns the Router switch back on. Problem is 30 seconds later the Auto-Reset turns it back off.

I only want the app to turn Off the Switch if it cannot reach the website. I then want it to automatically turn it back On 30 seconds later. This would successfully reboot the router if the internet is down (ie Comcast modem routers suck and need to be manually power cycled).
Thanks.