The program show this:
[
{
"id": "8ee0a7b9.5a9af8",
"type": "debug",
"z": "ebbf8292.d6fd4",
"name": "Output of function",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"x": 740.1001243591309,
"y": 26.200007438659668,
"wires": []
},
{
"id": "2778a415.504f8c",
"type": "function",
"z": "ebbf8292.d6fd4",
"name": "State of Sensor",
"func": "if(msg.topic[0]===0){\n msg.topic = " Sensor 1 not ok";\n}\nif(msg.topic[1]===0){\n msg.topic = " Sensor 2 is not ok";\n}\nif(msg.topic[2]===0){\n msg.topic = " Sensor 3 is not ok";\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 672.1001281738281,
"y": 203.00000286102295,
"wires": [
[
"1fec7822.d11a68",
"e740535a.cb834"
]
]
},
{
"id": "9a3bc2da.a4121",
"type": "join",
"z": "ebbf8292.d6fd4",
"name": "",
"mode": "custom",
"build": "object",
"property": "payload",
"propertyType": "msg",
"key": "topic",
"joiner": "\n",
"joinerType": "str",
"accumulate": false,
"timeout": "",
"count": "3",
"reduceRight": false,
"reduceExp": "",
"reduceInit": "",
"reduceInitType": "",
"reduceFixup": "",
"x": 503.1000061035156,
"y": 192.1999969482422,
"wires": [
[
"2778a415.504f8c",
"f6ef318b.063df"
]
]
},
{
"id": "1be92342.c9d3fd",
"type": "inject",
"z": "ebbf8292.d6fd4",
"name": "",
"topic": "sensor1",
"payload": "0",
"payloadType": "num",
"repeat": "10",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 274.3000030517578,
"y": 65.00000476837158,
"wires": [
[
"9a3bc2da.a4121"
]
]
},
{
"id": "a4dcbec2.bbf95",
"type": "inject",
"z": "ebbf8292.d6fd4",
"name": "",
"topic": "sensor2",
"payload": "25",
"payloadType": "num",
"repeat": "10",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 291.1000061035156,
"y": 181.00000286102295,
"wires": [
[
"9a3bc2da.a4121"
]
]
},
{
"id": "634894b0.fdecec",
"type": "inject",
"z": "ebbf8292.d6fd4",
"name": "",
"topic": "sensor3",
"payload": "0",
"payloadType": "num",
"repeat": "10",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 284.1000061035156,
"y": 288.00000286102295,
"wires": [
[
"9a3bc2da.a4121"
]
]
},
{
"id": "f6ef318b.063df",
"type": "debug",
"z": "ebbf8292.d6fd4",
"name": "Output of join",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"x": 588.8999938964844,
"y": 337.40000343322754,
"wires": []
},
{
"id": "e740535a.cb834",
"type": "debug",
"z": "ebbf8292.d6fd4",
"name": "Output of state of sensor",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"x": 939.1000633239746,
"y": 314.00000381469727,
"wires": []
},
{
"id": "1fec7822.d11a68",
"type": "function",
"z": "ebbf8292.d6fd4",
"name": "Function to send the data to database",
"func": "var newmsg=new Date().toString();\nmsg.topic= "INSERT INTO testebase VALUES ('"+new Date().toString()+"','"+msg.topic["sensor1"]+"','"+msg.topic["sensor2"]+"','"+msg.topic["sensor3"]+"')";\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 982.1001205444336,
"y": 203.20000076293945,
"wires": [
[
"8ee0a7b9.5a9af8",
"b5426519.0a4f88"
]
]
}
]