Simple flow to ping media server?

What is the best way to monitor a internal media server? I would like to maybe ping it every 5 minutes and if the ping is false then send a message to my Iphone.

How does the server connect to HA? Api or mqtt? This is for presence servers on mqtt. It gets pinged at least once per minute. If there is no response it will reboot the server and send a message.

monitor and notify flow

[{"id":"1ee8e024.ca4dc","type":"mqtt in","z":"7d105d71.cc18e4","name":"blue/rpz/#","topic":"blue/rpz/#","qos":"0","datatype":"auto","broker":"601bef1.d5b981","x":380,"y":2040,"wires":[["4e472f31.3b3168"]]},{"id":"4e472f31.3b3168","type":"change","z":"7d105d71.cc18e4","name":"set to on","rules":[{"t":"set","p":"payload","pt":"msg","to":"on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":2040,"wires":[["41b869ac.12e708"]]},{"id":"41b869ac.12e708","type":"trigger","z":"7d105d71.cc18e4","name":"is rpz online?","op1":"off","op2":"on","op1type":"str","op2type":"str","duration":"5","extend":true,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":2,"x":830,"y":2040,"wires":[[],["5d204585.156114"]]},{"id":"5d204585.156114","type":"api-call-service","z":"7d105d71.cc18e4","name":"notify if rebooted","server":"","version":1,"debugenabled":true,"service_domain":"persistent_notification","service":"create","entityId":"","data":"{\"message\":\"rpz restarted\",\"title\":\"rpz restarted\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1100,"y":2040,"wires":[[]]},{"id":"601bef1.d5b981","type":"mqtt-broker","name":"Mosquitto","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

ping flow

[{"id":"c1b01cd6.b0e498","type":"inject","z":"7d105d71.cc18e4","name":"15 min device state loop","props":[{"p":"topic","vt":"str"}],"repeat":"900","crontab":"","once":false,"onceDelay":0.1,"topic":"1","x":110,"y":2120,"wires":[["d7b89fa.3024f6"]]},{"id":"d7b89fa.3024f6","type":"mqtt out","z":"7d105d71.cc18e4","name":"","topic":"monitor/rpz/KNOWN DEVICE STATES","qos":"","retain":"","broker":"601bef1.d5b981","x":670,"y":2120,"wires":[]},{"id":"601bef1.d5b981","type":"mqtt-broker","name":"Mosquitto","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

I’m not using a Api or mqtt. It’s just a Freenas running on my network.
I have this flow now and it works by pinging the IP. Only thing is that it sends a message every time it fails the ping. How could I stop it and then reset the flow after it gets a valid ping?

image

Use the first flow and swap the first node. the trigger node will send a message if it stops receiving ping after 5 minutes. Change the notify node from persistent notification to the mobile app

E. you can change the 5 min interval in the trigger node to whatever you want. Every time the trigger node receives a message it resets the timer.

So your saying to use a trigger node in place of the switch node?

Change the first mqtt node in the first flow to the ping freenas node.

Okay. I have done that but when the server goes offline the ping still sends a “false” message that keeps the flow in a true state.

Here this is all you’ll need

[{"id":"60391ca2.0fafbc","type":"ping","z":"d6a46901.ebee1","protocol":"Automatic","mode":"timed","name":"","host":"192.168.0.88","timer":"1","inputs":0,"x":610,"y":560,"wires":[["38b86564.39f81a"]]},{"id":"ef75c093.3c8b88","type":"debug","z":"d6a46901.ebee1","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1030,"y":460,"wires":[]},{"id":"38b86564.39f81a","type":"switch","z":"d6a46901.ebee1","name":"","property":"payload","propertyType":"msg","rules":[{"t":"false"}],"checkall":"true","repair":false,"outputs":1,"x":810,"y":560,"wires":[["ef75c093.3c8b88","fe74a793.4268e"]]},{"id":"fe74a793.4268e","type":"api-call-service","z":"d6a46901.ebee1","name":"notify mobile","server":"","version":1,"debugenabled":false,"service_domain":"","service":"","entityId":"","data":"","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1030,"y":560,"wires":[[]]}]

Will not that send me a message every ping?

no the switch node acts as a filter and will only send the false message.

Okay that works but I get the message every 5 minutes that I set in the ping. Is there a way to have it only once?

rbe node

[{"id":"38b86564.39f81a","type":"switch","z":"d6a46901.ebee1","name":"","property":"payload","propertyType":"msg","rules":[{"t":"false"}],"checkall":"true","repair":false,"outputs":1,"x":770,"y":560,"wires":[["fe74a793.4268e"]]},{"id":"fe74a793.4268e","type":"api-call-service","z":"d6a46901.ebee1","name":"notify mobile","server":"7c85afe1.bbea8","version":1,"debugenabled":false,"service_domain":"","service":"","entityId":"","data":"","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":990,"y":560,"wires":[[]]},{"id":"3b0bb874.00f058","type":"rbe","z":"d6a46901.ebee1","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":590,"y":560,"wires":[["38b86564.39f81a"]]},{"id":"47d6982.ad4f968","type":"ping","z":"d6a46901.ebee1","protocol":"Automatic","mode":"timed","name":"","host":"","timer":"20","inputs":0,"x":380,"y":560,"wires":[["3b0bb874.00f058"]]},{"id":"7c85afe1.bbea8","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

I have a similar flow that pings a dns server to check that the internet is active. I have a gate node after the trigger. Each successful ping opens the gate. An unsuccessful ping sends a notification and the gate gets closed. No more notifications are sent until I manually trigger a successful ping.