# Showing Ping results

**URL:** <https://discourse.nodered.org/t/showing-ping-results/86243>\
**Category:** Dashboard\
**Created:** [7 March 2024 15:49 UTC](https://discourse.nodered.org/t/showing-ping-results/86243 "2024-03-07T15:49:31Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Richard238](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/richard238/32/48307_2.png) [@Richard238](https://discourse.nodered.org/u/Richard238)\
**Post date:** [7 March 2024 15:49 UTC](https://discourse.nodered.org/t/showing-ping-results/86243/1 "2024-03-07T15:49:31Z")

</div>

Trying to get a nice display of ping results.  
I tried this suggestion from @Steve-Mcl[Build automatic hyperlink in html table - #3 by Steve-Mcl](https://discourse.nodered.org/t/build-automatic-hyperlink-in-html-table/36832/3) but get an error in the 'convert pingResults to array' function.

```auto
[
    {
        "id": "6a22dd6e.c56fc4",
        "type": "inject",
        "z": "3d4dade1618a72c7",
        "name": " ***Setup devices to ping here***",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "20",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "[{\"name\":\"router\",\"host\":\"192.168.1.1\",\"link\":\"http://192.168.1.1/router.html\"},{\"name\":\"tv\",\"host\":\"192.168.1.46\",\"link\":\"http://192.168.1.46/channels.html\"},{\"name\":\"Pi 4 Green\",\"host\":\"192.168.1.23\"},{\"name\":\"bad device\",\"host\":\"192.168.2.99\"}]",
        "payloadType": "json",
        "x": 420,
        "y": 220,
        "wires": [
            [
                "4a46702f.96858"
            ]
        ]
    },
    {
        "id": "3539c581.74c1aa",
        "type": "template",
        "z": "3d4dade1618a72c7",
        "name": "build html table",
        "field": "html",
        "fieldType": "msg",
        "format": "handlebars",
        "syntax": "mustache",
        "template": "\n<table width=\"100%\">\n <tr>\n <th>Name</th>\n <th>Host</th> \n <th>Status</th> \n </tr>\n {{#tableData}}\n <tr class='{{rowclass}}'>\n <td>{{{name}}}</td>\n {{#link}}\n <td><a href=\"{{link}}\" target=\"_blank\">{{host}}</a> </td>\n {{/link}}\n {{^link}}\n <td>{{host}}</td>\n {{/link}} \n <td>{{{stateInfo}}}</i></td> \n </tr>\n {{/tableData}}\n</table>",
        "x": 760,
        "y": 280,
        "wires": [
            [
                "db2a0a6.457cef8",
                "83b23a6b.400778"
            ]
        ]
    },
    {
        "id": "db2a0a6.457cef8",
        "type": "debug",
        "z": "3d4dade1618a72c7",
        "name": "msg_2",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 930,
        "y": 320,
        "wires": []
    },
    {
        "id": "df081fcf.27c53",
        "type": "inject",
        "z": "3d4dade1618a72c7",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "30",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "[{\"name\":\"router\",\"ip\":\"192.168.1.1\"},{\"name\":\"tv\",\"ip\":\"192.168.1.23\"},{\"name\":\"smart speaker\",\"ip\":\"192.168.1.35\"},{\"name\":\"bad device\",\"ip\":\"192.168.1.99\"}]",
        "payloadType": "json",
        "x": 330,
        "y": 280,
        "wires": [
            [
                "823e24a1.87a718"
            ]
        ]
    },
    {
        "id": "823e24a1.87a718",
        "type": "function",
        "z": "3d4dade1618a72c7",
        "name": "convert pingResults to array",
        "func": "let pingResults = flow.get(\"pingResults\") || {}\nlet now = new Date();\n\nlet tableData = [];\nfor (let k in pingResults) {\n let r = pingResults[k];\n r.age = now - r.timestamp\n if(r.age > 18000){\n r.state = \"old\"\n }\n if(r.state == \"ok\"){\n r.rowclass = \"good\";\n r.stateInfo = '<i class=\"fa fa-thumbs-up\" aria-hidden=\"true\"></i> OK'\n } else if(r.state == \"ng\") {\n r.rowclass = \"bad\";\n r.stateInfo = '<i class=\"fa fa-thumbs-down\" aria-hidden=\"true\"></i> NG'\n } else {\n r.rowclass = \"unknown\";\n r.stateInfo = '<i class=\"fa question\" aria-hidden=\"true\"></i> ' + r.state\n }\n tableData.push(r);\n}\n\nmsg.tableData = tableData\n\nreturn msg;",
        "outputs": 1,
        "noerr": 1,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 540,
        "y": 280,
        "wires": [
            [
                "3539c581.74c1aa",
                "793afa09.1583c4"
            ]
        ]
    },
    {
        "id": "4a46702f.96858",
        "type": "ping",
        "z": "3d4dade1618a72c7",
        "mode": "triggered",
        "name": "",
        "host": "",
        "timer": "20",
        "inputs": 1,
        "x": 630,
        "y": 220,
        "wires": [
            [
                "fecfa19a.356ee"
            ]
        ]
    },
    {
        "id": "1b75c1a7.006c3e",
        "type": "debug",
        "z": "3d4dade1618a72c7",
        "name": "msg_1",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 930,
        "y": 220,
        "wires": []
    },
    {
        "id": "fecfa19a.356ee",
        "type": "function",
        "z": "3d4dade1618a72c7",
        "name": "Store Results",
        "func": "let pingResults = flow.get(\"pingResults\") || {}\nlet thisPing = pingResults[msg.topic] || {};\nlet success = msg.payload !== false && msg.payload >= 0;\n\nthisPing.name = msg.ping.name;\nthisPing.host = msg.ping.host;\nthisPing.link = msg.ping.link;\nthisPing.timestamp = new Date();\nthisPing.responseTime = success ? msg.payload : null;\nthisPing.state = success ? \"ok\" : \"ng\" ;\n\npingResults[msg.topic] = thisPing;//store ping obj in pingResults\nflow.set(\"pingResults\",pingResults);//save pingResults in flow context\n\nmsg.payload = thisPing;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 780,
        "y": 220,
        "wires": [
            [
                "1b75c1a7.006c3e"
            ]
        ]
    },
    {
        "id": "83b23a6b.400778",
        "type": "ui_template",
        "z": "3d4dade1618a72c7",
        "group": "9f4f9ffc.07f2a",
        "name": "",
        "order": 3,
        "width": "6",
        "height": "5",
        "format": "<style>\ntable {\n color: #333;\n font-family: Helvetica, Arial, sans-serif;\n width: 100%;\n border-collapse: collapse;\n border-spacing: 0;\n}\ntd, th {\n border: 1px solid transparent;\n /* No more visible border */\n height: 30px;\n transition: all 0.3s;\n /* Simple transition for hover effect */\n}\nth {\n background: #DFDFDF;\n /* Darken header a bit */\n font-weight: bold;\n}\ntd {\n background: #FAFAFA;\n text-align: center;\n}\n\n/* Cells in even rows (2,4,6...) are one color */\n\ntr:nth-child(even) td {\n background: #F1F1F1;\n}\n\n/* Cells in odd rows (1,3,5...) are another (excludes header cells) */\n\ntr:nth-child(odd) td {\n background: #FEFEFE;\n}\ntr td:hover {\n background: #666;\n color: #FFF;\n}\n\n/* Hover cell effect! */ \n\ntr.good {\n color: green;\n}\n\ntr.bad {\n color: red;\n}\n\ntr.unknown {\n color: orange;\n}\n\n \n</style>\n<div ng-bind-html=\"msg.html\"></div>\n",
        "storeOutMessages": true,
        "fwdInMessages": true,
        "resendOnRefresh": false,
        "templateScope": "local",
        "className": "",
        "x": 940,
        "y": 280,
        "wires": [
            []
        ]
    },
    {
        "id": "793afa09.1583c4",
        "type": "debug",
        "z": "3d4dade1618a72c7",
        "name": "msg_3",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 690,
        "y": 360,
        "wires": []
    },
    {
        "id": "9f4f9ffc.07f2a",
        "type": "ui_group",
        "name": "Default",
        "tab": "5132060d.4cde48",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": false
    },
    {
        "id": "5132060d.4cde48",
        "type": "ui_tab",
        "name": "Home",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    }
]

```

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/0/40424f37efc8272dabe1e6322c54ea0878f0db05.png)

Hopeless as I am at javascript, I cannot figure out what the error is.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [7 March 2024 15:55 UTC](https://discourse.nodered.org/t/showing-ping-results/86243/2 "2024-03-07T15:55:56Z")

</div>

Now that is a blast from the past.

the function will work, the error is most likely due to recent _improvements_ in the code editor highlighting things that _should_ be done _better_

here is an updated version of the function that should not show any warnings:

```auto
const pingResults = flow.get('pingResults') || {}
const now = new Date()

const tableData = []
for (const k in pingResults) {
    const r = pingResults[k]
    r.age = now.valueOf() - r.timestamp
    if (r.age > 18000) {
        r.state = 'old'
    }
    if (r.state === 'ok') {
        r.rowclass = 'good'
        r.stateInfo = '<i class="fa fa-thumbs-up" aria-hidden="true"></i> OK'
    } else if (r.state === 'ng') {
        r.rowclass = 'bad'
        r.stateInfo = '<i class="fa fa-thumbs-down" aria-hidden="true"></i> NG'
    } else {
        r.rowclass = 'unknown'
        r.stateInfo = '<i class="fa question" aria-hidden="true"></i> ' + r.state
    }
    tableData.push(r)
}

msg.tableData = tableData

return msg;

```

(untested)

---

<div class="post-metadata">

**Author:** ![Richard238](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/richard238/32/48307_2.png) [@Richard238](https://discourse.nodered.org/u/Richard238)\
**Post date:** [7 March 2024 16:11 UTC](https://discourse.nodered.org/t/showing-ping-results/86243/3 "2024-03-07T16:11:32Z")

</div>

That's a super-fast fix-n-reply, thank you! 🙂

Error has gone, but it's not showing on my dashboard.  
I reckon that's because I've forgotten how to use it, although the nodes are on a tab which is showing on the dashboard.

---

<div class="post-metadata">

**Author:** ![Richard238](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/richard238/32/48307_2.png) [@Richard238](https://discourse.nodered.org/u/Richard238)\
**Post date:** [7 March 2024 16:33 UTC](https://discourse.nodered.org/t/showing-ping-results/86243/4 "2024-03-07T16:33:35Z")

</div>

Found it, it's in "Home", I'll try figure out how to move it to "Dashboard".

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/b/0be2f8028830f35785b10df12458e4272b8e6918.png)

---

<div class="post-metadata">

**Author:** ![Richard238](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/richard238/32/48307_2.png) [@Richard238](https://discourse.nodered.org/u/Richard238)\
**Post date:** [7 March 2024 17:09 UTC](https://discourse.nodered.org/t/showing-ping-results/86243/5 "2024-03-07T17:09:50Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/7/47c2d73b70ffa5b79938cc321e202336547a77e8.png)  
How do I remove .99 (it's not in the ping list), and increase refresh frequency to reduce "old"?

Thank you.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [7 March 2024 17:11 UTC](https://discourse.nodered.org/t/showing-ping-results/86243/6 "2024-03-07T17:11:25Z")

</div>

delete the flow context variable named `pingResults` then run it again.

(look where debug sidebar is, chose the context viewer tab)

---

<div class="post-metadata">

**Author:** ![Richard238](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/richard238/32/48307_2.png) [@Richard238](https://discourse.nodered.org/u/Richard238)\
**Post date:** [9 March 2024 16:56 UTC](https://discourse.nodered.org/t/showing-ping-results/86243/7 "2024-03-09T16:56:10Z")

</div>

Got this working almost brilliantly, one nagging thing is that despite deleting the flow, the old, dummy/test pings till show. They're only there for a few seconds after hitting deploy, but they're still there.

Tried F12 console " localStorage.clear(); "  
Also tried viewing dashboard in completely different browser.

Any ideas as to where it's perhaps caching that data?

Thank you.

_Just tried on my phone - same thing there too....!_

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [9 March 2024 17:14 UTC](https://discourse.nodered.org/t/showing-ping-results/86243/8 "2024-03-09T17:14:12Z")

</div>

Share your flow and I'll take a look.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [9 March 2024 17:16 UTC](https://discourse.nodered.org/t/showing-ping-results/86243/9 "2024-03-09T17:16:23Z")

</div>

> [@Richard238](#):
>
> despite deleting the flow

hold on, did you delete the flow or the flow context variable?

Show me a screenshot of your flow context (expanded) as well as sharing your flow export.

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [9 March 2024 17:22 UTC](https://discourse.nodered.org/t/showing-ping-results/86243/10 "2024-03-09T17:22:41Z")

</div>

Try unchecking `Add output messages to stored state` in ui template node.

---

<div class="post-metadata">

**Author:** ![Richard238](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/richard238/32/48307_2.png) [@Richard238](https://discourse.nodered.org/u/Richard238)\
**Post date:** [10 March 2024 12:23 UTC](https://discourse.nodered.org/t/showing-ping-results/86243/11 "2024-03-10T12:23:00Z")

</div>

Flow context image:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/9/995e0f5df133f10382d47b1961a4c13019c3e3be.png)

---

<div class="post-metadata">

**Author:** ![Richard238](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/richard238/32/48307_2.png) [@Richard238](https://discourse.nodered.org/u/Richard238)\
**Post date:** [11 March 2024 13:14 UTC](https://discourse.nodered.org/t/showing-ping-results/86243/12 "2024-03-11T13:14:36Z")

</div>

Tried that, but no difference.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [11 March 2024 15:36 UTC](https://discourse.nodered.org/t/showing-ping-results/86243/13 "2024-03-11T15:36:05Z")

</div>

> [@Richard238](#):
>
> Got this working almost brilliantly, one nagging thing is that despite deleting the flow, the old, dummy/test pings till show. They're only there for a few seconds after hitting deploy, but they're still there.

👇

> [@Steve-Mcl](#):
>
> Share your flow

👇

> [@Steve-Mcl](#):
>
> > [@Richard238](#):
> >
> > despite deleting the flow
> 
> hold on, did you delete the flow or the flow context variable?

Cant really help if you dont share your flows or answer the questions.

---

<div class="post-metadata">

**Author:** ![Richard238](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/richard238/32/48307_2.png) [@Richard238](https://discourse.nodered.org/u/Richard238)\
**Post date:** [11 March 2024 15:41 UTC](https://discourse.nodered.org/t/showing-ping-results/86243/14 "2024-03-11T15:41:49Z")

</div>

```auto
[
    {
        "id": "6a22dd6e.c56fc4",
        "type": "inject",
        "z": "3c4bf0a06f560726",
        "name": " ***Setup devices to ping here***",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "20",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "[{\"name\":\"Greenhouse\",\"host\":\"192.168.1.41\"},{\"name\":\"TV\",\"host\":\"192.168.1.46\"},{\"name\":\"Pi 4 Green\",\"host\":\"192.168.1.23\"},{\"name\":\"Pi Garage\",\"host\":\"192.168.1.35\"},{\"name\":\"Pi Mote\",\"host\":\"192.168.1.15\"},{\"name\":\"Pi - ISS\",\"host\":\"192.168.1.40\"},{\"name\":\"8x8 Scroller\",\"host\":\"192.168.1.11\"},{\"name\":\"Pi Loft\",\"host\":\"192.168.1.42\"},{\"name\":\"Plane Spotter\",\"host\":\"192.168.1.29\"},{\"name\":\"Magic Mirror\",\"host\":\"192.168.1.21\"},{\"name\":\"Pi Hole\",\"host\":\"192.168.1.14\"},{\"name\":\"Hue\",\"host\":\"192.168.1.33\"},{\"name\":\"Pico O/S Temp\",\"host\":\"192.168.1.17\"},{\"name\":\"Cube\",\"host\":\"192.168.1.36\"},{\"name\":\"Pi 4 Blue\",\"host\":\"192.168.1.18\"},{\"name\":\"Pi 5\",\"host\":\"192.168.1.51\"},{\"name\":\"Pi DB Server\",\"host\":\"192.168.1.23\"},{\"name\":\"Pi Inky\",\"host\":\"192.168.1.26\"},{\"name\":\"Pi 3a/Piano\",\"host\":\"192.168.1.32\"},{\"name\":\"Printer\",\"host\":\"192.168.1.6\"},{\"name\":\"NAS\",\"host\":\"192.168.1.25\"},{\"name\":\"Music Streamer\",\"host\":\"192.168.1.36\"},{\"name\":\"WiFi AP\",\"host\":\"192.168.1.50\"}]",
        "payloadType": "json",
        "x": 240,
        "y": 1800,
        "wires": [
            [
                "4a46702f.96858"
            ]
        ]
    },
    {
        "id": "3539c581.74c1aa",
        "type": "template",
        "z": "3c4bf0a06f560726",
        "name": "build html table",
        "field": "html",
        "fieldType": "msg",
        "format": "handlebars",
        "syntax": "mustache",
        "template": "\n<table width=\"100%\">\n <tr>\n <th>Name</th>\n <th>Host</th> \n <th>Status</th> \n </tr>\n {{#tableData}}\n <tr class='{{rowclass}}'>\n <td>{{{name}}}</td>\n {{#link}}\n <td><a href=\"{{link}}\" target=\"_blank\">{{host}}</a> </td>\n {{/link}}\n {{^link}}\n <td>{{host}}</td>\n {{/link}} \n <td>{{{stateInfo}}}</i></td> \n </tr>\n {{/tableData}}\n</table>",
        "x": 580,
        "y": 1860,
        "wires": [
            [
                "db2a0a6.457cef8",
                "83b23a6b.400778"
            ]
        ]
    },
    {
        "id": "db2a0a6.457cef8",
        "type": "debug",
        "z": "3c4bf0a06f560726",
        "name": "msg_2",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 750,
        "y": 1920,
        "wires": []
    },
    {
        "id": "df081fcf.27c53",
        "type": "inject",
        "z": "3c4bf0a06f560726",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "30",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "[{\"name\":\"router\",\"ip\":\"192.168.1.1\"},{\"name\":\"tv\",\"ip\":\"192.168.1.23\"},{\"name\":\"smart speaker\",\"ip\":\"192.168.1.35\"},{\"name\":\"bad device\",\"ip\":\"192.168.1.99\"}]",
        "payloadType": "json",
        "x": 150,
        "y": 1860,
        "wires": [
            [
                "823e24a1.87a718"
            ]
        ]
    },
    {
        "id": "823e24a1.87a718",
        "type": "function",
        "z": "3c4bf0a06f560726",
        "name": "convert pingResults to array",
        "func": "const pingResults = flow.get('pingResults') || {}\nconst now = new Date()\n\nconst tableData = []\nfor (const k in pingResults) {\n const r = pingResults[k]\n r.age = now.valueOf() - r.timestamp\n if (r.age > 21000) {\n r.state = 'old'\n }\n if (r.state === 'ok') {\n r.rowclass = 'good'\n r.stateInfo = '<i class=\"fa fa-thumbs-up\" aria-hidden=\"true\"></i> OK'\n } else if (r.state === 'ng') {\n r.rowclass = 'bad'\n r.stateInfo = '<i class=\"fa fa-thumbs-down\" aria-hidden=\"true\"></i> NG'\n } else {\n r.rowclass = 'unknown'\n r.stateInfo = '<i class=\"fa question\" aria-hidden=\"true\"></i> ' + r.state\n }\n tableData.push(r)\n}\n\nmsg.tableData = tableData\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 360,
        "y": 1860,
        "wires": [
            [
                "3539c581.74c1aa",
                "793afa09.1583c4"
            ]
        ]
    },
    {
        "id": "4a46702f.96858",
        "type": "ping",
        "z": "3c4bf0a06f560726",
        "mode": "triggered",
        "name": "",
        "host": "",
        "timer": "20",
        "inputs": 1,
        "x": 450,
        "y": 1800,
        "wires": [
            [
                "fecfa19a.356ee"
            ]
        ]
    },
    {
        "id": "1b75c1a7.006c3e",
        "type": "debug",
        "z": "3c4bf0a06f560726",
        "name": "msg_1",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 750,
        "y": 1780,
        "wires": []
    },
    {
        "id": "fecfa19a.356ee",
        "type": "function",
        "z": "3c4bf0a06f560726",
        "name": "Store Results",
        "func": "let pingResults = flow.get(\"pingResults\") || {}\nlet thisPing = pingResults[msg.topic] || {};\nlet success = msg.payload !== false && msg.payload >= 0;\n\nthisPing.name = msg.ping.name;\nthisPing.host = msg.ping.host;\nthisPing.link = msg.ping.link;\nthisPing.timestamp = new Date();\nthisPing.responseTime = success ? msg.payload : null;\nthisPing.state = success ? \"ok\" : \"ng\" ;\n\npingResults[msg.topic] = thisPing;//store ping obj in pingResults\nflow.set(\"pingResults\",pingResults);//save pingResults in flow context\n\nmsg.payload = thisPing;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 600,
        "y": 1800,
        "wires": [
            [
                "1b75c1a7.006c3e"
            ]
        ]
    },
    {
        "id": "83b23a6b.400778",
        "type": "ui_template",
        "z": "3c4bf0a06f560726",
        "group": "8ff6ebdf94641931",
        "name": "",
        "order": 3,
        "width": "6",
        "height": "20",
        "format": "<style>\ntable {\n color: #333;\n font-family: Helvetica, Arial, sans-serif;\n width: 100%;\n border-collapse: collapse;\n border-spacing: 0;\n}\ntd, th {\n border: 1px solid transparent;\n /* No more visible border */\n height: 30px;\n transition: all 0.3s;\n /* Simple transition for hover effect */\n}\nth {\n background: #DFDFDF;\n /* Darken header a bit */\n font-weight: bold;\n}\ntd {\n background: #FAFAFA;\n text-align: center;\n}\n\n/* Cells in even rows (2,4,6...) are one color */\n\ntr:nth-child(even) td {\n background: #F1F1F1;\n}\n\n/* Cells in odd rows (1,3,5...) are another (excludes header cells) */\n\ntr:nth-child(odd) td {\n background: #FEFEFE;\n}\ntr td:hover {\n background: #666;\n color: #FFF;\n}\n\n/* Hover cell effect! */ \n\ntr.good {\n color: green;\n}\n\ntr.bad {\n color: red;\n}\n\ntr.unknown {\n color: orange;\n}\n\n \n</style>\n<div ng-bind-html=\"msg.html\"></div>\n",
        "storeOutMessages": true,
        "fwdInMessages": true,
        "resendOnRefresh": false,
        "templateScope": "local",
        "className": "",
        "x": 760,
        "y": 1860,
        "wires": [
            []
        ]
    },
    {
        "id": "793afa09.1583c4",
        "type": "debug",
        "z": "3c4bf0a06f560726",
        "name": "msg_3",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 750,
        "y": 1980,
        "wires": []
    },
    {
        "id": "8ff6ebdf94641931",
        "type": "ui_group",
        "name": "Pinging",
        "tab": "717f2583d4cd909d",
        "order": 6,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "717f2583d4cd909d",
        "type": "ui_tab",
        "name": "Dashboard ",
        "icon": "dashboard",
        "order": 1,
        "disabled": false,
        "hidden": false
    }
]

```

---

<div class="post-metadata">

**Author:** ![Richard238](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/richard238/32/48307_2.png) [@Richard238](https://discourse.nodered.org/u/Richard238)\
**Post date:** [11 March 2024 15:43 UTC](https://discourse.nodered.org/t/showing-ping-results/86243/15 "2024-03-11T15:43:11Z")

</div>

I deleted this  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/3/433e70efb86b4f2ee2671a5894401b7aaa707378.png)

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [11 March 2024 17:34 UTC](https://discourse.nodered.org/t/showing-ping-results/86243/16 "2024-03-11T17:34:30Z")

</div>

Not sure but about timing with two injects. Would it not be better to do it all with one inject and split and auto join.  
example with no function nodes and joining ping results.

You can add links and any other properties to the input inject

```auto
[{"id":"ce7b4fcf0cdafcc2","type":"inject","z":"d1395164b4eec73e","name":" ***Setup devices to ping here***","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[{\"name\":\"Greenhouse\",\"host\":\"192.168.1.41\",\"link\":\"http://google.com\"},{\"name\":\"TV\",\"host\":\"192.168.1.46\",\"link\":false},{\"name\":\"Pi 4 Green\",\"host\":\"192.168.1.23\",\"link\":false},{\"name\":\"Pi Garage\",\"host\":\"192.168.1.35\",\"link\":false},{\"name\":\"Pi Mote\",\"host\":\"192.168.1.15\",\"link\":false},{\"name\":\"Pi - ISS\",\"host\":\"192.168.1.40\",\"link\":false},{\"name\":\"8x8 Scroller\",\"host\":\"192.168.1.11\",\"link\":false},{\"name\":\"Pi Loft\",\"host\":\"192.168.1.42\",\"link\":false},{\"name\":\"Plane Spotter\",\"host\":\"192.168.1.29\",\"link\":false},{\"name\":\"Magic Mirror\",\"host\":\"192.168.1.21\"},{\"name\":\"Pi Hole\",\"host\":\"192.168.1.14\",\"link\":false},{\"name\":\"Hue\",\"host\":\"192.168.1.33\",\"link\":false},{\"name\":\"Pico O/S Temp\",\"host\":\"192.168.1.17\",\"link\":false},{\"name\":\"Cube\",\"host\":\"192.168.1.36\",\"link\":false},{\"name\":\"Pi 4 Blue\",\"host\":\"192.168.1.18\",\"link\":false},{\"name\":\"Pi 5\",\"host\":\"192.168.1.51\",\"link\":false},{\"name\":\"Pi DB Server\",\"host\":\"192.168.1.23\",\"link\":false},{\"name\":\"Pi Inky\",\"host\":\"192.168.1.26\",\"link\":false},{\"name\":\"Pi 3a/Piano\",\"host\":\"192.168.1.32\",\"link\":false},{\"name\":\"Printer\",\"host\":\"192.168.1.6\",\"link\":false},{\"name\":\"NAS\",\"host\":\"192.168.1.25\",\"link\":false},{\"name\":\"Music Streamer\",\"host\":\"192.168.1.36\",\"link\":false},{\"name\":\"WiFi AP\",\"host\":\"192.168.1.50\",\"link\":false}]","payloadType":"json","x":370,"y":7540,"wires":[["1ccc69be794889a3"]]},{"id":"1ccc69be794889a3","type":"split","z":"d1395164b4eec73e","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":610,"y":7540,"wires":[["9aa68795d91a320e"]]},{"id":"9aa68795d91a320e","type":"change","z":"d1395164b4eec73e","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"payload[0]","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":810,"y":7540,"wires":[["4a46702f.96858"]]},{"id":"4a46702f.96858","type":"ping","z":"d1395164b4eec73e","mode":"triggered","name":"","host":"","timer":"20","inputs":1,"x":310,"y":7600,"wires":[["5878a4fa2f1a22c9"]]},{"id":"5878a4fa2f1a22c9","type":"change","z":"d1395164b4eec73e","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"temp","tot":"msg"},{"t":"set","p":"payload","pt":"msg","to":"ping","tot":"msg"},{"t":"set","p":"payload.timestamp","pt":"msg","to":"$now()","tot":"jsonata"},{"t":"move","p":"temp","pt":"msg","to":"payload.responseTime","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":7600,"wires":[["bb78407a3825e84a"]]},{"id":"bb78407a3825e84a","type":"join","z":"d1395164b4eec73e","name":"","mode":"auto","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":"false","timeout":"","count":"","reduceRight":false,"x":390,"y":7660,"wires":[["238261fadd4b5b9b","1b75c1a7.006c3e"]]},{"id":"238261fadd4b5b9b","type":"change","z":"d1395164b4eec73e","name":"save pingResponse and create tableData","rules":[{"t":"set","p":"pingResults","pt":"flow","to":"payload","tot":"msg","dc":true},{"t":"set","p":"tableData","pt":"msg","to":"$$.payload","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":7660,"wires":[["3539c581.74c1aa"]]},{"id":"1b75c1a7.006c3e","type":"debug","z":"d1395164b4eec73e","name":"msg_1","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":730,"y":7620,"wires":[]},{"id":"3539c581.74c1aa","type":"template","z":"d1395164b4eec73e","name":"build html table","field":"html","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"\n<table width=\"100%\">\n <tr>\n <th>Name</th>\n <th>Host</th> \n <th>Status</th> \n </tr>\n {{#tableData}}\n <tr class='{{#responseTime}}good{{/responseTime}}{{^responseTime}}bad{{/responseTime}}'>\n <td>\n {{{name}}}\n </td>\n <td>\n {{#link}}<a href=\"{{link}}\" target=\"_blank\">{{host}}</a>{{/link}}{{^link}}{{host}}{{/link}}\n </td> \n <td>\n {{#responseTime}}<i class=\"fa fa-thumbs-up\" aria-hidden=\"true\"></i> OK</i>{{/responseTime}}{{^responseTime}}<i class=\"fa fa-thumbs-down\" aria-hidden=\"true\"></i> NG</i>{{/responseTime}}\n </td> \n </tr>\n {{/tableData}}\n</table>","x":600,"y":7720,"wires":[["db2a0a6.457cef8","83b23a6b.400778"]]},{"id":"e86fc4d62c2b1d72","type":"inject","z":"d1395164b4eec73e","name":"reload at startup","props":[{"p":"tableData","v":"pingResults","vt":"flow"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","x":350,"y":7720,"wires":[["3539c581.74c1aa"]]},{"id":"db2a0a6.457cef8","type":"debug","z":"d1395164b4eec73e","name":"msg_2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":750,"y":7760,"wires":[]},{"id":"83b23a6b.400778","type":"ui_template","z":"d1395164b4eec73e","group":"8ff6ebdf94641931","name":"","order":3,"width":"6","height":"20","format":"<style>\ntable {\n color: #333;\n font-family: Helvetica, Arial, sans-serif;\n width: 100%;\n border-collapse: collapse;\n border-spacing: 0;\n}\ntd, th {\n border: 1px solid transparent;\n /* No more visible border */\n height: 30px;\n transition: all 0.3s;\n /* Simple transition for hover effect */\n}\nth {\n background: #DFDFDF;\n /* Darken header a bit */\n font-weight: bold;\n}\ntd {\n background: #FAFAFA;\n text-align: center;\n}\n\n/* Cells in even rows (2,4,6...) are one color */\n\ntr:nth-child(even) td {\n background: #F1F1F1;\n}\n\n/* Cells in odd rows (1,3,5...) are another (excludes header cells) */\n\ntr:nth-child(odd) td {\n background: #FEFEFE;\n}\ntr td:hover {\n background: #666;\n color: #FFF;\n}\n\n/* Hover cell effect! */ \n\ntr.good {\n color: green;\n}\n\ntr.bad {\n color: red;\n}\n\ntr.unknown {\n color: orange;\n}\n\n \n</style>\n<div ng-bind-html=\"msg.html\"></div>\n","storeOutMessages":false,"fwdInMessages":false,"resendOnRefresh":true,"templateScope":"local","className":"","x":860,"y":7720,"wires":[[]]},{"id":"8ff6ebdf94641931","type":"ui_group","name":"Pinging","tab":"717f2583d4cd909d","order":6,"disp":true,"width":"6","collapse":false,"className":""},{"id":"717f2583d4cd909d","type":"ui_tab","name":"Dashboard ","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![Richard238](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/richard238/32/48307_2.png) [@Richard238](https://discourse.nodered.org/u/Richard238)\
**Post date:** [17 March 2024 16:57 UTC](https://discourse.nodered.org/t/showing-ping-results/86243/17 "2024-03-17T16:57:21Z")

</div>

Where am I now?  
Well, the list became too long so I have split it into Pi and non Pi devices.  
I also found that the default/dummy IPs and the 30 second delay are in the second inject, so changed this to just ping my router and wait for only 3 seconds.

It's working well, and I am certainly interested in trying the suggestion from @E1cid , which I will do when I get a moment.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/0/c0c2e22ad5b9827fef73a85c6a7c9c2c64b4adec.png)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [16 April 2024 16:58 UTC](https://discourse.nodered.org/t/showing-ping-results/86243/18 "2024-04-16T16:58:07Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
