Hello,
I have a little question, how to send multiple value on one message MQTT.
I have a HomeKit Block is send by MQTT, but i want to have the name of the block.
I test a JOIN block but is don't no work
Can you help me ?
Many thanks
Hello,
I have a little question, how to send multiple value on one message MQTT.
I have a HomeKit Block is send by MQTT, but i want to have the name of the block.
I test a JOIN block but is don't no work
Can you help me ?
Many thanks
Can you give an example of what you mean?
you can send a JSON string as a single message in MQTT.
Hello,
this is my code :
[{"id":"c48d1eb9.be4c08","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"53d431f0.74fd6","type":"mqtt in","z":"c48d1eb9.be4c08","name":"De Volet1","topic":"FromVolet1","qos":"2","broker":"555de38f.aa2144","x":97.5,"y":95,"wires":[["387f69d6.74845e"]]},{"id":"387f69d6.74845e","type":"function","z":"c48d1eb9.be4c08","name":"","func":"msg.payload = {\n CurrentPosition:(msg.payload)\n};\nreturn msg;","outputs":1,"noerr":0,"x":250.5,"y":109,"wires":[["19ede858.1c5e78"]]},{"id":"bb27c51.85371b8","type":"mqtt out","z":"c48d1eb9.be4c08","name":"","topic":"ToVolet1","qos":"","retain":"","broker":"555de38f.aa2144","x":671.5,"y":41,"wires":[]},{"id":"4b24d763.2e733","type":"debug","z":"c48d1eb9.be4c08","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":660.5,"y":186,"wires":[]},{"id":"c289aa64.01827","type":"mqtt in","z":"c48d1eb9.be4c08","name":"De Volet2","topic":"FromVolet2","qos":"2","broker":"555de38f.aa2144","x":96,"y":248,"wires":[["cdd76f7.901451"]]},{"id":"cdd76f7.901451","type":"function","z":"c48d1eb9.be4c08","name":"","func":"msg.payload = {\n CurrentPosition:(msg.payload)\n};\nreturn msg;","outputs":1,"noerr":0,"x":249,"y":262,"wires":[["765c6d11.ca3ee4"]]},{"id":"62ce5958.f163c8","type":"mqtt out","z":"c48d1eb9.be4c08","name":"","topic":"ToVolet2","qos":"","retain":"","broker":"555de38f.aa2144","x":595,"y":252,"wires":[]},{"id":"f5418bb0.896b98","type":"mqtt in","z":"c48d1eb9.be4c08","name":"De Volet3","topic":"FromVolet2","qos":"2","broker":"555de38f.aa2144","x":99,"y":406,"wires":[["5f8c047c.339674"]]},{"id":"5f8c047c.339674","type":"function","z":"c48d1eb9.be4c08","name":"","func":"msg.payload = {\n CurrentPosition:(msg.payload)\n};\nreturn msg;","outputs":1,"noerr":0,"x":252,"y":420,"wires":[["cd1515f9.e26b38"]]},{"id":"999610bc.ff09f8","type":"mqtt out","z":"c48d1eb9.be4c08","name":"","topic":"ToVolet3","qos":"","retain":"","broker":"555de38f.aa2144","x":598,"y":410,"wires":[]},{"id":"19ede858.1c5e78","type":"homekit-service","z":"c48d1eb9.be4c08","bridge":"b23a461a.fe62b","name":"VV1","serviceName":"WindowCovering","manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","characteristicProperties":"{}","x":409.5,"y":109,"wires":[["4b24d763.2e733","414b6296.f4f95c"]]},{"id":"765c6d11.ca3ee4","type":"homekit-service","z":"c48d1eb9.be4c08","bridge":"b23a461a.fe62b","name":"VV2","serviceName":"WindowCovering","manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","characteristicProperties":"{}","x":424,"y":260,"wires":[["62ce5958.f163c8"]]},{"id":"cd1515f9.e26b38","type":"homekit-service","z":"c48d1eb9.be4c08","bridge":"b23a461a.fe62b","name":"VV3","serviceName":"WindowCovering","manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","characteristicProperties":"{}","x":414,"y":426,"wires":[["999610bc.ff09f8"]]},{"id":"f0670bdc.1ec49","type":"inject","z":"c48d1eb9.be4c08","name":"","topic":"Name","payload":"VV1","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":397.5,"y":35,"wires":[["414b6296.f4f95c"]]},{"id":"414b6296.f4f95c","type":"join","z":"c48d1eb9.be4c08","name":"","mode":"auto","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":"false","timeout":"","count":"","reduceRight":false,"x":537.5,"y":72,"wires":[["bb27c51.85371b8"]]},{"id":"555de38f.aa2144","type":"mqtt-broker","z":"","name":"MQTT-BROKER","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","willTopic":"","willQos":"0","willRetain":"false","willPayload":""},{"id":"b23a461a.fe62b","type":"homekit-bridge","z":"","bridgeName":"VROUB","pinCode":"111-11-111","port":"","manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number"}]´
have ypu a exemple for me ?
many thanks
I don't want a flow, I want you to explain what you mean by "multiple value on one message MQTT". Give an example of what data you want to write.
I want à TargetPsition & the Name of the block homekit.
Name:vv1 and TargetPosition:XX dépend of the value of my iPhone set.
Manu Thanks
[{"id":"36742a24.c24aee","type":"inject","z":"6dc690a3.1abc88","name":"","topic":"SomeTestTopic","payload":"{\"Name\":\"vv1\",\"TargetPosition\":12}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":133,"y":560,"wires":[["76c49342.83e504"]]},{"id":"76c49342.83e504","type":"mqtt out","z":"6dc690a3.1abc88","name":"","topic":"","qos":"","retain":"false","broker":"35776abd.9e4316","x":306.5,"y":561,"wires":[]},{"id":"fc64ac2a.31a378","type":"mqtt in","z":"6dc690a3.1abc88","name":"","topic":"SomeTestTopic","qos":"1","broker":"35776abd.9e4316","x":329.5,"y":631,"wires":[["3293d9b5.fdab46"]]},{"id":"76839c26.a38b24","type":"debug","z":"6dc690a3.1abc88","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":529.5,"y":707,"wires":[]},{"id":"3293d9b5.fdab46","type":"json","z":"6dc690a3.1abc88","name":"","property":"payload","action":"","pretty":false,"x":496.5,"y":633,"wires":[["76839c26.a38b24"]]},{"id":"35776abd.9e4316","type":"mqtt-broker","z":"","name":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
Ah, your question was not "How to send multiple property to MQTT" but "How to combine data from multiple messages into one".
You can do this with the Join node set to combine messages into key/value pairs.
Of course if you can just build up one message as you pass a message along then you don't have to worry about using the join node. Where are the name and target coming from?
I can't import your flow to see because you have not put a line with three backtick characters before the flow and another such line after it.
[{"id":"53d431f0.74fd6","type":"mqtt in","z":"c48d1eb9.be4c08","name":"De Volet1","topic":"FromVolet1","qos":"2","broker":"555de38f.aa2144","x":97.5,"y":95,"wires":[["387f69d6.74845e"]]},{"id":"387f69d6.74845e","type":"function","z":"c48d1eb9.be4c08","name":"","func":"msg.payload = {\n CurrentPosition:(msg.payload)\n};\nreturn msg;","outputs":1,"noerr":0,"x":250.5,"y":109,"wires":[["19ede858.1c5e78"]]},{"id":"bb27c51.85371b8","type":"mqtt out","z":"c48d1eb9.be4c08","name":"","topic":"ToVolet1","qos":"","retain":"","broker":"555de38f.aa2144","x":671.5,"y":41,"wires":[]},{"id":"4b24d763.2e733","type":"debug","z":"c48d1eb9.be4c08","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":660.5,"y":186,"wires":[]},{"id":"19ede858.1c5e78","type":"homekit-service","z":"c48d1eb9.be4c08","bridge":"b23a461a.fe62b","name":"VV1","serviceName":"WindowCovering","manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","characteristicProperties":"{}","x":409.5,"y":109,"wires":[["469491f7.82e5"]]},{"id":"f0670bdc.1ec49","type":"inject","z":"c48d1eb9.be4c08","name":"","topic":"Name","payload":"{\"Name\":\"VV1\"}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":243.5,"y":32,"wires":[["469491f7.82e5"]]},{"id":"469491f7.82e5","type":"json","z":"c48d1eb9.be4c08","name":"","property":"payload","action":"","pretty":false,"x":531.4434814453125,"y":68.8094711303711,"wires":[["bb27c51.85371b8","4b24d763.2e733"]]},{"id":"555de38f.aa2144","type":"mqtt-broker","z":"","name":"MQTT-BROKER","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","willTopic":"","willQos":"0","willRetain":"false","willPayload":""},{"id":"b23a461a.fe62b","type":"homekit-bridge","z":"","bridgeName":"VROUB","pinCode":"111-11-111","port":"","manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number"}]
What I want is that each time I change the value of the TargetPosition, the name of the HomeKit block or whatever is important but happy a name is sent at the same time as the TargetPosition.
I already tried a joint but I did not succeed either
What did you get out of the join?
Name:1,TargetPosition:xx(value from the bloc homekit),
Thanks
So it did work. Assuming that what you actually mean is that msg.payload contained {name:1, TargetPosition: XX}. What's the problem then? That is exactly what is in the inject in the example I posted. Just feed it into the MQTT as in my example.