I have a very odd situation here. I have been fiddling with this bit of a flow.
Ignore the Change node, it just happens to be in the screenshot. As you see there is a Join node, which produces key value pairs in msg.payload. Previously I had the debug connected directly to the Join node. I added the function node and moved the debug node to the output of the function node, which contains
// get all the properties in the payload
let max = -100
for (let property in msg.payload) {
max = Math.max(max, Number(msg.payload[property]))
}
msg.payload = max
return msg;
In the debug pane I now see
The -100 values are correct, but there are interspersed occasional payloads that look to have come straight from the Join node.
In fact I have just added a line to the function node
msg.topic = "Set in function node"
and from the debug window I can see that the extra messages do not have that topic, which means that the messages must be coming direct from the Join node.
I have only been doing partial deploys, but have now tried a full Deploy in the full expectation the problem will disappear, but it didn't.
I have also now added a second debug and it is only showing the good messages.
I am now at a complete loss to understand what is going on. I have cleared the browser cache.
This is the flow of those nodes:
[{"id":"dbdcfa4e.84f408","type":"join","z":"526bdf59.6829a","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"1","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":330.5,"y":632,"wires":[["7433395b.ae8f98"]]},{"id":"7433395b.ae8f98","type":"function","z":"526bdf59.6829a","name":"Max","func":"// get all the properties in the payload\nlet max = -100\nfor (let property in msg.payload) {\n max = Math.max(max, Number(msg.payload[property]))\n}\nmsg.payload = max\nmsg.topic = \"Set in function node\"\nreturn msg;","outputs":1,"noerr":0,"x":479,"y":712,"wires":[["9c391fdd.68ab78","92252c5d.2cef9"]]},{"id":"9c391fdd.68ab78","type":"debug","z":"526bdf59.6829a","name":"","active":true,"tosidebar":true,"console":false,"complete":"payload","x":416,"y":823,"wires":[]},{"id":"92252c5d.2cef9","type":"debug","z":"526bdf59.6829a","name":"Second debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":705,"y":735,"wires":[]}]
[Edit]
Just tried a node-red restart and it is still doing it.
This is on a Pi running Jessie
1 Oct 12:04:13 - [info] Node.js version: v10.16.3
1 Oct 12:04:13 - [info] Linux 4.4.21+ arm LE
1 Oct 12:04:17 - [info] Loading palette nodes
1 Oct 12:04:33 - [info] Dashboard version 2.16.3 started at /ui
1 Oct 12:04:34 - [warn] ------------------------------------------------------
1 Oct 12:04:34 - [warn] [node-red-node-pi-sense-hat/sensehat] Error: Can't find Sense HAT python libraries. Run sudo apt-get install sense-hat
1 Oct 12:04:34 - [warn] ------------------------------------------------------
1 Oct 12:04:34 - [info] Settings file : /home/me/.node-red/settings.js
1 Oct 12:04:34 - [info] HTTP Static : /home/me/.node-red/static
1 Oct 12:04:34 - [info] Context store : 'default' [module=memory]
1 Oct 12:04:34 - [info] User directory : /home/me/.node-red
1 Oct 12:04:34 - [warn] Projects disabled : set editorTheme.projects.enabled=true to enable
1 Oct 12:04:34 - [info] Flows file : /home/me/.node-red/flows_pi-ade.json
1 Oct 12:04:34 - [info] Server now running at http://127.0.0.1:1880/
1 Oct 12:04:34 - [warn]
---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------
1 Oct 12:04:35 - [info] Starting flows
1 Oct 12:04:38 - [info] Started flows