Ping a Host

Flow to ping a given IP address each second and if it is down for 5 seconds send a DOWN message, if the host starts responding the timer is reset and an UP message will be sent once.

[{"id":"f4e5cd9e434f5567","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"5d501c6fa918035d","type":"ping","z":"f4e5cd9e434f5567","protocol":"Automatic","mode":"timed","name":"","host":"192.168.1.123","timer":"1","inputs":0,"x":150,"y":380,"wires":[["c3bcb95c40f50b53"]]},{"id":"4a693eafa0c30293","type":"trigger","z":"f4e5cd9e434f5567","name":"","op1":"","op2":"DOWN","op1type":"nul","op2type":"str","duration":"5","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":780,"y":340,"wires":[["bfe05b4d867b334e"]]},{"id":"411ee745138899d0","type":"change","z":"f4e5cd9e434f5567","name":"","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"},{"t":"set","p":"payload","pt":"msg","to":"UP","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":400,"wires":[["4a693eafa0c30293","4f36671224033fa2"]]},{"id":"c3bcb95c40f50b53","type":"switch","z":"f4e5cd9e434f5567","name":"","property":"payload","propertyType":"msg","rules":[{"t":"false"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":350,"y":380,"wires":[["4a693eafa0c30293"],["411ee745138899d0"]]},{"id":"dcac14b4e5def6ab","type":"debug","z":"f4e5cd9e434f5567","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1270,"y":400,"wires":[]},{"id":"bfe05b4d867b334e","type":"rbe","z":"f4e5cd9e434f5567","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":1030,"y":400,"wires":[["dcac14b4e5def6ab"]]},{"id":"4f36671224033fa2","type":"change","z":"f4e5cd9e434f5567","name":"","rules":[{"t":"delete","p":"reset","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":790,"y":400,"wires":[["bfe05b4d867b334e"]]}]

Flow Info

Created 2 years, 7 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • change (x2)
  • debug (x1)
  • rbe (x1)
  • switch (x1)
  • trigger (x1)
Other
  • ping (x1)
  • tab (x1)

Tags

  • ping
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option