Hi,
I have 3 or 4 nodes which generates different msg.payload at different times. I need to join all the payloads into one single payload, only when the last node has completed its job. Got confused....
Is the "last" one always the same one ? If so use a join node and let that node also set msg.complete to trigger the group to be complete. If not - how do you know what is last ? - once you know that you can do same.
That's my problem. I cannot know exactly which is the last. They are 3 or 4 queries to servers and they always respond with different times...
Can you knock up a demo flow (using injects to simulate the data) and explain how you expect them to be joined, i'll have a look.
something like...
Use the "copy value" button (that appears under your mouse cursor when you hover over the debug message) to capture the server data and paste it into the payload of the injects so that it simulates your situation.
If there is no logical way to solve your problem then there is no way in s/w either.
That's easier than that. They are text messages that I need to join and send to an Alexa speech node.
Messages can be:
1:
Alarm state: Activated
Zone 1: OFF
Zone2: ON
Zone 3: OFF
2:
Sprinkler system ENABLED (or DIABLED)
3:
Air Condition ON
4:
Kitchen Window: Open
Living Window: Closed
..
...
But I need to have a singles (long) speech message with the full status
Then provide the demo flow (complete with demo sample messages as i described) and what you expect the output to be & I will attempt to provide an answer (if it is possible)
You can specify the msg.parts for each message
{"id":"mes1","count":4,"type":"object","key":"alarm"}
The id and count will give you a object length and group the messages, you can then reconstruct automatic or using the reduced sequence in the join node. ( reduced sequence - the only issue i see with this is repeat messages with same id and key are counted).
[{"id":"2fedd031.63e358","type":"inject","z":"5a245aa1.510164","name":"","props":[{"p":"payload"},{"p":"parts","v":"{\"id\":\"mes1\",\"count\":4,\"type\":\"object\",\"key\":\"alarm\"}","vt":"json"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"alarm","payloadType":"str","x":160,"y":2800,"wires":[["e6419572.6fa578"]]},{"id":"e6419572.6fa578","type":"join","z":"5a245aa1.510164","name":"join","mode":"auto","build":"array","property":"payload","propertyType":"msg","key":"parts.key","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"4","reduceRight":false,"reduceExp":"(\t$merge([parts, {\"count\": $I + parts.count}]);\t$merge([$A,{parts.key: payload}]) \t)","reduceInit":"{}","reduceInitType":"json","reduceFixup":"","x":400,"y":2900,"wires":[["6bb469c0.836dc"]]},{"id":"a00f481.1c890b8","type":"inject","z":"5a245aa1.510164","name":"","props":[{"p":"payload"},{"p":"parts","v":"{\"id\":\"mes1\",\"count\":4,\"type\":\"object\",\"key\":\"sprinkler\"}","vt":"json"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"enabled","payloadType":"str","x":160,"y":2840,"wires":[["e6419572.6fa578"]]},{"id":"6733626c.c7463c","type":"inject","z":"5a245aa1.510164","name":"","props":[{"p":"payload"},{"p":"parts","v":"{ \"id\": \"mes1\", \"count\": 4, \"type\": \"object\", \"key\": \"air\" }","vt":"json"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"on","payloadType":"str","x":150,"y":2880,"wires":[["e6419572.6fa578"]]},{"id":"17a963d0.05ee4c","type":"inject","z":"5a245aa1.510164","name":"","props":[{"p":"payload"},{"p":"parts","v":"{ \"id\": \"mes1\", \"count\": 4, \"type\": \"object\", \"key\": \"windows\" }","vt":"json"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"kitchen open","payloadType":"str","x":180,"y":2920,"wires":[["e6419572.6fa578"]]},{"id":"6bb469c0.836dc","type":"debug","z":"5a245aa1.510164","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":700,"y":2940,"wires":[]},{"id":"5fb9a37.ab249dc","type":"inject","z":"5a245aa1.510164","name":"","props":[{"p":"payload"},{"p":"parts","v":"{\"id\":\"mes3\",\"count\":3,\"type\":\"object\",\"key\":\"sprinkler\"}","vt":"json"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"disabled","payloadType":"str","x":430,"y":3040,"wires":[["e6419572.6fa578"]]},{"id":"e085142b.4296","type":"inject","z":"5a245aa1.510164","name":"","props":[{"p":"payload"},{"p":"parts","v":"{ \"id\": \"mes3\", \"count\": 3, \"type\": \"object\", \"key\": \"air\" }","vt":"json"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"on","payloadType":"str","x":420,"y":3080,"wires":[["e6419572.6fa578"]]},{"id":"b68a8ade.60ddb8","type":"inject","z":"5a245aa1.510164","name":"","props":[{"p":"payload"},{"p":"parts","v":"{\"id\":\"mes3\",\"count\":3,\"type\":\"object\",\"key\":\"alarm\"}","vt":"json"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"alarm bedroom","payloadType":"str","x":470,"y":3000,"wires":[["e6419572.6fa578"]]},{"id":"cca2980c.8f3a28","type":"inject","z":"5a245aa1.510164","name":"","props":[{"p":"payload"},{"p":"parts","v":"{\"id\":\"mes2\", \"index\":0, \"count\":3,\"type\":\"object\",\"key\":\"alarm\"}","vt":"json"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"alarm kitchen","payloadType":"str","x":200,"y":3120,"wires":[["e6419572.6fa578"]]},{"id":"2c7d4940.fafa3e","type":"inject","z":"5a245aa1.510164","name":"","props":[{"p":"payload"},{"p":"parts","v":"{\"id\":\"mes2\",\"index\":1,\"count\":3,\"type\":\"object\",\"key\":\"sprinkler\"}","vt":"json"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"enabled","payloadType":"str","x":170,"y":3160,"wires":[["e6419572.6fa578"]]},{"id":"69458bef.1053e4","type":"inject","z":"5a245aa1.510164","name":"","props":[{"p":"payload"},{"p":"parts","v":"{ \"id\": \"mes2\", \"index\": 2, \"count\": 3, \"type\": \"object\", \"key\": \"air\" }","vt":"json"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"off","payloadType":"str","x":160,"y":3200,"wires":[["e6419572.6fa578"]]}]
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.