[ { "id": "86befa0c.255748", "type": "ui_switch", "z": "bc1ee432.85cb8", "name": "", "label": "Running", "group": "546e15.d5d5f1ec", "order": 3, "width": 0, "height": 0, "passthru": true, "decouple": "false", "topic": "", "style": "", "onvalue": "ON", "onvalueType": "str", "onicon": "", "oncolor": "", "offvalue": "OFF", "offvalueType": "str", "officon": "", "offcolor": "", "x": 140, "y": 160, "wires": [ [ "651860d8.c960c8" ] ] }, { "id": "651860d8.c960c8", "type": "function", "z": "bc1ee432.85cb8", "name": "Running (On/Off)", "func": "flow.set(\"Running\",msg.payload);\n\nreturn msg;", "outputs": 1, "noerr": 0, "x": 390, "y": 160, "wires": [ [] ] }, { "id": "e3f2e696.d3e9d8", "type": "inject", "z": "bc1ee432.85cb8", "name": "", "topic": "", "payload": "", "payloadType": "date", "repeat": "2", "crontab": "", "once": false, "onceDelay": 0.1, "x": 150, "y": 220, "wires": [ [ "1af0bd85.1c1aca" ] ] }, { "id": "1af0bd85.1c1aca", "type": "switch", "z": "bc1ee432.85cb8", "name": "if Running ON", "property": "Running", "propertyType": "flow", "rules": [ { "t": "eq", "v": "ON", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 1, "x": 400, "y": 220, "wires": [ [ "17e61f71.0b5069", "26d8bb0f.6bb78c" ] ] }, { "id": "90a9648d.12d7e8", "type": "mqtt out", "z": "bc1ee432.85cb8", "name": "", "topic": "/246F28AA380C/altitudeReq", "qos": "", "retain": "", "broker": "2640d603.56aa6a", "x": 680, "y": 120, "wires": [] }, { "id": "cda480c8.83b138", "type": "mqtt in", "z": "bc1ee432.85cb8", "name": "", "topic": "/246F28AA380C/altitude", "qos": "2", "broker": "2640d603.56aa6a", "x": 170, "y": 300, "wires": [ [ "94889b9a.b5196", "3f7c05b9.b4526a" ] ] }, { "id": "6203b7e8.f19308", "type": "inject", "z": "bc1ee432.85cb8", "name": "", "topic": "", "payload": "", "payloadType": "date", "repeat": "", "crontab": "", "once": true, "onceDelay": 0.1, "x": 150, "y": 40, "wires": [ [ "7e85da37.27dec4" ] ] }, { "id": "7e85da37.27dec4", "type": "function", "z": "bc1ee432.85cb8", "name": "Set Charting OFF", "func": "flow.set(\"Running\",\"OFF\")\nflow.set(\"DIFF\",\"0.0\")\nflow.set(\"bPrimerCop\",\"true\")\n\nmsg.payload = parseFloat(flow.get(\"DIFF\"));\n\nreturn msg;", "outputs": 1, "noerr": 0, "x": 390, "y": 40, "wires": [ [ "ec1d378.6ebf3c8" ] ] }, { "id": "94889b9a.b5196", "type": "switch", "z": "bc1ee432.85cb8", "name": "if Running ON", "property": "Running", "propertyType": "flow", "rules": [ { "t": "eq", "v": "ON", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 1, "x": 400, "y": 300, "wires": [ [ "742eb350.21974c" ] ] }, { "id": "3f7c05b9.b4526a", "type": "function", "z": "bc1ee432.85cb8", "name": "Set Altitude", "func": "var diff = parseFloat(flow.get(\"DIFF\"))\nvar bPrimerCop = flow.get(\"bPrimerCop\")\nif( bPrimerCop == \"true\"){\n diff = parseFloat(msg.payload)\n flow.set(\"bPrimerCop\",\"false\")\n flow.set(\"DIFF\",diff)\n flow.set(\"Charting\",\"ON\")\n}\nvar readAltitude = parseFloat(msg.payload)\nvar altitude = readAltitude - diff;\nflow.set(\"Altitude\",altitude)\nmsg.payload = altitude\n\nreturn [msg,{payload: readAltitude}];", "outputs": 2, "noerr": 0, "x": 390, "y": 360, "wires": [ [], [] ] }, { "id": "742eb350.21974c", "type": "function", "z": "bc1ee432.85cb8", "name": "altitude - diff", "func": "msg.payload = parseFloat(msg.payload)-parseFloat(flow.get(\"DIFF\"))\nreturn msg;", "outputs": 1, "noerr": 0, "x": 590, "y": 300, "wires": [ [] ] }, { "id": "17e61f71.0b5069", "type": "mqtt out", "z": "bc1ee432.85cb8", "name": "", "topic": "/246F28AA380C/pressureReq", "qos": "", "retain": "", "broker": "2640d603.56aa6a", "x": 670, "y": 180, "wires": [] }, { "id": "1f685735.ac38a1", "type": "mqtt in", "z": "bc1ee432.85cb8", "name": "", "topic": "/246F28AA380C/pressure", "qos": "2", "broker": "2640d603.56aa6a", "x": 170, "y": 500, "wires": [ [ "39a34276.a419f6" ] ] }, { "id": "39a34276.a419f6", "type": "switch", "z": "bc1ee432.85cb8", "name": "if Running ON", "property": "Running", "propertyType": "flow", "rules": [ { "t": "eq", "v": "ON", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 1, "x": 400, "y": 500, "wires": [ [ "2b7b4f17.9c375", "4dd9d354.8b849c", "27f1ae32.6b1fca" ] ] }, { "id": "b1a0b0aa.d99ab8", "type": "ui_chart", "z": "bc1ee432.85cb8", "name": "", "group": "57ab4626.631f5", "order": 1, "width": 0, "height": 0, "label": "Pressure", "chartType": "line", "legend": "false", "xformat": "HH:mm:ss", "interpolate": "linear", "nodata": "", "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": 760, "y": 460, "wires": [ [], [] ] }, { "id": "3c8de2ec.d078b6", "type": "ui_chart", "z": "bc1ee432.85cb8", "name": "", "group": "57ab4626.631f5", "order": 3, "width": 0, "height": 0, "label": "Pressure (average 10 seconds)", "chartType": "line", "legend": "false", "xformat": "HH:mm:ss", "interpolate": "linear", "nodata": "", "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": 730, "y": 560, "wires": [ [], [] ] }, { "id": "2b7b4f17.9c375", "type": "function", "z": "bc1ee432.85cb8", "name": "10 seconds RC", "func": "// Applies a simple RC low pass filter to incoming payload values\n//var tc = 10*60*1000; // time constant in milliseconds\nvar tc = 10*1000; // time constant in milliseconds\n\nvar lastValue = context.get('lastValue');\nif (typeof lastValue == \"undefined\") lastValue = msg.payload;\nvar lastTime = context.get('lastTime') || null;\nvar now = new Date();\nvar currentValue = msg.payload;\nif (lastTime === null) {\n // first time through\n newValue = currentValue;\n} else {\n var dt = now - lastTime;\n var newValue;\n \n if (dt > 0) {\n var dtotc = dt / tc;\n newValue = lastValue * (1 - dtotc) + currentValue * dtotc;\n } else {\n // no time has elapsed leave output the same as last time\n newValue = lastValue;\n }\n}\ncontext.set('lastValue', newValue);\ncontext.set('lastTime', now);\n\nmsg.payload = newValue;\nreturn msg;", "outputs": 1, "noerr": 0, "x": 400, "y": 640, "wires": [ [ "3c8de2ec.d078b6" ] ] }, { "id": "1d77b22d.89d34e", "type": "ui_chart", "z": "bc1ee432.85cb8", "name": "", "group": "57ab4626.631f5", "order": 2, "width": 0, "height": 0, "label": "Pressure (Average 5 seconds)", "chartType": "line", "legend": "false", "xformat": "HH:mm:ss", "interpolate": "linear", "nodata": "", "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": 730, "y": 620, "wires": [ [], [] ] }, { "id": "4dd9d354.8b849c", "type": "function", "z": "bc1ee432.85cb8", "name": "5 seconds RC", "func": "// Applies a simple RC low pass filter to incoming payload values\n//var tc = 10*60*1000; // time constant in milliseconds\nvar tc = 5*1000; // time constant in milliseconds\n\nvar lastValue = context.get('lastValue_5');\nif (typeof lastValue == \"undefined\") lastValue = msg.payload;\nvar lastTime = context.get('lastTime_5') || null;\nvar now = new Date();\nvar currentValue = msg.payload;\nif (lastTime === null) {\n // first time through\n newValue = currentValue;\n} else {\n var dt = now - lastTime;\n var newValue;\n \n if (dt > 0) {\n var dtotc = dt / tc;\n newValue = lastValue * (1 - dtotc) + currentValue * dtotc;\n } else {\n // no time has elapsed leave output the same as last time\n newValue = lastValue;\n }\n}\ncontext.set('lastValue_5', newValue);\ncontext.set('lastTime_5', now);\n\nflow.set(\"LAST_PRESS_VALUE\",newValue)\nmsg.payload = newValue;\nreturn msg;", "outputs": 1, "noerr": 0, "x": 400, "y": 680, "wires": [ [ "1d77b22d.89d34e" ] ] }, { "id": "26d8bb0f.6bb78c", "type": "mqtt out", "z": "bc1ee432.85cb8", "name": "", "topic": "/3C71BFFD6AC0/pressureReq", "qos": "", "retain": "", "broker": "2640d603.56aa6a", "x": 670, "y": 240, "wires": [] }, { "id": "2a6d731a.643194", "type": "mqtt in", "z": "bc1ee432.85cb8", "name": "", "topic": "/3C71BFFD6AC0/pressure", "qos": "2", "broker": "2640d603.56aa6a", "x": 170, "y": 780, "wires": [ [ "793f64ff.0b02ec" ] ] }, { "id": "793f64ff.0b02ec", "type": "switch", "z": "bc1ee432.85cb8", "name": "if Running ON", "property": "Running", "propertyType": "flow", "rules": [ { "t": "eq", "v": "ON", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 1, "x": 400, "y": 780, "wires": [ [ "e4938758.cb4088", "703f4fba.45395", "2d54f93b.4be3ce" ] ] }, { "id": "9327420.18fd7c", "type": "ui_chart", "z": "bc1ee432.85cb8", "name": "", "group": "12772034.3fe508", "order": 1, "width": 0, "height": 0, "label": "Pressure REF", "chartType": "line", "legend": "false", "xformat": "HH:mm:ss", "interpolate": "linear", "nodata": "", "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": 700, "y": 780, "wires": [ [], [] ] }, { "id": "ca220d2e.ac1e98", "type": "ui_chart", "z": "bc1ee432.85cb8", "name": "", "group": "12772034.3fe508", "order": 3, "width": 0, "height": 0, "label": "Pressure REF (Average 5 seconds)", "chartType": "line", "legend": "false", "xformat": "HH:mm:ss", "interpolate": "linear", "nodata": "", "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": 710, "y": 840, "wires": [ [], [] ] }, { "id": "e4938758.cb4088", "type": "function", "z": "bc1ee432.85cb8", "name": "5 seconds RC REF", "func": "// Applies a simple RC low pass filter to incoming payload values\n//var tc = 10*60*1000; // time constant in milliseconds\nvar tc = 5*1000; // time constant in milliseconds\n\nvar lastValue = context.get('lastValue_5_REF');\nif (typeof lastValue == \"undefined\") lastValue = msg.payload;\nvar lastTime = context.get('lastTime_5_REF') || null;\nvar now = new Date();\nvar currentValue = msg.payload;\nif (lastTime === null) {\n // first time through\n newValue = currentValue;\n} else {\n var dt = now - lastTime;\n var newValue;\n \n if (dt > 0) {\n var dtotc = dt / tc;\n newValue = lastValue * (1 - dtotc) + currentValue * dtotc;\n } else {\n // no time has elapsed leave output the same as last time\n newValue = lastValue;\n }\n}\ncontext.set('lastValue_5_REF', newValue);\ncontext.set('lastTime_5_REF', now);\n\nmsg.payload = newValue;\nreturn msg;", "outputs": 1, "noerr": 0, "x": 410, "y": 840, "wires": [ [ "ca220d2e.ac1e98", "952e48d3.c8b8e8" ] ] }, { "id": "c4f91cee.d251c8", "type": "ui_chart", "z": "bc1ee432.85cb8", "name": "", "group": "546e15.d5d5f1ec", "order": 2, "width": 0, "height": 0, "label": "Pressure DIFF (avg 5s)", "chartType": "line", "legend": "false", "xformat": "HH:mm:ss", "interpolate": "linear", "nodata": "", "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": 670, "y": 920, "wires": [ [], [] ] }, { "id": "952e48d3.c8b8e8", "type": "function", "z": "bc1ee432.85cb8", "name": "PRESS_VALUE_REF - LAST_PRESS_VALUE (avg 5s)", "func": "var lastValue = parseFloat(flow.get(\"LAST_PRESS_VALUE\"));\nvar refValue = parseFloat(msg.payload);\n\nmsg.payload = refValue - lastValue - flow.get(\"DIFF\");\n\nreturn msg;", "outputs": 1, "noerr": 0, "x": 310, "y": 920, "wires": [ [ "c4f91cee.d251c8" ] ] }, { "id": "27f1ae32.6b1fca", "type": "function", "z": "bc1ee432.85cb8", "name": "CURRENT_PRESS", "func": "flow.set(\"CURRENT_PRESS\",parseFloat(msg.payload));\n//msg.payload = parseFloat(msg.payload);\nreturn msg;", "outputs": 1, "noerr": 0, "x": 590, "y": 460, "wires": [ [ "b1a0b0aa.d99ab8" ] ] }, { "id": "703f4fba.45395", "type": "function", "z": "bc1ee432.85cb8", "name": "CURRENT_REF_PRESS", "func": "flow.set(\"CURRENT_REF_PRESS\",parseFloat(msg.payload));\n\nreturn msg;", "outputs": 1, "noerr": 0, "x": 610, "y": 740, "wires": [ [ "9327420.18fd7c" ] ] }, { "id": "649603ee.77572c", "type": "ui_chart", "z": "bc1ee432.85cb8", "name": "", "group": "546e15.d5d5f1ec", "order": 1, "width": 0, "height": 0, "label": "Pressure DIFF", "chartType": "line", "legend": "false", "xformat": "HH:mm:ss", "interpolate": "linear", "nodata": "", "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": 640, "y": 1020, "wires": [ [], [] ] }, { "id": "2d54f93b.4be3ce", "type": "function", "z": "bc1ee432.85cb8", "name": "CURRENT_REF_PRESS - CURRENT_PRESS - DIFF", "func": "var lastValue = parseFloat(flow.get(\"CURRENT_PRESS\"));\nvar refValue = parseFloat(msg.payload);\n\nmsg.payload = refValue - lastValue - flow.get(\"DIFF\");\n\nreturn msg;", "outputs": 1, "noerr": 0, "x": 300, "y": 1020, "wires": [ [ "649603ee.77572c" ] ] }, { "id": "6d8dff28.9420e", "type": "ui_button", "z": "bc1ee432.85cb8", "name": "", "group": "546e15.d5d5f1ec", "order": 0, "width": 0, "height": 0, "passthru": false, "label": "SET NEW DIFF", "color": "", "bgcolor": "", "icon": "", "payload": "", "payloadType": "str", "topic": "", "x": 180, "y": 1100, "wires": [ [ "ba0a5284.70c29" ] ] }, { "id": "ec1d378.6ebf3c8", "type": "ui_text", "z": "bc1ee432.85cb8", "group": "546e15.d5d5f1ec", "order": 0, "width": 0, "height": 0, "name": "", "label": "Current diff", "format": "{{msg.payload}}", "layout": "row-spread", "x": 630, "y": 1100, "wires": [] }, { "id": "ba0a5284.70c29", "type": "function", "z": "bc1ee432.85cb8", "name": "Set DIFF", "func": "var lastValue = parseFloat(flow.get(\"CURRENT_PRESS\"));\nvar refValue = parseFloat(flow.get(\"CURRENT_REF_PRESS\"));\nmsg.payload = refValue - lastValue;\nflow.set(\"DIFF\",msg.payload)\n\nreturn msg;", "outputs": 1, "noerr": 0, "x": 420, "y": 1100, "wires": [ [ "ec1d378.6ebf3c8" ] ] }, { "id": "546e15.d5d5f1ec", "type": "ui_group", "z": "", "name": "Calibration", "tab": "55321aaa.8db404", "order": 1, "disp": true, "width": "6", "collapse": false }, { "id": "2640d603.56aa6a", "type": "mqtt-broker", "z": "", "name": "", "broker": "iot.siarq.net", "port": "8883", "tls": "", "clientid": "", "usetls": true, "compatmode": true, "keepalive": "60", "cleansession": true, "birthTopic": "", "birthQos": "0", "birthPayload": "", "closeTopic": "", "closeQos": "0", "closePayload": "", "willTopic": "", "willQos": "0", "willPayload": "" }, { "id": "57ab4626.631f5", "type": "ui_group", "z": "", "name": "Pressure", "tab": "55321aaa.8db404", "order": 2, "disp": true, "width": "6", "collapse": false }, { "id": "12772034.3fe508", "type": "ui_group", "z": "", "name": "Pressure REF", "tab": "55321aaa.8db404", "order": 3, "disp": true, "width": "6", "collapse": false }, { "id": "55321aaa.8db404", "type": "ui_tab", "z": "", "name": "Altitude", "icon": "dashboard", "order": 1 } ]