Simple IP connection control (ping) using standard nodes

this is an easy way to check your ip connection to a router or other equipment. It uses standard nodes. Only limitation is a minimum of 2 seconds per ping due to the kill command in the execute node. Result is true for connection ok and false if no connection

[{"id":"a3624a8b.295b18","type":"tab","label":"Ping","disabled":false,"info":""},{"id":"98320e01.02826","type":"inject","z":"a3624a8b.295b18","name":"IP connection down","topic":"","payload":"ping 10.0.0.5","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":300,"wires":[["57f7c641.6ece68"]]},{"id":"feda3abb.eb94d8","type":"exec","z":"a3624a8b.295b18","command":"","addpay":true,"append":"","useSpawn":"true","timer":"1","oldrc":true,"name":"ping","x":670,"y":280,"wires":[["25eec67d.5620fa"],[],["42f82f15.3f40c","281d6ad.c79fb96"]]},{"id":"42f82f15.3f40c","type":"function","z":"a3624a8b.295b18","name":"kill con down","func":"flow.set('code',msg.payload);\nreturn {kill : 1};","outputs":1,"noerr":0,"x":690,"y":340,"wires":[["feda3abb.eb94d8"]]},{"id":"25eec67d.5620fa","type":"function","z":"a3624a8b.295b18","name":"kill-con-up","func":"flow.set('ping',msg.payload);\nreturn {kill : 1};","outputs":1,"noerr":0,"x":690,"y":220,"wires":[["feda3abb.eb94d8"]]},{"id":"fdf5472c.f43178","type":"debug","z":"a3624a8b.295b18","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":990,"y":280,"wires":[]},{"id":"57f7c641.6ece68","type":"change","z":"a3624a8b.295b18","name":"","rules":[{"t":"set","p":"ping","pt":"flow","to":"na","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":280,"wires":[["feda3abb.eb94d8"]]},{"id":"281d6ad.c79fb96","type":"function","z":"a3624a8b.295b18","name":"","func":"var ping = flow.get('ping');\nif (ping == \"na\"){\n    msg.payload = false;\n}\nelse{ \nmsg.payload = true;\n}\nreturn msg;","outputs":1,"noerr":0,"x":830,"y":280,"wires":[["fdf5472c.f43178"]]},{"id":"bf354f68.c0f9","type":"inject","z":"a3624a8b.295b18","name":"IP connection up","topic":"","payload":"ping 10.0.0.1","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":260,"y":260,"wires":[["57f7c641.6ece68"]]}]

Export your code again and then post it like

three backticks `

your code

three backticks `

Or edit your post by inserting the backticks before and after your code.

done! Thanks for your support