Rule Machine help - Use of Ping in a rule

I notice that you can use Ping as an action in a Rule. Has anyone got an example of this they could screenshot? I can see how to create the action (send the ping) but not how to act further on the result.

I've got a rule that sends a wake on lan packet to my NAS, when either a virtual switch is turned on or my Harmony 'Watch Apple TV' activity is On. When the virtual switch turns off, or the Harmony activity changes, it sends a shutdown command. I don't get any feedback from that shutdown so want to use a rule to ping the NAS as the result will let me know for sure whether it is on or off (allowing me to repeat the wake/shutdown if needed)

TIA

I would suspect that is for pinging devices, that expose a ping command.

image

That usually updates healStatus attribute, so you could wait a few seconds after a ping command to see if healthStatus is online.

image

That is my guess for its use, I could be wrong.

Edit: based on @bertabcd1234, I guess I was wrong... that does really ping a network address. Handy.

There's an example in the docs:

How 'bout something like this?

1 Like

1 Like

Found it - thanks, that helps:

Good example thanks. It's mainly to confirm that my device (NAS) has shut down. After my shutdown command I'll add a wait for elapsed time (30 seconds ish) before the ping command and setting the variable. I'll have it exit the rule if the value is 100 but re run the shutdown command if not. :+1:

@kahn-hubitat I take it you have some other rule that this one is linked to - or is there some app that runs the ping?

Sounds good.

Not that I'm an expert, but I'd work down from obvious stuff to the more esoteric, just to make sure the darn thing works. Or at least send you a notification if it does trip.

1 Like

actually i am using a modified version of the hubping done by someone else.. dont see where i got it but i put it in my github if your want it.

This actually creates a device that pings on a schedule that i use in the rule..

ie

it has percent loss, sets a switch if reacheable and also sets presence cability attribute

1 Like

Thanks - I've just grabbed a copy of that, it might prove useful :+1: