# MQTT data send from BSB-LAN arduino program

**URL:** <https://discourse.nodered.org/t/mqtt-data-send-from-bsb-lan-arduino-program/38334>\
**Category:** General\
**Created:** [31 December 2020 16:55 UTC](https://discourse.nodered.org/t/mqtt-data-send-from-bsb-lan-arduino-program/38334 "2020-12-31T16:55:06Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Smitex](https://avatars.discourse-cdn.com/v4/letter/s/9fc29f/32.png) [@Smitex](https://discourse.nodered.org/u/Smitex)\
**Post date:** [31 December 2020 16:55 UTC](https://discourse.nodered.org/t/mqtt-data-send-from-bsb-lan-arduino-program/38334/1 "2020-12-31T16:55:06Z")

</div>

Hi,  
I want to send data from an arduino program BSB-LAN that sends MQTT.

I revieved them and made a program in rednode to send the data to Domoticz

I see some data in domoticz but I want to send it to a specific IDX in domoticz.

unfortunately I am not an Json programmer, so I do not know what to write in the rednode function node between MQTT inject node "Buitentemperatuur WP" (ambient temp heatpump) and the domoticz/in node.

I have attached the rednode flow I wrote.

This flow is sending data to Domoticz but in the log I see “error::MQTT: Invalid data recieved !”. So the flow send something to Domoticz but it is not ok, and with the function node it doesn’t send data to an IDX.

Please can someone help me to solve the problem.

Kind regard Peter from the Netherlands

[{"id":"12f69e2c.88aaf2","type":"mqtt in","z":"a7f56b1b.43d8d8","name":"Buitentemp WP","topic":"BSB-LAN/8700","qos":"2","datatype":"auto","broker":"5aedb555.d0a26c","x":140,"y":300,"wires":[["5ad007ff.d8c158","730e33f3.966894"]]},{"id":"5ad007ff.d8c158","type":"debug","z":"a7f56b1b.43d8d8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":610,"y":420,"wires":},{"id":"4dac0088.02d14","type":"mqtt out","z":"a7f56b1b.43d8d8","name":"Buitentemperatuur","topic":"BSB-LAN/8700","qos":"","retain":"","broker":"5aedb555.d0a26c","x":490,"y":60,"wires":},{"id":"e4df2233.0892d","type":"inject","z":"a7f56b1b.43d8d8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":"10","x":150,"y":160,"wires":[["4dac0088.02d14","a88d5ce7.623a5","6b69374a.82d4c8","31262c61.08b9b4","38957d7.27d5f82","637e4636.24d8c8"]]},{"id":"5d2ddfb5.24d4a","type":"mqtt in","z":"a7f56b1b.43d8d8","name":"Sanitairwater Temp","topic":"BSB-LAN/8830","qos":"2","datatype":"auto","broker":"5aedb555.d0a26c","x":150,"y":380,"wires":[["aa13a77a.9a1d88"]]},{"id":"a88d5ce7.623a5","type":"mqtt out","z":"a7f56b1b.43d8d8","name":"Kamertemperatuur","topic":"BSB-LAN/8740","qos":"","retain":"","broker":"5aedb555.d0a26c","x":490,"y":100,"wires":},{"id":"6b69374a.82d4c8","type":"mqtt out","z":"a7f56b1b.43d8d8","name":"Sanitairwater Temp","topic":"BSB-LAN/8830","qos":"","retain":"","broker":"5aedb555.d0a26c","x":490,"y":140,"wires":},{"id":"31262c61.08b9b4","type":"mqtt out","z":"a7f56b1b.43d8d8","name":"Retourwater Temp","topic":"BSB-LAN/8410","qos":"","retain":"","broker":"5aedb555.d0a26c","x":490,"y":180,"wires":},{"id":"637e4636.24d8c8","type":"mqtt out","z":"a7f56b1b.43d8d8","name":"Aanvoer Temp","topic":"BSB-LAN/8412","qos":"","retain":"","broker":"5aedb555.d0a26c","x":500,"y":220,"wires":},{"id":"38957d7.27d5f82","type":"mqtt out","z":"a7f56b1b.43d8d8","name":"Modulatie Pomp","topic":"BSB-LAN/8413","qos":"","retain":"","broker":"5aedb555.d0a26c","x":500,"y":260,"wires":},{"id":"51ce9400.961d3c","type":"mqtt in","z":"a7f56b1b.43d8d8","name":"Retourwater Temp","topic":"BSB-LAN/8410","qos":"2","datatype":"auto","broker":"5aedb555.d0a26c","x":150,"y":420,"wires":[["aa13a77a.9a1d88"]]},{"id":"1a6f4d2f.b0a0d3","type":"mqtt in","z":"a7f56b1b.43d8d8","name":"Aanvoer Temp","topic":"BSB-LAN/8412","qos":"2","datatype":"auto","broker":"5aedb555.d0a26c","x":130,"y":460,"wires":[["aa13a77a.9a1d88"]]},{"id":"c2283c88.59bfc","type":"mqtt in","z":"a7f56b1b.43d8d8","name":"Kamertemperatuur","topic":"BSB-LAN/8740","qos":"2","datatype":"auto","broker":"5aedb555.d0a26c","x":150,"y":340,"wires":[["aa13a77a.9a1d88"]]},{"id":"9b32cfa0.e24c7","type":"mqtt in","z":"a7f56b1b.43d8d8","name":"Modulatie Pomp","topic":"BSB-LAN/8413","qos":"2","datatype":"auto","broker":"5aedb555.d0a26c","x":140,"y":500,"wires":[["aa13a77a.9a1d88"]]},{"id":"2ca8e8d0.bfc868","type":"file","z":"a7f56b1b.43d8d8","name":"","filename":"/home/pi/logs/test.log","appendNewline":true,"createDir":true,"overwriteFile":"false","encoding":"none","x":660,"y":640,"wires":[]},{"id":"7ff4ae87.7225","type":"csv","z":"a7f56b1b.43d8d8","name":"","sep":",","hdrin":"","hdrout":"","multi":"one","ret":"\n","temp":"","skip":"0","x":430,"y":640,"wires":[["2ca8e8d0.bfc868"]]},{"id":"4009f8bc.df4208","type":"function","z":"a7f56b1b.43d8d8","name":"Modify Payload","func":"var d = new Date();\nvar t = d.getTime();\npayload={"time":t,"payload":msg.payload,"topic":msg.topic};\nmsg.payload=payload;\nreturn msg;","outputs":1,"noerr":0,"x":180,"y":620,"wires":[["7ff4ae87.7225"]]},{"id":"aa13a77a.9a1d88","type":"mqtt out","z":"a7f56b1b.43d8d8","name":"","topic":"domoticz/in","qos":"","retain":"true","broker":"5aedb555.d0a26c","x":710,"y":300,"wires":},{"id":"361932a3.6efdce","type":"function","z":"a7f56b1b.43d8d8","name":"sonoff wcd 3 IDX 51","func":"// 59 is a RGB strip, 28 is a normal ligth\n\nif (msg.topic=="light"){\n var newMsg={ command: "switchlight", idx: 51, switchcmd: msg.payload }\n}\nreturn {payload: newMsg}\n\n","outputs":1,"noerr":0,"x":500,"y":540,"wires":[]},{"id":"7d4565a.a6b2e9c","type":"file","z":"a7f56b1b.43d8d8","name":"","filename":"/home/pi/logs/test.log","appendNewline":true,"createDir":true,"overwriteFile":"false","encoding":"none","x":520,"y":740,"wires":[]},{"id":"730e33f3.966894","type":"function","z":"a7f56b1b.43d8d8","name":"","func":"\nvar msg1 = {};\nrequests1 = {"command": "BSB-LAN/8700", "idx": 1928};\nmsg1.payload = requests1\nreturn [msg1];\n","outputs":1,"noerr":0,"x":330,"y":280,"wires":[["aa13a77a.9a1d88","5ad007ff.d8c158"]]},{"id":"5aedb555.d0a26c","type":"mqtt-broker","z":"","name":"","broker":"192.168.1.200","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [31 December 2020 17:05 UTC](https://discourse.nodered.org/t/mqtt-data-send-from-bsb-lan-arduino-program/38334/2 "2020-12-31T17:05:40Z")

</div>

Hi and welcome, your flow is corrupt due to not posting correctly.  
please read this

> [@How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506/8):
>
> @dclear thanks - have updated the guidance to match

---

<div class="post-metadata">

**Author:** ![Smitex](https://avatars.discourse-cdn.com/v4/letter/s/9fc29f/32.png) [@Smitex](https://discourse.nodered.org/u/Smitex)\
**Post date:** [31 December 2020 17:19 UTC](https://discourse.nodered.org/t/mqtt-data-send-from-bsb-lan-arduino-program/38334/3 "2020-12-31T17:19:29Z")

</div>

ok, thank i'll try to upload the correct flow

---

<div class="post-metadata">

**Author:** ![Smitex](https://avatars.discourse-cdn.com/v4/letter/s/9fc29f/32.png) [@Smitex](https://discourse.nodered.org/u/Smitex)\
**Post date:** [31 December 2020 17:35 UTC](https://discourse.nodered.org/t/mqtt-data-send-from-bsb-lan-arduino-program/38334/4 "2020-12-31T17:35:54Z")

</div>

[{"id":"12f69e2c.88aaf2","type":"mqtt in","z":"a7f56b1b.43d8d8","name":"Buitentemp WP","topic":"BSB-LAN/8700","qos":"2","datatype":"auto","broker":"5aedb555.d0a26c","x":140,"y":300,"wires":[["5ad007ff.d8c158","730e33f3.966894"]]},{"id":"5ad007ff.d8c158","type":"debug","z":"a7f56b1b.43d8d8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":610,"y":420,"wires":},{"id":"4dac0088.02d14","type":"mqtt out","z":"a7f56b1b.43d8d8","name":"Buitentemperatuur","topic":"BSB-LAN/8700","qos":"","retain":"","broker":"5aedb555.d0a26c","x":490,"y":60,"wires":},{"id":"e4df2233.0892d","type":"inject","z":"a7f56b1b.43d8d8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":"10","x":150,"y":160,"wires":[["4dac0088.02d14","a88d5ce7.623a5","6b69374a.82d4c8","31262c61.08b9b4","38957d7.27d5f82","637e4636.24d8c8"]]},{"id":"5d2ddfb5.24d4a","type":"mqtt in","z":"a7f56b1b.43d8d8","name":"Sanitairwater Temp","topic":"BSB-LAN/8830","qos":"2","datatype":"auto","broker":"5aedb555.d0a26c","x":150,"y":380,"wires":[["aa13a77a.9a1d88"]]},{"id":"a88d5ce7.623a5","type":"mqtt out","z":"a7f56b1b.43d8d8","name":"Kamertemperatuur","topic":"BSB-LAN/8740","qos":"","retain":"","broker":"5aedb555.d0a26c","x":490,"y":100,"wires":},{"id":"6b69374a.82d4c8","type":"mqtt out","z":"a7f56b1b.43d8d8","name":"Sanitairwater Temp","topic":"BSB-LAN/8830","qos":"","retain":"","broker":"5aedb555.d0a26c","x":490,"y":140,"wires":},{"id":"31262c61.08b9b4","type":"mqtt out","z":"a7f56b1b.43d8d8","name":"Retourwater Temp","topic":"BSB-LAN/8410","qos":"","retain":"","broker":"5aedb555.d0a26c","x":490,"y":180,"wires":},{"id":"637e4636.24d8c8","type":"mqtt out","z":"a7f56b1b.43d8d8","name":"Aanvoer Temp","topic":"BSB-LAN/8412","qos":"","retain":"","broker":"5aedb555.d0a26c","x":500,"y":220,"wires":},{"id":"38957d7.27d5f82","type":"mqtt out","z":"a7f56b1b.43d8d8","name":"Modulatie Pomp","topic":"BSB-LAN/8413","qos":"","retain":"","broker":"5aedb555.d0a26c","x":500,"y":260,"wires":},{"id":"51ce9400.961d3c","type":"mqtt in","z":"a7f56b1b.43d8d8","name":"Retourwater Temp","topic":"BSB-LAN/8410","qos":"2","datatype":"auto","broker":"5aedb555.d0a26c","x":150,"y":420,"wires":[["aa13a77a.9a1d88"]]},{"id":"1a6f4d2f.b0a0d3","type":"mqtt in","z":"a7f56b1b.43d8d8","name":"Aanvoer Temp","topic":"BSB-LAN/8412","qos":"2","datatype":"auto","broker":"5aedb555.d0a26c","x":130,"y":460,"wires":[["aa13a77a.9a1d88"]]},{"id":"c2283c88.59bfc","type":"mqtt in","z":"a7f56b1b.43d8d8","name":"Kamertemperatuur","topic":"BSB-LAN/8740","qos":"2","datatype":"auto","broker":"5aedb555.d0a26c","x":150,"y":340,"wires":[["aa13a77a.9a1d88"]]},{"id":"9b32cfa0.e24c7","type":"mqtt in","z":"a7f56b1b.43d8d8","name":"Modulatie Pomp","topic":"BSB-LAN/8413","qos":"2","datatype":"auto","broker":"5aedb555.d0a26c","x":140,"y":500,"wires":[["aa13a77a.9a1d88"]]},{"id":"2ca8e8d0.bfc868","type":"file","z":"a7f56b1b.43d8d8","name":"","filename":"/home/pi/logs/test.log","appendNewline":true,"createDir":true,"overwriteFile":"false","encoding":"none","x":660,"y":640,"wires":[]},{"id":"7ff4ae87.7225","type":"csv","z":"a7f56b1b.43d8d8","name":"","sep":",","hdrin":"","hdrout":"","multi":"one","ret":"\n","temp":"","skip":"0","x":430,"y":640,"wires":[["2ca8e8d0.bfc868"]]},{"id":"4009f8bc.df4208","type":"function","z":"a7f56b1b.43d8d8","name":"Modify Payload","func":"var d = new Date();\nvar t = d.getTime();\npayload={"time":t,"payload":msg.payload,"topic":msg.topic};\nmsg.payload=payload;\nreturn msg;","outputs":1,"noerr":0,"x":180,"y":620,"wires":[["7ff4ae87.7225"]]},{"id":"aa13a77a.9a1d88","type":"mqtt out","z":"a7f56b1b.43d8d8","name":"","topic":"domoticz/in","qos":"","retain":"true","broker":"5aedb555.d0a26c","x":710,"y":300,"wires":},{"id":"361932a3.6efdce","type":"function","z":"a7f56b1b.43d8d8","name":"sonoff wcd 3 IDX 51","func":"// 59 is a RGB strip, 28 is a normal ligth\n\nif (msg.topic=="light"){\n var newMsg={ command: "switchlight", idx: 51, switchcmd: msg.payload }\n}\nreturn {payload: newMsg}\n\n","outputs":1,"noerr":0,"x":500,"y":540,"wires":[]},{"id":"7d4565a.a6b2e9c","type":"file","z":"a7f56b1b.43d8d8","name":"","filename":"/home/pi/logs/test.log","appendNewline":true,"createDir":true,"overwriteFile":"false","encoding":"none","x":520,"y":740,"wires":[]},{"id":"730e33f3.966894","type":"function","z":"a7f56b1b.43d8d8","name":"","func":"\nvar msg1 = {};\nrequests1 = {"command": "BSB-LAN/8700", "idx": 1928};\nmsg1.payload = requests1\nreturn [msg1];\n","outputs":1,"noerr":0,"x":330,"y":280,"wires":[["aa13a77a.9a1d88","5ad007ff.d8c158"]]},{"id":"5aedb555.d0a26c","type":"mqtt-broker","z":"","name":"","broker":"192.168.1.200","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]Preformatted text

---

<div class="post-metadata">

**Author:** ![Smitex](https://avatars.discourse-cdn.com/v4/letter/s/9fc29f/32.png) [@Smitex](https://discourse.nodered.org/u/Smitex)\
**Post date:** [31 December 2020 18:01 UTC](https://discourse.nodered.org/t/mqtt-data-send-from-bsb-lan-arduino-program/38334/5 "2020-12-31T18:01:05Z")

</div>

I tried to upload the red-node flow, but I don't know how to do it  
sorry

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [31 December 2020 18:47 UTC](https://discourse.nodered.org/t/mqtt-data-send-from-bsb-lan-arduino-program/38334/6 "2020-12-31T18:47:14Z")

</div>

Did you read this and follow the instruction

> [@How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506):
>
> To share code samples or flow json in this forum, you need to take care to format it properly so that it is displayed correctly. The easiest way to do that is to click the 'Preformatted Text' button in the toolbar: [image] Then paste in your code or flow json. You should end up with three back-tick characters - ``` - on their own line before and after the code. On standard US English keyboards, this is on the same key as the ~ character. Using the backticks will ens…

---

<div class="post-metadata">

**Author:** ![Smitex](https://avatars.discourse-cdn.com/v4/letter/s/9fc29f/32.png) [@Smitex](https://discourse.nodered.org/u/Smitex)\
**Post date:** [31 December 2020 19:08 UTC](https://discourse.nodered.org/t/mqtt-data-send-from-bsb-lan-arduino-program/38334/7 "2020-12-31T19:08:44Z")

</div>

````auto
[{"id":"12f69e2c.88aaf2","type":"mqtt in","z":"a7f56b1b.43d8d8","name":"Buitentemp WP","topic":"BSB-LAN/8700","qos":"2","datatype":"auto","broker":"5aedb555.d0a26c","x":140,"y":300,"wires":[["5ad007ff.d8c158","730e33f3.966894"]]},{"id":"5ad007ff.d8c158","type":"debug","z":"a7f56b1b.43d8d8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":610,"y":420,"wires":[]},{"id":"4dac0088.02d14","type":"mqtt out","z":"a7f56b1b.43d8d8","name":"Buitentemperatuur","topic":"BSB-LAN/8700","qos":"","retain":"","broker":"5aedb555.d0a26c","x":490,"y":60,"wires":[]},{"id":"e4df2233.0892d","type":"inject","z":"a7f56b1b.43d8d8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":"10","x":150,"y":160,"wires":[["4dac0088.02d14","a88d5ce7.623a5","6b69374a.82d4c8","31262c61.08b9b4","38957d7.27d5f82","637e4636.24d8c8"]]},{"id":"5d2ddfb5.24d4a","type":"mqtt in","z":"a7f56b1b.43d8d8","name":"Sanitairwater Temp","topic":"BSB-LAN/8830","qos":"2","datatype":"auto","broker":"5aedb555.d0a26c","x":150,"y":380,"wires":[["aa13a77a.9a1d88"]]},{"id":"a88d5ce7.623a5","type":"mqtt out","z":"a7f56b1b.43d8d8","name":"Kamertemperatuur","topic":"BSB-LAN/8740","qos":"","retain":"","broker":"5aedb555.d0a26c","x":490,"y":100,"wires":[]},{"id":"6b69374a.82d4c8","type":"mqtt out","z":"a7f56b1b.43d8d8","name":"Sanitairwater Temp","topic":"BSB-LAN/8830","qos":"","retain":"","broker":"5aedb555.d0a26c","x":490,"y":140,"wires":[]},{"id":"31262c61.08b9b4","type":"mqtt out","z":"a7f56b1b.43d8d8","name":"Retourwater Temp","topic":"BSB-LAN/8410","qos":"","retain":"","broker":"5aedb555.d0a26c","x":490,"y":180,"wires":[]},{"id":"637e4636.24d8c8","type":"mqtt out","z":"a7f56b1b.43d8d8","name":"Aanvoer Temp","topic":"BSB-LAN/8412","qos":"","retain":"","broker":"5aedb555.d0a26c","x":500,"y":220,"wires":[]},{"id":"38957d7.27d5f82","type":"mqtt out","z":"a7f56b1b.43d8d8","name":"Modulatie Pomp","topic":"BSB-LAN/8413","qos":"","retain":"","broker":"5aedb555.d0a26c","x":500,"y":260,"wires":[]},{"id":"51ce9400.961d3c","type":"mqtt in","z":"a7f56b1b.43d8d8","name":"Retourwater Temp","topic":"BSB-LAN/8410","qos":"2","datatype":"auto","broker":"5aedb555.d0a26c","x":150,"y":420,"wires":[["aa13a77a.9a1d88"]]},{"id":"1a6f4d2f.b0a0d3","type":"mqtt in","z":"a7f56b1b.43d8d8","name":"Aanvoer Temp","topic":"BSB-LAN/8412","qos":"2","datatype":"auto","broker":"5aedb555.d0a26c","x":130,"y":460,"wires":[["aa13a77a.9a1d88"]]},{"id":"c2283c88.59bfc","type":"mqtt in","z":"a7f56b1b.43d8d8","name":"Kamertemperatuur","topic":"BSB-LAN/8740","qos":"2","datatype":"auto","broker":"5aedb555.d0a26c","x":150,"y":340,"wires":[["aa13a77a.9a1d88"]]},{"id":"9b32cfa0.e24c7","type":"mqtt in","z":"a7f56b1b.43d8d8","name":"Modulatie Pomp","topic":"BSB-LAN/8413","qos":"2","datatype":"auto","broker":"5aedb555.d0a26c","x":140,"y":500,"wires":[["aa13a77a.9a1d88"]]},{"id":"2ca8e8d0.bfc868","type":"file","z":"a7f56b1b.43d8d8","name":"","filename":"/home/pi/logs/test.log","appendNewline":true,"createDir":true,"overwriteFile":"false","encoding":"none","x":660,"y":640,"wires":[[]]},{"id":"7ff4ae87.7225","type":"csv","z":"a7f56b1b.43d8d8","name":"","sep":",","hdrin":"","hdrout":"","multi":"one","ret":"\\n","temp":"","skip":"0","x":430,"y":640,"wires":[["2ca8e8d0.bfc868"]]},{"id":"4009f8bc.df4208","type":"function","z":"a7f56b1b.43d8d8","name":"Modify Payload","func":"var d = new Date();\nvar t = d.getTime();\npayload={\"time\":t,\"payload\":msg.payload,\"topic\":msg.topic};\nmsg.payload=payload;\nreturn msg;","outputs":1,"noerr":0,"x":180,"y":620,"wires":[["7ff4ae87.7225"]]},{"id":"aa13a77a.9a1d88","type":"mqtt out","z":"a7f56b1b.43d8d8","name":"","topic":"domoticz/in","qos":"","retain":"true","broker":"5aedb555.d0a26c","x":710,"y":300,"wires":[]},{"id":"361932a3.6efdce","type":"function","z":"a7f56b1b.43d8d8","name":"sonoff wcd 3 IDX 51","func":"// 59 is a RGB strip, 28 is a normal ligth\n\nif (msg.topic==\"light\"){\n var newMsg={ command: \"switchlight\", idx: 51, switchcmd: msg.payload }\n}\nreturn {payload: newMsg}\n\n","outputs":1,"noerr":0,"x":500,"y":540,"wires":[[]]},{"id":"7d4565a.a6b2e9c","type":"file","z":"a7f56b1b.43d8d8","name":"","filename":"/home/pi/logs/test.log","appendNewline":true,"createDir":true,"overwriteFile":"false","encoding":"none","x":520,"y":740,"wires":[[]]},{"id":"730e33f3.966894","type":"function","z":"a7f56b1b.43d8d8","name":"","func":"\nvar msg1 = {};\nrequests1 = {\"command\": \"BSB-LAN/8700\", \"idx\": 1928};\nmsg1.payload = requests1\nreturn [msg1];\n","outputs":1,"noerr":0,"x":330,"y":280,"wires":[["aa13a77a.9a1d88","5ad007ff.d8c158"]]},{"id":"5aedb555.d0a26c","type":"mqtt-broker","z":"","name":"","broker":"192.168.1.200","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]```
````

---

<div class="post-metadata">

**Author:** ![Smitex](https://avatars.discourse-cdn.com/v4/letter/s/9fc29f/32.png) [@Smitex](https://discourse.nodered.org/u/Smitex)\
**Post date:** [31 December 2020 19:10 UTC](https://discourse.nodered.org/t/mqtt-data-send-from-bsb-lan-arduino-program/38334/8 "2020-12-31T19:10:11Z")

</div>

this is the code I wanted to update  
please can someone help me to solve my problem?

thanx

Peter

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [31 December 2020 19:34 UTC](https://discourse.nodered.org/t/mqtt-data-send-from-bsb-lan-arduino-program/38334/9 "2020-12-31T19:34:28Z")

</div>

Ok can i have an payload output from the mqtt in node, also how the json input to the domoticz mqtt should structured. then i can help.

[edit]  
I have edited your flow and added wildcards, so you can subscribe to all topics in one node.  
I can not finish function as i do not use Domotics so don't know the payload structure, and i do not know your input payload structure

```auto
[{"id":"f03eb685.0cfc","type":"mqtt in","z":"8d22ae29.7df6d","name":"recieve from all bsb topic","topic":"BSB-LAN/#","qos":"2","datatype":"auto","broker":"7b8cda69.1563ec","x":210,"y":2800,"wires":[["5fc2a4ee.a2f38c","61c9d902.fa901"]]},{"id":"5fc2a4ee.a2f38c","type":"debug","z":"8d22ae29.7df6d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":590,"y":2880,"wires":[]},{"id":"61c9d902.fa901","type":"function","z":"8d22ae29.7df6d","name":"","func":"\nvar msg1 = {};\nmsg1.payload = {\"command\": msg.payload, \"idx\": 1928};\nreturn msg1;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":460,"y":2800,"wires":[["5fc2a4ee.a2f38c","afe6064e.c23f9"]]},{"id":"afe6064e.c23f9","type":"mqtt out","z":"8d22ae29.7df6d","name":"","topic":"domoticz/in","qos":"","retain":"","broker":"7b8cda69.1563ec","x":670,"y":2800,"wires":[]},{"id":"7b8cda69.1563ec","type":"mqtt-broker","z":"","name":"testb","broker":"192.168.1.25","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

```

Here is some info on wildcards

> **[MQTT man page](https://mosquitto.org/man/mqtt-7.html)**
>
> Name
> mqtt — MQ Telemetry Transport
> 
> 
> Synopsis
> MQTT 
> 
> 
> Description
> MQTT is a lightweight publish/subscribe
> messaging protocol. It is useful for use with low power sensors, but
> is applicable to man

And here are Domoticz mqtt api docs, which command do you want to send?  
[https://www.domoticz.com/wiki/MQTT](https://www.domoticz.com/wiki/MQTT)

---

<div class="post-metadata">

**Author:** ![Smitex](https://avatars.discourse-cdn.com/v4/letter/s/9fc29f/32.png) [@Smitex](https://discourse.nodered.org/u/Smitex)\
**Post date:** [1 January 2021 13:55 UTC](https://discourse.nodered.org/t/mqtt-data-send-from-bsb-lan-arduino-program/38334/10 "2021-01-01T13:55:20Z")

</div>

thanx,

I will try your flow,  
but first I will enjoy new year,  
happy new year,

greetz peter

---

<div class="post-metadata">

**Author:** ![Smitex](https://avatars.discourse-cdn.com/v4/letter/s/9fc29f/32.png) [@Smitex](https://discourse.nodered.org/u/Smitex)\
**Post date:** [1 January 2021 16:22 UTC](https://discourse.nodered.org/t/mqtt-data-send-from-bsb-lan-arduino-program/38334/11 "2021-01-01T16:22:12Z")

</div>

Hi, E1cid,  
I tried your flow but it doen'st work either,  
It stil gives me an Unknown command in Domticz.  
I tried myselves some changes I found at the webpage I copied but does didn't work either,  
so I ask for you help one more time.  
can you look at the web page I copied,  
perhaps you can solve the problem with these pages

thanks for your help  
Greetz, Peter

```auto
https://www.domoticz.com/wiki/MQTT

```

---

<div class="post-metadata">

**Author:** ![Smitex](https://avatars.discourse-cdn.com/v4/letter/s/9fc29f/32.png) [@Smitex](https://discourse.nodered.org/u/Smitex)\
**Post date:** [1 January 2021 16:24 UTC](https://discourse.nodered.org/t/mqtt-data-send-from-bsb-lan-arduino-program/38334/12 "2021-01-01T16:24:18Z")

</div>

Sorry E1cid,  
I have seen just, that you copied the webseite already in you answer,

Peter

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [1 January 2021 16:26 UTC](https://discourse.nodered.org/t/mqtt-data-send-from-bsb-lan-arduino-program/38334/13 "2021-01-01T16:26:29Z")

</div>

I said i need the debug from an in node and the format of the command you want to send..

The function can not be completed as i do not have all the info required.

---

<div class="post-metadata">

**Author:** ![Smitex](https://avatars.discourse-cdn.com/v4/letter/s/9fc29f/32.png) [@Smitex](https://discourse.nodered.org/u/Smitex)\
**Post date:** [1 January 2021 16:51 UTC](https://discourse.nodered.org/t/mqtt-data-send-from-bsb-lan-arduino-program/38334/14 "2021-01-01T16:51:52Z")

</div>

hi E1cid,

I want to send devices/sensors data, in this case a temperature, so a value that the BSB topic contains,  
that value (the temprature) needs to send to a IDX (an identifier in Domoticz)

I can't help any further because I am not an JSON programmer, and just tried examples I found on the web.

kind regards, Peter

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [1 January 2021 17:01 UTC](https://discourse.nodered.org/t/mqtt-data-send-from-bsb-lan-arduino-program/38334/15 "2021-01-01T17:01:26Z")

</div>

You have the data, i do not. If you can not supply it how can anyone help.

So attach a debug to the in node and capture the payload, use the copy value button, which appeares to right of payload in debug when you hoover the cursor in that area.

As to how to send i have no idea which payload you wish to send, have a read of api and try to work out which you require.

---

<div class="post-metadata">

**Author:** ![Smitex](https://avatars.discourse-cdn.com/v4/letter/s/9fc29f/32.png) [@Smitex](https://discourse.nodered.org/u/Smitex)\
**Post date:** [1 January 2021 17:18 UTC](https://discourse.nodered.org/t/mqtt-data-send-from-bsb-lan-arduino-program/38334/16 "2021-01-01T17:18:25Z")

</div>

Thanks,

I did it, I see that the output of the "recieve from all bsb topic"is an nummber, and the output of the function block is an object. That should a number also I think,  
I will try some other things to come to the solution,

Thanks very much for yout effort E1cid

---

<div class="post-metadata">

**Author:** ![FireWizard52](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/firewizard52/32/34508_2.png) [@FireWizard52](https://discourse.nodered.org/u/FireWizard52)\
**Post date:** [1 January 2021 20:18 UTC](https://discourse.nodered.org/t/mqtt-data-send-from-bsb-lan-arduino-program/38334/17 "2021-01-01T20:18:40Z")

</div>

Hello,

Can you publish the contents of the Debug node, connected to the MQTT input node.  
A screenshot would help a lot.

Currently your Function node contains:

var msg1 = {};  
msg1.payload = {"command": msg.payload, "idx": 1928};  
return msg1;

This should become something like:

msg.payload = {"command":"udevice","idx":1928,"svalue":msg.payload.temp};  
return msg;

But, before I'm sure, what to insert after "svalue", I have to know, what the output of the MQTT input node is.

Regards

---

<div class="post-metadata">

**Author:** ![Smitex](https://avatars.discourse-cdn.com/v4/letter/s/9fc29f/32.png) [@Smitex](https://discourse.nodered.org/u/Smitex)\
**Post date:** [1 January 2021 21:11 UTC](https://discourse.nodered.org/t/mqtt-data-send-from-bsb-lan-arduino-program/38334/18 "2021-01-01T21:11:47Z")

</div>

Hi FireWizard,

I will check it tomorrow,

Regards  
Peter

---

<div class="post-metadata">

**Author:** ![Smitex](https://avatars.discourse-cdn.com/v4/letter/s/9fc29f/32.png) [@Smitex](https://discourse.nodered.org/u/Smitex)\
**Post date:** [2 January 2021 14:01 UTC](https://discourse.nodered.org/t/mqtt-data-send-from-bsb-lan-arduino-program/38334/19 "2021-01-02T14:01:27Z")

</div>

Hi FireWizard52,

I inplemented your code and it works!!!!!!!

thank you very much

greetz, Peter

---

<div class="post-metadata">

**Author:** ![Smitex](https://avatars.discourse-cdn.com/v4/letter/s/9fc29f/32.png) [@Smitex](https://discourse.nodered.org/u/Smitex)\
**Post date:** [2 January 2021 19:31 UTC](https://discourse.nodered.org/t/mqtt-data-send-from-bsb-lan-arduino-program/38334/20 "2021-01-02T19:31:35Z")

</div>

````auto
[{"id":"12f69e2c.88aaf2","type":"mqtt in","z":"a7f56b1b.43d8d8","name":"Buitentemp WP/8700","topic":"BSB-LAN/8700","qos":"2","datatype":"auto","broker":"5aedb555.d0a26c","x":120,"y":280,"wires":[["730e33f3.966894"]]},{"id":"5ad007ff.d8c158","type":"debug","z":"a7f56b1b.43d8d8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":730,"y":500,"wires":[]},{"id":"4dac0088.02d14","type":"mqtt out","z":"a7f56b1b.43d8d8","name":"Buitentemperatuur","topic":"BSB-LAN/8700","qos":"","retain":"","broker":"5aedb555.d0a26c","x":730,"y":20,"wires":[]},{"id":"e4df2233.0892d","type":"inject","z":"a7f56b1b.43d8d8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":"10","x":430,"y":100,"wires":[[]]},{"id":"5d2ddfb5.24d4a","type":"mqtt in","z":"a7f56b1b.43d8d8","name":"Sanitairwater Temp/8830","topic":"BSB-LAN/8830","qos":"2","datatype":"auto","broker":"5aedb555.d0a26c","x":110,"y":400,"wires":[["469f7b38.71a744"]]},{"id":"a88d5ce7.623a5","type":"mqtt out","z":"a7f56b1b.43d8d8","name":"Kamertemperatuur","topic":"BSB-LAN/8740","qos":"","retain":"","broker":"5aedb555.d0a26c","x":730,"y":60,"wires":[]},{"id":"6b69374a.82d4c8","type":"mqtt out","z":"a7f56b1b.43d8d8","name":"Sanitairwater Temp","topic":"BSB-LAN/8830","qos":"","retain":"","broker":"5aedb555.d0a26c","x":730,"y":100,"wires":[]},{"id":"31262c61.08b9b4","type":"mqtt out","z":"a7f56b1b.43d8d8","name":"Retourwater Temp","topic":"BSB-LAN/8410","qos":"","retain":"","broker":"5aedb555.d0a26c","x":730,"y":140,"wires":[]},{"id":"637e4636.24d8c8","type":"mqtt out","z":"a7f56b1b.43d8d8","name":"Aanvoer Temp","topic":"BSB-LAN/8412","qos":"","retain":"","broker":"5aedb555.d0a26c","x":740,"y":180,"wires":[]},{"id":"38957d7.27d5f82","type":"mqtt out","z":"a7f56b1b.43d8d8","name":"Modulatie Pomp","topic":"BSB-LAN/8413","qos":"","retain":"","broker":"5aedb555.d0a26c","x":740,"y":220,"wires":[]},{"id":"51ce9400.961d3c","type":"mqtt in","z":"a7f56b1b.43d8d8","name":"Retourwater Temp/8410","topic":"BSB-LAN/8410","qos":"2","datatype":"auto","broker":"5aedb555.d0a26c","x":120,"y":460,"wires":[["bd7c401.f926cc"]]},{"id":"1a6f4d2f.b0a0d3","type":"mqtt in","z":"a7f56b1b.43d8d8","name":"Aanvoer Temp/8412","topic":"BSB-LAN/8412","qos":"2","datatype":"auto","broker":"5aedb555.d0a26c","x":130,"y":520,"wires":[["33e337cf.7bc378"]]},{"id":"c2283c88.59bfc","type":"mqtt in","z":"a7f56b1b.43d8d8","name":"Kamertemperatuur/8740","topic":"BSB-LAN/8740","qos":"2","datatype":"auto","broker":"5aedb555.d0a26c","x":110,"y":340,"wires":[["9d73ecdd.1884c"]]},{"id":"9b32cfa0.e24c7","type":"mqtt in","z":"a7f56b1b.43d8d8","name":"Modulatie Pomp/8413","topic":"BSB-LAN/8413","qos":"2","datatype":"auto","broker":"5aedb555.d0a26c","x":120,"y":580,"wires":[["16f28d7b.fffd53"]]},{"id":"2ca8e8d0.bfc868","type":"file","z":"a7f56b1b.43d8d8","name":"","filename":"/home/pi/logs/test.log","appendNewline":true,"createDir":true,"overwriteFile":"false","encoding":"none","x":760,"y":640,"wires":[[]]},{"id":"7ff4ae87.7225","type":"csv","z":"a7f56b1b.43d8d8","name":"","sep":",","hdrin":"","hdrout":"","multi":"one","ret":"\\n","temp":"","skip":"0","x":330,"y":640,"wires":[["2ca8e8d0.bfc868"]]},{"id":"4009f8bc.df4208","type":"function","z":"a7f56b1b.43d8d8","name":"Modify Payload","func":"var d = new Date();\nvar t = d.getTime();\npayload={\"time\":t,\"payload\":msg.payload,\"topic\":msg.topic};\nmsg.payload=payload;\nreturn msg;","outputs":1,"noerr":0,"x":140,"y":620,"wires":[["7ff4ae87.7225"]]},{"id":"aa13a77a.9a1d88","type":"mqtt out","z":"a7f56b1b.43d8d8","name":"","topic":"domoticz/in","qos":"","retain":"true","broker":"5aedb555.d0a26c","x":730,"y":400,"wires":[]},{"id":"730e33f3.966894","type":"function","z":"a7f56b1b.43d8d8","name":"","func":"\nmsg.payload = {\"command\":\"udevice\",\"idx\":1928,\"svalue\":msg.payload};\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":280,"wires":[["aa13a77a.9a1d88","5ad007ff.d8c158"]]},{"id":"9d73ecdd.1884c","type":"function","z":"a7f56b1b.43d8d8","name":"","func":"\n\nmsg.payload = {\"command\":\"udevice\",\"idx\":1927,\"svalue\":msg.payload};\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":340,"wires":[["aa13a77a.9a1d88","5ad007ff.d8c158"]]},{"id":"469f7b38.71a744","type":"function","z":"a7f56b1b.43d8d8","name":"","func":"\n\nmsg.payload = {\"command\":\"udevice\",\"idx\":1778,\"svalue\":msg.payload};\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":400,"wires":[["aa13a77a.9a1d88"]]},{"id":"51e57838.793c48","type":"function","z":"a7f56b1b.43d8d8","name":"","func":"\n\nmsg.payload = {\"command\":\"udevice\",\"idx\":1778,\"svalue\":msg.payload};\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":400,"wires":[["5ad007ff.d8c158"]]},{"id":"16f28d7b.fffd53","type":"function","z":"a7f56b1b.43d8d8","name":"","func":"\n\nmsg.payload = {\"command\":\"udevice\",\"idx\":1929,\"svalue\":msg.payload};\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":580,"wires":[["aa13a77a.9a1d88","5ad007ff.d8c158"]]},{"id":"bd7c401.f926cc","type":"function","z":"a7f56b1b.43d8d8","name":"","func":"\n\nmsg.payload = {\"command\":\"udevice\",\"idx\":1930,\"svalue\":msg.payload};\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":460,"wires":[["aa13a77a.9a1d88","5ad007ff.d8c158"]]},{"id":"33e337cf.7bc378","type":"function","z":"a7f56b1b.43d8d8","name":"","func":"\n\nmsg.payload = {\"command\":\"udevice\",\"idx\":1931,\"svalue\":msg.payload};\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":520,"wires":[["aa13a77a.9a1d88","5ad007ff.d8c158"]]},{"id":"5aedb555.d0a26c","type":"mqtt-broker","z":"","name":"","broker":"192.168.1.200","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]```
````

[Next page](https://discourse.nodered.org/t/mqtt-data-send-from-bsb-lan-arduino-program/38334.md?page=2)
