[
{
"id": "c0cb50b.7f76a3",
"type": "tab",
"label": "Grove_Device",
"disabled": false,
"info": ""
},
{
"id": "763be56f.189914",
"type": "mqtt-broker",
"z": "",
"name": "GroveDevice",
"broker": "192.168.2.169",
"port": "1883",
"clientid": "",
"usetls": false,
"compatmode": true,
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"willTopic": "",
"willQos": "0",
"willPayload": ""
},
{
"id": "5313a928.201298",
"type": "ui_tab",
"z": "",
"name": "EdgeX - Smart Factory - Production Line Use Case",
"icon": "dashboard",
"disabled": false,
"hidden": false
},
{
"id": "a976ff15.85f498",
"type": "ui_group",
"z": "",
"name": "Package Monitoring",
"tab": "5313a928.201298",
"order": 1,
"disp": true,
"width": "12",
"collapse": false
},
{
"id": "ea195502.839d28",
"type": "ui_group",
"z": "",
"name": "Production Line Monitoring",
"tab": "5313a928.201298",
"order": 2,
"disp": true,
"width": "12",
"collapse": false
},
{
"id": "bde73c0f.ce374",
"type": "ui_base",
"theme": {
"name": "theme-light",
"lightTheme": {
"default": "#0094CE",
"baseColor": "#0094CE",
"baseFont": "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif",
"edited": true,
"reset": false
},
"darkTheme": {
"default": "#097479",
"baseColor": "#097479",
"baseFont": "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif",
"edited": false
},
"customTheme": {
"name": "Untitled Theme 1",
"default": "#4B7930",
"baseColor": "#4B7930",
"baseFont": "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"
},
"themeState": {
"base-color": {
"default": "#0094CE",
"value": "#0094CE",
"edited": false
},
"page-titlebar-backgroundColor": {
"value": "#0094CE",
"edited": false
},
"page-backgroundColor": {
"value": "#fafafa",
"edited": false
},
"page-sidebar-backgroundColor": {
"value": "#ffffff",
"edited": false
},
"group-textColor": {
"value": "#1bbfff",
"edited": false
},
"group-borderColor": {
"value": "#ffffff",
"edited": false
},
"group-backgroundColor": {
"value": "#ffffff",
"edited": false
},
"widget-textColor": {
"value": "#111111",
"edited": false
},
"widget-backgroundColor": {
"value": "#0094ce",
"edited": false
},
"widget-borderColor": {
"value": "#ffffff",
"edited": false
},
"base-font": {
"value": "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"
}
},
"angularTheme": {
"primary": "indigo",
"accents": "blue",
"warn": "red",
"background": "grey"
}
},
"site": {
"name": "Node-RED Dashboard",
"hideToolbar": "false",
"allowSwipe": "false",
"lockMenu": "false",
"allowTempTheme": "true",
"dateFormat": "DD/MM/YYYY",
"sizes": {
"sx": 48,
"sy": 48,
"gx": 19,
"gy": 6,
"cx": 6,
"cy": 6,
"px": 0,
"py": 0
}
}
},
{
"id": "735c4802.cc64f8",
"type": "ui_group",
"name": "Group 3",
"tab": "5313a928.201298",
"order": 3,
"disp": true,
"width": 6
},
{
"id": "e98d2e91.c7a24",
"type": "mqtt in",
"z": "c0cb50b.7f76a3",
"name": "MQTT_DeviceGrove",
"topic": "MQTT_DeviceGrove",
"qos": "2",
"broker": "763be56f.189914",
"x": 219.74993133544922,
"y": 190.74997901916504,
"wires": [
[
"ecb33cb1.cc778"
]
]
},
{
"id": "ecb33cb1.cc778",
"type": "json",
"z": "c0cb50b.7f76a3",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 440.7500343322754,
"y": 190.74999904632568,
"wires": [
[
"8d8aeb9b.78432",
"df23ae53.17c7e",
"19a75597.d3073a",
"1721a2b7.f8de8d"
]
]
},
{
"id": "8d8aeb9b.78432",
"type": "function",
"z": "c0cb50b.7f76a3",
"name": "RotaryAngle",
"func": "for (var i = 0; i < msg.payload.readings.length; i++)\n{\n if (msg.payload.readings[i].name == \"RotaryAngle\")\n {\n twoPlacedFloat = parseFloat(msg.payload.readings[0].value).toFixed(2)\n msg.payload = twoPlacedFloat;\n \n flow.set (\"RotaryAngle\", msg.payload);\n return msg;\n }\n}\n\nreturn null;",
"outputs": 1,
"noerr": 0,
"x": 655.5278396606445,
"y": 50.3055419921875,
"wires": [
[
"9d5dd2c1.71c6d8",
"6345abb4.fd8234"
]
]
},
{
"id": "df23ae53.17c7e",
"type": "function",
"z": "c0cb50b.7f76a3",
"name": "LightIntensity",
"func": "for (var i = 0; i < msg.payload.readings.length; i++)\n{\n if (msg.payload.readings[i].name == \"LightIntensity\")\n {\n twoPlacedFloat = parseFloat(msg.payload.readings[0].value).toFixed(2)\n msg.payload = twoPlacedFloat;\n \n flow.set (\"LightIntensity\", msg.payload);\n return msg;\n }\n}\n\nreturn null;",
"outputs": 1,
"noerr": 0,
"x": 654.4998931884766,
"y": 140.00000095367432,
"wires": [
[
"25a318bf.04cd4",
"7f087b47.0f029c"
]
]
},
{
"id": "19a75597.d3073a",
"type": "function",
"z": "c0cb50b.7f76a3",
"name": "SoundIntensity",
"func": "for (var i = 0; i < msg.payload.readings.length; i++)\n{\n if (msg.payload.readings[i].name == \"SoundIntensity\")\n {\n twoPlacedFloat = parseFloat(msg.payload.readings[0].value * 10).toFixed(2)\n msg.payload = twoPlacedFloat;\n \n flow.set (\"SoundIntensity\", msg.payload);\n return msg;\n }\n}\n\nreturn null;",
"outputs": 1,
"noerr": 0,
"x": 652.7499504089355,
"y": 482.2500286102295,
"wires": [
[
"5645661e.34b028",
"1bc8acfd.2ec65b"
]
]
},
{
"id": "7f087b47.0f029c",
"type": "ui_text",
"z": "c0cb50b.7f76a3",
"group": "a976ff15.85f498",
"order": 6,
"width": "6",
"height": "1",
"name": "Package Size",
"label": "Package Size:",
"format": "{{msg.payload}}",
"layout": "row-center",
"x": 926.4998626708984,
"y": 157.75005531311035,
"wires": []
},
{
"id": "1bc8acfd.2ec65b",
"type": "ui_text",
"z": "c0cb50b.7f76a3",
"group": "ea195502.839d28",
"order": 7,
"width": "6",
"height": "1",
"name": "Sound / Vibration",
"label": "Current Level: ",
"format": "{{msg.payload}}",
"layout": "row-left",
"x": 938.5001068115234,
"y": 519.7499914169312,
"wires": []
},
{
"id": "9d5dd2c1.71c6d8",
"type": "ui_gauge",
"z": "c0cb50b.7f76a3",
"name": "Package Weight Graph",
"group": "a976ff15.85f498",
"order": 1,
"width": "6",
"height": "8",
"gtype": "gage",
"title": "Package Weight",
"label": "KG",
"format": "{{value}}",
"min": 0,
"max": "250",
"colors": [
"#ca3838",
"#22dd5a",
"#ca3838"
],
"seg1": "100",
"seg2": "150",
"x": 956.4999389648438,
"y": 22.74999713897705,
"wires": []
},
{
"id": "25a318bf.04cd4",
"type": "ui_chart",
"z": "c0cb50b.7f76a3",
"name": "Package Size Graph",
"group": "a976ff15.85f498",
"order": 2,
"width": "6",
"height": "6",
"label": "Package Size",
"chartType": "line",
"legend": "false",
"xformat": "auto",
"interpolate": "linear",
"nodata": "No data yet",
"dot": false,
"ymin": "",
"ymax": "",
"removeOlder": "5",
"removeOlderPoints": "",
"removeOlderUnit": "60",
"cutout": 0,
"useOneColor": false,
"colors": [
"#1f77b4",
"#aec7e8",
"#ff7f0e",
"#2ca02c",
"#98df8a",
"#d62728",
"#ff9896",
"#9467bd",
"#c5b0d5"
],
"useOldStyle": false,
"x": 945.4999237060547,
"y": 119.00005054473877,
"wires": [
[],
[]
]
},
{
"id": "5645661e.34b028",
"type": "ui_chart",
"z": "c0cb50b.7f76a3",
"name": "Sound / Vibration Graph",
"group": "ea195502.839d28",
"order": 2,
"width": "6",
"height": "6",
"label": "Sound / Vibration",
"chartType": "line",
"legend": "false",
"xformat": "auto",
"interpolate": "linear",
"nodata": "No data yet",
"dot": false,
"ymin": "",
"ymax": "",
"removeOlder": "30",
"removeOlderPoints": "",
"removeOlderUnit": "1",
"cutout": 0,
"useOneColor": false,
"colors": [
"#1f77b4",
"#aec7e8",
"#ff7f0e",
"#2ca02c",
"#98df8a",
"#d62728",
"#ff9896",
"#9467bd",
"#c5b0d5"
],
"useOldStyle": false,
"x": 958.5,
"y": 460.74999141693115,
"wires": [
[],
[]
]
},
{
"id": "93e4efd4.5802d",
"type": "inject",
"z": "c0cb50b.7f76a3",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "2",
"crontab": "",
"once": true,
"onceDelay": "2",
"x": 159.00006484985352,
"y": 1047.0000495910645,
"wires": [
[
"c95e3c88.bf06f",
"3c23c1aa.e04bbe"
]
]
},
{
"id": "c95e3c88.bf06f",
"type": "function",
"z": "c0cb50b.7f76a3",
"name": "New Package",
"func": "if (flow.get(\"RotaryAngle\") ===undefined)\n{\n // no data arrived yet\n return null;\n}\n\nvar packageCount = flow.get (\"PackageCount\") + 1;\nflow.set (\"PackageCount\", packageCount);\nmsg.payload = packageCount;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 387.0000991821289,
"y": 983.0001010894775,
"wires": [
[
"38901545.82c22a",
"2daf4899.bf8c08"
]
]
},
{
"id": "47e5dbf1.1b0f04",
"type": "inject",
"z": "c0cb50b.7f76a3",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"x": 179.0000228881836,
"y": 657.0000219345093,
"wires": [
[
"75f63552.85931c",
"9ed801fc.4933e",
"eec0f1de.cea93",
"409a837f.ca1b2c"
]
]
},
{
"id": "75f63552.85931c",
"type": "function",
"z": "c0cb50b.7f76a3",
"name": "Init Values",
"func": "flow.set (\"PackageCount\", 0);\nflow.set (\"GoodCount\", 0);\nflow.set (\"BadCount\", 0);\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 410.00006103515625,
"y": 566.9999914169312,
"wires": [
[]
]
},
{
"id": "72f3b838.929778",
"type": "ui_text",
"z": "c0cb50b.7f76a3",
"group": "a976ff15.85f498",
"order": 8,
"width": "12",
"height": "1",
"name": "",
"label": "Total Packages Accepted:",
"format": "{{msg.payload}}",
"layout": "row-center",
"x": 1369.0006523132324,
"y": 1071.000280380249,
"wires": []
},
{
"id": "22b6410d.9c8f8e",
"type": "ui_text",
"z": "c0cb50b.7f76a3",
"group": "a976ff15.85f498",
"order": 9,
"width": "12",
"height": "1",
"name": "",
"label": "Total Packages Rejected:",
"format": "{{msg.payload}}",
"layout": "row-center",
"x": 1370.000259399414,
"y": 1141.0001287460327,
"wires": []
},
{
"id": "359fbb6f.5ebbf4",
"type": "function",
"z": "c0cb50b.7f76a3",
"name": "GoodCount",
"func": "msg.payload = flow.get (\"GoodCount\");\n\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"x": 1128.0003967285156,
"y": 1071.0002994537354,
"wires": [
[
"72f3b838.929778"
]
]
},
{
"id": "735e4fb0.16b62",
"type": "function",
"z": "c0cb50b.7f76a3",
"name": "BadCount",
"func": "msg.payload = flow.get (\"BadCount\");\n\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"x": 1124.0001487731934,
"y": 1141.000163078308,
"wires": [
[
"22b6410d.9c8f8e"
]
]
},
{
"id": "20e5a639.840fc2",
"type": "http request",
"z": "c0cb50b.7f76a3",
"name": "Green LED",
"method": "PUT",
"ret": "txt",
"url": "http://edgex-device-grove:49992/api/v1/device/all/Set_GreenLed",
"tls": "",
"x": 1392.8835144042969,
"y": 823.383505821228,
"wires": [
[]
]
},
{
"id": "ac2f795.74b2688",
"type": "function",
"z": "c0cb50b.7f76a3",
"name": "Set LEDs",
"func": "var data = {};\n \nif (msg.packageAccepted === \"true\")\n{\n data[\"Green-LED\"] = \"true\";\n msg.payload = JSON.stringify (data);\n return [msg, null];\n}\nelse\n{\n data[\"Red-LED\"] = \"true\";\n msg.payload = JSON.stringify (data);\n return [null, msg];\n}\n\n//msg.payload = JSON.stringify (data);\n\n//if \n//return msg;\n \n\n",
"outputs": 2,
"noerr": 0,
"x": 1115.8835716247559,
"y": 1006.8835401535034,
"wires": [
[
"20e5a639.840fc2"
],
[
"50df276b.3687f"
]
]
},
{
"id": "50df276b.3687f",
"type": "http request",
"z": "c0cb50b.7f76a3",
"name": "Red LED",
"method": "PUT",
"ret": "txt",
"url": "http://edgex-device-grove:49992/api/v1/device/all/Set_RedLed",
"tls": "",
"x": 1394.8835468292236,
"y": 923.883508682251,
"wires": [
[]
]
},
{
"id": "712fdf88.7831a",
"type": "ui_numeric",
"z": "c0cb50b.7f76a3",
"name": "",
"label": "Min Package Size",
"tooltip": "",
"group": "a976ff15.85f498",
"order": 3,
"width": "6",
"height": "1",
"passthru": true,
"topic": "",
"format": "{{value}}",
"min": 0,
"max": "100",
"step": 1,
"x": 707.1666946411133,
"y": 623.1111583709717,
"wires": [
[
"efb1695b.277468"
]
]
},
{
"id": "97267dc8.f20b9",
"type": "function",
"z": "c0cb50b.7f76a3",
"name": "Analyse Package",
"func": "var rotaryAngle = flow.get (\"RotaryAngle\");\nvar lightIntensity = flow.get (\"LightIntensity\");\nvar packageMin = flow.get(\"PackageMin\");\nvar packageMax = flow.get(\"PackageMax\");\nvar packageID = msg.payload;\n\nif (rotaryAngle > 100 && rotaryAngle < 150)\n{\n if (lightIntensity > packageMin && lightIntensity < packageMax)\n {\n msg.payload = \" PACKAGE \" + packageID + \" ACCEPTED\";\n var goodCount = flow.get (\"GoodCount\") + 1;\n flow.set (\"GoodCount\", goodCount);\n msg.packageAccepted = \"true\";\n msg.fontColor = \"Green\";\n return msg;\n }\n}\n\nmsg.payload = \" PACKAGE \" + packageID + \" REJECTED\";\nvar badCount = flow.get (\"BadCount\") + 1;\nflow.set (\"BadCount\", badCount);\nmsg.fontColor = \"Red\";\nmsg.packageAccepted = \"false\";\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 837.0001525878906,
"y": 1029.0003271102905,
"wires": [
[
"995e429d.35834",
"ac2f795.74b2688",
"735e4fb0.16b62",
"359fbb6f.5ebbf4"
]
]
},
{
"id": "995e429d.35834",
"type": "ui_text",
"z": "c0cb50b.7f76a3",
"group": "a976ff15.85f498",
"order": 7,
"width": "12",
"height": "1",
"name": "Package Decision",
"label": "",
"format": " {{msg.payload}} ",
"layout": "row-center",
"x": 1077.0006408691406,
"y": 929.0005140304565,
"wires": []
},
{
"id": "7e0e63fc.c1e2dc",
"type": "ui_numeric",
"z": "c0cb50b.7f76a3",
"name": "",
"label": "Max Package Size",
"tooltip": "",
"group": "a976ff15.85f498",
"order": 4,
"width": "6",
"height": "1",
"passthru": true,
"topic": "",
"format": "{{value}}",
"min": 0,
"max": "100",
"step": 1,
"x": 706.0000610351562,
"y": 682.999997138977,
"wires": [
[
"ed13b4b7.46a658"
]
]
},
{
"id": "38901545.82c22a",
"type": "function",
"z": "c0cb50b.7f76a3",
"name": "Clear",
"func": "msg.payload = \"Calculating...\";\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 631.0004234313965,
"y": 935.7337560653687,
"wires": [
[
"995e429d.35834",
"879f1b1b.536288"
]
]
},
{
"id": "6345abb4.fd8234",
"type": "ui_text",
"z": "c0cb50b.7f76a3",
"group": "a976ff15.85f498",
"order": 5,
"width": "6",
"height": "1",
"name": "Package Weight",
"label": "Package Weight:",
"format": "{{msg.payload}}",
"layout": "row-left",
"x": 928.0174407958984,
"y": 69.01041221618652,
"wires": []
},
{
"id": "9ed801fc.4933e",
"type": "function",
"z": "c0cb50b.7f76a3",
"name": "Default Min Package",
"func": "msg.payload = 3;\nflow.set (\"PackageMin\", msg.payload);\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 439.0195503234863,
"y": 625.0038967132568,
"wires": [
[
"712fdf88.7831a"
]
]
},
{
"id": "eec0f1de.cea93",
"type": "function",
"z": "c0cb50b.7f76a3",
"name": "Default Max Package",
"func": "msg.payload = 10;\nflow.set (\"PackageMax\", msg.payload);\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 437.01953506469727,
"y": 684.0039138793945,
"wires": [
[
"7e0e63fc.c1e2dc"
]
]
},
{
"id": "efb1695b.277468",
"type": "function",
"z": "c0cb50b.7f76a3",
"name": "Set PackageMin",
"func": "flow.set (\"PackageMin\", msg.payload);",
"outputs": 1,
"noerr": 0,
"x": 945.019660949707,
"y": 622.003942489624,
"wires": [
[]
]
},
{
"id": "ed13b4b7.46a658",
"type": "function",
"z": "c0cb50b.7f76a3",
"name": "Set PackageMax",
"func": "flow.set (\"PackageMax\", msg.payload);",
"outputs": 1,
"noerr": 0,
"x": 950.019645690918,
"y": 683.003942489624,
"wires": [
[]
]
},
{
"id": "1721a2b7.f8de8d",
"type": "function",
"z": "c0cb50b.7f76a3",
"name": "ButtonState",
"func": "for (var i = 0; i < msg.payload.readings.length; i++)\n{\n if (msg.payload.readings[i].name == \"ButtonState\")\n {\n var value = parseInt(msg.payload.readings[0].value)\n \n if (value == 1)\n {\n msg.payload = \"PRESSED!!!\";\n }\n else\n {\n msg.payload = \"not pressed\";\n }\n \n flow.set (\"ButtonState\", value);\n return msg;\n }\n}\n\nreturn null;",
"outputs": 1,
"noerr": 0,
"x": 649.0194778442383,
"y": 302.00389671325684,
"wires": [
[
"3801f3f1.a528cc",
"6a965bd2.e296f4",
"deeb411d.5e28b",
"c7eba607.bfd7a8"
]
]
},
{
"id": "3801f3f1.a528cc",
"type": "ui_text",
"z": "c0cb50b.7f76a3",
"group": "ea195502.839d28",
"order": 3,
"width": "6",
"height": "2",
"name": "Button Status",
"label": "",
"format": "{{msg.payload}}",
"layout": "col-center",
"x": 928.0197868347168,
"y": 253.00396156311035,
"wires": []
},
{
"id": "6a965bd2.e296f4",
"type": "function",
"z": "c0cb50b.7f76a3",
"name": "Button Check",
"func": "var buttonState = flow.get (\"ButtonState\");\n\nif (buttonState == 1)\n{\n msg.payload = \" EMERGENCY - SOUNDING ALARM!!! \";\n}\nelse\n{\n msg.payload = \"Everything's fine\";\n}\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 929.0198364257812,
"y": 299.00401401519775,
"wires": [
[
"5081b775.3b8e88"
]
]
},
{
"id": "5081b775.3b8e88",
"type": "ui_text",
"z": "c0cb50b.7f76a3",
"group": "ea195502.839d28",
"order": 4,
"width": "6",
"height": "3",
"name": "Button Action",
"label": "",
"format": "{{msg.payload}}",
"layout": "row-center",
"x": 1169.0195770263672,
"y": 299.0040063858032,
"wires": []
},
{
"id": "deeb411d.5e28b",
"type": "function",
"z": "c0cb50b.7f76a3",
"name": "Set Buzzer",
"func": "var buttonState = flow.get (\"ButtonState\");\n\nif (buttonState == 1)\n{\n var data = {};\n data[\"Grove-Buzzer\"] = \"true\";\n}\nelse\n{\n var data = {};\n data[\"Grove-Buzzer\"] = \"false\";\n}\n\nmsg.payload = JSON.stringify (data);\nreturn msg;\n \n\n",
"outputs": 1,
"noerr": 0,
"x": 927.0196075439453,
"y": 354.0039691925049,
"wires": [
[
"9cd85554.0b53a8"
]
]
},
{
"id": "9cd85554.0b53a8",
"type": "http request",
"z": "c0cb50b.7f76a3",
"name": "Buzzer",
"method": "PUT",
"ret": "txt",
"url": "http://edgex-device-grove:49992/api/v1/device/all/Set_Buzzer",
"tls": "",
"x": 1152.01957321167,
"y": 354.5039234161377,
"wires": [
[]
]
},
{
"id": "c7eba607.bfd7a8",
"type": "function",
"z": "c0cb50b.7f76a3",
"name": "Set LCD Output",
"func": "var buttonState = flow.get (\"ButtonState\");\n\nvar data = {};\ndata[\"Display-String\"] = \"We're fine here \";\ndata[\"Row\"] = \"0\";\ndata[\"Column\"] = \"0\";\n\nif (buttonState == 1)\n{\n data[\"Display-String\"] = \"Everybody Out!!!\";\n}\n\nmsg.payload = JSON.stringify (data);\nreturn msg;\n \n\n",
"outputs": 1,
"noerr": 0,
"x": 937.0195922851562,
"y": 407.00391483306885,
"wires": [
[
"d3061bd9.03b718"
]
]
},
{
"id": "879f1b1b.536288",
"type": "function",
"z": "c0cb50b.7f76a3",
"name": "Reset LEDs",
"func": "var data = {};\n\ndata[\"Green-LED\"] = \"false\";\ndata[\"Red-LED\"] = \"false\";\n\nmsg.payload = JSON.stringify (data);\nreturn msg;\n \n\n",
"outputs": 1,
"noerr": 0,
"x": 999.019775390625,
"y": 837.0042629241943,
"wires": [
[
"20e5a639.840fc2",
"50df276b.3687f"
]
]
},
{
"id": "d3061bd9.03b718",
"type": "http request",
"z": "c0cb50b.7f76a3",
"name": "LCD Output",
"method": "PUT",
"ret": "txt",
"url": "http://edgex-device-grove:49992/api/v1/device/all/Write_String",
"tls": "",
"x": 1150.019618988037,
"y": 407.00396156311035,
"wires": [
[]
]
},
{
"id": "3c23c1aa.e04bbe",
"type": "function",
"z": "c0cb50b.7f76a3",
"name": "Check Line",
"func": "var soundIntensity = flow.get (\"SoundIntensity\");\nvar soundMax = flow.get(\"SoundMax\");\n\nif (soundIntensity===undefined)\n{\n // no data arrived yet\n return null;\n}\n\nif (soundIntensity > soundMax)\n{\n msg.payload = \"Send an Engineer!!!\";\n msg.good = \"true\";\n msg.fontColor = \"Blue\";\n}\nelse\n{\n msg.payload = \"Line operating normally\";\n}\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 379.01956939697266,
"y": 1149.0039167404175,
"wires": [
[
"160682c4.c3115d",
"f1cffd4e.fb91"
]
]
},
{
"id": "160682c4.c3115d",
"type": "ui_text",
"z": "c0cb50b.7f76a3",
"group": "ea195502.839d28",
"order": 8,
"width": "6",
"height": "1",
"name": "Line Status",
"label": "",
"format": " {{msg.payload}} ",
"layout": "row-left",
"x": 610.0195732116699,
"y": 1127.7538776397705,
"wires": []
},
{
"id": "79116723.d05868",
"type": "http request",
"z": "c0cb50b.7f76a3",
"name": "BlueLED",
"method": "PUT",
"ret": "txt",
"url": "http://edgex-device-grove:49992/api/v1/device/all/Set_BlueLed",
"tls": "",
"x": 821.0196685791016,
"y": 1195.0038805007935,
"wires": [
[]
]
},
{
"id": "f1cffd4e.fb91",
"type": "function",
"z": "c0cb50b.7f76a3",
"name": "Set Blue LED",
"func": "if (msg.good === \"true\")\n{\n var data = {};\n data[\"Blue-LED\"] = \"true\";\n}\nelse\n{\n var data = {};\n data[\"Blue-LED\"] = \"false\";\n}\n\nmsg.payload = JSON.stringify (data);\nreturn msg;\n \n\n",
"outputs": 1,
"noerr": 0,
"x": 618.0195732116699,
"y": 1193.0039281845093,
"wires": [
[
"79116723.d05868"
]
]
},
{
"id": "409a837f.ca1b2c",
"type": "function",
"z": "c0cb50b.7f76a3",
"name": "Default Max Sound",
"func": "msg.payload = 12;\nflow.set (\"SoundMax\", msg.payload);\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 424.01952362060547,
"y": 742.0039072036743,
"wires": [
[
"fc31c6a.bbf5d38"
]
]
},
{
"id": "fc31c6a.bbf5d38",
"type": "ui_numeric",
"z": "c0cb50b.7f76a3",
"name": "",
"label": "Max Acceptance",
"tooltip": "",
"group": "ea195502.839d28",
"order": 6,
"width": "6",
"height": "1",
"passthru": true,
"topic": "",
"format": "{{value}}",
"min": 0,
"max": "100",
"step": 1,
"x": 698.0195236206055,
"y": 742.0039072036743,
"wires": [
[
"21955236.1f365e"
]
]
},
{
"id": "21955236.1f365e",
"type": "function",
"z": "c0cb50b.7f76a3",
"name": "Set SoundMax",
"func": "flow.set (\"SoundMax\", msg.payload);",
"outputs": 1,
"noerr": 0,
"x": 940.0195693969727,
"y": 742.003942489624,
"wires": [
[]
]
},
{
"id": "e0a7d7e2.6b2fb8",
"type": "ui_text",
"z": "c0cb50b.7f76a3",
"group": "ea195502.839d28",
"order": 5,
"width": "6",
"height": "3",
"name": "Spacer",
"label": "",
"format": "{{msg.payload}}",
"layout": "row-left",
"x": 1194.0195426940918,
"y": 1251.003882408142,
"wires": []
},
{
"id": "a9692f39.89977",
"type": "ui_text",
"z": "c0cb50b.7f76a3",
"group": "ea195502.839d28",
"order": 1,
"width": "6",
"height": "1",
"name": "Emergency Button Label",
"label": "Emergency Button",
"format": "{{msg.payload}}",
"layout": "col-center",
"x": 958.0196380615234,
"y": 206.00392055511475,
"wires": []
},
{
"id": "2daf4899.bf8c08",
"type": "delay",
"z": "c0cb50b.7f76a3",
"name": "",
"pauseType": "delay",
"timeout": "1",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"x": 637.0195541381836,
"y": 1030.0039014816284,
"wires": [
[
"97267dc8.f20b9"
]
]
}
]