I'm quite new to the world of node red and I have a project where I don't really know where to start, and I need some advice, currently my project includes a reading part from an mqtt server, of several "buoys" of which it shows the location on a world map. I would like to be able to drag and drop these buoys and have as a result a coordinate to return to the mqtt server, to then be processed by another program
here is my actual flow, i know, it's messy, and it probably doesn't work if the server or the py program aren't up
[
{
"id": "f6f2187d.f17ca8",
"type": "tab",
"label": "Flow 1",
"disabled": false,
"info":
[
{
"id": "f6f2187d.f17ca8",
"type": "tab",
"label": "Flow 1",
"disabled": false,
"info": ""
},
{
"id": "dff0a33eddfabb82",
"type": "mqtt in",
"z": "f6f2187d.f17ca8",
"name": "mqtt moquitto",
"topic": "mavlink_data_10.8.0.55/json",
"qos": "2",
"datatype": "auto-detect",
"broker": "b66b9508dd319e39",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 690,
"y": 140,
"wires": [
[
"cceba5e11f8002d8"
]
]
},
{
"id": "28b6af694511feba",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "json from py scrpit .55",
"info": "",
"x": 720,
"y": 100,
"wires": []
},
{
"id": "aa370cdd0f7f75d0",
"type": "inject",
"z": "f6f2187d.f17ca8",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "nomeprova",
"payloadType": "str",
"x": 160,
"y": 500,
"wires": [
[
"afa709ea469d3081"
]
]
},
{
"id": "4eaab1b2536db849",
"type": "inject",
"z": "f6f2187d.f17ca8",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "boa",
"payloadType": "str",
"x": 150,
"y": 540,
"wires": [
[
"24d6f91998f64cc3"
]
]
},
{
"id": "afa709ea469d3081",
"type": "mqtt out",
"z": "f6f2187d.f17ca8",
"name": "mqttt out name",
"topic": "datiFromNodeRed/name",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "b66b9508dd319e39",
"x": 380,
"y": 500,
"wires": []
},
{
"id": "24d6f91998f64cc3",
"type": "mqtt out",
"z": "f6f2187d.f17ca8",
"name": "mqttt out name",
"topic": "datiFromNodeRed/tipoIcona",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "b66b9508dd319e39",
"x": 380,
"y": 540,
"wires": []
},
{
"id": "8abc5c3869b88330",
"type": "mqtt out",
"z": "f6f2187d.f17ca8",
"name": "",
"topic": "heartBeat/redNodeBeat",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "b66b9508dd319e39",
"x": 470,
"y": 220,
"wires": []
},
{
"id": "0aa91f91f6a6eea4",
"type": "inject",
"z": "f6f2187d.f17ca8",
"name": "",
"props": [
{
"p": "payload.heartbeat",
"v": "alive",
"vt": "str"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "3",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "heartBeat",
"x": 250,
"y": 180,
"wires": [
[
"8abc5c3869b88330"
]
]
},
{
"id": "2e1e788158631905",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "inject to mqtt",
"info": "",
"x": 150,
"y": 460,
"wires": []
},
{
"id": "15431a6fc8164dbe",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "heart beat refresh py code",
"info": "",
"x": 290,
"y": 140,
"wires": []
},
{
"id": "86953eeeb7351ae8",
"type": "inject",
"z": "f6f2187d.f17ca8",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "terminate",
"payloadType": "str",
"x": 260,
"y": 220,
"wires": [
[
"8abc5c3869b88330"
]
]
},
{
"id": "72bb8a399974e091",
"type": "mqtt in",
"z": "f6f2187d.f17ca8",
"name": "mqtt moquitto",
"topic": "mavlink_data_10.8.0.54/json",
"qos": "2",
"datatype": "auto-detect",
"broker": "b66b9508dd319e39",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 690,
"y": 240,
"wires": [
[
"bf5722e7779dea0d"
]
]
},
{
"id": "10da5394b0bc5843",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "json from py scrpit .54",
"info": "",
"x": 720,
"y": 200,
"wires": []
},
{
"id": "357f844a1d39d6a8",
"type": "mqtt in",
"z": "f6f2187d.f17ca8",
"name": "mqtt moquitto",
"topic": "mavlink_data_10.8.0.53/json",
"qos": "2",
"datatype": "auto-detect",
"broker": "b66b9508dd319e39",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 690,
"y": 340,
"wires": [
[
"329b7874ddc94e8e"
]
]
},
{
"id": "7eca921ad8cc344a",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "json from py scrpit .53",
"info": "",
"x": 720,
"y": 300,
"wires": []
},
{
"id": "0652516107900e82",
"type": "mqtt in",
"z": "f6f2187d.f17ca8",
"name": "mqtt moquitto",
"topic": "mavlink_data_10.8.0.52/json",
"qos": "2",
"datatype": "auto-detect",
"broker": "b66b9508dd319e39",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 690,
"y": 440,
"wires": [
[
"dd910edfc8b2fe75"
]
]
},
{
"id": "e918dec245d69e78",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "json from py scrpit .52",
"info": "",
"x": 720,
"y": 400,
"wires": []
},
{
"id": "09767dfd01360ce4",
"type": "mqtt in",
"z": "f6f2187d.f17ca8",
"name": "mqtt moquitto",
"topic": "mavlink_data_10.8.0.50/json",
"qos": "2",
"datatype": "auto-detect",
"broker": "b66b9508dd319e39",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 690,
"y": 540,
"wires": [
[
"0393d95c9d305015"
]
]
},
{
"id": "7eb080477792a051",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "json from py scrpit .50",
"info": "",
"x": 720,
"y": 500,
"wires": []
},
{
"id": "cceba5e11f8002d8",
"type": "link out",
"z": "f6f2187d.f17ca8",
"name": "json .55",
"mode": "link",
"links": [
"6a8b5ca9e7d44816"
],
"x": 795,
"y": 160,
"wires": []
},
{
"id": "bf5722e7779dea0d",
"type": "link out",
"z": "f6f2187d.f17ca8",
"name": "json .54",
"mode": "link",
"links": [
"914a4edf01860285"
],
"x": 795,
"y": 260,
"wires": []
},
{
"id": "329b7874ddc94e8e",
"type": "link out",
"z": "f6f2187d.f17ca8",
"name": "json .53",
"mode": "link",
"links": [
"573612281c915aee"
],
"x": 795,
"y": 360,
"wires": []
},
{
"id": "dd910edfc8b2fe75",
"type": "link out",
"z": "f6f2187d.f17ca8",
"name": "json .52",
"mode": "link",
"links": [
"f5dcad1e83c54b2a"
],
"x": 795,
"y": 460,
"wires": []
},
{
"id": "0393d95c9d305015",
"type": "link out",
"z": "f6f2187d.f17ca8",
"name": "json .50",
"mode": "link",
"links": [
"8705087cb84eca16"
],
"x": 795,
"y": 560,
"wires": []
},
{
"id": "cfd3bbc2a0aca344",
"type": "inject",
"z": "f6f2187d.f17ca8",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "CLEAR",
"payload": "",
"payloadType": "date",
"x": 730,
"y": 40,
"wires": [
[]
]
},
{
"id": "067d5b4a048b79c0",
"type": "ui_worldmap",
"z": "f6f2187d.f17ca8",
"group": "7a70e5c28d8ec144",
"order": 0,
"width": 0,
"height": 0,
"name": "",
"lat": "",
"lon": "",
"zoom": "",
"layer": "OSMC",
"cluster": "",
"maxage": "",
"usermenu": "hide",
"layers": "hide",
"panit": "false",
"panlock": "false",
"zoomlock": "false",
"hiderightclick": "true",
"coords": "none",
"showgrid": "false",
"showruler": "false",
"allowFileDrop": "false",
"path": "/worldmap",
"overlist": "DR,CO,RA,DN,HM",
"maplist": "OSMG,OSMC,EsriC,EsriS,EsriT,EsriDG,UKOS",
"mapname": "",
"mapurl": "",
"mapopt": "",
"mapwms": false,
"x": 1500,
"y": 480,
"wires": []
},
{
"id": "573612281c915aee",
"type": "link in",
"z": "f6f2187d.f17ca8",
"name": "world map",
"links": [
"329b7874ddc94e8e"
],
"x": 1085,
"y": 380,
"wires": [
[
"e9de89b6e75d70e0"
]
]
},
{
"id": "e9de89b6e75d70e0",
"type": "function",
"z": "f6f2187d.f17ca8",
"name": "function 1",
"func": "const lat = msg.payload.GPS_RAW_INT.lat;\nconst lon = msg.payload.GPS_RAW_INT.lon;\nconst hdg = msg.payload.GLOBAL_POSITION_INT.hdg\nconst vel = msg.payload.GPS_RAW_INT.vel\n\nmsg.payload = {\n lat: lat / Math.pow(10, 7),\n lon: lon / Math.pow(10, 7),\n hdg: hdg / Math.pow(10, 2),\n vel: vel,\n name: \"default name 53\",\n icon: \"ship\"\n};\n\nreturn msg;\n",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1180,
"y": 380,
"wires": [
[
"757a9596885d71cc"
]
]
},
{
"id": "72f84c9f274b5875",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "map .53",
"info": "",
"x": 1160,
"y": 340,
"wires": []
},
{
"id": "914a4edf01860285",
"type": "link in",
"z": "f6f2187d.f17ca8",
"name": "world map",
"links": [
"bf5722e7779dea0d"
],
"x": 1085,
"y": 280,
"wires": [
[
"b371467e59067587"
]
]
},
{
"id": "b371467e59067587",
"type": "function",
"z": "f6f2187d.f17ca8",
"name": "function 2",
"func": "const lat = msg.payload.GPS_RAW_INT.lat;\nconst lon = msg.payload.GPS_RAW_INT.lon;\nconst hdg = msg.payload.GLOBAL_POSITION_INT.hdg\nconst vel = msg.payload.GPS_RAW_INT.vel\n\nmsg.payload = {\n lat: lat / Math.pow(10, 7),\n lon: lon / Math.pow(10, 7),\n hdg: hdg / Math.pow(10, 2),\n vel: vel,\n name: \"default name 54\",\n icon: \"ship\"\n};\n\nreturn msg;\n",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1180,
"y": 280,
"wires": [
[
"757a9596885d71cc"
]
]
},
{
"id": "f6b8ed4f34568b85",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "map .54",
"info": "",
"x": 1160,
"y": 240,
"wires": []
},
{
"id": "6a8b5ca9e7d44816",
"type": "link in",
"z": "f6f2187d.f17ca8",
"name": "world map",
"links": [
"cceba5e11f8002d8"
],
"x": 1085,
"y": 180,
"wires": [
[
"a81efc8cea338596"
]
]
},
{
"id": "a81efc8cea338596",
"type": "function",
"z": "f6f2187d.f17ca8",
"name": "function 3",
"func": "const lat = msg.payload.GPS_RAW_INT.lat;\nconst lon = msg.payload.GPS_RAW_INT.lon;\nconst hdg = msg.payload.GLOBAL_POSITION_INT.hdg\nconst vel = msg.payload.GPS_RAW_INT.vel\n\nmsg.payload = {\n lat: lat / Math.pow(10, 7),\n lon: lon / Math.pow(10, 7),\n hdg: hdg / Math.pow(10, 2),\n vel: vel,\n name: \"default name 55\",\n icon: \"ship\"\n};\n\nreturn msg;\n",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1180,
"y": 180,
"wires": [
[
"757a9596885d71cc"
]
]
},
{
"id": "4b9e5ae8ad9f47ce",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "map .55",
"info": "",
"x": 1160,
"y": 140,
"wires": []
},
{
"id": "f5dcad1e83c54b2a",
"type": "link in",
"z": "f6f2187d.f17ca8",
"name": "world map",
"links": [
"dd910edfc8b2fe75"
],
"x": 1245,
"y": 220,
"wires": [
[
"7c71964a7dc8facd"
]
]
},
{
"id": "7c71964a7dc8facd",
"type": "function",
"z": "f6f2187d.f17ca8",
"name": "function 4",
"func": "const lat = msg.payload.GPS_RAW_INT.lat;\nconst lon = msg.payload.GPS_RAW_INT.lon;\nconst hdg = msg.payload.GLOBAL_POSITION_INT.hdg\nconst vel = msg.payload.GPS_RAW_INT.vel\n\nmsg.payload = {\n lat: lat / Math.pow(10, 7),\n lon: lon / Math.pow(10, 7),\n hdg: hdg / Math.pow(10, 2),\n vel: vel,\n name: \"default name 52\",\n icon: \"ship\"\n};\n\nreturn msg;\n",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1340,
"y": 220,
"wires": [
[
"757a9596885d71cc"
]
]
},
{
"id": "71b00b5410e36d10",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "map .52",
"info": "",
"x": 1320,
"y": 180,
"wires": []
},
{
"id": "757a9596885d71cc",
"type": "worldmap",
"z": "f6f2187d.f17ca8",
"name": "",
"lat": "",
"lon": "",
"zoom": "",
"layer": "OSMG",
"cluster": "",
"maxage": "",
"usermenu": "show",
"layers": "show",
"panit": "false",
"panlock": "false",
"zoomlock": "false",
"hiderightclick": "false",
"coords": "none",
"showgrid": "false",
"showruler": "false",
"allowFileDrop": "false",
"path": "/worldmap",
"overlist": "DR,CO,RA,DN",
"maplist": "OSMG,OSMC,EsriC,EsriS,UKOS",
"mapname": "",
"mapurl": "",
"mapopt": "",
"mapwms": false,
"x": 1700,
"y": 260,
"wires": []
},
{
"id": "8705087cb84eca16",
"type": "link in",
"z": "f6f2187d.f17ca8",
"name": "world map",
"links": [
"0393d95c9d305015"
],
"x": 1245,
"y": 320,
"wires": [
[
"dca4f5a2676e91f1"
]
]
},
{
"id": "dca4f5a2676e91f1",
"type": "function",
"z": "f6f2187d.f17ca8",
"name": "function 5",
"func": "const lat = msg.payload.GPS_RAW_INT.lat;\nconst lon = msg.payload.GPS_RAW_INT.lon;\nconst hdg = msg.payload.GLOBAL_POSITION_INT.hdg\nconst vel = msg.payload.GPS_RAW_INT.vel\n\nmsg.payload = {\n lat: lat / Math.pow(10, 7),\n lon: lon / Math.pow(10, 7),\n hdg: hdg / Math.pow(10, 2),\n vel: vel,\n name: \"default name 50\",\n icon: \"ship\"\n};\n\nreturn msg;\n",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1340,
"y": 320,
"wires": [
[
"757a9596885d71cc"
]
]
},
{
"id": "8f8fa833ab72be7c",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "map .50",
"info": "",
"x": 1320,
"y": 280,
"wires": []
},
{
"id": "b66b9508dd319e39",
"type": "mqtt-broker",
"name": "mosquitto boe",
"broker": "10.0.0.99",
"port": "1888",
"clientid": "",
"autoConnect": true,
"usetls": false,
"protocolVersion": "4",
"keepalive": "60",
"cleansession": true,
"autoUnsubscribe": true,
"birthTopic": "",
"birthQos": "0",
"birthRetain": "false",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closeRetain": "false",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willRetain": "false",
"willPayload": "",
"willMsg": {},
"userProps": "",
"sessionExpiry": ""
},
{
"id": "7a70e5c28d8ec144",
"type": "ui_group",
"name": "world map",
"tab": "451791de0953f8e1",
"order": 1,
"disp": true,
"width": "11",
"collapse": true,
"className": ""
},
{
"id": "451791de0953f8e1",
"type": "ui_tab",
"name": "home",
"icon": "dashboard",
"order": 1,
"disabled": false,
"hidden": false
}
]