I have array with ip
[{"nazwa":"T1","ip":"10.0.0.71","opis_ip_alarm":"ip alarm 1"},{"nazwa":"T2","ip":"10.0.0.72","opis_ip_alarm":null}]
how loop msg.host by ip
I try this
[
{
"id": "4f61a7737e17d8d3",
"type": "adv ping",
"z": "e79cd8495882236e",
"name": "",
"host": "",
"x": 450,
"y": 160,
"wires": [
[
"549a4d06d5505586",
"6cab19e646867a6b"
]
]
},
{
"id": "20bdc2a9b89d78ca",
"type": "function",
"z": "e79cd8495882236e",
"name": "",
"func": "var ip = msg.payload;\nvar query = [];\n\nfor (var i = 0; i < ip.length; i++) {\n query[i]=ip[i].ip\n}\nmsg.query.forEach(query => node.send({host: query}))\n\nmsg.ip = query;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 270,
"y": 160,
"wires": [
[
"4f61a7737e17d8d3"
]
]
},
{
"id": "62bb480eeab3e30e",
"type": "inject",
"z": "e79cd8495882236e",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "[{\"nazwa\":\"T1\",\"ip\":\"10.0.0.71\",\"opis_ip_alarm\":\"ip alarm 1\"},{\"nazwa\":\"T2\",\"ip\":\"10.0.0.72\",\"opis_ip_alarm\":null}]",
"payloadType": "json",
"x": 90,
"y": 160,
"wires": [
[
"20bdc2a9b89d78ca"
]
]
},
{
"id": "549a4d06d5505586",
"type": "debug",
"z": "e79cd8495882236e",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 610,
"y": 160,
"wires": []
}
]