Hi,
how to create to the status change only one time send message(connected or disconnected) At the moment looping after 10sc.
image looping message
[
{
"id": "8908298453a7101b",
"type": "inject",
"z": "c316ced4bde3414b",
"name": "QueryStatus 10sc",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "10",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 110,
"y": 180,
"wires": [
[
"59f8f786dc8e47ac"
]
]
},
{
"id": "59f8f786dc8e47ac",
"type": "function",
"z": "c316ced4bde3414b",
"name": "Ip",
"func": "msg.payload =\n[\n \n {\n \"host\": \"192.168.16.5\"\n }\n]\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 270,
"y": 180,
"wires": [
[
"25ea9c4f735a8ad3"
]
]
},
{
"id": "25ea9c4f735a8ad3",
"type": "ping",
"z": "c316ced4bde3414b",
"mode": "triggered",
"name": "",
"host": "",
"timer": "20",
"inputs": 1,
"x": 390,
"y": 180,
"wires": [
[
"1c7915fa2aad22cd"
]
]
},
{
"id": "1c7915fa2aad22cd",
"type": "function",
"z": "c316ced4bde3414b",
"name": "S.Results",
"func": "let pingResults = flow.get(\"pingResults\") || {}\nlet thisPing = pingResults[msg.topic] || {};\nlet success = msg.payload !== false && msg.payload >= 0;\n\nthisPing.host = msg.ping.host;\nthisPing.timestamp = new Date();\nthisPing.responseTime = success ? msg.payload : null;\nthisPing.state = success ? \"connected\" : \"disconnected\" ;\n\npingResults[msg.topic] = thisPing;\nflow.set(\"pingResults\",pingResults);\n\nmsg.payload = thisPing;\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 520,
"y": 180,
"wires": [
[
"e016a53d35371d05"
]
]
},
{
"id": "e016a53d35371d05",
"type": "change",
"z": "c316ced4bde3414b",
"name": "State",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "$$.payload.state",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 650,
"y": 180,
"wires": [
[
"92ef6bcdba454e0a"
]
]
},
{
"id": "92ef6bcdba454e0a",
"type": "debug",
"z": "c316ced4bde3414b",
"name": "payload",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 800,
"y": 180,
"wires": []
}
]
thanks