Advice needed on Pi CPU usage

Sure. But within the context of node-red, Node-red-node-ping :slight_smile:

Just because you can, doesn't always mean you should :rofl:

Hey Steve...

Strangely, this is what I am using.... As to why Balena is involved, I have no idea.... Any hints?

Is this a "native" node red node? ... I take it that its not, as it says "contrib" in the naming... Is there a NR "internal" node of similarity?

Ed

I have no idea.

Contrib

Kinda, the "inject node", but cron-plus much more flexible & has many more features and is 100% programmable / flexible. I suggested it as you had 3 different "scheduling nodes to achieve your requirements" - cron-plus can do most of what they all do.

Indeed it can... It is EXTREMELY powerful.... but as the superheroes say, with great power comes great... Knowledge to set it up and use it correctly... I will give it a go again, but I ran around in little square circles last time trying to wrap my head around how to use it properly... Was a little "beyond me" at the time... hence the 3x "easier to set up" nodes I used for different tasks....

E

Edit: AdHD....Highway to...Oh look, a squirrel... I must focus on trying to find a way to do a simple online check(To replace the troublesome "isonline" node), ping a unit, if it doesn't come back within a user-definable time(different for the units involved as close units respond quickly on the wifi, some of the others can take up to 500ms as they are relayed through multiple AP/repeaters), raise an alert and then send via Telegram if it is too far out of spec.... Possibly a subflow as there are quite a few to keep an eye on...Any hints?

there are lots of built in helpers (like the cron examples in the dropdown, a cron builder, map picker for solar events location etc etc) and built in demos (CTRL+I)

the built in help is also quite extensive.

and you can always as "how do I" in the forum :slight_smile:

Oops, you were replying as I was editing the previous post... I must really avoid hitting "send" before I am finished ....

This will get you started: Ping Network Devices From a List - #12 by Steve-Mcl

you could break it up so that 5sec after issuing ping, check the results in context & send a telegram accordingly.

Thank you!!

Hi Steve,

Query:

In the example (Which is Sterling if I might add), is there any way to set a global timeout value in the inject payload as opposed to setting each timeout individually?

Regds
Ed

Edit: Spotted the timeout value, found a workaround using it ... then discovered something interesting.... The lowest it can be set to is 1000ms....

not entirely certain what yo mean here. If you mean can an inject be set less than 1s then yes, it can...
image

Thanks for coming back to me Steve,

But no, the timeout as in:

Timeout = msg.timeout;
msg.payload = [
    {
        "name": "USFridge",
        "host": "192.168.0.139",
        "timeout": Timeout
    },
    {
        "name": "Fridge",
        "host": "192.168.0.145",
        "timeout": Timeout
    },
    {
        "name": "FFridge",
        "host": "192.168.0.146",
        "timeout": Timeout
    },
    {
        "name": "DFreeze",
        "host": "192.168.0.155",
        "timeout": Timeout
    },
    {
        "name": "EGEle",
        "host": "192.168.0.156",
        "timeout": Timeout
    },
    {
        "name": "EGMain",
        "host": "192.168.0.161",
        "timeout": Timeout
    }
]
return msg;

I presume that this timeout value denotes the fail boundary... It cannot be set to less than 1000ms though...

Regds
Ed

Actually, I think this is a shortcoming of the flow inspector that it can only guess what node module a node belongs to where there are nodes of the same name from different modules. That's why I keep a small flow around that actually analyses both my flow file and my package.json:

[{"id":"51fb56d2.8ca248","type":"inject","z":"d0860be6.7951b8","g":"68054db5.4e78b4","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":"","topic":"","payload":"","payloadType":"date","x":95,"y":1140,"wires":[["1dd9f4ac.8347eb","b0df5fa0.7698b"]],"l":false},{"id":"2d29205.cb6abe","type":"comment","z":"d0860be6.7951b8","g":"68054db5.4e78b4","name":"How Many Nodes in my flow?","info":"Don't forget to change the path to your flow file.\n\nNote the oddity regarding subflows. \nThey appear firstly as type \"subflow\" which is the\ndefinition, then again in the form\n\"subflow:<id>\" once for each instance of that\nsubflow `<id>` in your flows.\n\nI show both a JSONata and a function node\napproach to getting the data but note that\nthe JSONata version _is not quite correct_.\nIn the sense that it doesn't subtract the tabs\nand subflows from the overal counts.\n\nSo while the execution time of both approaches\nseems to be pretty identical, the function node\nis more comprehensive.","x":200,"y":1100,"wires":[]},{"id":"1dd9f4ac.8347eb","type":"file in","z":"d0860be6.7951b8","g":"68054db5.4e78b4","name":"","filename":"./data/nrmain_flows.json","format":"utf8","chunk":false,"sendError":false,"x":270,"y":1140,"wires":[["7db3c4dc.803e6c"]]},{"id":"b0df5fa0.7698b","type":"file in","z":"d0860be6.7951b8","g":"68054db5.4e78b4","name":"","filename":"./data/package.json","format":"utf8","chunk":false,"sendError":false,"x":250,"y":1260,"wires":[["b4c067a0.285bd8"]]},{"id":"b4c067a0.285bd8","type":"json","z":"d0860be6.7951b8","g":"68054db5.4e78b4","name":"","property":"payload","action":"","pretty":false,"x":435,"y":1260,"wires":[["dff7c57.77c4138"]],"l":false},{"id":"7db3c4dc.803e6c","type":"json","z":"d0860be6.7951b8","g":"68054db5.4e78b4","name":"","property":"payload","action":"","pretty":false,"x":435,"y":1140,"wires":[["3aeb5629.c2b33a","9c8f63ea.e8083"]],"l":false},{"id":"3aeb5629.c2b33a","type":"change","z":"d0860be6.7951b8","g":"68054db5.4e78b4","name":"","rules":[{"t":"set","p":"totalNodes","pt":"msg","to":"$count(payload)\t","tot":"jsonata"},{"t":"set","p":"payload","pt":"msg","to":"payload^(type) {\t   `type`: $count([$])\t}","tot":"jsonata"},{"t":"set","p":"nodeTypesCount","pt":"msg","to":"$count($keys(payload))","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":515,"y":1140,"wires":[["5de6fbf7.a75344"]],"l":false},{"id":"9c8f63ea.e8083","type":"function","z":"d0860be6.7951b8","g":"68054db5.4e78b4","name":"","func":"msg.totalNodes = msg.payload.length\n\nlet tabsCount = 0, subflowsCount = 0, nodeTypesCount = 0\nlet totalNodes = 0\nlet tabs = {}, subflows = {}, nodeTypes = {}\n\nmsg.payload.sort(function(a, b) {\n  var typeA = a.type.toUpperCase(); // ignore upper and lowercase\n  var typeB = b.type.toUpperCase(); // ignore upper and lowercase\n  if (typeA < typeB) {\n    return -1;\n  }\n  if (typeA > typeB) {\n    return 1;\n  }\n\n  // names must be equal\n  return 0;\n})\n\nmsg.payload.forEach((el) => {\n    if ( el.type === 'tab' ) {\n        tabsCount++\n        tabs[el.label] = el.id\n    } else if ( el.type === 'subflow' ) {\n        subflowsCount++\n        subflows[el.name] = el.id\n    } else {\n        nodeTypes[el.type] = nodeTypes[el.type]+1 || 1\n        totalNodes++\n    }\n})\n\nmsg.payload = {\n    'totalNodesCount': totalNodes,\n    'tabsCount': tabsCount,\n    'subflowsCount': subflowsCount,\n    'nodeTypesCount': Object.keys(nodeTypes).length,\n    'tabs': tabs,\n    'subflows': subflows,\n    'nodeTypes': nodeTypes,\n}\n\nreturn msg","outputs":1,"noerr":0,"x":515,"y":1200,"wires":[["97a2dead.fea94"]],"l":false},{"id":"5de6fbf7.a75344","type":"debug","z":"d0860be6.7951b8","g":"68054db5.4e78b4","name":"All Nodes (incl. Config.)","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"\"Nodes: \" & totalNodes & \", Types: \" & nodeTypesCount","statusType":"jsonata","x":690,"y":1140,"wires":[]},{"id":"97a2dead.fea94","type":"debug","z":"d0860be6.7951b8","g":"68054db5.4e78b4","name":"Nodes, Tabs, Subflows","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"\"N: \" & payload.totalNodesCount & \", Tabs: \" & payload.tabsCount & \", Subflows: \" & payload.subflowsCount","statusType":"jsonata","x":680,"y":1200,"wires":[]},{"id":"dff7c57.77c4138","type":"debug","z":"d0860be6.7951b8","g":"68054db5.4e78b4","name":"Package Dependencies","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload.dependencies","targetType":"msg","statusVal":"\"#: \" & $count($keys(payload.dependencies))","statusType":"jsonata","x":690,"y":1260,"wires":[]}]

It tells me all of the node packages I've got installed and analyses all of the nodes.


image

2 Likes

Ooooh.... Flashy light toy things... I like it!

Thanx!!

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