In the thread Ras Pi voltage - new node.
I wrote a little flow to play with it and show you what it can do.
For me, I don't mind data, but I don't like getting the same data over and over.
So I want to differentiate it to only show changes.
I've played with the RBE
node, but not had desirable results.
Anyway, here is the flow. I uploaded it to the library I hope.
But here it is just to show you all the functions it (the new node) can do.
This is a new tab/flow.
[{"id":"1e209ff7.121d78","type":"tab","label":"Flow 3","disabled":false,"info":""},{"id":"b10f3fb4.3f023","type":"vcgencmd","z":"1e209ff7.121d78","name":"Other stuff","command":"get_throttled","codec":"H264","clock":"core","voltage":"core","memory":"arm","videoOutput":"0","separateMsg":false,"x":240,"y":300,"wires":[["3207c5ea.9fea4a"]]},{"id":"78c209ca.24c3e","type":"split","z":"1e209ff7.121d78","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":510,"y":300,"wires":[["ff1eb464.4163c8"]]},{"id":"ff1eb464.4163c8","type":"change","z":"1e209ff7.121d78","name":"set","rules":[{"t":"set","p":"state","pt":"msg","to":"payload","tot":"msg"},{"t":"move","p":"parts.key","pt":"msg","to":"topic","tot":"msg"},{"t":"delete","p":"delay","pt":"msg"},{"t":"delete","p":"_event","pt":"msg"},{"t":"delete","p":"parts","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":630,"y":300,"wires":[["a315ae34.ed839"]]},{"id":"a315ae34.ed839","type":"switch","z":"1e209ff7.121d78","name":"","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":220,"y":360,"wires":[["4ffaa1e8.b8424"],["4ffaa1e8.b8424"]]},{"id":"94384e10.fd5bf8","type":"inject","z":"1e209ff7.121d78","name":"Pulse","topic":"","payload":"","payloadType":"date","repeat":"20","crontab":"","once":false,"onceDelay":0.1,"x":80,"y":300,"wires":[["b10f3fb4.3f023"]]},{"id":"4ffaa1e8.b8424","type":"function","z":"1e209ff7.121d78","name":"TimeStamp","func":"var time = new Date().toLocaleString();\nvar WIFI_DEVICE = msg.payload.WIFI_DEVICE;\nvar IP_ = msg.payload.IP_Address;\nmsg.WIFI_DEVICE = WIFI_DEVICE;\nmsg.IP_Address = IP_;\nmsg.time = time;\nreturn msg;","outputs":1,"noerr":0,"x":390,"y":360,"wires":[["2861501f.baa698"]]},{"id":"2861501f.baa698","type":"string","z":"1e209ff7.121d78","name":"- to /","methods":[{"name":"replaceAll","params":[{"type":"str","value":"-"},{"type":"str","value":"/"}]}],"prop":"time","propout":"time","object":"msg","objectout":"msg","x":560,"y":360,"wires":[["d2a06ed3.739f28"]]},{"id":"d2a06ed3.739f28","type":"function","z":"1e209ff7.121d78","name":"Make message","func":"if (msg.topic == \"NEWDAY\")\n{\n return msg;\n}\nif (msg.topic == \"TIMESTAMP\")\n{\n return msg;\n}\n\nmsg.payload = msg.time + \" \" + msg.topic + \" > \" + msg.payload + \" <\";\nreturn msg;","outputs":1,"noerr":0,"x":720,"y":360,"wires":[["8c24f008.34d208"]]},{"id":"8c24f008.34d208","type":"debug","z":"1e209ff7.121d78","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":900,"y":360,"wires":[]},{"id":"3207c5ea.9fea4a","type":"function","z":"1e209ff7.121d78","name":"RBE","func":"var newval = msg.state;\nvar last = context.get(\"last\");\nif (msg.topic == \"CONTROL\")\n{\n //\n // Set how node works.\n //\n context.set(\"PASS\",msg.payload);\n node.status({fill:\"yellow\",shape:\"dot\",text:\"Changed\"});\n return;\n}\nvar pass = context.get(\"PASS\") || 0;\nif (pass === 0)\n{\n if (newval != last)\n {\n context.set(\"last\", newval);\n node.status({fill:\"green\",shape:\"dot\",text:\"Passed\"});\n return msg;\n }\n node.status({fill:\"red\",shape:\"dot\",text:\"Blocked\"});\n return;\n}\nelse\n{\n node.status({fill:\"green\",shape:\"dot\",text:\"All\"});\n return msg;\n}\n","outputs":1,"noerr":0,"x":380,"y":300,"wires":[["78c209ca.24c3e"]]},{"id":"3df94b24.f0687c","type":"inject","z":"1e209ff7.121d78","name":"ALL","topic":"CONTROL","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":200,"wires":[["3207c5ea.9fea4a"]]},{"id":"26191e32.7d5122","type":"inject","z":"1e209ff7.121d78","name":"Change only","topic":"CONTROL","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":270,"y":160,"wires":[["3207c5ea.9fea4a"]]}]
The source node pulse
provides a . . . . clock to run the flow. Though you can use what ever you want.
The next two inject
nodes select how the rest of the flow works.
1 - ALL
This sends all messages through.
2 - CHANGE ONLY
This only passes a message if there is a change from the previous one.
the output is for now a debug
node.
I would inject that into a list
of some sorts. Up to you.
This simply shows you the output of the node and gives you a list of sorts.
Enjoy.