How to separate receiving dashboards from two different devices

Hello guys, I have a problem. I'm doing a project using LoRa. I receive data from several devices with different IDs on the same gateway, which is sending data to an MQTT broker. I want to build a dashboard for the device I receive, for example, if I receive temperature and humidity from device ID 3289211400 it will show in gauges 1 and 2, if I receive it from device ID 681017712 it will show in gauges 3 and 4 ... with you do this on Node-red? Thanks!

You can use a Switch node (not the dashboard switch) to route the message along separate paths for the two ID values.

I still haven't been able to reach a good result using the node switch .. it doesn't do what I wanted it to do): I'm going to share my project ..

[{"id":"d72b056f.0d3248","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"ac6f5e08.195e3","type":"mqtt in","z":"d72b056f.0d3248","name":"TCC","topic":"Teste","qos":"0","datatype":"json","broker":"c7266bc3.062ef8","x":78,"y":48,"wires":[["bfa75558.0dcca8","f874f639.70b688"]]},{"id":"9f4f2111.81f77","type":"debug","z":"d72b056f.0d3248","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload[0]","targetType":"msg","x":492.5,"y":40,"wires":},{"id":"f5f9f94d.b40778","type":"ui_gauge","z":"d72b056f.0d3248","name":"umidade","group":"d8123882.e133f8","order":1,"width":0,"height":0,"gtype":"gage","title":"umidade","label":"%","format":"{{msg.payload[0].valores[2]}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":492,"y":132,"wires":},{"id":"260fb5ab.7bdeea","type":"ui_text","z":"d72b056f.0d3248","group":"d8123882.e133f8","order":2,"width":0,"height":0,"name":"","label":"ID","format":"{{msg.payload[0].valores[0]}}","layout":"row-spread","x":489.5,"y":181,"wires":},{"id":"9a1e500c.0772c","type":"debug","z":"d72b056f.0d3248","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1013.5,"y":104,"wires":},{"id":"f874f639.70b688","type":"change","z":"d72b056f.0d3248","name":"aviario1","rules":[{"t":"set","p":"payload[0]","pt":"msg","to":"payload.[valores[0]=681017712].valores","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":262,"y":45,"wires":[["9f4f2111.81f77","ec66510c.9f189","f5f9f94d.b40778","260fb5ab.7bdeea"]]},{"id":"bfa75558.0dcca8","type":"change","z":"d72b056f.0d3248","name":"aviario2","rules":[{"t":"set","p":"payload[0]","pt":"msg","to":"payload.[valores[0]=3289211400].valores","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":266,"y":264,"wires":[["4310fb87.f23c44","8d496871.e689f8","88ccaae0.2b5aa8","3d3c71ee.834e7e"]]},{"id":"ec66510c.9f189","type":"ui_gauge","z":"d72b056f.0d3248","name":"temperatura","group":"d8123882.e133f8","order":1,"width":0,"height":0,"gtype":"gage","title":"temperatura","label":"ºC","format":"{{msg.payload[0].valores[1]}}","min":"-10","max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":497.5,"y":88,"wires":},{"id":"4310fb87.f23c44","type":"debug","z":"d72b056f.0d3248","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload[0]","targetType":"msg","x":489,"y":269,"wires":},{"id":"88ccaae0.2b5aa8","type":"ui_gauge","z":"d72b056f.0d3248","name":"umidade","group":"d8123882.e133f8","order":1,"width":0,"height":0,"gtype":"gage","title":"umidade","label":"%","format":"{{msg.payload[0].valores[2]}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":488.5,"y":361,"wires":},{"id":"3d3c71ee.834e7e","type":"ui_text","z":"d72b056f.0d3248","group":"d8123882.e133f8","order":2,"width":0,"height":0,"name":"","label":"ID","format":"{{msg.payload[0].valores[0]}}","layout":"row-spread","x":486,"y":410,"wires":},{"id":"8d496871.e689f8","type":"ui_gauge","z":"d72b056f.0d3248","name":"temperatura","group":"d8123882.e133f8","order":1,"width":0,"height":0,"gtype":"gage","title":"temperatura","label":"ºC","format":"{{msg.payload[0].valores[1]}}","min":"-10","max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":494,"y":317,"wires":},{"id":"c7266bc3.062ef8","type":"mqtt-broker","z":"","name":"TCC ","broker":"m24.cloudmqtt.com","port":"14910","clientid":"","usetls":false,"compatmode":true,"keepalive":"1","cleansession":true,"birthTopic":"esp/test","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"d8123882.e133f8","type":"ui_group","z":"","name":"Aviário IFSC ","tab":"52698c4b.9a7b34","disp":true,"width":"6","collapse":false},{"id":"52698c4b.9a7b34","type":"ui_tab","z":"","name":"TCC - Movitoramento de Aviários","icon":"TCC - Movitoramento de Aviários","disabled":false,"hidden":false}]

Your flow is not importable. Please read the link below and then edit your post above. (use the pencil icon)

[
{
"id": "d72b056f.0d3248",
"type": "tab",
"label": "Flow 1",
"disabled": false,
"info": ""
},
{
"id": "ac6f5e08.195e3",
"type": "mqtt in",
"z": "d72b056f.0d3248",
"name": "TCC",
"topic": "Teste",
"qos": "0",
"datatype": "json",
"broker": "c7266bc3.062ef8",
"x": 78,
"y": 48,
"wires": [
[
"bfa75558.0dcca8",
"f874f639.70b688"
]
]
},
{
"id": "9f4f2111.81f77",
"type": "debug",
"z": "d72b056f.0d3248",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload[0]",
"targetType": "msg",
"x": 492.5,
"y": 40,
"wires":
},
{
"id": "f5f9f94d.b40778",
"type": "ui_gauge",
"z": "d72b056f.0d3248",
"name": "umidade",
"group": "d8123882.e133f8",
"order": 1,
"width": 0,
"height": 0,
"gtype": "gage",
"title": "umidade",
"label": "%",
"format": "{{msg.payload[0].valores[2]}}",
"min": 0,
"max": "100",
"colors": [
"#00b500",
"#e6e600",
"#ca3838"
],
"seg1": "",
"seg2": "",
"x": 492,
"y": 132,
"wires":
},
{
"id": "260fb5ab.7bdeea",
"type": "ui_text",
"z": "d72b056f.0d3248",
"group": "d8123882.e133f8",
"order": 2,
"width": 0,
"height": 0,
"name": "",
"label": "ID",
"format": "{{msg.payload[0].valores[0]}}",
"layout": "row-spread",
"x": 489.5,
"y": 181,
"wires":
},
{
"id": "9a1e500c.0772c",
"type": "debug",
"z": "d72b056f.0d3248",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 1013.5,
"y": 104,
"wires":
},
{
"id": "f874f639.70b688",
"type": "change",
"z": "d72b056f.0d3248",
"name": "aviario1",
"rules": [
{
"t": "set",
"p": "payload[0]",
"pt": "msg",
"to": "payload.[valores[0]=681017712].valores",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 262,
"y": 45,
"wires": [
[
"9f4f2111.81f77",
"ec66510c.9f189",
"f5f9f94d.b40778",
"260fb5ab.7bdeea"
]
]
},
{
"id": "bfa75558.0dcca8",
"type": "change",
"z": "d72b056f.0d3248",
"name": "aviario2",
"rules": [
{
"t": "set",
"p": "payload[0]",
"pt": "msg",
"to": "payload.
[valores[0]=3289211400].valores",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 266,
"y": 264,
"wires": [
[
"4310fb87.f23c44",
"8d496871.e689f8",
"88ccaae0.2b5aa8",
"3d3c71ee.834e7e"
]
]
},
{
"id": "ec66510c.9f189",
"type": "ui_gauge",
"z": "d72b056f.0d3248",
"name": "temperatura",
"group": "d8123882.e133f8",
"order": 1,
"width": 0,
"height": 0,
"gtype": "gage",
"title": "temperatura",
"label": "ºC",
"format": "{{msg.payload[0].valores[1]}}",
"min": "-10",
"max": "100",
"colors": [
"#00b500",
"#e6e600",
"#ca3838"
],
"seg1": "",
"seg2": "",
"x": 497.5,
"y": 88,
"wires":
},
{
"id": "4310fb87.f23c44",
"type": "debug",
"z": "d72b056f.0d3248",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload[0]",
"targetType": "msg",
"x": 489,
"y": 269,
"wires":
},
{
"id": "88ccaae0.2b5aa8",
"type": "ui_gauge",
"z": "d72b056f.0d3248",
"name": "umidade",
"group": "d8123882.e133f8",
"order": 1,
"width": 0,
"height": 0,
"gtype": "gage",
"title": "umidade",
"label": "%",
"format": "{{msg.payload[0].valores[2]}}",
"min": 0,
"max": "100",
"colors": [
"#00b500",
"#e6e600",
"#ca3838"
],
"seg1": "",
"seg2": "",
"x": 488.5,
"y": 361,
"wires":
},
{
"id": "3d3c71ee.834e7e",
"type": "ui_text",
"z": "d72b056f.0d3248",
"group": "d8123882.e133f8",
"order": 2,
"width": 0,
"height": 0,
"name": "",
"label": "ID",
"format": "{{msg.payload[0].valores[0]}}",
"layout": "row-spread",
"x": 486,
"y": 410,
"wires":
},
{
"id": "8d496871.e689f8",
"type": "ui_gauge",
"z": "d72b056f.0d3248",
"name": "temperatura",
"group": "d8123882.e133f8",
"order": 1,
"width": 0,
"height": 0,
"gtype": "gage",
"title": "temperatura",
"label": "ºC",
"format": "{{msg.payload[0].valores[1]}}",
"min": "-10",
"max": "100",
"colors": [
"#00b500",
"#e6e600",
"#ca3838"
],
"seg1": "",
"seg2": "",
"x": 494,
"y": 317,
"wires":
},
{
"id": "c7266bc3.062ef8",
"type": "mqtt-broker",
"z": "",
"name": "TCC ",
"broker": "m24.cloudmqtt.com",
"port": "14910",
"clientid": "",
"usetls": false,
"compatmode": true,
"keepalive": "1",
"cleansession": true,
"birthTopic": "esp/test",
"birthQos": "0",
"birthPayload": "",
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"willTopic": "",
"willQos": "0",
"willPayload": ""
},
{
"id": "d8123882.e133f8",
"type": "ui_group",
"z": "",
"name": "Aviário IFSC ",
"tab": "52698c4b.9a7b34",
"disp": true,
"width": "6",
"collapse": false
},
{
"id": "52698c4b.9a7b34",
"type": "ui_tab",
"z": "",
"name": "TCC - Movitoramento de Aviários",
"icon": "TCC - Movitoramento de Aviários",
"disabled": false,
"hidden": false
}
]

You don't have a switch node in your flow. Add a switch node right after the MQTT-in node so send the data where you want.

Also your flow is still not importable. Go read what @Paul-Reed pointed you at.

[{"id":"d72b056f.0d3248","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"ac6f5e08.195e3","type":"mqtt in","z":"d72b056f.0d3248","name":"TCC","topic":"Teste","qos":"0","datatype":"json","broker":"c7266bc3.062ef8","x":78,"y":48,"wires":[["bfa75558.0dcca8","f874f639.70b688"]]},{"id":"9f4f2111.81f77","type":"debug","z":"d72b056f.0d3248","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload[0]","targetType":"msg","x":492.5,"y":40,"wires":[]},{"id":"f5f9f94d.b40778","type":"ui_gauge","z":"d72b056f.0d3248","name":"umidade","group":"d8123882.e133f8","order":1,"width":0,"height":0,"gtype":"gage","title":"umidade","label":"%","format":"{{msg.payload[0].valores[2]}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":492,"y":132,"wires":[]},{"id":"260fb5ab.7bdeea","type":"ui_text","z":"d72b056f.0d3248","group":"d8123882.e133f8","order":2,"width":0,"height":0,"name":"","label":"ID","format":"{{msg.payload[0].valores[0]}}","layout":"row-spread","x":489.5,"y":181,"wires":[]},{"id":"9a1e500c.0772c","type":"debug","z":"d72b056f.0d3248","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1013.5,"y":104,"wires":[]},{"id":"f874f639.70b688","type":"change","z":"d72b056f.0d3248","name":"aviario1","rules":[{"t":"set","p":"payload[0]","pt":"msg","to":"payload.**[valores[0]=681017712].valores","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":262,"y":45,"wires":[["9f4f2111.81f77","ec66510c.9f189","f5f9f94d.b40778","260fb5ab.7bdeea"]]},{"id":"bfa75558.0dcca8","type":"change","z":"d72b056f.0d3248","name":"aviario2","rules":[{"t":"set","p":"payload[0]","pt":"msg","to":"payload.**[valores[0]=3289211400].valores","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":266,"y":264,"wires":[["4310fb87.f23c44","8d496871.e689f8","88ccaae0.2b5aa8","3d3c71ee.834e7e"]]},{"id":"ec66510c.9f189","type":"ui_gauge","z":"d72b056f.0d3248","name":"temperatura","group":"d8123882.e133f8","order":1,"width":0,"height":0,"gtype":"gage","title":"temperatura","label":"ºC","format":"{{msg.payload[0].valores[1]}}","min":"-10","max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":497.5,"y":88,"wires":[]},{"id":"4310fb87.f23c44","type":"debug","z":"d72b056f.0d3248","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload[0]","targetType":"msg","x":489,"y":269,"wires":[]},{"id":"88ccaae0.2b5aa8","type":"ui_gauge","z":"d72b056f.0d3248","name":"umidade","group":"d8123882.e133f8","order":1,"width":0,"height":0,"gtype":"gage","title":"umidade","label":"%","format":"{{msg.payload[0].valores[2]}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":488.5,"y":361,"wires":[]},{"id":"3d3c71ee.834e7e","type":"ui_text","z":"d72b056f.0d3248","group":"d8123882.e133f8","order":2,"width":0,"height":0,"name":"","label":"ID","format":"{{msg.payload[0].valores[0]}}","layout":"row-spread","x":486,"y":410,"wires":[]},{"id":"8d496871.e689f8","type":"ui_gauge","z":"d72b056f.0d3248","name":"temperatura","group":"d8123882.e133f8","order":1,"width":0,"height":0,"gtype":"gage","title":"temperatura","label":"ºC","format":"{{msg.payload[0].valores[1]}}","min":"-10","max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":494,"y":317,"wires":[]},{"id":"c7266bc3.062ef8","type":"mqtt-broker","z":"","name":"TCC ","broker":"m24.cloudmqtt.com","port":"14910","clientid":"","usetls":false,"compatmode":true,"keepalive":"1","cleansession":true,"birthTopic":"esp/test","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"d8123882.e133f8","type":"ui_group","z":"","name":"Aviário IFSC ","tab":"52698c4b.9a7b34","disp":true,"width":"6","collapse":false},{"id":"52698c4b.9a7b34","type":"ui_tab","z":"","name":"TCC - Movitoramento de Aviários","icon":"TCC - Movitoramento de Aviários","disabled":false,"hidden":false}]

I think now I did it the right way, I'm new using node-red

so where is the switch node?

sorry, in this node

[{"id":"d72b056f.0d3248","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"ac6f5e08.195e3","type":"mqtt in","z":"d72b056f.0d3248","name":"TCC","topic":"Teste","qos":"0","datatype":"json","broker":"c7266bc3.062ef8","x":78,"y":48,"wires":[["de12f99f.e3dad8","e41eb6c4.ee5148"]]},{"id":"9f4f2111.81f77","type":"debug","z":"d72b056f.0d3248","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":482.5,"y":40,"wires":[]},{"id":"f5f9f94d.b40778","type":"ui_gauge","z":"d72b056f.0d3248","name":"umidade","group":"d8123882.e133f8","order":1,"width":0,"height":0,"gtype":"gage","title":"umidade","label":"%","format":"{{msg.payload[0].valores[2]}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":492,"y":132,"wires":[]},{"id":"260fb5ab.7bdeea","type":"ui_text","z":"d72b056f.0d3248","group":"d8123882.e133f8","order":2,"width":0,"height":0,"name":"","label":"ID","format":"{{msg.payload[0].valores[0]}}","layout":"row-spread","x":489.5,"y":181,"wires":[]},{"id":"9a1e500c.0772c","type":"debug","z":"d72b056f.0d3248","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1013.5,"y":104,"wires":[]},{"id":"ec66510c.9f189","type":"ui_gauge","z":"d72b056f.0d3248","name":"temperatura","group":"d8123882.e133f8","order":1,"width":0,"height":0,"gtype":"gage","title":"temperatura","label":"ºC","format":"{{msg.payload[0].valores[1]}}","min":"-10","max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":497.5,"y":88,"wires":[]},{"id":"4310fb87.f23c44","type":"debug","z":"d72b056f.0d3248","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload[0]","targetType":"msg","x":489,"y":269,"wires":[]},{"id":"88ccaae0.2b5aa8","type":"ui_gauge","z":"d72b056f.0d3248","name":"umidade","group":"d8123882.e133f8","order":1,"width":0,"height":0,"gtype":"gage","title":"umidade","label":"%","format":"{{msg.payload[0].valores[2]}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":488.5,"y":361,"wires":[]},{"id":"3d3c71ee.834e7e","type":"ui_text","z":"d72b056f.0d3248","group":"d8123882.e133f8","order":2,"width":0,"height":0,"name":"","label":"ID","format":"{{msg.payload[0].valores[0]}}","layout":"row-spread","x":486,"y":410,"wires":[]},{"id":"8d496871.e689f8","type":"ui_gauge","z":"d72b056f.0d3248","name":"temperatura","group":"d8123882.e133f8","order":1,"width":0,"height":0,"gtype":"gage","title":"temperatura","label":"ºC","format":"{{msg.payload[0].valores[1]}}","min":"-10","max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":494,"y":317,"wires":[]},{"id":"de12f99f.e3dad8","type":"switch","z":"d72b056f.0d3248","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"payload.**[valores[0]=3289211400].valores","vt":"jsonata"}],"checkall":"true","repair":false,"outputs":1,"x":285.5,"y":42,"wires":[["9f4f2111.81f77"]]},{"id":"e41eb6c4.ee5148","type":"switch","z":"d72b056f.0d3248","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"payload.**[valores[0]=681017712].valores","vt":"jsonata"}],"checkall":"true","repair":false,"outputs":1,"x":281,"y":165,"wires":[["4310fb87.f23c44"]]},{"id":"c7266bc3.062ef8","type":"mqtt-broker","z":"","name":"TCC ","broker":"m24.cloudmqtt.com","port":"14910","clientid":"","usetls":false,"compatmode":true,"keepalive":"1","cleansession":true,"birthTopic":"esp/test","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"d8123882.e133f8","type":"ui_group","z":"","name":"Aviário IFSC ","tab":"52698c4b.9a7b34","disp":true,"width":"6","collapse":false},{"id":"52698c4b.9a7b34","type":"ui_tab","z":"","name":"TCC - Movitoramento de Aviários","icon":"TCC - Movitoramento de Aviários","disabled":false,"hidden":false}]

Do you realize that in a switch node, you can test for more than one thing?
Attach a debug node (set to display the complete msg object) to the output of the MQTT-in node and open all the dropdown and taste whr you get here (only need one debug)

I still don't understand how to do this):

run the flow and when you see the output in the debug tab, click ever one of the triangles
Screen Shot 2020-03-16 at 7.43.28 PM

so the wholedebug shows
Screen Shot 2020-03-16 at 7.42.44 PM

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.