Show ping status (on or off) as Red or Green Lamp on Dashboard

I check my diverse servers by the pingtime!
I will show the status

I'm confused. Are you making a statement or asking for help?

If you are asking for help, what have you tried so far?

I want to show the pingstatus as red or green lamp or bottem
image

First you need to decide what constitutes red and green. Then you can use a button or switch with appropriate CSS styles that change the colour according to your decision.

what have you tried so far? all you have done so far is show a graph. Do you want a ui-led on the dashboard along with that graph or someting else? You have to give more information to get any help.

First of all!
Sorry about my english.
Could you please send my a little exemple?

My input are values of ping [0,24 and so on)this must show a green button and value (0 = zerro) must show a red button.

Start by installing node-red-node-ping and feed that into a debug node to see if you can get that bit going.

Really, don't you mean the other way around? You need to think about what the data actually means. You will never get a zero ping. Think about what happens when something doesn't respond to a ping?

While you are doing that, I strongly recommend reading up about what a ping actually does and what the results actually mean. A ping only hits the hardware, it doesn't mean that anything other than the network card itself is actually working.

I used the 'Ping' Node and the ui-LED node. Maybe mine is too simple, but if the ping is successful, a '1' the ui-led displays a green color; if the ping is unsuccessful, a '0', the ui-led displays a red color.
As TotallyInformation states, it only reflects the state of the network card. My simpleton philosophy is if the card is up, then the device is up...(maybe not working correctly, but its not powered off. As the devices are remote, saves me a walk)

Hi chucksteele,
thank you for the answer,
Could you please send me a little exemple as FLOW
Thanks
Heinz

As I suggested, start with the ping node and get that working. This is a very simple requirement and perfect for learning the basics, but to learn you must try things yourself. Then if it does not work come back and say what is not working or what you do not understand.

:ok: I understand.
With the ping node I got values and this is for me not possible change to boolan. How can I do this?

Hi.

Yes, if you install the advanced pingnode it will be a lot easier.

Not wanting to muddy the waters - make it more confusing than it already is - I have a similar thing I do.

This flow pings my IP addresses.

I have cut it back a bit, but I think it will do what you want.

You will have to edit the two nodes as marked.

The first is for your IP addresses to ping and the second is to route the replies to their respective outputs.

[{"id":"925b0f39.d9c58","type":"function","z":"8abed8bb.324b88","name":"check list","func":"var checks = [\n    {'topic':'Blacksheep', 'addr':\"192.168.0.1\"},\n    {'topic':'Relay Board1', 'addr':\"192.168.0.21\"},\n    {'topic':'W.I.B',    'addr':\"192.168.0.34\"},\n    {'topic':'MusicPi',  'addr': \"192.168.0.82\"}, \n    {'topic':'BedPi',    'addr': \"192.168.0.83\"}, \n    {'topic':'PiFace',   'addr': \"192.168.0.86\"},\n    {'topic':'EyeSpyPi', 'addr': \"192.168.0.89\"},\n    {'topic':'CameraPi', 'addr': \"192.168.0.91\"},\n    {'topic':'PortaPi',  'addr': \"192.168.0.92\"},\n    {'topic':'TelePi',   'addr': \"192.168.0.93\"},\n    {'topic':'BeefPi',   'addr': \"192.168.0.94\"},\n    {'topic':'TimePi',   'addr': \"192.168.0.99\"},\n    {'topic':'SG NAS',   'addr': \"192.168.0.200\"},\n    {'topic':'Thecus',   'addr': \"192.168.0.201\"},\n    {'topci':'Nas-T-Nuc',  'addr': \"192.168.0.202\"},\n    {'topic':'Beyonwiz', 'addr':\"192.168.0.211\"},\n    {'topic':'TIVX',     'addr':\"192.168.0.212\"},\n    {'topic':'Lab',      'addr':\"192.168.0.221\"},\n    {'topic':'1801 Router', 'addr':\"192.168.0.222\"},\n    {'topic':'LinkSys',  'addr':\"192.168.0.250\"},\n    {'topic':'Printer',  'addr': \"192.168.0.253\"},\n    {'topic':'Gateway',  'addr': \"192.168.0.254\"},\n    {'topic':'UpLink',  'addr': \"61.9.194.49\"},\n//    {'topic':'(E) WiFi WAP1','addr': \"192.168.1.1\"},\n    {'topic':'Network',  'addr': \"192.168.1.2\"},\n    {'topic':'Network',  'addr': \"192.168.1.3\"},\n    {'topic':'Network',  'addr': \"192.168.1.4\"},\n    {'topic':'Network',  'addr': \"192.168.1.5\"},\n    {'topic':'Network',  'addr': \"192.168.1.6\"},\n    {'topic':'Network',  'addr': \"192.168.1.7\"},\n    {'topic':'Network',  'addr': \"192.168.1.8\"},\n    {'topic':'Network',  'addr': \"192.168.1.9\"},\n    {'topic':'Network',  'addr': \"192.168.1.10\"},\n    {'topic':'Network',  'addr': \"192.168.1.11\"},\n    {'topic':'Network',  'addr': \"192.168.1.12\"},\n    {'topic':'Network',  'addr': \"192.168.1.13\"},\n    {'topic':'Network',  'addr': \"192.168.1.14\"},\n];\n\nfor ( var i in checks ) {\n    node.send({\n        \"topic\" : checks[i].topic,\n        \"host\"  : checks[i].addr,\n    });\n}","outputs":1,"noerr":0,"x":440,"y":290,"wires":[["64175af8.b2b964"]]},{"id":"64175af8.b2b964","type":"adv ping","z":"8abed8bb.324b88","name":"","host":"","x":600,"y":290,"wires":[["73214018.c120d8"]]},{"id":"73214018.c120d8","type":"function","z":"8abed8bb.324b88","name":"msg","func":"if (msg.payload===false){\n    //if its false the its off-line\n    msg.payload=msg.topic+\" Off-line\";\n}else{\n    //If its not false then it must be true / on-line\n    msg.payload=msg.topic+\" On-line\";\n}  \nreturn msg;\n\n","outputs":1,"noerr":0,"x":750,"y":290,"wires":[["f47cea2f.d6b21"]]},{"id":"f47cea2f.d6b21","type":"switch","z":"8abed8bb.324b88","name":"IP switch","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"192.168.0.82","vt":"str"},{"t":"cont","v":"192.168.0.83","vt":"str"},{"t":"cont","v":"192.168.0.86","vt":"str"},{"t":"cont","v":"192.168.0.89","vt":"str"},{"t":"cont","v":"192.168.0.91","vt":"str"},{"t":"cont","v":"192.168.0.92","vt":"str"},{"t":"cont","v":"192.168.0.93","vt":"str"},{"t":"cont","v":"192.168.0.94","vt":"str"},{"t":"cont","v":"192.168.0.99","vt":"str"},{"t":"cont","v":"192.168.0.200","vt":"str"},{"t":"cont","v":"192.168.0.201","vt":"str"},{"t":"cont","v":"192.168.0.202","vt":"str"},{"t":"cont","v":"192.168.0.253","vt":"str"},{"t":"cont","v":"192.168.0.254","vt":"str"}],"checkall":"true","repair":false,"outputs":14,"x":900,"y":290,"wires":[[],[],[],[],[],[],[],[],[],[],[],[],[],[]]},{"id":"6fc40050.4ae228","type":"comment","z":"8abed8bb.324b88","name":"EDIT THIS NODE","info":"","x":440,"y":250,"wires":[]},{"id":"d26ac357.436de8","type":"comment","z":"8abed8bb.324b88","name":"EDIT THIS NODE","info":"","x":890,"y":160,"wires":[]},{"id":"cc23a510.d10ba","type":"inject","z":"8abed8bb.324b88","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":200,"y":290,"wires":[["925b0f39.d9c58"]]},{"id":"b4f723b6.b910a8","type":"comment","z":"8abed8bb.324b88","name":"Trigger / clock input.","info":"","x":210,"y":250,"wires":[]}]

I haven't posted a flow before, so hopefully this will work for you. Please let me know before I get banished to the corner for improper posting procedure :wink:

[{"id":"8cfacf5e.eee3e","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"c02c390b.be8a48","type":"ping","z":"8cfacf5e.eee3e","name":"HB Rachio - 217","host":"192.168.0.217","timer":"300","x":337.01953125,"y":473.00390625,"wires":[["1afe60ad.3662df"]]},{"id":"1afe60ad.3662df","type":"ui_led","z":"8cfacf5e.eee3e","group":"c3b7f18b.155d5","order":4,"width":0,"height":0,"label":"Rachio","labelPlacement":"left","labelAlignment":"left","colorForValue":[{"color":"red","value":"0","valueType":"num"},{"color":"green","value":"1","valueType":"num"}],"allowColorForValueInMessage":false,"name":"Rachio","x":557.01953125,"y":473.00390625,"wires":[]},{"id":"c3b7f18b.155d5","type":"ui_group","z":"","name":" Status","tab":"2bca5f61.829fc","disp":true,"width":"6","collapse":false},{"id":"2bca5f61.829fc","type":"ui_tab","z":"","name":"HB Status","icon":"dashboard","order":8,"disabled":false,"hidden":false}]

Try this flow:

[{"id":"8eee6e26.470a3","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"4a9da371.c1b13c","type":"inject","z":"8eee6e26.470a3","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":270,"y":180,"wires":[["97e6812b.4bcfc"]]},{"id":"29705fda.de70e","type":"ping","z":"8eee6e26.470a3","name":"Ping Fritzbox alle 60 sec","host":"10.0.0.1","timer":"60","x":210,"y":280,"wires":[["97e6812b.4bcfc"]]},{"id":"2be70490.e9ac7c","type":"inject","z":"8eee6e26.470a3","name":"","topic":"","payload":"25","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":270,"y":360,"wires":[["97e6812b.4bcfc"]]},{"id":"97e6812b.4bcfc","type":"function","z":"8eee6e26.470a3","name":"","func":"if (msg.payload === false){\n    msg.payload = \"off\";\n}\nelse{\n    msg.payload = \"on\";\n}\nreturn msg;","outputs":1,"noerr":0,"x":470,"y":280,"wires":[["ee177ea4.3f32f"]]},{"id":"ee177ea4.3f32f","type":"rbe","z":"8eee6e26.470a3","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":590,"y":280,"wires":[["8d03c1ea.57018"]]},{"id":"8d03c1ea.57018","type":"switch","z":"8eee6e26.470a3","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"off","vt":"str"},{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":710,"y":280,"wires":[["10a612d2.7e2d9d"],["9885e760.4c1ed8"]]},{"id":"10a612d2.7e2d9d","type":"function","z":"8eee6e26.470a3","name":"","func":"msg.payload = \"red\";\nreturn msg;","outputs":1,"noerr":0,"x":870,"y":240,"wires":[["1eefe2e6.dfab6d"]]},{"id":"9885e760.4c1ed8","type":"function","z":"8eee6e26.470a3","name":"","func":"msg.payload = \"green\";\nreturn msg;","outputs":1,"noerr":0,"x":870,"y":320,"wires":[["33b654b2.b5d89c"]]},{"id":"1eefe2e6.dfab6d","type":"debug","z":"8eee6e26.470a3","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1010,"y":240,"wires":[]},{"id":"33b654b2.b5d89c","type":"debug","z":"8eee6e26.470a3","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1010,"y":320,"wires":[]}]

if you want a red and green dot try template.
Don't forget to change the ip address!

Dot:

[{"id":"57c6344f.fc6fbc","type":"change","z":"9b890450.3fe668","name":"green","rules":[{"t":"set","p":"payload","pt":"msg","to":"green","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":830,"y":420,"wires":[["5d9694b8.687bcc"]]},{"id":"5d9694b8.687bcc","type":"ui_template","z":"9b890450.3fe668","group":"23f69a7d.d522b6","name":"UWP Heizung Template","order":2,"width":"1","height":"2","format":"<div><br><br></div>\n<div style=\"color:{{msg.payload}}\" <i class=\"fa fa-circle\"></i></div>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":1170,"y":340,"wires":[[]]},{"id":"23f69a7d.d522b6","type":"ui_group","z":"","name":"Temperaturregelung Status","tab":"e12a3848.60d5c8","order":4,"disp":false,"width":"17","collapse":false},{"id":"e12a3848.60d5c8","type":"ui_tab","z":"","name":"Temperaturregelung","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

Thank you all "helpers"

I think now I have a solution for my problem

please close this chat

Thanks again Heinz

Heinz,

To "Close" the chat, pick one of the ones that helped you and click the "solution" box.

It doesn't really "close" the chat, but indicates which is the better solution, so if people have a similar problem they can quickly see which is the solution you chose.

(And it indicates to others they don't need to read it and help you - as you have found a solution.)

Yeah, ok.... The meaning seems to be lost in translation.

Pick the person's reply you use. Not the last post you made.

So, if Juntiedt's flow is the one you used, pick his post.
Of if you used checksteele's post, tick his post.
Or mine.

That way if someone has a similar problem, they will see which post you used and it may help them find the answer to their problem faster.

1 Like