[ { "id": "41eb43ed.17bf8c", "type": "debug", "z": "ffe8f7ab.b55518", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "x": 610, "y": 160, "wires": [] }, { "id": "80957478.e279a8", "type": "ui_text", "z": "ffe8f7ab.b55518", "group": "ed9537a1.bf1508", "order": 0, "width": 0, "height": 0, "name": "", "label": "Rebut", "format": "{{msg.payload}}", "layout": "row-spread", "x": 590, "y": 200, "wires": [] }, { "id": "bc1f3d02.7dc2f", "type": "function", "z": "ffe8f7ab.b55518", "name": "array to float", "func": "var data = msg.payload;\n\n// Create a buffer\nvar buf = new ArrayBuffer(4);\n// Create a data view of it\nvar view = new DataView(buf);\n\n// set bytes\ndata.forEach(function (b, i) {\n view.setUint8(i, b);\n});\n\n// Read the bits as a float; note that by doing this, we're implicitly\n// converting it from a 32-bit float into JavaScript's native 64-bit double\nvar num = view.getFloat32(0);\nnum = Math.round(num*100)/100;\n// Done\nmsg.payload = num;\n\nreturn msg;", "outputs": 1, "noerr": 0, "x": 430, "y": 120, "wires": [ [ "41eb43ed.17bf8c", "6b1926d.f4877d8", "ff2cb8c.e178248" ] ] }, { "id": "6b1926d.f4877d8", "type": "ui_chart", "z": "ffe8f7ab.b55518", "name": "", "group": "ed9537a1.bf1508", "order": 0, "width": 0, "height": 0, "label": "chart", "chartType": "line", "legend": "false", "xformat": "HH:mm:ss", "interpolate": "linear", "nodata": "", "dot": false, "ymin": "15", "ymax": "45", "removeOlder": 1, "removeOlderPoints": "", "removeOlderUnit": "3600", "cutout": 0, "useOneColor": false, "colors": [ "#1f77b4", "#aec7e8", "#ff7f0e", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5" ], "useOldStyle": false, "x": 590, "y": 80, "wires": [ [], [] ] }, { "id": "ff2cb8c.e178248", "type": "ui_gauge", "z": "ffe8f7ab.b55518", "name": "", "group": "ed9537a1.bf1508", "order": 0, "width": 0, "height": 0, "gtype": "gage", "title": "Gauge", "label": "units", "format": "{{value}}", "min": "-30", "max": "80", "colors": [ "#00b500", "#e6e600", "#ca3838" ], "seg1": "", "seg2": "", "x": 590, "y": 120, "wires": [] }, { "id": "24a831df.67061e", "type": "ui_switch", "z": "ffe8f7ab.b55518", "name": "", "label": "R01", "group": "bb73125f.d3a1a", "order": 0, "width": 0, "height": 0, "passthru": true, "decouple": "false", "topic": "", "style": "", "onvalue": "1", "onvalueType": "num", "onicon": "", "oncolor": "", "offvalue": "0", "offvalueType": "num", "officon": "", "offcolor": "", "x": 450, "y": 420, "wires": [ [ "f70c2df9.beedc" ] ] }, { "id": "77a2b88d.c52028", "type": "ttn uplink", "z": "ffe8f7ab.b55518", "name": "Missatge ascendent (uplink)", "app": "627ca9b.6f5e758", "dev_id": "icm-00-10", "field": "", "x": 220, "y": 120, "wires": [ [ "bc1f3d02.7dc2f", "41eb43ed.17bf8c", "80957478.e279a8" ] ] }, { "id": "d6ed0673.ec3b98", "type": "ttn downlink", "z": "ffe8f7ab.b55518", "name": "Missatge descendent (downlink)", "app": "627ca9b.6f5e758", "dev_id": "", "port": "", "confirmed": false, "schedule": "replace", "x": 620, "y": 240, "wires": [] }, { "id": "f4d4dfae.655b8", "type": "inject", "z": "ffe8f7ab.b55518", "name": "", "topic": "", "payload": "1h", "payloadType": "str", "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "x": 130, "y": 240, "wires": [ [ "a662c102.c70de" ] ] }, { "id": "6835429.8c8a3bc", "type": "inject", "z": "ffe8f7ab.b55518", "name": "", "topic": "", "payload": "1l", "payloadType": "str", "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "x": 130, "y": 280, "wires": [ [ "a662c102.c70de" ] ] }, { "id": "a662c102.c70de", "type": "function", "z": "ffe8f7ab.b55518", "name": "Cap a icm-00-10", "func": "\nreturn {\n dev_id: \"icm-00-10\",\n port: msg.port,\n schedule: \"replace\",\n confirmed: false,\n payload: Buffer.from(msg.payload)\n};", "outputs": 1, "noerr": 0, "x": 310, "y": 240, "wires": [ [ "d6ed0673.ec3b98", "a6042804.894628" ] ] }, { "id": "a6042804.894628", "type": "debug", "z": "ffe8f7ab.b55518", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "x": 590, "y": 320, "wires": [] }, { "id": "8e169196.772a9", "type": "ui_switch", "z": "ffe8f7ab.b55518", "name": "", "label": "R02", "group": "bb73125f.d3a1a", "order": 0, "width": 0, "height": 0, "passthru": true, "decouple": "false", "topic": "", "style": "", "onvalue": "2", "onvalueType": "num", "onicon": "", "oncolor": "", "offvalue": "0", "offvalueType": "num", "officon": "", "offcolor": "", "x": 450, "y": 480, "wires": [ [ "b958e144.deb79" ] ] }, { "id": "65a5c52b.2978bc", "type": "ui_switch", "z": "ffe8f7ab.b55518", "name": "", "label": "R03", "group": "bb73125f.d3a1a", "order": 0, "width": 0, "height": 0, "passthru": true, "decouple": "false", "topic": "", "style": "", "onvalue": "4", "onvalueType": "num", "onicon": "", "oncolor": "", "offvalue": "0", "offvalueType": "num", "officon": "", "offcolor": "", "x": 450, "y": 540, "wires": [ [ "5d03a70d.851da8" ] ] }, { "id": "a70fd1e1.1b247", "type": "ui_switch", "z": "ffe8f7ab.b55518", "name": "", "label": "R04", "group": "bb73125f.d3a1a", "order": 0, "width": 0, "height": 0, "passthru": true, "decouple": "false", "topic": "", "style": "", "onvalue": "8", "onvalueType": "num", "onicon": "", "oncolor": "", "offvalue": "0", "offvalueType": "num", "officon": "", "offcolor": "", "x": 450, "y": 600, "wires": [ [ "26c47347.5f01cc" ] ] }, { "id": "f70c2df9.beedc", "type": "function", "z": "ffe8f7ab.b55518", "name": "R01", "func": "global.set(\"R01\",msg.payload);\nreturn msg;", "outputs": 1, "noerr": 0, "x": 570, "y": 420, "wires": [ [ "e9edbcd8.b30dc" ] ] }, { "id": "b958e144.deb79", "type": "function", "z": "ffe8f7ab.b55518", "name": "R02", "func": "global.set(\"R02\",msg.payload);\nreturn msg;", "outputs": 1, "noerr": 0, "x": 570, "y": 480, "wires": [ [ "e9edbcd8.b30dc" ] ] }, { "id": "5d03a70d.851da8", "type": "function", "z": "ffe8f7ab.b55518", "name": "R03", "func": "global.set(\"R03\",msg.payload);\nreturn msg;", "outputs": 1, "noerr": 0, "x": 570, "y": 540, "wires": [ [ "e9edbcd8.b30dc" ] ] }, { "id": "26c47347.5f01cc", "type": "function", "z": "ffe8f7ab.b55518", "name": "R04", "func": "global.set(\"R04\",msg.payload);\nreturn msg;", "outputs": 1, "noerr": 0, "x": 570, "y": 600, "wires": [ [ "e9edbcd8.b30dc" ] ] }, { "id": "e9edbcd8.b30dc", "type": "function", "z": "ffe8f7ab.b55518", "name": "Suma HEX", "func": "var r01 = parseInt(global.get(\"R01\"));\nvar r02 = parseInt(global.get(\"R02\"));\nvar r03 = parseInt(global.get(\"R03\"));\nvar r04 = parseInt(global.get(\"R04\"));\n\nvar rTotal = (r01+r02+r03+r04).toString(16);\n\nmsg.payload = rTotal;\n\nglobal.set(\"R_TOTAL\",rTotal);\n\nreturn msg;", "outputs": 1, "noerr": 0, "x": 770, "y": 500, "wires": [ [ "bad9812a.a9589" ] ] }, { "id": "4b3c2e1b.ddfd8", "type": "function", "z": "ffe8f7ab.b55518", "name": "prevR01", "func": "var r01 = parseInt(global.get(\"R01\"));\nif(parseInt(r01) == 1)\n msg.payload = 1;\nelse\n msg.payload = 0;\nreturn msg;", "outputs": 1, "noerr": 0, "x": 320, "y": 420, "wires": [ [ "24a831df.67061e" ] ] }, { "id": "f46f8dec.48273", "type": "function", "z": "ffe8f7ab.b55518", "name": "prevR02", "func": "var r02 = parseInt(global.get(\"R02\"));\nif(parseInt(r02) == 2)\n msg.payload = 2;\nelse\n msg.payload = 0;\nreturn msg;", "outputs": 1, "noerr": 0, "x": 320, "y": 480, "wires": [ [ "8e169196.772a9" ] ] }, { "id": "8ee7414a.6ca7a", "type": "function", "z": "ffe8f7ab.b55518", "name": "prevR03", "func": "var r = parseInt(global.get(\"R03\"));\nif(parseInt(r) == 4)\n msg.payload = 4;\nelse\n msg.payload = 0;\nreturn msg;", "outputs": 1, "noerr": 0, "x": 320, "y": 540, "wires": [ [ "65a5c52b.2978bc" ] ] }, { "id": "bf41f55.23bfd08", "type": "function", "z": "ffe8f7ab.b55518", "name": "prevR04", "func": "var r = parseInt(global.get(\"R04\"));\nif(parseInt(r) == 8)\n msg.payload = 8;\nelse\n msg.payload = 0;\nreturn msg;", "outputs": 1, "noerr": 0, "x": 320, "y": 600, "wires": [ [ "a70fd1e1.1b247" ] ] }, { "id": "bad9812a.a9589", "type": "ui_text", "z": "ffe8f7ab.b55518", "group": "bb73125f.d3a1a", "order": 0, "width": 0, "height": 0, "name": "", "label": "Relés", "format": "{{msg.payload}}", "layout": "row-spread", "x": 910, "y": 500, "wires": [] }, { "id": "34d57119.29fd7e", "type": "inject", "z": "ffe8f7ab.b55518", "name": "", "topic": "", "payload": "", "payloadType": "date", "repeat": "", "crontab": "", "once": true, "onceDelay": 0.1, "x": 550, "y": 660, "wires": [ [ "e9edbcd8.b30dc" ] ] }, { "id": "f025c141.4ae5b", "type": "ui_button", "z": "ffe8f7ab.b55518", "name": "", "group": "bb73125f.d3a1a", "order": 0, "width": 0, "height": 0, "passthru": false, "label": "Tramet", "color": "", "bgcolor": "", "icon": "", "payload": "", "payloadType": "str", "topic": "", "x": 120, "y": 340, "wires": [ [ "d25ba805.80e808" ] ] }, { "id": "d25ba805.80e808", "type": "function", "z": "ffe8f7ab.b55518", "name": "R_TOTAL", "func": "var rT = global.get(\"R_TOTAL\");\n\nmsg.payload = rT;\n\nreturn msg;", "outputs": 1, "noerr": 0, "x": 290, "y": 340, "wires": [ [ "a662c102.c70de" ] ] }, { "id": "88c67ca9.c285b", "type": "debug", "z": "ffe8f7ab.b55518", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "x": 590, "y": 800, "wires": [] }, { "id": "65c67c0d.2869b4", "type": "ui_text", "z": "ffe8f7ab.b55518", "group": "cdbf2778.4c1fd8", "order": 0, "width": 0, "height": 0, "name": "", "label": "Rebut", "format": "{{msg.payload}}", "layout": "row-spread", "x": 570, "y": 840, "wires": [] }, { "id": "e71cf78e.c34628", "type": "function", "z": "ffe8f7ab.b55518", "name": "array to float", "func": "var data = msg.payload;\n\n// Create a buffer\nvar buf = new ArrayBuffer(4);\n// Create a data view of it\nvar view = new DataView(buf);\nvar byR = 0;\nvar bR = false;\n\n// set bytes\ndata.forEach(function (b, i) {\n if(i!=4)\n view.setUint8(i, b);\n else{\n byR = b;\n bR = true;\n }\n});\n\n// Read the bits as a float; note that by doing this, we're implicitly\n// converting it from a 32-bit float into JavaScript's native 64-bit double\nvar num = view.getFloat32(0);\nnum = Math.round(num*100)/100;\n// Done\nmsg.payload = num;\nmsgR={};\nmsgR.payload = byR;\n\nif(bR)\n return [msg,msgR];\nelse\n return [msg,null];", "outputs": 2, "noerr": 0, "x": 410, "y": 760, "wires": [ [ "88c67ca9.c285b", "83e305fe.4908d8", "7d911436.f15bdc" ], [ "15575652.5f576a", "3abcccfd.35d834" ] ] }, { "id": "83e305fe.4908d8", "type": "ui_chart", "z": "ffe8f7ab.b55518", "name": "", "group": "cdbf2778.4c1fd8", "order": 0, "width": 0, "height": 0, "label": "chart", "chartType": "line", "legend": "false", "xformat": "HH:mm:ss", "interpolate": "linear", "nodata": "", "dot": false, "ymin": "15", "ymax": "45", "removeOlder": 1, "removeOlderPoints": "", "removeOlderUnit": "3600", "cutout": 0, "useOneColor": false, "colors": [ "#1f77b4", "#aec7e8", "#ff7f0e", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5" ], "useOldStyle": false, "x": 570, "y": 720, "wires": [ [], [] ] }, { "id": "7d911436.f15bdc", "type": "ui_gauge", "z": "ffe8f7ab.b55518", "name": "", "group": "cdbf2778.4c1fd8", "order": 0, "width": 0, "height": 0, "gtype": "gage", "title": "Gauge", "label": "units", "format": "{{value}}", "min": "-30", "max": "80", "colors": [ "#00b500", "#e6e600", "#ca3838" ], "seg1": "", "seg2": "", "x": 570, "y": 760, "wires": [] }, { "id": "a07df652.d14ae8", "type": "ttn uplink", "z": "ffe8f7ab.b55518", "name": "Missatge ascendent (uplink)", "app": "627ca9b.6f5e758", "dev_id": "icm-00-08", "field": "", "x": 200, "y": 760, "wires": [ [ "e71cf78e.c34628", "65c67c0d.2869b4" ] ] }, { "id": "15575652.5f576a", "type": "debug", "z": "ffe8f7ab.b55518", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "x": 590, "y": 880, "wires": [] }, { "id": "3abcccfd.35d834", "type": "function", "z": "ffe8f7ab.b55518", "name": "Actualitza relés", "func": "var rx = msg.payload;\n\nif(rx & 0x01)\n global.set(\"R01\",1);\nelse\n global.set(\"R01\",0);\nif(rx & 0x02)\n global.set(\"R02\",2);\nelse\n global.set(\"R02\",0);\nif(rx & 0x04)\n global.set(\"R03\",4);\nelse\n global.set(\"R03\",0);\nif(rx & 0x08)\n global.set(\"R04\",8);\nelse\n global.set(\"R04\",0);\n\n\nvar r01 = parseInt(global.get(\"R01\"));\nvar r02 = parseInt(global.get(\"R02\"));\nvar r03 = parseInt(global.get(\"R03\"));\nvar r04 = parseInt(global.get(\"R04\"));\n\nvar rTotal = (r01+r02+r03+r04).toString(16);\n\nmsg.payload = rTotal;\n\nglobal.set(\"R_TOTAL\",rTotal);\n\n\nreturn msg;", "outputs": 1, "noerr": 0, "x": 140, "y": 500, "wires": [ [ "4b3c2e1b.ddfd8", "f46f8dec.48273", "8ee7414a.6ca7a", "bf41f55.23bfd08", "a6042804.894628", "d25ba805.80e808" ] ] }, { "id": "ed9537a1.bf1508", "type": "ui_group", "z": "", "name": "M-Duino 19R+", "tab": "fd33ef81.c9647", "order": 1, "disp": true, "width": "6", "collapse": false }, { "id": "bb73125f.d3a1a", "type": "ui_group", "z": "", "name": "Relés M-Duino 19R+", "tab": "fd33ef81.c9647", "order": 2, "disp": true, "width": "6", "collapse": false }, { "id": "627ca9b.6f5e758", "type": "ttn app", "z": "", "appId": "icm-00", "accessKey": "ttn-account-v2.swPaunQLUf53JIdDSd2lxuDAMxkcwOLvvh8vA6Ll69o", "discovery": "discovery.thethingsnetwork.org:1900" }, { "id": "cdbf2778.4c1fd8", "type": "ui_group", "z": "", "name": "Metacrilat 08", "tab": "fd33ef81.c9647", "order": 3, "disp": true, "width": "6", "collapse": false }, { "id": "fd33ef81.c9647", "type": "ui_tab", "z": "", "name": "IndustrialShields", "icon": "dashboard", "order": 1 } ]