Hi @dceejay,
Thanks for your answer.
Here is my test flow:
[{"id":"465bf6d5.382638","type":"join","z":"295d70f2.01c4b","name":"join to key/value obj on 2 msgs","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":570,"y":600,"wires":[["16b0329b.f87d25"]]},{"id":"16b0329b.f87d25","type":"debug","z":"295d70f2.01c4b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":770,"y":600,"wires":[]},{"id":"eb31ed8c.becb88","type":"inject","z":"295d70f2.01c4b","name":"","topic":"topic1","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":480,"wires":[["465bf6d5.382638"]]},{"id":"5711a091.217af8","type":"join","z":"295d70f2.01c4b","name":"join to merged obj on 2 msgs","mode":"custom","build":"merged","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":740,"y":660,"wires":[["5a4d49cb.07e19"]]},{"id":"5a4d49cb.07e19","type":"debug","z":"295d70f2.01c4b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":950,"y":660,"wires":[]},{"id":"96f344a4.ddd35","type":"inject","z":"295d70f2.01c4b","name":"","topic":"topic1","payload":"2","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":520,"wires":[["465bf6d5.382638"]]},{"id":"4f3f57d5.96d96","type":"inject","z":"295d70f2.01c4b","name":"","topic":"topic1","payload":"3","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":560,"wires":[["31f6a669.031942"]]},{"id":"e42b4639.237c18","type":"inject","z":"295d70f2.01c4b","name":"","topic":"topic2","payload":"4","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":600,"wires":[["465bf6d5.382638"]]},{"id":"640cb8fe.5f5608","type":"inject","z":"295d70f2.01c4b","name":"","topic":"topic1","payload":"{\"first_content\" : 1}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":660,"wires":[["5711a091.217af8"]]},{"id":"31f6a669.031942","type":"change","z":"295d70f2.01c4b","name":"","rules":[{"t":"set","p":"complete","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":270,"y":560,"wires":[["465bf6d5.382638"]]},{"id":"898a53c0.94985","type":"change","z":"295d70f2.01c4b","name":"","rules":[{"t":"set","p":"complete","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":410,"y":740,"wires":[["5711a091.217af8"]]},{"id":"3542d6ea.6c0e3a","type":"inject","z":"295d70f2.01c4b","name":"","topic":"topic1","payload":"{\"second_content\" : 2}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":180,"y":700,"wires":[["5711a091.217af8"]]},{"id":"76c89b43.62d2dc","type":"inject","z":"295d70f2.01c4b","name":"","topic":"topic2","payload":"{\"fourth_content\" : 1}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":180,"y":780,"wires":[["5711a091.217af8"]]},{"id":"ac5f5189.ba88f","type":"inject","z":"295d70f2.01c4b","name":"","topic":"topic1","payload":"{\"third_content\" : 3}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":740,"wires":[["898a53c0.94985"]]}]
I actually tested it again this morning. And the join output is triggeres when 2 messages with 2 different topics are received. Is this the way a join node should work?
If yes, how can I join messages based on a unique key?
My use case is to generate a totp code for a device and store the secret key to be able to check the code later.
Workflow is:
- Ask for a device registration, with a UUID
- Generate a secret key (msg with secret is hold in a join node, using the UUID for correlating messages)
- Generate the QRcode
- The device flashes the QRcode to store it
- The device generates and sends a TOTP to NodeRED, giving its UUID
- Join is triggered (2 messages with the same UUID) -> this is my problem
- The TOTP is checked by generating a TOTP on the server with the stored secret key
- If codes matches, store the secret and uuid in a database
Thanks again for any hint.