-
Notifications
You must be signed in to change notification settings - Fork 0
/
dymanicModbus.json
1 lines (1 loc) · 207 KB
/
dymanicModbus.json
1
[{"id":"a14027eb.55f138","type":"tab","label":"modbusMaster","disabled":false,"info":""},{"id":"3c97418c.41d44e","type":"inject","z":"a14027eb.55f138","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":150,"y":340,"wires":[["8afd7d8f.ee62"]]},{"id":"71d6b579.1d683c","type":"python3-function","z":"a14027eb.55f138","name":"modbusMaster.py","func":"from pymodbus.client.sync import ModbusSerialClient\nimport time\nimport json\n\ndataS = []\nopArray = []\n\nparameter =json.loads(msg['payload'])\ncomm = msg['comm']\n\nclient = ModbusSerialClient(method = 'rtu', port = comm[0], baudrate = comm[1], parity = comm[2], stopbits = comm[3])\n\nfor i in range(parameter[0]):\n try:\n regs = client.read_holding_registers(parameter[i+1][1], parameter[i+1][2], unit = parameter[i+1][0])\n dataS = regs.registers if regs else None\n z = json.dumps({'id': parameter[i+1][0], 'register': parameter[i+1][1], 'data': dataS, 'status': \"Connected\"})\n opArray.append(z)\n dataS = []\n time.sleep(1)\n except:\n z = json.dumps({'id': parameter[i+1][0], 'register': parameter[i+1][1], 'data': dataS, 'status': \"Disconnected\"})\n opArray.append(z)\n time.sleep(1)\n\nmsg['payload'] = opArray\nreturn msg","outputs":1,"x":670,"y":340,"wires":[["f91dbb0b.ec33d8","22244960.187936"]]},{"id":"8afd7d8f.ee62","type":"function","z":"a14027eb.55f138","name":"","func":"if(flow.get('GetData')==1)\n{\n flow.set('GetData',0)\n var n = global.get('slaveLength')\n \n var parameters = []\n \n parameters[0] = n\n \n for(i=0;i<n;i++)\n {\n parameters[i+1] = [global.get('sID'+(i)), global.get('sregisterAddress'+(i)), global.get('sdataBits'+(i))];\n }\n \n msg.payload = parameters\n msg.comm = [global.get('port'),global.get('baudRate'), global.get('parity'),global.get('stopBits')]\n \n return msg;\n}","outputs":1,"noerr":0,"x":320,"y":340,"wires":[["8e0256c7.76e438"]]},{"id":"cfc8fa69.f6d558","type":"inject","z":"a14027eb.55f138","name":"","repeat":"","crontab":"","once":true,"onceDelay":"0.1","topic":"","payload":"","payloadType":"date","x":150,"y":160,"wires":[["c32d890c.6d2af8"]]},{"id":"c32d890c.6d2af8","type":"file in","z":"a14027eb.55f138","name":"modbusSlave.txt","filename":"/home/pi/Desktop/modbusSlave.txt","format":"utf8","chunk":false,"sendError":false,"x":350,"y":160,"wires":[["4a7e2e8d.ec392"]]},{"id":"4a7e2e8d.ec392","type":"json","z":"a14027eb.55f138","name":"","property":"payload","action":"","pretty":false,"x":530,"y":160,"wires":[["7231c5e1.f1d45c"]]},{"id":"45249f99.a9d4a","type":"file","z":"a14027eb.55f138","name":"modbusSlave.txt","filename":"/home/pi/Desktop/modbusSlave.txt","appendNewline":false,"createDir":true,"overwriteFile":"true","x":1090,"y":160,"wires":[["f2ed7b51.56d618"]]},{"id":"1f6d2821.4fcfe8","type":"debug","z":"a14027eb.55f138","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1450,"y":160,"wires":[]},{"id":"f2ed7b51.56d618","type":"function","z":"a14027eb.55f138","name":"SetVal","func":"var data = msg.payload.RecipDetails;\nvar n= data.length;\nglobal.set('slaveLength', n)\n\nfor(i=0;i<n;i++)\n{\n global.set('parameterName'+i, msg.payload.RecipDetails[i].parameterName)\n global.set('parameterID'+i, msg.payload.RecipDetails[i].id)\n global.set('sID'+i, msg.payload.RecipDetails[i].slaveID);\n global.set('sregisterAddress'+i, msg.payload.RecipDetails[i].registerAddress);\n global.set('sdataBits'+i, msg.payload.RecipDetails[i].dataBits);\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":1270,"y":160,"wires":[["8ae385e2.8cdec8","1f6d2821.4fcfe8"]]},{"id":"8e0256c7.76e438","type":"json","z":"a14027eb.55f138","name":"","property":"payload","action":"","pretty":false,"x":470,"y":340,"wires":[["71d6b579.1d683c","13958efc.8204e1"]]},{"id":"f91dbb0b.ec33d8","type":"function","z":"a14027eb.55f138","name":"GetData = 1","func":"flow.set('GetData',1)\nreturn msg;","outputs":1,"noerr":0,"x":890,"y":400,"wires":[[]]},{"id":"912ee5cc.d13878","type":"function","z":"a14027eb.55f138","name":"flow variables","func":"flow.set('GetData',1)\nflow.set('parameterForLoop', 0)\nflow.set('forLoopCounter',0)\nflow.set('phIndex', 0)\nreturn msg;","outputs":1,"noerr":0,"x":360,"y":80,"wires":[[]]},{"id":"bab093a5.4d422","type":"inject","z":"a14027eb.55f138","name":"","repeat":"","crontab":"","once":true,"onceDelay":"1","topic":"","payload":"","payloadType":"date","x":150,"y":80,"wires":[["912ee5cc.d13878"]]},{"id":"bd94592c.56e0e8","type":"json","z":"a14027eb.55f138","name":"","property":"payload","action":"","pretty":false,"x":1030,"y":340,"wires":[["7064ccef.0fa6e4","84f42647.dd19c8"]]},{"id":"7064ccef.0fa6e4","type":"debug","z":"a14027eb.55f138","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1210,"y":280,"wires":[]},{"id":"f1c65c78.7b985","type":"inject","z":"a14027eb.55f138","name":"","repeat":"1","crontab":"","once":true,"onceDelay":"1","topic":"","payload":"","payloadType":"date","x":150,"y":560,"wires":[["47446f8e.863b7"]]},{"id":"47446f8e.863b7","type":"function","z":"a14027eb.55f138","name":"","func":"var n = global.get('slaveLength')\nvar id = []\nvar Add = []\nmsg={}\nmsg.payload={}\n\nmsg.payload.RecipDetails=[{Name:global.get('parameterName0'),ID:global.get('sID0'),Add:global.get('sregisterAddress0'),Data:global.get('sensorData[' + global.get('sID0') + '][' + global.get('sregisterAddress0') + ']'),Status:global.get('Status[' + global.get('sID0') + ']')}]\nfor(i=1;i<n;i++)\n{\n msg.payload.RecipDetails[i] = {Name:global.get('parameterName'+i),ID:global.get('sID'+i),Add:global.get('sregisterAddress'+i),Data:global.get('sensorData[' + global.get('sID'+i) + '][' + global.get('sregisterAddress'+i) + ']'),Status:global.get('Status[' + global.get('sID'+i) + ']')}\n}\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":560,"wires":[["e0011cad.26e6f"]]},{"id":"e0011cad.26e6f","type":"ui_template","z":"a14027eb.55f138","group":"196652fc.0d4e3d","name":"modbus data","order":4,"width":0,"height":0,"format":"<html>\n <head>\n \n </head>\n <body>\n<style>\ntable, th, tr, td\n{\n border: 1px black solid;\n border-collapse: collapse;\n text-align: center;\n}\n\ninput[type = number], input[type = text]\n{\n background-color: white;\n border: none;\n word-wrap: break-word;\n word-break: break-all;\n text-align: center;\n}\n\nth\n{\n background-color: #2a92b5;\n padding : 7px 3px;\n color: white;\n}\n</style>\n \n \n<div>\n\n\n<div>\n <form id=\"TableForm\" ng-submit=\"MyTableFormAction()\" >\n \n <table align = \"center\" id=\"EmptableWithEditDelete\">\n <tr>\n <th>\n Sr. No.\n </th>\n <th>\n Name\n </th>\n <th>\n Slave ID\n </th>\n <th>\n Address\n </th>\n <th>\n Data\n </th>\n <th>\n Status\n </th>\n\n </tr>\n <tr ng-repeat=\"RawData in msg.payload.RecipDetails\" >\n <td disabled=\"true\">\n {{$index+1}}\n </td>\n <td>\n <input type=\"text\" id=\"Parameter{{$index}}\" ng-model=\"RawData.Name\" disabled=\"true\" required><!--ng-model=-->\n </td>\n <td>\n <input type=\"text\" id=\"Parameter{{$index}}\" ng-model=\"RawData.ID\" disabled=\"true\" required><!--ng-model=-->\n </td>\n <td>\n <input type=\"text\" id=\"Warning_error{{$index}}\" ng-model=\"RawData.Add\" disabled=\"true\" required> <!--ng-model=\"IntMsg.payload.EmpData[$index].Name\"-->\n </td>\n <td>\n <input type=\"text\" id=\"Warning_error{{$index}}\" ng-model=\"RawData.Data\" disabled=\"true\" required> <!--ng-model=\"IntMsg.payload.EmpData[$index].Name\"-->\n </td>\n <td>\n <input type=\"text\" id=\"Warning_error{{$index}}\" ng-model=\"RawData.Status\" disabled=\"true\" required> <!--ng-model=\"IntMsg.payload.EmpData[$index].Name\"-->\n </td>\n \n </tr>\n </table>\n </form>\n</div>\n</div>\n<script>\n\n(function(scope) {\n // use this func\n \n scope.$watch('msg', function(msg) {\n if (msg) {\n // Do something when msg arrives\n \n console.log(msg.payload);\n }\n });\n\n})(scope);\n\n\n</script>\n</body>\n</html>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":510,"y":560,"wires":[[]]},{"id":"84f42647.dd19c8","type":"function","z":"a14027eb.55f138","name":"","func":"var n = global.get('slaveLength')\nfor(i=0;i<n;i++)\n{\n if((msg.payload.id == global.get('sID'+i)) && (msg.payload.register) == global.get('sregisterAddress'+i))\n {\n flow.set('sensorRawData[' + global.get('sID'+i) + '][' + global.get('sregisterAddress'+i) + ']',msg.payload.data)\n global.set('Status[' + global.get('sID'+i) + ']',msg.payload.status)\n }\n}\nreturn msg;","outputs":1,"noerr":0,"x":1190,"y":340,"wires":[[]]},{"id":"5e22e17d.5fb1a","type":"function","z":"a14027eb.55f138","name":"Testing","func":"\n\nnode.warn(flow.get('sensorRawData[1][0]'))\nreturn msg","outputs":1,"noerr":0,"x":820,"y":80,"wires":[[]]},{"id":"a7b2b6af.817b78","type":"inject","z":"a14027eb.55f138","name":"","repeat":"","crontab":"","once":false,"onceDelay":"1","topic":"","payload":"","payloadType":"date","x":660,"y":80,"wires":[["5e22e17d.5fb1a"]]},{"id":"e95f0c21.b4ef1","type":"inject","z":"a14027eb.55f138","name":"","repeat":"","crontab":"","once":true,"onceDelay":"5","topic":"","payload":"","payloadType":"date","x":150,"y":640,"wires":[["2ead3cc1.5294c4"]]},{"id":"2ead3cc1.5294c4","type":"file in","z":"a14027eb.55f138","name":"Parameter.txt","filename":"/home/pi/Desktop/Parameter.txt","format":"utf8","chunk":false,"sendError":false,"x":330,"y":640,"wires":[["f923b67d.aaa718"]]},{"id":"f923b67d.aaa718","type":"function","z":"a14027eb.55f138","name":"settings obj","func":"global.set(\"settings\",msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":510,"y":640,"wires":[["a749c2e1.e6fd8"]]},{"id":"a749c2e1.e6fd8","type":"json","z":"a14027eb.55f138","name":"","property":"payload","action":"","pretty":false,"x":670,"y":640,"wires":[["cf894523.f6b3f8"]]},{"id":"cf894523.f6b3f8","type":"ui_template","z":"a14027eb.55f138","group":"744f5e6.759fba","name":"Parameter type","order":1,"width":"0","height":"0","format":"<html>\n <head>\n \n </head>\n <body>\n <style>\nbody{\n background-image : url(\"/background9.jpg\");\n}\n \n input[type=text]{\n \tbackground-color: white;\n \ttext-align : center;\n \tcolor : black;\n border:none;\n padding : 7px;\n }\n input[type=submit] {\n background-color: #4CAF50;\n color: white;\n padding: 5px 7px;\n text-align : center;\n border: none;\n border-radius: 1px;\n cursor: allowed;\n float: left;\n}\n\ninput[type=submit]:hover {\n background-color: #45a049;\n}\ntable, tr, th, td {\n \n background-color: white;\n border-collapse: collapse;\n\t\tborder: 1px solid black;\n\t\tcolor: black;\n\t\ttext-align: center;\n\t\tpadding: 1px;\n\t\theight: 100%;\n}\n\n input[type=number]{\n background-color: white;\n color : black;\n text-align : center;\n border : 1px solid #0093dc;\n padding : 7px 6px;\n text-align : center;\n } \n th{\n\t text-align : center;\n\t color: white;\n\t font-weight: normal;\n\t font-family: candara;\n\t font-size: 110%;\n\t background-color: #097479;\n\t padding : 7px 3px\n\t }\n\t td {\n \n background-color: white;\n border-collapse: collapse;\n\t\tborder: 1px solid black;\n\t\tcolor : black;\n\t\ttext-align : center;\n\t\tpadding: 1px;\n}\ntr, th, td \n{\n width: 200px;\n}\n</style>\n \n \n<div>\n\n\n<div >\n <form id=\"TableForm\" ng-submit=\"MyTableFormAction()\" >\n <table align = \"center\" id=\"EmptableWithEditDelete1\">\n <tr>\n <th>\n Sr. No.\n </th>\n <th>\n Parameter\n </th>\n <th>\n Edit\n </th>\n <th>\n Add Record\n </th> \n <th>\n Delete\n </th>\n </tr>\n <tr ng-repeat=\"Set in IntMsg.payload.SetData\" >\n <td disabled=\"true\">\n {{$index+1}}\n </td>\n <td>\n <input type=\"text\" id=\"EmpHighInput{{$index}}\" ng-model=\"Set.Name\" disabled=\"true\" required> <!--ng-model=\"IntMsg.payload.SetData[$index].Name\"-->\n </td>\n <td>\n <button type=\"button\" ng-click=\"TableFormRowEditBtn($index)\" ng-style=\"{background: '#ffc399', color:'black', border : '1px solid #0093dc', cursor: 'allowed'}\">\n Edit\n </button>\n \n </td>\n <td>\n <button type=\"button\" ng-click=\"TableFormAddRowBtn($index)\" ng-style=\"{background: '#ffc399', color:'black', border : '1px solid #0093dc', cursor: 'allowed'}\">\n Add Record\n </button>\n \n </td>\n <td>\n <button type=\"button\" ng-click=\"TableFormRowDeleteBtn($index)\" ng-style=\"{background: '#ffc399', color:'black', border : '1px solid #0093dc', cursor: 'allowed'}\">\n Delete\n </button>\n </td>\n </tr>\n </table>\n <br>\n <br>\n\n <button type=\"Submit\" name=\"Submit\" ng-style=\"{float: 'right', background: '#54e18a', color:'Black',padding: '4px 6px', border: 'none', cursor: 'allowed'}\"> \n Submit Data\n </button>\n <button type=\"button\" ng-click=\"TableAddFirstRecord()\" ng-style=\"{float: 'left', background: '#54e18a', color:'Black',padding: '4px 6px', border: 'none', cursor: 'allowed'}\"> Add Record\n \n </button>\n \n \n </form>\n</div>\n</div>\n<script>\n//send({payload:myFunction1()})\n//few learnigs: if msg.pyload is used to link data to html tags like \n//<input type=\"text\" id=\"EmpId\" name=\"fname\" value={{msg.payload.TSetData.Selectedobj}} disabled > \n//then \n//ensure orginal data variables in msg.payload are intact through out the session/user interaction. \n\n//\"{{angular_var}}\" syntax is used in html to pass varible data from angular to html tags\n//angular function send({payload:var/funct}) is used to send the msg to node red using ng-click directives. it updates msg.payload of entire template. \n// if your html view tags like input msg/table/dropdowns are getting reset that means\n//while sending msg, orginal msg got disturbed.\n// to solve this issue you can preserve original msg by adding new varibles to orginal msg.payload .\n// this is allowed but you should not disturb incoming msg.payload varibales data structure.\n// i.e say incoming msg.payload had data structure like msg={\"payload\":{\"emp\":employees}}\n//employees=[{\"name\":\"e1\",\"id\":1,\"dept\":\"dept1\",\"div\":\"div1\"},{\"name\":\"e2\",\"id\":2,\"dept\":\"dept2\",\"div\":\"div2\"},{\"name\":\"e3\",\"id\":3,\"dept\":\"dept3\",\"div\":\"div3\"}]\n// in this case you can add msg={\"payload\":{\"emp\":employees},{\"newVar\":newVarData}} this will works as orignal msg.payload.emp is not disturbed and new object \"NewVar is added\"\n// you can chage values of all varibles . that will not create any error or reset of view.\n\n\n// to check node-red ui is working properly , type \"http://127.0.0.1:1880/ui/\" in chrome browser and click\n//on broweser three dots menu-->more tools-->developer tools ensure at riht side of broweser debug window is opend\n// click on Consol tab to see error/status mssages.\n// you can use console.log(\"your_var_name\"); to see the value\n\n var test=document.getElementById(\"EmpId\");\n\n(function(scope) {\n // use this func\n scope.IntMsg={\"payload\":{\"SetData\":[{}]}};\n \n scope.$watch('msg', function(msg) {\n if (msg) {\n // Do something when msg arrives\n scope.IntMsg=msg;\n \n console.log(msg.payload);\n }\n });\n\n \n //\n scope.TableFormRowEditBtn=function MyTableFormEditBtn(index){\n console.log(\"hi\");\n document.getElementById(\"EmptableWithEditDelete1\").rows[index+1].cells[1].getElementsByTagName(\"input\")[0].disabled=false\n \n //document.getElementById(\"DivtableWithEditDelete\").rows[index+1].cells[1] provides row-1 column 1 cell. in this cell. as index in JS starts with zero,need to do +1 to get first row.\n //to access input tag from row-1,column-1, \"getElementsByTagName(\"input\")[0]\" is used.[0] provides first input tag in this context.\n \n //console.log(scope.msg.payload.MyFormData.Edit[index]);\n \n }\n\n\n scope.TableAddFirstRecord=function MyTableAddFirstRecordBtn(){\n //Array index in JS variable starts from Zero where as table row index starts from 1 so index is added with +1\n console.log(\"TableAddFirstRecord clicked\");\n var dummy={\"Pressure\":\"\",};\n scope.IntMsg.payload.SetData.push(dummy);\n }\n\n\n scope.TableFormAddRowBtn=function MyTableFormAddRowBtn(index){\n //Array index in JS variable starts from Zero where as table row index starts from 1 so index is added with +1\n var dummy={\"Pressure\":\"\"};\n scope.IntMsg.payload.SetData.splice(index+1, 0, dummy);\n }\n scope.MyTableFormAction= function MyTableFormData(){\n var i;\n for (i = 0; i < scope.IntMsg.payload.SetData.length; i++) {\n document.getElementById(\"EmptableWithEditDelete1\").rows[i+1].cells[1].getElementsByTagName(\"input\")[0].disabled=true\n \n \n }\n \n console.log(\"MyTableFormData\");\n console.log(scope.IntMsg.payload.SetData);\n window.confirm(\"Data Saved\");\n scope.send({\"payload\":(scope.IntMsg.payload)});\n \n }\n scope.TableFormRowDeleteBtn=function MyTableFormRowDeleteBtn(index){\n var txt;\n var r = confirm(\"Press OK to Confim Delete \");\n if (r == true) {\n scope.IntMsg.payload.SetData.splice(index,1);\n scope.MyTableFormAction();\n console.log([\"TableFormRowDeleteBtn\"],index);\n }\n \n\n }\n \n})(scope);\n\n\n</script>\n</body>\n</html>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":840,"y":640,"wires":[["4f390250.a42aac"]]},{"id":"4f390250.a42aac","type":"file","z":"a14027eb.55f138","name":"Parameter.txt","filename":"/home/pi/Desktop/Parameter.txt","appendNewline":false,"createDir":true,"overwriteFile":"true","x":1030,"y":640,"wires":[["762881ed.bae51"]]},{"id":"762881ed.bae51","type":"function","z":"a14027eb.55f138","name":"SetVal","func":"var data= msg.payload.SetData;\nvar n = data.length;\n//node.warn(n)\nglobal.set('AllPara',msg.payload)\n//node.warn(global.get('AllPara'))\n\nfor(i=0;i<n;i++)\n{\n global.set('SetDataParameterType['+i+']',msg.payload.SetData[i])\n}\n\nvar a= global.get('SetDataParameterType')\nfor(i=0;i<n;i++)\n{\n global.set('parameterType['+i+']',a[i].Name)\n global.set('id['+i+']',i)\n}\nvar b=global.get('parameterType')\n\nfor(i=0;i<n;i++)\n{\n global.set('parameterTypeName['+i+']',b[i])\n}\nvar d=global.get('parameterTypeName')\nvar ParaDet={ };\nfor(i=0;i<n;i++)\n{\n ParaDet[i]={\"id\":i,\"parameterTypeName\":d[i]};\n}\nmsg.payload= ParaDet\n\nreturn msg;\n","outputs":1,"noerr":0,"x":1210,"y":640,"wires":[["c69f75ff.573618"]]},{"id":"c69f75ff.573618","type":"function","z":"a14027eb.55f138","name":"SetVal","func":"global.set('ParaDrop',msg.payload);\nglobal.set('Para1DropUpdated',1);\nreturn msg;","outputs":1,"noerr":0,"x":1350,"y":640,"wires":[["d9e630d2.c9532"]]},{"id":"d9e630d2.c9532","type":"debug","z":"a14027eb.55f138","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1510,"y":640,"wires":[]},{"id":"9c961308.421d3","type":"inject","z":"a14027eb.55f138","name":"","repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":150,"y":220,"wires":[["1e1594b7.ad165b"]]},{"id":"1e1594b7.ad165b","type":"function","z":"a14027eb.55f138","name":"","func":"if(global.get('Para1DropUpdated')==1)\n{\n global.set('Para1DropUpdated',0);\n return msg;\n}","outputs":1,"noerr":0,"x":360,"y":220,"wires":[["c32d890c.6d2af8"]]},{"id":"7231c5e1.f1d45c","type":"function","z":"a14027eb.55f138","name":"settings obj","func":"var Dropdown=global.get('ParaDrop');\nvar RecipDetails = msg.payload.RecipDetails\nvar NoOfRecip = msg.payload.NoOfRecip\nmsg.payload.Dropdown=Dropdown;\nmsg.payload={\"RecipDetails\":RecipDetails,\"NoOfRecip\":NoOfRecip,\"Dropdown\":Dropdown}\n//node.warn(Dropdown)\nreturn msg;","outputs":1,"noerr":0,"x":690,"y":160,"wires":[["c9e65f4b.ba89c"]]},{"id":"c9e65f4b.ba89c","type":"ui_template","z":"a14027eb.55f138","group":"2f99bea8.cf2d52","name":"modbus slaves","order":3,"width":0,"height":0,"format":"<html>\n<body>\n<style>\nbody{\n background-image : url(\"/background9.jpg\");\n}\n \n input[type=text]{\n \tbackground-color: white;\n \ttext-align : center;\n \tcolor : black;\n border:none;\n padding : 7px;\n }\n input[type=submit] {\n background-color: #4CAF50;\n color: white;\n padding: 5px 7px;\n text-align : center;\n border: none;\n border-radius: 1px;\n cursor: allowed;\n float: left;\n}\n\ninput[type=submit]:hover {\n background-color: #45a049;\n}\ntable, tr, th, td {\n \n background-color: white;\n border-collapse: collapse;\n\t\tborder: 1px solid black;\n\t\tcolor: black;\n\t\ttext-align: center;\n\t\tpadding: 1px;\n}\n\n input[type=number]{\n background-color: white;\n color : black;\n text-align : center;\n border : 1px solid #0093dc;\n padding : 7px 6px;\n text-align : center;\n } \n th{\n\t text-align : center;\n\t color: white;\n\t font-weight: normal;\n\t font-family: candara;\n\t font-size: 110%;\n\t background-color: #097479;\n\t padding : 7px 3px\n\t }\n\t td {\n \n background-color: white;\n border-collapse: collapse;\n\t\tborder: 1px solid black;\n\t\tcolor : black;\n\t\ttext-align : center;\n\t\tpadding: 1px;\n}\ntr, th, td \n{\n width: 200px;\n}\n \n</style>\n\n \n<form id=\"MobileNoForm\" ng-submit=\"submitlist()\" align=\"justify\">\n<br>\n<div padding: 5px; margin: 5px; >\n<div class = \"addrow\">\n<div class = \"column\">\n\n\n<table id=\"mytable\" class=\"table table-bordered\">\n<thead>\n<tr>\n<th style=\"width:20% type='text' name ='srNo';\">Sr. No.</th>\n<th style=\"width:20% type='text' name ='parameterName';\">Parameter Name</th>\n<th style=\"width:20% type='text' name ='type';\">Parameter Type</th>\n<th style=\"width:20% type='text' name ='slaveID';\">Slave ID</th>\n<th style=\"width:20% type='text' name ='registerAddress';\">Register Address</th>\n<th style=\"width:20% type='text' name ='dataBits';\">Register Length</th>\n<th style=\"width:30% type='text' name ='Code';\">Remove</th>\n</tr>\n</thead>\n<tbody align=\"center\">\n<tr ng-repeat=\"Details in recipients\">\n<!--<td><select id=\"sel\" name=\"Details.id{{$index}}\" placeholder = \"-\" ng-model=\"Details.id\" required></select></td>-->\n<td>{{$index+1}}</td>\n<td><input type=\"text\" name=\"parameterName{{$index}}\" ng-model=\"Details.parameterName\" required></td>\n <td>\n <select id=\"EmpDropdown\" ng-model=\"Details.id\" >\n <!-- when user selects option from dropdown, value attrubite in option tag will receive the varible value assigned to it. This value will be passed to \"ng-model=\"your_variable\"\" and can be accessed\n in java script . another way of accessing it is using DOM:document.getElementById(\"Your Select ID\").value syntax -->\n <option ng-repeat=\"Tasklist in Drop\" value=\"{{Tasklist.id}}\" required >{{Tasklist.parameterTypeName}}\n <!--ng-repeat repeas html tag for each object in the list/array assigned to it -->\n </option>\n </select>\n </td>\n<td><input type=\"number\" name=\"slaveID{{$index}}\" ng-model=\"Details.slaveID\" required></td>\n<td><input type=\"number\" name=\"registerAddress{{$index}}\" ng-model=\"Details.registerAddress\" required></td>\n<td><input type=\"number\" name=\"dataBits{{$index}}\" ng-model=\"Details.dataBits\" required></td>\n<td><input type=\"button\" value=\"Remove\" ng-click=\"deleteDetails($index)\" ng-style=\"{background: '#ffc399', color:'black', border : '1px solid #0093dc', cursor: 'allowed'}\"></td>\n</tbody>\n</table>\n<br>\n<br>\n</div>\n</div>\n</div>\n<input type=\"submit\" class=\"btn btn-primary\" value=\"Submit\" ng-style=\"{float: 'right', background: '#54e18a', color:'Black',padding: '4px 6px', border: 'none', cursor: 'allowed'}\"/> \n<input type=\"button\" name=\"NoOfRecip\" value =\"Add Parameter\" ng-click=\"addRecipient()\" ng-style=\"{align:'right',float: 'left',background: '#7dcfff', color:'Black',padding: '4px 6px', border: 'none', cursor: 'allowed'}\">\n\n</form>\n<script>\nvar dropdata;\n\t (function(scope) { \t\n scope.$watch('msg', function(msg) {\n console.log([\"msg\",msg]);\n if (msg) {\n $(\"#my_\"+scope.$id).html(msg.payload);\n scope.data = angular.copy(msg.payload.RecipDetails);\n scope.Drop = angular.copy(msg.payload.Dropdown);\n scope.recipients = angular.copy(scope.data);\n dropdata = angular.copy(scope.Drop);\n \n }\n \n //var msg={\"payload\":{\"dropdata\" :(scope.dropdata)}};\n//scope.send(msg);\n });\n\n\t scope.enabledEdit = [];\t\n//scope.data = [{ id:\"\",slaveID:\"\",registerAddress:\"\",dataBits:\"\"}];\n \n//scope.recipients = angular.copy(scope.data);\n\n\t\n\t scope.addRecipient = function(){\n\t \n\tvar Details ={ id:\"\",slaveID:\"\",registerAddress:\"\",dataBits:\"\"};\n\t\tscope.recipients.push(Details);\n\t\tscope.enabledEdit[scope.recipients.length-1]=true;\n}\n\t scope.editDetails = function(index){\n\t console.log(\"edit index\"+index);\n\t scope.enabledEdit[index] = true;\n\t}\n\tscope.deleteDetails = function(index) {\n\t\tvar r = confirm(\"Are you sure you want to delete?\");\n if (r == true) {\n txt = \"You pressed OK!\";\n scope.recipients.splice(index,1);\n scope.submitlist();\n } else {\n txt = \"You pressed Cancel!\";\n }\n document.getElementById(\"demo\").innerHTML = txt;\n\t}\n\nscope.submitlist = function(){\n \n for(var i = 0 ; i < scope.recipients.length ; i++)\n {\n //window.confirm([\"for loopin sg=umbmit\"]);\n scope.recipients[i].GenCode = dropdata[scope.recipients[i].id].code;\n }\n//window.confirm([\"above msg\"]);\nvar msg={\"payload\":{\"RecipDetails\" :(scope.recipients),\"NoOfRecip\":(scope.recipients.length),\"Dropdown\":(scope.Drop)}};//,\"SetVal\":(dropdata[scope.recipients[0].Value]\n//window.confirm([\"msg\",msg]);\nscope.send(msg);\nwindow.confirm(\"Data Saved\");\nconsole.log([\"form submitted:\",(msg)]);\n\n}\n})(scope);\n</script> \n</body>\n</html>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":880,"y":160,"wires":[["45249f99.a9d4a"]]},{"id":"1bd82b41.040035","type":"inject","z":"a14027eb.55f138","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"10","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":150,"y":720,"wires":[["b39388c3.a79818"]]},{"id":"b39388c3.a79818","type":"function","z":"a14027eb.55f138","name":"parameterForLoop","func":"var n = global.get('slaveLength')\n\n\nfor(i = 0;i<n;i++)\n{\n msg.payload = [global.get('parameterTypeName[' + global.get('parameterID'+i) + ']'),flow.get('sensorRawData[' + global.get('sID'+i) + '][' + global.get('sregisterAddress'+i) + ']'), i]\n node.send(msg);\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":350,"y":720,"wires":[["ebf3b78c.8b1b98","4a765581.1ff22c","1e640dba.14aee2","5b07dde7.3d4cf4","76cffb3d.40e484","bd47c0fe.abada","7d19457d.8175cc","a8b20563.a4dc48"]]},{"id":"5b07dde7.3d4cf4","type":"function","z":"a14027eb.55f138","name":"Temperature - RTD","func":"var compare = [\"Temperature - RTD\"]\n\nfor(i = 0;i< compare.length;i++)\n{\n if(msg.payload[0] == compare[i])\n {\n msg.data = msg.payload[1]\n msg.index = msg.payload[2] \n return msg;\n }\n}","outputs":1,"noerr":0,"x":590,"y":960,"wires":[["5b704284.c45a8c"]]},{"id":"76cffb3d.40e484","type":"function","z":"a14027eb.55f138","name":"DHT","func":"var compare = [\"DHT\"]\n\nfor(i = 0;i< compare.length;i++)\n{\n if(msg.payload[0] == compare[i])\n {\n msg.data = msg.payload[1]\n msg.index = msg.payload[2] \n return msg;\n }\n}","outputs":1,"noerr":0,"x":550,"y":1020,"wires":[["85925be9.41a418"]]},{"id":"ebf3b78c.8b1b98","type":"function","z":"a14027eb.55f138","name":"Energy Meter","func":"var compare = [\"Schneider Energy Meter\"]\n\nfor(i = 0;i< compare.length;i++)\n{\n if(msg.payload[0] == compare[i])\n {\n msg.data = msg.payload[1]\n msg.index = msg.payload[2] \n return msg;\n }\n}","outputs":1,"noerr":0,"x":580,"y":720,"wires":[["9d652c01.14f6f"]]},{"id":"9d652c01.14f6f","type":"function","z":"a14027eb.55f138","name":"set MSB LSB","func":"var m = msg.data[1].toString(16)\nvar l = msg.data[0].toString(16)\n//node.warn([\"m\",m])\n//node.warn([\"l\",l])\n//var value = (msg.payload[1] << 16) + (msg.payload[0])\nvar k=\"0x\"+m+\"\"+l;\n//var n=parseInt(k,16)\n//var num3=(m<<16)|(l);\n//node.warn([\"k\",k])\nmsg.payload=k\n//node.warn(value)\nreturn msg;","outputs":1,"noerr":0,"x":830,"y":720,"wires":[["2c894e9.b99f7b2"]]},{"id":"2c894e9.b99f7b2","type":"function","z":"a14027eb.55f138","name":"IEEE-754 to float","func":"/* Converts from an number, string, buffer or array representing an IEEE-754 value\n * to a javascript float.\n * The following may be given in msg.payload:\n * A string representing a number, which may be hex or binary\n * examples, \"1735\" \"0x02045789\" 0b01000000010010010000111111011011\n * An integer value\n * A four element array or buffer of 8 bit values, most significant byte first.\n*/ \n// first make a number from the given payload if necessary\nlet intValue;\nif (typeof msg.payload === \"number\") {\n intValue = msg.payload;\n} else if (typeof msg.payload === \"string\") {\n intValue = Number(msg.payload);\n} else if (msg.payload.length == 4) {\n // four byte array or buffer\n intValue = (((((msg.payload[0] << 8) + msg.payload[1]) << 8) + msg.payload[2]) << 8) + msg.payload[3];\n} else {\n node.warn(\"Unrecognised payload type or length\");\n}\n\nmsg.payload = parseFloat(Int2Float32(intValue));\nreturn msg;\n\nfunction Int2Float32(bytes) {\n var sign = (bytes & 0x80000000) ? -1 : 1;\n var exponent = ((bytes >> 23) & 0xFF) - 127;\n var significand = (bytes & ~(-1 << 23));\n\n if (exponent == 128) \n return sign * ((significand) ? Number.NaN : Number.POSITIVE_INFINITY);\n\n if (exponent == -127) {\n if (significand === 0) return sign * 0.0;\n exponent = -126;\n significand /= (1 << 22);\n } else significand = (significand | (1 << 23)) / (1 << 23);\n\n return sign * significand * Math.pow(2, exponent);\n}","outputs":1,"noerr":0,"x":1030,"y":720,"wires":[["888bb02e.c4027"]]},{"id":"888bb02e.c4027","type":"function","z":"a14027eb.55f138","name":"","func":"msg.value = msg.payload.toFixed(2)\nvar i = msg.index\n\nglobal.set('sensorData[' + global.get('sID'+i) + '][' + global.get('sregisterAddress'+i) + ']', msg.value)\n\nreturn msg;","outputs":1,"noerr":0,"x":1240,"y":720,"wires":[[]]},{"id":"4a765581.1ff22c","type":"function","z":"a14027eb.55f138","name":"pH","func":"var compare = [\"pH\"]\n\nfor(i = 0;i< compare.length;i++)\n{\n if(msg.payload[0] == compare[i])\n {\n msg.data = msg.payload[1]\n msg.index = msg.payload[2] \n return msg;\n }\n}","outputs":1,"noerr":0,"x":550,"y":780,"wires":[["a0085ad7.d15628"]]},{"id":"1e640dba.14aee2","type":"function","z":"a14027eb.55f138","name":"Pressure","func":"var compare = [\"Pressure\"]\n\nfor(i = 0;i< compare.length;i++)\n{\n if(msg.payload[0] == compare[i])\n {\n msg.data = msg.payload[1]\n msg.index = msg.payload[2] \n return msg;\n }\n}","outputs":1,"noerr":0,"x":560,"y":900,"wires":[["17363568.007c1b"]]},{"id":"bd47c0fe.abada","type":"function","z":"a14027eb.55f138","name":"Raw Data","func":"var compare = [\"Raw Data\"]\n\nfor(i = 0;i< compare.length;i++)\n{\n if(msg.payload[0] == compare[i])\n {\n msg.data = msg.payload[1]\n msg.index = msg.payload[2] \n return msg;\n }\n}","outputs":1,"noerr":0,"x":560,"y":1080,"wires":[["85925be9.41a418"]]},{"id":"45dee8f.924cf18","type":"function","z":"a14027eb.55f138","name":"pH Logic","func":"var s10=msg.data;\nvar i = msg.index;\nvar j = flow.get('phIndex')\nvar n = global.get('slaveLength')\nvar Volt =s10 *((5.0 /1024.0))*1000; //voltage in mV\nvar pHValue = []\nvar slope = []\nvar intercept = []\nvar offset = flow.get(\"offset\")\nvar SuccessReqPrev = flow.get(\"SuccessReq\")\nvar TankName = flow.get(\"TankName\")\nvar NutralVolt = flow.get(\"NutralVolt\")\nvar AcidVolt = flow.get(\"AcidVolt\")\nvar LastCalib7 = flow.get(\"LastCalib7\")\nvar LastCalib4 = flow.get(\"LastCalib4\")\nvar time = new Date();\nvar Datetime = (time.getDate() + \"-\" + (time.getMonth() + 1) + \"-\" + time.getFullYear() + \",\" + time.getHours() + \":\" + time.getMinutes() + \":\" + time.getSeconds()).toString();\n\n//substracting offset from raw value. (offset is calculated in calibration module)\nslope= (7.0-4.0)/((NutralVolt[j]-1500.0)/3 - (AcidVolt[j]-1500)/3)\nintercept = 7.0 - slope*(NutralVolt[j]-1500.0)/3\npHValue = slope * ((Volt - 1500.0)/3) + intercept\n\n//Setting the pHValues within flow\nflow.set('Voltage[' + global.get('sID'+i) + ']', Number(Volt))\nglobal.set('sensorData[' + global.get('sID'+i) + '][' + global.get('sregisterAddress'+i) + ']', pHValue.toFixed(2))\nmsg.payload = global.get('sensorData[' + global.get('sID'+i) + '][' + global.get('sregisterAddress'+i) + ']')\n\nreturn msg;","outputs":1,"noerr":0,"x":1000,"y":780,"wires":[["7b94898e.0ace58","88286b4c.1781c8"]]},{"id":"575c5fdd.34fde","type":"file in","z":"a14027eb.55f138","name":"pHRef.txt","filename":"/home/pi/Desktop/pHRef.txt","format":"utf8","chunk":false,"sendError":false,"x":320,"y":1280,"wires":[["bc3d6dda.aac2e"]]},{"id":"6529aab.9fb2354","type":"inject","z":"a14027eb.55f138","name":"","repeat":"","crontab":"","once":true,"onceDelay":"3","topic":"","payload":"","payloadType":"date","x":150,"y":1280,"wires":[["575c5fdd.34fde"]]},{"id":"bc3d6dda.aac2e","type":"json","z":"a14027eb.55f138","name":"","property":"payload","action":"","pretty":false,"x":470,"y":1280,"wires":[["732d5f93.12be9"]]},{"id":"732d5f93.12be9","type":"function","z":"a14027eb.55f138","name":"var init","func":"flow.set(\"pHValue\",[])\nflow.set(\"Voltage\",[])\nflow.set(\"SuccessReq\",[])\nflow.set(\"UnitId\",[])\nflow.set(\"pHAlert\",[0,0,0,0,0,0,0,0,0]);\nflow.set(\"NutralVolt\",msg.payload.NutralVolt)\nflow.set(\"AcidVolt\",msg.payload.AcidVolt)\nflow.set(\"LastCalib4\",msg.payload.LastCalib4)\nflow.set(\"LastCalib7\",msg.payload.LastCalib7)\n","outputs":1,"noerr":0,"x":650,"y":1280,"wires":[[]]},{"id":"b04b3cff.0687","type":"comment","z":"a14027eb.55f138","name":"Setting pH flow variables","info":"","x":170,"y":1240,"wires":[]},{"id":"7d19457d.8175cc","type":"function","z":"a14027eb.55f138","name":"Custom Code","func":"var compare = [\"Custom Code\"]\n\nfor(i = 0;i< compare.length;i++)\n{\n if(msg.payload[0] == compare[i])\n {\n msg.data = msg.payload[1]\n msg.index = msg.payload[2] \n return msg;\n }\n}","outputs":1,"noerr":0,"x":580,"y":1140,"wires":[["c29475c.c5fd688"]]},{"id":"d61a1436.b9fbe8","type":"inject","z":"a14027eb.55f138","name":"","repeat":"","crontab":"","once":true,"onceDelay":"5","topic":"","payload":"","payloadType":"date","x":150,"y":2080,"wires":[["1cb4b570.52ae6b"]]},{"id":"1cb4b570.52ae6b","type":"file in","z":"a14027eb.55f138","name":"PressureCal.txt","filename":"/home/pi/Desktop/PressureCal.txt","format":"utf8","chunk":false,"sendError":false,"x":340,"y":2080,"wires":[["e741ea5b.f71ab8"]]},{"id":"e741ea5b.f71ab8","type":"function","z":"a14027eb.55f138","name":"settings obj","func":"//global.set(\"settings\",msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":530,"y":2080,"wires":[["3a02bd84.b53c22"]]},{"id":"3a02bd84.b53c22","type":"json","z":"a14027eb.55f138","name":"","property":"payload","action":"","pretty":false,"x":670,"y":2080,"wires":[["c87d022a.b3f9b"]]},{"id":"c87d022a.b3f9b","type":"ui_template","z":"a14027eb.55f138","group":"f443a0cc.b77b1","name":"Pressure Calibration","order":1,"width":24,"height":8,"format":"<html>\n <head>\n \n </head>\n <body>\n <style>\nbody{\n background-image : url(\"/background9.jpg\");\n}\n \n input[type=text]{\n \tbackground-color: white;\n \ttext-align : center;\n \tcolor : black;\n border:none;\n padding : 7px;\n }\n input[type=submit] {\n background-color: #4CAF50;\n color: white;\n padding: 5px 7px;\n text-align : center;\n border: none;\n border-radius: 1px;\n cursor: allowed;\n float: left;\n}\n\ninput[type=submit]:hover {\n background-color: #45a049;\n}\ntable, tr, th, td {\n \n background-color: white;\n border-collapse: collapse;\n\t\tborder: 1px solid black;\n\t\tcolor: black;\n\t\ttext-align: center;\n\t\tpadding: 1px;\n}\n\n input[type=number]{\n background-color: white;\n color : black;\n text-align : center;\n border : 1px solid #0093dc;\n padding : 7px 6px;\n text-align : center;\n } \n th{\n\t text-align : center;\n\t color: white;\n\t font-weight: normal;\n\t font-family: candara;\n\t font-size: 110%;\n\t background-color: #097479;\n\t padding : 7px 3px\n\t }\n\t td {\n \n background-color: white;\n border-collapse: collapse;\n\t\tborder: 1px solid black;\n\t\tcolor : black;\n\t\ttext-align : center;\n\t\tpadding: 1px;\n}\ntr, th, td \n{\n width: 200px;\n}\n</style>\n \n \n<div>\n\n\n<div >\n <form id=\"TableForm\" ng-submit=\"MyTableFormAction()\" >\n <table align = \"center\" id=\"EmptableWithEditDelete2\">\n <tr>\n <th>\n Sr. No.\n </th>\n <th>\n Pressure\n </th>\n <th>\n Value(Bar)\n </th>\n <th>\n Edit\n </th>\n <th>\n Add Record\n </th> \n <th>\n Delete\n </th>\n </tr>\n <tr ng-repeat=\"Set in IntMsg.payload.SetData\" >\n <td disabled=\"true\">\n {{$index+1}}\n </td>\n <td disabled=\"true\">\n Pressure {{$index+1}}\n </td>\n <td>\n <input type=\"number\" id=\"EmpHighInput{{$index}}\" ng-model=\"Set.Pressure\" disabled=\"true\" required> <!--ng-model=\"IntMsg.payload.SetData[$index].Name\"-->\n </td>\n <td>\n <button type=\"button\" ng-click=\"TableFormRowEditBtn($index)\" ng-style=\"{background: '#ffc399', color:'black', border : '1px solid #0093dc', cursor: 'allowed'}\">\n Edit\n </button>\n \n </td>\n <td>\n <button type=\"button\" ng-click=\"TableFormAddRowBtn($index)\" ng-style=\"{background: '#ffc399', color:'black', border : '1px solid #0093dc', cursor: 'allowed'}\">\n Add Record\n </button>\n \n </td>\n <td>\n <button type=\"button\" ng-click=\"TableFormRowDeleteBtn($index)\" ng-style=\"{background: '#ffc399', color:'black', border : '1px solid #0093dc', cursor: 'allowed'}\">\n Delete\n </button>\n </td>\n </tr>\n </table>\n <br>\n <br>\n\n <button type=\"Submit\" name=\"Submit\" ng-style=\"{float: 'right', background: '#54e18a', color:'Black',padding: '4px 6px', border: 'none', cursor: 'allowed'}\"> \n Submit Data\n </button>\n <button type=\"button\" ng-click=\"TableAddFirstRecord()\" ng-style=\"{float: 'left', background: '#54e18a', color:'Black',padding: '4px 6px', border: 'none', cursor: 'allowed'}\"> Add Record\n \n </button>\n \n \n </form>\n</div>\n</div>\n<script>\n//send({payload:myFunction1()})\n//few learnigs: if msg.pyload is used to link data to html tags like \n//<input type=\"text\" id=\"EmpId\" name=\"fname\" value={{msg.payload.TSetData.Selectedobj}} disabled > \n//then \n//ensure orginal data variables in msg.payload are intact through out the session/user interaction. \n\n//\"{{angular_var}}\" syntax is used in html to pass varible data from angular to html tags\n//angular function send({payload:var/funct}) is used to send the msg to node red using ng-click directives. it updates msg.payload of entire template. \n// if your html view tags like input msg/table/dropdowns are getting reset that means\n//while sending msg, orginal msg got disturbed.\n// to solve this issue you can preserve original msg by adding new varibles to orginal msg.payload .\n// this is allowed but you should not disturb incoming msg.payload varibales data structure.\n// i.e say incoming msg.payload had data structure like msg={\"payload\":{\"emp\":employees}}\n//employees=[{\"name\":\"e1\",\"id\":1,\"dept\":\"dept1\",\"div\":\"div1\"},{\"name\":\"e2\",\"id\":2,\"dept\":\"dept2\",\"div\":\"div2\"},{\"name\":\"e3\",\"id\":3,\"dept\":\"dept3\",\"div\":\"div3\"}]\n// in this case you can add msg={\"payload\":{\"emp\":employees},{\"newVar\":newVarData}} this will works as orignal msg.payload.emp is not disturbed and new object \"NewVar is added\"\n// you can chage values of all varibles . that will not create any error or reset of view.\n\n\n// to check node-red ui is working properly , type \"http://127.0.0.1:1880/ui/\" in chrome browser and click\n//on broweser three dots menu-->more tools-->developer tools ensure at riht side of broweser debug window is opend\n// click on Consol tab to see error/status mssages.\n// you can use console.log(\"your_var_name\"); to see the value\n\n var test=document.getElementById(\"EmpId\");\n\n(function(scope) {\n // use this func\n scope.IntMsg={\"payload\":{\"SetData\":[{}]}};\n \n scope.$watch('msg', function(msg) {\n if (msg) {\n // Do something when msg arrives\n scope.IntMsg=msg;\n \n console.log(msg.payload);\n }\n });\n\n \n //\n scope.TableFormRowEditBtn=function MyTableFormEditBtn(index){\n console.log(\"hi\");\n document.getElementById(\"EmptableWithEditDelete2\").rows[index+1].cells[2].getElementsByTagName(\"input\")[0].disabled=false\n \n //document.getElementById(\"DivtableWithEditDelete\").rows[index+1].cells[1] provides row-1 column 1 cell. in this cell. as index in JS starts with zero,need to do +1 to get first row.\n //to access input tag from row-1,column-1, \"getElementsByTagName(\"input\")[0]\" is used.[0] provides first input tag in this context.\n \n //console.log(scope.msg.payload.MyFormData.Edit[index]);\n \n }\n\n\n scope.TableAddFirstRecord=function MyTableAddFirstRecordBtn(){\n //Array index in JS variable starts from Zero where as table row index starts from 1 so index is added with +1\n console.log(\"TableAddFirstRecord clicked\");\n var dummy={\"Pressure\":\"\",};\n scope.IntMsg.payload.SetData.push(dummy);\n }\n\n\n scope.TableFormAddRowBtn=function MyTableFormAddRowBtn(index){\n //Array index in JS variable starts from Zero where as table row index starts from 1 so index is added with +1\n var dummy={\"Pressure\":\"\"};\n scope.IntMsg.payload.SetData.splice(index+1, 0, dummy);\n }\n scope.MyTableFormAction= function MyTableFormData(){\n var i;\n for (i = 0; i < scope.IntMsg.payload.SetData.length; i++) {\n document.getElementById(\"EmptableWithEditDelete2\").rows[i+1].cells[2].getElementsByTagName(\"input\")[0].disabled=true\n }\n \n console.log(\"MyTableFormData\");\n console.log(scope.IntMsg.payload.SetData);\n window.confirm(\"Data Saved\");\n scope.send({\"payload\":(scope.IntMsg.payload)});\n \n }\n scope.TableFormRowDeleteBtn=function MyTableFormRowDeleteBtn(index){\n var txt;\n var r = confirm(\"Press OK to Confim Delete \");\n if (r == true) {\n scope.IntMsg.payload.SetData.splice(index,1);\n scope.MyTableFormAction();\n console.log([\"TableFormRowDeleteBtn\"],index);\n }\n \n\n }\n \n})(scope);\n\n\n</script>\n</body>\n</html>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":860,"y":2080,"wires":[["1ba3ebd4.9cb6f4"]]},{"id":"1ba3ebd4.9cb6f4","type":"file","z":"a14027eb.55f138","name":"PressureCal.txt","filename":"/home/pi/Desktop/PressureCal.txt","appendNewline":false,"createDir":true,"overwriteFile":"true","x":1060,"y":2080,"wires":[["dab6117e.62186","7e0baf5c.2c52e"]]},{"id":"7e0baf5c.2c52e","type":"function","z":"a14027eb.55f138","name":"SetVal","func":"var data = msg.payload.SetData;\nvar n= data.length;\nfor(i=0;i<n;i++)\n{\n global.set('Pressure'+(i+1)+'High',msg.payload.SetData[i].Pressure);\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":1230,"y":2120,"wires":[["dab6117e.62186"]]},{"id":"dab6117e.62186","type":"debug","z":"a14027eb.55f138","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1390,"y":2080,"wires":[]},{"id":"17363568.007c1b","type":"function","z":"a14027eb.55f138","name":"Pressure Logic","func":"var s30=msg.data;\nvar i = msg.index;\n\nvar v = s30 *( 5.0/1024.0);\nvar map = function(value, istart, istop, ostart, ostop) {\n return ostart + (ostop - ostart) * ((value - istart) / (istop - istart));\n}\nvar value = map(v,1,5,0,global.get('Pressure1High'))\n\nglobal.set('sensorData[' + global.get('sID'+i) + '][' + global.get('sregisterAddress'+i) + ']', value.toFixed(2))\nreturn msg;","outputs":1,"noerr":0,"x":840,"y":900,"wires":[[]]},{"id":"66c7cd57.285744","type":"comment","z":"a14027eb.55f138","name":"Pressure Calibration","info":"","x":150,"y":2040,"wires":[]},{"id":"85925be9.41a418","type":"function","z":"a14027eb.55f138","name":"Raw Data Logic","func":"var ip =msg.data;\nvar i = msg.index;\n\nglobal.set('sensorData[' + global.get('sID'+i) + '][' + global.get('sregisterAddress'+i) + ']', ip[0])\n\nmsg.payload = global.get('sensorData[' + global.get('sID'+i) + '][' + global.get('sregisterAddress'+i) + ']')\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":840,"y":1080,"wires":[["be2dba6.4a52448"]]},{"id":"5b704284.c45a8c","type":"function","z":"a14027eb.55f138","name":"Temperature - RTD Logic","func":"var s10=msg.data*(5.0 / 1023.0); //taking value and converting to voltage;\nvar i = msg.index;\n\nvar R1 = 200; \n\nvar R2 = R1 * 1/(5.0/s10 - 1); //calculating rtd resistance\n\nvar c = MultiMap(R2, 160);\n\nfunction MultiMap(val, size)\n{\n var temp = [100.00, 100.39, 100.78, 101.17, 101.56, 101.95, 102.34, 102.73, 103.12, 103.51,\n 103.90, 104.29, 104.68, 105.07, 105.46, 105.85, 106.24, 106.63, 107.02, 107.40,\n 107.79, 108.18, 108.57, 108.96, 109.35, 109.73, 110.12, 110.51, 110.90, 111.29,\n 111.67, 112.06, 112.45, 112.83, 113.22, 113.61, 114.00, 114.38, 114.77, 115.15,\n 115.54, 115.93, 116.31, 116.70, 117.08, 117.47, 117.86, 118.24, 118.63, 119.01,\n 119.40, 119.78, 120.17, 120.55, 120.94, 121.32, 121.71, 122.09, 122.47, 122.86,\n 123.24, 123.63, 124.01, 124.39, 124.78, 125.16, 125.54, 125.93, 126.31, 126.69,\n 127.08, 127.46, 127.84, 128.22, 128.61, 128.99, 129.37, 129.75, 130.13, 130.52,\n 130.90, 131.28, 131.66, 132.04, 132.42, 132.80, 133.18, 133.57, 133.95, 134.33,\n 134.71, 135.09, 135.47, 135.85, 136.23, 136.61, 136.99, 137.37, 137.75, 138.13,\n 138.51, 138.88, 139.26, 139.64, 140.02, 140.40, 140.78, 141.16, 141.54, 141.91,\n 142.29, 142.67, 143.05, 143.43, 143.80, 144.18, 144.56, 144.94, 145.31, 145.69,\n 146.07, 146.44, 146,82, 147.20, 147.57, 147.95, 148.33, 148.70, 149.08, 149.46,\n 149.83, 150.21, 150.58, 150.96, 151.33, 151.71, 152.08, 152.46, 152.83, 152.21,\n 153.58, 153.96, 154.33, 154.71, 155.08, 155.46, 155.83, 156.20, 156.58, 156.95,\n 157.33, 157.70, 158.07, 158.45, 158.82, 159.19, 159.56, 159.94, 160.31, 160.68,\n 161.05];\n var pos = 0;\n \n //if value is out of range\n if (val < temp[0] ) return -99.99;\n if (val > temp[size-1] ) return 99.99;\n \n //search for 'value' in temp array to get the position No.\n while(val > temp[pos]) pos++;\n //handles the 'rare' equality case\n if(val == temp[pos]) return pos;\n \n var r1 = temp[pos - 1];\n var r2 = temp[pos];\n var c1 = pos-1;\n var c2 = pos;\n \n //calculating temp from resistance\n return c1 + (val - r1) / (r2-r1) * (c2-c1);\n}\n\nmsg.payload = c;\nglobal.set('sensorData[' + global.get('sID'+i) + '][' + global.get('sregisterAddress'+i) + ']', c.toFixed(2))\nreturn msg;","outputs":1,"noerr":0,"x":870,"y":960,"wires":[[]]},{"id":"412e1949.74d4b8","type":"inject","z":"a14027eb.55f138","name":"","repeat":"1","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":150,"y":480,"wires":[["46ef31ad.afa4a"]]},{"id":"46ef31ad.afa4a","type":"function","z":"a14027eb.55f138","name":"","func":"msg.payload = new Date().toLocaleString();\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":480,"wires":[["79bc40fd.811b9"]]},{"id":"79bc40fd.811b9","type":"ui_text","z":"a14027eb.55f138","group":"196652fc.0d4e3d","order":1,"width":6,"height":1,"name":"","label":"Date:","format":"{{msg.payload}}","layout":"row-left","x":490,"y":480,"wires":[]},{"id":"8ae385e2.8cdec8","type":"function","z":"a14027eb.55f138","name":"Para2DropUpdated","func":"var data= msg.payload.RecipDetails;\nvar n = data.length;\n//node.warn(n)\nglobal.set('AllPara',msg.payload)\n//node.warn(global.get('AllPara'))\n\nfor(i=0;i<n;i++)\n{\n global.set('RecipDetails['+i+']',msg.payload.RecipDetails[i])\n}\n\nvar a= global.get('RecipDetails')\nfor(i=0;i<n;i++)\n{\n global.set('ParameterName['+i+']',a[i].parameterName)\n global.set('Locaction['+i+']',i)\n}\nvar b=global.get('ParameterName')\n\nfor(i=0;i<n;i++)\n{\n global.set('name['+i+']',b[i])\n}\nvar d=global.get('name')\nvar ParaDet={ };\nfor(i=0;i<n;i++)\n{\n ParaDet[i]={\"Location\":i,\"name\":d[i]};\n}\nmsg.payload= ParaDet\nglobal.set('ParaDrop2',msg.payload);\nglobal.set('Para2DropUpdated',1);\nreturn msg;\n","outputs":1,"noerr":0,"x":1470,"y":220,"wires":[[]]},{"id":"c29475c.c5fd688","type":"function","z":"a14027eb.55f138","name":"/10","func":"var map = function(value, istart, istop, ostart, ostop) {\n return ostart + (ostop - ostart) * ((value - istart) / (istop - istart));\n}\nvar ip =msg.data;\nvar op = (map(ip,0,5000,-70,70)).toFixed(3)\nvar i = msg.index;\n\nglobal.set('sensorData[' + global.get('sID'+i) + '][' + global.get('sregisterAddress'+i) + ']', op)\nreturn msg;","outputs":1,"noerr":0,"x":810,"y":1140,"wires":[[]]},{"id":"22244960.187936","type":"function","z":"a14027eb.55f138","name":"","func":"var opArray = msg.payload\nmsg = {}\nmsg.payload = {}\nvar len = opArray.length\n\nfor(i = 0; i<len ; i++)\n{\n msg.payload = opArray[i]\n node.send(msg);\n}","outputs":1,"noerr":0,"x":870,"y":340,"wires":[["bd94592c.56e0e8"]]},{"id":"7b94898e.0ace58","type":"debug","z":"a14027eb.55f138","name":"pH output","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1240,"y":780,"wires":[]},{"id":"9718879d.b9be88","type":"ui_button","z":"a14027eb.55f138","name":"","group":"196652fc.0d4e3d","order":3,"width":6,"height":1,"passthru":false,"label":"Reset Data","tooltip":"","color":"","bgcolor":"","icon":"","payload":"flow variables","payloadType":"str","topic":"","x":1090,"y":80,"wires":[["b481eeb0.66ab9"]]},{"id":"b481eeb0.66ab9","type":"function","z":"a14027eb.55f138","name":"flow variables","func":"flow.set('GetData',1)\nflow.set('parameterForLoop', 0)\nflow.set('forLoopCounter',0)\nreturn msg;","outputs":1,"noerr":0,"x":1300,"y":80,"wires":[[]]},{"id":"be2dba6.4a52448","type":"debug","z":"a14027eb.55f138","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1250,"y":1080,"wires":[]},{"id":"1f3f0779.efa9a9","type":"comment","z":"a14027eb.55f138","name":"Module 4 ( 7 ph Calibration input ) ","info":"","x":200,"y":1360,"wires":[]},{"id":"f34b75cf.39fb78","type":"debug","z":"a14027eb.55f138","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1190,"y":1420,"wires":[]},{"id":"64d49111.dc56b","type":"file","z":"a14027eb.55f138","name":"7phInput","filename":"/home/pi/Desktop/7phInput.txt","appendNewline":false,"createDir":true,"overwriteFile":"true","x":1020,"y":1420,"wires":[["f34b75cf.39fb78"]]},{"id":"7ee4c9d3.77e8e8","type":"json","z":"a14027eb.55f138","name":"","property":"payload","action":"","pretty":false,"x":470,"y":1420,"wires":[["97504f90.e9de6"]]},{"id":"5c6ece8d.60c7c","type":"file in","z":"a14027eb.55f138","name":"7phInput","filename":"/home/pi/Desktop/7phInput.txt","format":"utf8","chunk":false,"sendError":false,"x":320,"y":1420,"wires":[["7ee4c9d3.77e8e8"]]},{"id":"8e75315a.6fd97","type":"inject","z":"a14027eb.55f138","name":"","repeat":"","crontab":"","once":true,"onceDelay":"3","topic":"","payload":"","payloadType":"date","x":150,"y":1420,"wires":[["5c6ece8d.60c7c"]]},{"id":"d639f208.6e8ff","type":"debug","z":"a14027eb.55f138","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1190,"y":1600,"wires":[]},{"id":"42f80236.26e2dc","type":"file","z":"a14027eb.55f138","name":"4phInput","filename":"/home/pi/Desktop/4phInput.txt","appendNewline":false,"createDir":true,"overwriteFile":"true","x":1020,"y":1600,"wires":[["d639f208.6e8ff"]]},{"id":"facb20dc.1a6a","type":"json","z":"a14027eb.55f138","name":"","property":"payload","action":"","pretty":false,"x":470,"y":1600,"wires":[["a5709f7b.2d80e"]]},{"id":"efda5eaf.e2666","type":"file in","z":"a14027eb.55f138","name":"4phInput","filename":"/home/pi/Desktop/4phInput.txt","format":"utf8","chunk":false,"sendError":false,"x":320,"y":1600,"wires":[["facb20dc.1a6a"]]},{"id":"f6a5f5c7.725c08","type":"inject","z":"a14027eb.55f138","name":"","repeat":"","crontab":"","once":true,"onceDelay":"3","topic":"","payload":"","payloadType":"date","x":150,"y":1600,"wires":[["efda5eaf.e2666"]]},{"id":"f9a31311.a6673","type":"ui_template","z":"a14027eb.55f138","group":"11baa1b6.36d60e","name":"4 ph Calibration input","order":1,"width":12,"height":3,"format":"<html>\n<body>\n<style>\nbody{\n background-image : url(\"/background9.jpg\");\n}\n \n input[type=text]{\n \tbackground-color: white;\n \ttext-align : center;\n \tcolor : black;\n border:none;\n padding : 7px;\n }\n input[type=submit] {\n background-color: #4CAF50;\n color: white;\n padding: 5px 7px;\n text-align : center;\n border: none;\n border-radius: 1px;\n cursor: allowed;\n float: left;\n}\n\ninput[type=submit]:hover {\n background-color: #45a049;\n}\ntable, tr, th, td {\n \n background-color: white;\n border-collapse: collapse;\n\t\tborder: 1px solid black;\n\t\tcolor : black;\n\t\ttext-align : center;\n\t\twidth:100%;\n\t\tpadding: 1px\n}\n\n input[type=number]{\n background-color: white;\n color : black;\n text-align : center;\n border : 1px solid #0093dc;\n padding : 7px 6px;\n text-align : center;\n } \\\n th{\n\talign : center;\n\t color: white;\n\t font-weight: normal;\n\t font-family: Candara;\n\t font-size: 110%;\n\t background-color:#097479;\n\t padding : 7px 3px\n\t }\n \n \n</style>\n\n \n<form id=\"MobileNoForm\" ng-submit=\"submitlist()\" align=\"justify\">\n<br>\n<div padding: 5px; margin: 5px; >\n<div class = \"addrow\">\n<div class = \"column\">\n\n\n<table id=\"mytable\" class=\"table table-bordered\">\n<thead>\n<tr>\n<th style=\"width:20%;\">pH</th>\n<th style=\"width:20%;\">Calibrate</th>\n\n</tr>\n</thead>\n<tbody align=\"center\">\n<tr ng-repeat=\"Details in recipients\">\n<td>Select the measuring unit for 4pH calibration</td>\n <td>\n <select id=\"EmpDropdown\" ng-model=\"Details.id\" >\n <!-- when user selects option from dropdown, value attrubite in option tag will receive the varible value assigned to it. This value will be passed to \"ng-model=\"your_variable\"\" and can be accessed\n in java script . another way of accessing it is using DOM:document.getElementById(\"Your Select ID\").value syntax -->\n <option ng-repeat=\"Tasklist in Drop\" value=\"{{Tasklist.id}}\" required >{{Tasklist.name}}\n <!--ng-repeat repeas html tag for each object in the list/array assigned to it -->\n </option>\n </select>\n </td>\n</tbody>\n</table>\n</div>\n</div>\n</div>\n<input type=\"submit\" class=\"btn btn-primary\" value=\"Submit\" ng-style=\"{float: 'right', background: '#54e18a', color:'Black',padding: '4px 6px', border: 'none', cursor: 'allowed'}\"/> \n\n</form>\n\n<script >\n // import Swal from '/node_modules/sweetalert2/src/sweetalert2.js'\n\nvar dropdata;\n\t (function(scope) { \t\n scope.$watch('msg', function(msg) {\n //console.log([\"msg\",msg]);\n if (msg) {\n $(\"#my_\"+scope.$id).html(msg.payload);\n \n scope.data = angular.copy(msg.payload.RecipDetails);\n \n scope.Drop = angular.copy(msg.payload.Dropdown);\n scope.recipients = angular.copy(scope.data);\n dropdata = angular.copy(scope.Drop);\n }\n \n //var msg={\"payload\":{\"dropdata\" :(scope.dropdata)}};\n//scope.send(msg);\n });\n\n\t scope.enabledEdit = [];\t\n//scope.data = [{ id:\"\"}];\n \n//scope.recipients = angular.copy(scope.data);\n\n\nscope.submitlist = function(){\n console.log(scope.Loss);\n console.log(scope.StopTime);\n var msg={\"payload\":{\"RecipDetails\" :(scope.recipients),\"Dropdown\":(scope.Drop),\"Submit\":1}};//,\"SetVal\":(dropdata[scope.recipients[0].Value]\n //window.confirm([\"msg\",msg]);\n scope.send(msg);\n window.confirm(\"Data Saved\");\n console.log([\"form submitted:\",(msg)]);\n}\n})(scope);\n</script> \n</body>\n</html>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":820,"y":1600,"wires":[["42f80236.26e2dc","2588c90.b07ec38"]]},{"id":"4539dad1.eda3f4","type":"file","z":"a14027eb.55f138","name":"pHRef.txt","filename":"/home/pi/Desktop/pHRef.txt","appendNewline":false,"createDir":true,"overwriteFile":"true","x":1500,"y":1540,"wires":[[]]},{"id":"a983602a.8a6c","type":"comment","z":"a14027eb.55f138","name":"Module 6 ( Clear all Calibration ) ","info":"","x":190,"y":1720,"wires":[]},{"id":"86425ad6.6aea58","type":"comment","z":"a14027eb.55f138","name":"Module 5 ( 4 ph Calibration input) ","info":"","x":190,"y":1540,"wires":[]},{"id":"32cc083a.e77df8","type":"debug","z":"a14027eb.55f138","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1190,"y":1780,"wires":[]},{"id":"401353e9.faa33c","type":"file","z":"a14027eb.55f138","name":"Clear","filename":"/home/pi/Desktop/Clear.txt","appendNewline":false,"createDir":true,"overwriteFile":"true","x":1010,"y":1780,"wires":[["32cc083a.e77df8"]]},{"id":"ac759dbd.a9888","type":"json","z":"a14027eb.55f138","name":"","property":"payload","action":"","pretty":false,"x":470,"y":1780,"wires":[["6b2e21d5.341e6"]]},{"id":"ba36fcac.e652c","type":"file in","z":"a14027eb.55f138","name":"Clear","filename":"/home/pi/Desktop/Clear.txt","format":"utf8","chunk":false,"sendError":false,"x":310,"y":1780,"wires":[["ac759dbd.a9888"]]},{"id":"f2f049c9.735758","type":"inject","z":"a14027eb.55f138","name":"","repeat":"","crontab":"","once":true,"onceDelay":"3","topic":"","payload":"","payloadType":"date","x":150,"y":1780,"wires":[["ba36fcac.e652c"]]},{"id":"949371b9.172d9","type":"ui_template","z":"a14027eb.55f138","group":"1f6d099b.aef646","name":"Clear Calibration input","order":1,"width":11,"height":3,"format":"<html>\n<body>\n<style>\nbody{\n background-image : url(\"/background9.jpg\");\n}\n \n input[type=text]{\n \tbackground-color: white;\n \ttext-align : center;\n \tcolor : black;\n border:none;\n padding : 7px;\n }\n input[type=submit] {\n background-color: #4CAF50;\n color: white;\n padding: 5px 7px;\n text-align : center;\n border: none;\n border-radius: 1px;\n cursor: allowed;\n float: left;\n}\n\ninput[type=submit]:hover {\n background-color: #45a049;\n}\ntable, tr, th, td {\n \n background-color: white;\n border-collapse: collapse;\n\t\tborder: 1px solid black;\n\t\tcolor : black;\n\t\ttext-align : center;\n\t\twidth:100%;\n\t\tpadding: 1px\n}\n\n input[type=number]{\n background-color: white;\n color : black;\n text-align : center;\n border : 1px solid #0093dc;\n padding : 7px 6px;\n text-align : center;\n } \\\n th{\n\talign : center;\n\t color: white;\n\t font-weight: normal;\n\t font-family: Candara;\n\t font-size: 110%;\n\t background-color:#097479;\n\t padding : 7px 3px\n\t }\n \n \n</style>\n\n \n<form id=\"MobileNoForm\" ng-submit=\"submitlist()\" align=\"justify\">\n<br>\n<div padding: 5px; margin: 5px; >\n<div class = \"addrow\">\n<div class = \"column\">\n\n\n<table id=\"mytable\" class=\"table table-bordered\">\n<thead>\n<tr>\n<th style=\"width:20%;\">pH</th>\n<th style=\"width:20%;\">Calibrate</th>\n\n</tr>\n</thead>\n<tbody align=\"center\">\n<tr ng-repeat=\"Details in recipients\">\n<td>Select the measuring unit to clear calibration</td>\n <td>\n <select id=\"EmpDropdown\" ng-model=\"Details.id\" >\n <!-- when user selects option from dropdown, value attrubite in option tag will receive the varible value assigned to it. This value will be passed to \"ng-model=\"your_variable\"\" and can be accessed\n in java script . another way of accessing it is using DOM:document.getElementById(\"Your Select ID\").value syntax -->\n <option ng-repeat=\"Tasklist in Drop\" value=\"{{Tasklist.id}}\" required >{{Tasklist.name}}\n <!--ng-repeat repeas html tag for each object in the list/array assigned to it -->\n </option>\n </select>\n </td>\n</tbody>\n</table>\n</div>\n</div>\n</div>\n<input type=\"submit\" class=\"btn btn-primary\" value=\"Submit\" ng-style=\"{float: 'right', background: '#54e18a', color:'Black',padding: '4px 6px', border: 'none', cursor: 'allowed'}\"/> \n\n</form>\n\n<script >\n // import Swal from '/node_modules/sweetalert2/src/sweetalert2.js'\n\nvar dropdata;\n\t (function(scope) { \t\n scope.$watch('msg', function(msg) {\n //console.log([\"msg\",msg]);\n if (msg) {\n $(\"#my_\"+scope.$id).html(msg.payload);\n \n scope.data = angular.copy(msg.payload.RecipDetails);\n \n scope.Drop = angular.copy(msg.payload.Dropdown);\n scope.recipients = angular.copy(scope.data);\n dropdata = angular.copy(scope.Drop);\n }\n \n //var msg={\"payload\":{\"dropdata\" :(scope.dropdata)}};\n//scope.send(msg);\n });\n\n\t scope.enabledEdit = [];\t\n//scope.data = [{ id:\"\"}];\n \n//scope.recipients = angular.copy(scope.data);\n\n\nscope.submitlist = function(){\n console.log(scope.Loss);\n console.log(scope.StopTime);\n var msg={\"payload\":{\"RecipDetails\" :(scope.recipients),\"Dropdown\":(scope.Drop),\"Submit\":1}};//,\"SetVal\":(dropdata[scope.recipients[0].Value]\n //window.confirm([\"msg\",msg]);\n scope.send(msg);\n window.confirm(\"Data Saved\");\n console.log([\"form submitted:\",(msg)]);\n}\n})(scope);\n</script> \n</body>\n</html>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":820,"y":1780,"wires":[["401353e9.faa33c","1e3bccc8.c89713"]]},{"id":"c85bff5c.a98c7","type":"file","z":"a14027eb.55f138","name":"pHRef.txt","filename":"/home/pi/Desktop/pHRef.txt","appendNewline":false,"createDir":true,"overwriteFile":"true","x":620,"y":1900,"wires":[[]]},{"id":"fe126745.b77d78","type":"inject","z":"a14027eb.55f138","name":"Inject to clear all calibrations","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":200,"y":1900,"wires":[["1d23d97c.3b1c77"]]},{"id":"7467bc84.e81744","type":"ui_template","z":"a14027eb.55f138","group":"55ef55ec.0ce6cc","name":"Clear All calibrations button","order":1,"width":4,"height":1,"format":"<!DOCTYPE html>\n<html>\n<body>\n \n<md-button ng-style=\"{background:'#CB6B84', \n color:'black',\n padding: '10px',\n cursor: 'allowed'}\"\n\n ng-click=\"msg.payload ='1'; send(msg);\"\n>\n<i class=\"fa fa-minus-circle\"></i>\nClear all calibration\n</md-button>\n</body>\n</html>\n","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","x":180,"y":1960,"wires":[["1d23d97c.3b1c77","cfdbb8bc.3a5ce8"]]},{"id":"97504f90.e9de6","type":"function","z":"a14027eb.55f138","name":"","func":"global.set(\"settings\",msg.payload);\nvar n = global.get('slaveLength')\nvar opTopic = []\nvar count =0\nfor(i=0; i< n ;i++)\n{\n \n if((global.get('parameterID'+i))==\"2\")\n {\n opTopic.push({id: count,name:global.get('parameterName'+ (i))})\n count=count+1;\n }\n}\n\nflow.set('pHCalibLength',opTopic.length)\nmsg.payload.Dropdown=opTopic\nreturn msg;","outputs":1,"noerr":0,"x":620,"y":1420,"wires":[["b0016b4f.07e028"]]},{"id":"23699cea.665844","type":"inject","z":"a14027eb.55f138","name":"","repeat":"","crontab":"","once":true,"onceDelay":"1","topic":"","payload":"","payloadType":"date","x":150,"y":2160,"wires":[["938782e7.278c5"]]},{"id":"938782e7.278c5","type":"file in","z":"a14027eb.55f138","name":"projectName.txt","filename":"/home/pi/Desktop/projectName.txt","format":"utf8","chunk":false,"sendError":false,"encoding":"none","x":340,"y":2160,"wires":[["a0d64820.cf46a8"]]},{"id":"a0d64820.cf46a8","type":"ui_text_input","z":"a14027eb.55f138","name":"","label":"Project Name :","tooltip":"grpname","group":"2f99bea8.cf2d52","order":1,"width":4,"height":1,"passthru":true,"mode":"text","delay":300,"topic":"","x":540,"y":2160,"wires":[["1b710c51.264d14"]]},{"id":"1b710c51.264d14","type":"function","z":"a14027eb.55f138","name":"","func":"global.set('projectName', msg.payload)\nreturn msg;","outputs":1,"noerr":0,"x":720,"y":2160,"wires":[["b55e801e.3dd4f"]]},{"id":"b55e801e.3dd4f","type":"file","z":"a14027eb.55f138","name":"projectName.txt","filename":"/home/pi/Desktop/projectName.txt","appendNewline":false,"createDir":true,"overwriteFile":"true","encoding":"none","x":900,"y":2160,"wires":[[]]},{"id":"b0016b4f.07e028","type":"ui_template","z":"a14027eb.55f138","group":"c3b0f085.aa123","name":"7 pH calibration input","order":1,"width":12,"height":3,"format":"<html>\n<body>\n<style>\nbody{\n background-image : url(\"/background9.jpg\");\n}\n \n input[type=text]{\n \tbackground-color: white;\n \ttext-align : center;\n \tcolor : black;\n border:none;\n padding : 7px;\n }\n input[type=submit] {\n background-color: #4CAF50;\n color: white;\n padding: 5px 7px;\n text-align : center;\n border: none;\n border-radius: 1px;\n cursor: allowed;\n float: left;\n}\n\ninput[type=submit]:hover {\n background-color: #45a049;\n}\ntable, tr, th, td {\n \n background-color: white;\n border-collapse: collapse;\n\t\tborder: 1px solid black;\n\t\tcolor : black;\n\t\ttext-align : center;\n\t\twidth:100%;\n\t\tpadding: 1px\n}\n\n input[type=number]{\n background-color: white;\n color : black;\n text-align : center;\n border : 1px solid #0093dc;\n padding : 7px 6px;\n text-align : center;\n } \\\n th{\n\talign : center;\n\t color: white;\n\t font-weight: normal;\n\t font-family: Candara;\n\t font-size: 110%;\n\t background-color:#097479;\n\t padding : 7px 3px\n\t }\n \n \n</style>\n\n \n<form id=\"MobileNoForm\" ng-submit=\"submitlist()\" align=\"justify\">\n<br>\n<div padding: 5px; margin: 5px; >\n<div class = \"addrow\">\n<div class = \"column\">\n\n\n<table id=\"mytable\" class=\"table table-bordered\">\n<thead>\n<tr>\n<th style=\"width:20%;\">pH</th>\n<th style=\"width:20%;\">Calibrate</th>\n\n</tr>\n</thead>\n<tbody align=\"center\">\n<tr ng-repeat=\"Details in recipients\">\n<td>Select the measuring unit for 7pH calibration</td>\n <td>\n <select id=\"EmpDropdown\" ng-model=\"Details.id\" >\n <!-- when user selects option from dropdown, value attrubite in option tag will receive the varible value assigned to it. This value will be passed to \"ng-model=\"your_variable\"\" and can be accessed\n in java script . another way of accessing it is using DOM:document.getElementById(\"Your Select ID\").value syntax -->\n <option ng-repeat=\"Tasklist in Drop\" value=\"{{Tasklist.id}}\" required >{{Tasklist.name}}\n <!--ng-repeat repeas html tag for each object in the list/array assigned to it -->\n </option>\n </select>\n </td>\n</tbody>\n</table>\n</div>\n</div>\n</div>\n<input type=\"submit\" class=\"btn btn-primary\" value=\"Submit\" ng-style=\"{float: 'right', background: '#54e18a', color:'Black',padding: '4px 6px', border: 'none', cursor: 'allowed'}\"/> \n\n</form>\n\n<script >\n // import Swal from '/node_modules/sweetalert2/src/sweetalert2.js'\n\nvar dropdata;\n\t (function(scope) { \t\n scope.$watch('msg', function(msg) {\n //console.log([\"msg\",msg]);\n if (msg) {\n $(\"#my_\"+scope.$id).html(msg.payload);\n \n scope.data = angular.copy(msg.payload.RecipDetails);\n \n scope.Drop = angular.copy(msg.payload.Dropdown);\n scope.recipients = angular.copy(scope.data);\n dropdata = angular.copy(scope.Drop);\n }\n \n //var msg={\"payload\":{\"dropdata\" :(scope.dropdata)}};\n//scope.send(msg);\n });\n\n\t scope.enabledEdit = [];\t\n//scope.data = [{ id:\"\"}];\n \n//scope.recipients = angular.copy(scope.data);\n\n\nscope.submitlist = function(){\n console.log(scope.Loss);\n console.log(scope.StopTime);\n var msg={\"payload\":{\"RecipDetails\" :(scope.recipients),\"Dropdown\":(scope.Drop),\"Submit\":1}};//,\"SetVal\":(dropdata[scope.recipients[0].Value]\n //window.confirm([\"msg\",msg]);\n scope.send(msg);\n window.confirm(\"Data Saved\");\n console.log([\"form submitted:\",(msg)]);\n}\n})(scope);\n</script> \n</body>\n</html>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":820,"y":1420,"wires":[["64d49111.dc56b","7471cf0c.db979"]]},{"id":"7471cf0c.db979","type":"switch","z":"a14027eb.55f138","name":"","property":"payload.Submit","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1010,"y":1480,"wires":[["8bc5594a.07f1f8"]]},{"id":"8bc5594a.07f1f8","type":"function","z":"a14027eb.55f138","name":"Setting Nutral Voltage Referance","func":"var offset = flow.get(\"offset\")\nvar NutralVolt = flow.get(\"NutralVolt\")\nvar AcidVolt = flow.get(\"AcidVolt\")\nvar LastCalib7 = flow.get(\"LastCalib7\")\nvar LastCalib4 = flow.get(\"LastCalib4\")\nvar time = new Date();\nvar Datetime = (time.getDate() + \"-\" + (time.getMonth() + 1) + \"-\" + time.getFullYear() + \",\" + time.getHours() + \":\" + time.getMinutes() + \":\" + time.getSeconds()).toString();\nvar data = msg.payload.RecipDetails\nvar id = Number(data[0].id)\n\nNutralVolt[id] = flow.get('Voltage['+ (id + 1) +']')\nLastCalib7[id] = Datetime\n\nflow.set(\"NutralVolt\",NutralVolt)\nflow.set(\"LastCalib7\",LastCalib7)\n\nmsg = {}\nmsg.payload = {}\nmsg.payload.NutralVolt = NutralVolt\nmsg.payload.AcidVolt = AcidVolt\nmsg.payload.LastCalib7 = LastCalib7\nmsg.payload.LastCalib4 = LastCalib4\nreturn msg;\n","outputs":1,"noerr":0,"x":1260,"y":1480,"wires":[["93dcb2d9.3cda1","4539dad1.eda3f4"]]},{"id":"93dcb2d9.3cda1","type":"debug","z":"a14027eb.55f138","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1510,"y":1480,"wires":[]},{"id":"a5709f7b.2d80e","type":"function","z":"a14027eb.55f138","name":"","func":"global.set(\"settings\",msg.payload);\nvar n = global.get('slaveLength')\nvar opTopic = []\nvar count =0\nfor(i=0; i< n ;i++)\n{\n \n if((global.get('parameterID'+i))==\"2\")\n {\n opTopic.push({id: count,name:global.get('parameterName'+ (i))})\n count=count+1;\n }\n}\n\n\nmsg.payload.Dropdown=opTopic\nreturn msg;","outputs":1,"noerr":0,"x":620,"y":1600,"wires":[["f9a31311.a6673"]]},{"id":"d403b1c5.8b0a8","type":"file","z":"a14027eb.55f138","name":"pHRef.txt","filename":"/home/pi/Desktop/pHRef.txt","appendNewline":false,"createDir":true,"overwriteFile":"true","x":1500,"y":1720,"wires":[[]]},{"id":"2588c90.b07ec38","type":"switch","z":"a14027eb.55f138","name":"","property":"payload.Submit","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1010,"y":1660,"wires":[["bdc20229.fe1b5"]]},{"id":"bdc20229.fe1b5","type":"function","z":"a14027eb.55f138","name":"Setting Acid Voltage Referance","func":"var offset = flow.get(\"offset\")\nvar NutralVolt = flow.get(\"NutralVolt\")\nvar AcidVolt = flow.get(\"AcidVolt\")\nvar LastCalib7 = flow.get(\"LastCalib7\")\nvar LastCalib4 = flow.get(\"LastCalib4\")\nvar time = new Date();\nvar Datetime = (time.getDate() + \"-\" + (time.getMonth() + 1) + \"-\" + time.getFullYear() + \",\" + time.getHours() + \":\" + time.getMinutes() + \":\" + time.getSeconds()).toString();\nvar data = msg.payload.RecipDetails\nvar id = Number(data[0].id)\n\nAcidVolt[id] = flow.get('Voltage['+ (id + 1) +']')\nLastCalib4[id] = Datetime\n\nflow.set(\"AcidVolt\",AcidVolt)\nflow.set(\"LastCalib4\",LastCalib4)\n\nmsg = {}\nmsg.payload = {}\nmsg.payload.NutralVolt = NutralVolt\nmsg.payload.AcidVolt = AcidVolt\nmsg.payload.LastCalib7 = LastCalib7\nmsg.payload.LastCalib4 = LastCalib4\nreturn msg;\n","outputs":1,"noerr":0,"x":1250,"y":1660,"wires":[["3ca3c507.3584ba","d403b1c5.8b0a8"]]},{"id":"3ca3c507.3584ba","type":"debug","z":"a14027eb.55f138","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1510,"y":1660,"wires":[]},{"id":"6b2e21d5.341e6","type":"function","z":"a14027eb.55f138","name":"","func":"global.set(\"settings\",msg.payload);\nvar n = global.get('slaveLength')\nvar opTopic = []\nvar count =0\nfor(i=0; i< n ;i++)\n{\n \n if((global.get('parameterID'+i))==\"2\")\n {\n opTopic.push({id: count,name:global.get('parameterName'+ (i))})\n count=count+1;\n }\n}\n\nnode.warn(opTopic)\nmsg.payload.Dropdown=opTopic\nreturn msg;","outputs":1,"noerr":0,"x":620,"y":1780,"wires":[["949371b9.172d9","b41d82a8.b3ff6"]]},{"id":"16e6ba83.c00455","type":"file","z":"a14027eb.55f138","name":"pHRef.txt","filename":"/home/pi/Desktop/pHRef.txt","appendNewline":false,"createDir":true,"overwriteFile":"true","x":1500,"y":1900,"wires":[[]]},{"id":"1e3bccc8.c89713","type":"switch","z":"a14027eb.55f138","name":"","property":"payload.Submit","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1010,"y":1840,"wires":[["2c729c4a.336a24"]]},{"id":"2c729c4a.336a24","type":"function","z":"a14027eb.55f138","name":"Clear Voltage Referance","func":"var offset = flow.get(\"offset\")\nvar NutralVolt = flow.get(\"NutralVolt\")\nvar AcidVolt = flow.get(\"AcidVolt\")\nvar LastCalib7 = flow.get(\"LastCalib7\")\nvar LastCalib4 = flow.get(\"LastCalib4\")\nvar time = new Date();\nvar Datetime = (time.getDate() + \"-\" + (time.getMonth() + 1) + \"-\" + time.getFullYear() + \",\" + time.getHours() + \":\" + time.getMinutes() + \":\" + time.getSeconds()).toString();\nvar data = msg.payload.RecipDetails\nvar id = Number(data[0].id)\n\nAcidVolt[id] = 2032.44\nNutralVolt[id] = 1500\nLastCalib7[id] = NaN\nLastCalib4[id] = NaN\n\nflow.set(\"AcidVolt\",AcidVolt)\nflow.set(\"NutralVolt\",NutralVolt)\nflow.set(\"LastCalib7\",LastCalib7)\nflow.set(\"LastCalib4\",LastCalib4)\n\nmsg = {}\nmsg.payload = {}\nmsg.payload.NutralVolt = NutralVolt\nmsg.payload.AcidVolt = AcidVolt\nmsg.payload.LastCalib7 = LastCalib7\nmsg.payload.LastCalib4 = LastCalib4\nreturn msg;\n","outputs":1,"noerr":0,"x":1230,"y":1840,"wires":[["8cfd357d.dbfc78","16e6ba83.c00455"]]},{"id":"8cfd357d.dbfc78","type":"debug","z":"a14027eb.55f138","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1510,"y":1840,"wires":[]},{"id":"1d23d97c.3b1c77","type":"function","z":"a14027eb.55f138","name":"","func":"var NutralVolt = []\nvar AcidVolt = []\nvar LastCalib7 = []\nvar LastCalib4 = []\n\n\nvar n = flow.get('pHCalibLength')\nfor(i=0;i<n;i++)\n{\n AcidVolt[i] = 2032.44\n NutralVolt[i] = 1500\n LastCalib7[i] = NaN\n LastCalib4[i] = NaN\n}\n\nflow.set(\"NutralVolt\",NutralVolt)\nflow.set(\"AcidVolt\",AcidVolt )\nflow.set(\"LastCalib7\",LastCalib7)\nflow.set(\"LastCalib4\",LastCalib4)\n\nmsg = {}\nmsg.payload = {}\nmsg.payload.NutralVolt = NutralVolt\nmsg.payload.AcidVolt = AcidVolt\nmsg.payload.LastCalib7 = LastCalib7\nmsg.payload.LastCalib4 = LastCalib4\n\nreturn msg;","outputs":1,"noerr":0,"x":440,"y":1900,"wires":[["c85bff5c.a98c7"]]},{"id":"cfdbb8bc.3a5ce8","type":"ui_toast","z":"a14027eb.55f138","position":"dialog","displayTime":"3","highlight":"","sendall":true,"outputs":1,"ok":"OK","cancel":"","raw":false,"topic":"Calibration for all units is cleared","name":"","x":450,"y":1960,"wires":[[]]},{"id":"88286b4c.1781c8","type":"function","z":"a14027eb.55f138","name":"","func":"var len = flow.get('pHCalibLength') - 1\n\nif(flow.get('phIndex') < len)\n{\n flow.set('phIndex',flow.get('phIndex') + 1)\n}\nelse\n{\n flow.set('phIndex', 0)\n}\nreturn msg","outputs":1,"noerr":0,"x":1240,"y":840,"wires":[[]]},{"id":"a0085ad7.d15628","type":"delay","z":"a14027eb.55f138","name":"","pauseType":"rate","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":830,"y":780,"wires":[["45dee8f.924cf18"]]},{"id":"a8b20563.a4dc48","type":"function","z":"a14027eb.55f138","name":"CT Current","func":"var compare = [\"CT Current\"]\n\nfor(i = 0;i< compare.length;i++)\n{\n if(msg.payload[0] == compare[i])\n {\n msg.data = msg.payload[1]\n msg.index = msg.payload[2] \n return msg;\n }\n}","outputs":1,"noerr":0,"x":570,"y":840,"wires":[["f434a3c3.34aa6"]]},{"id":"f434a3c3.34aa6","type":"function","z":"a14027eb.55f138","name":"Map","func":"var map = function(value, istart, istop, ostart, ostop) {\n return ostart + (ostop - ostart) * ((value - istart) / (istop - istart));\n}\nvar i = msg.index;\nvar ip =msg.data;\nvar CurrentCal=global.get('CurrentCal['+global.get('sID'+i)+']['+global.get('sregisterAddress'+i)+']')\nvar op = (map(ip,0,5000,CurrentCal*(-1),CurrentCal)).toFixed(3)\nglobal.set('sensorData[' + global.get('sID'+i) + '][' + global.get('sregisterAddress'+i) + ']', op)\nreturn msg;","outputs":1,"noerr":0,"x":810,"y":840,"wires":[[]]},{"id":"65cb2719.c30008","type":"inject","z":"a14027eb.55f138","name":"","repeat":"","crontab":"","once":true,"onceDelay":"5","topic":"","payload":"","payloadType":"date","x":150,"y":2320,"wires":[["805a73e2.eed9c"]]},{"id":"805a73e2.eed9c","type":"file in","z":"a14027eb.55f138","name":"CurrentCal.txt","filename":"/home/pi/Desktop/CurrentCal.txt","format":"utf8","chunk":false,"sendError":false,"x":340,"y":2320,"wires":[["69e95319.8700bc"]]},{"id":"69e95319.8700bc","type":"function","z":"a14027eb.55f138","name":"settings obj","func":"//global.set(\"settings\",msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":530,"y":2320,"wires":[["67e91f1d.4cad2"]]},{"id":"67e91f1d.4cad2","type":"json","z":"a14027eb.55f138","name":"","property":"payload","action":"","pretty":false,"x":670,"y":2320,"wires":[["d51491b6.54a0c"]]},{"id":"d51491b6.54a0c","type":"ui_template","z":"a14027eb.55f138","group":"f443a0cc.b77b1","name":"Current Calibration","order":1,"width":24,"height":8,"format":"<html>\n <head>\n \n </head>\n <body>\n <style>\nbody{\n background-image : url(\"/background9.jpg\");\n}\n \n input[type=text]{\n \tbackground-color: white;\n \ttext-align : center;\n \tcolor : black;\n border:none;\n padding : 7px;\n }\n input[type=submit] {\n background-color: #4CAF50;\n color: white;\n padding: 5px 7px;\n text-align : center;\n border: none;\n border-radius: 1px;\n cursor: allowed;\n float: left;\n}\n\ninput[type=submit]:hover {\n background-color: #45a049;\n}\ntable, tr, th, td {\n \n background-color: white;\n border-collapse: collapse;\n\t\tborder: 1px solid black;\n\t\tcolor: black;\n\t\ttext-align: center;\n\t\tpadding: 1px;\n}\n\n input[type=number]{\n background-color: white;\n color : black;\n text-align : center;\n border : 1px solid #0093dc;\n padding : 7px 6px;\n text-align : center;\n } \n th{\n\t text-align : center;\n\t color: white;\n\t font-weight: normal;\n\t font-family: candara;\n\t font-size: 110%;\n\t background-color: #097479;\n\t padding : 7px 3px\n\t }\n\t td {\n \n background-color: white;\n border-collapse: collapse;\n\t\tborder: 1px solid black;\n\t\tcolor : black;\n\t\ttext-align : center;\n\t\tpadding: 1px;\n}\ntr, th, td \n{\n width: 200px;\n}\n</style>\n \n \n<div>\n\n\n<div >\n <form id=\"TableForm\" ng-submit=\"MyTableFormAction()\" >\n <table align = \"center\" id=\"EmptableWithEditDelete6\">\n <tr>\n <th>\n Sr. No.\n </th>\n <th>\n Current\n </th>\n <th>\n Current value(A)\n </th>\n <th>\n Slave ID\n </th>\n <th>\n Address\n </th>\n <th>\n Edit\n </th>\n <th>\n Add Record\n </th> \n <th>\n Delete\n </th>\n </tr>\n <tr ng-repeat=\"Set in IntMsg.payload.SetData\" >\n <td disabled=\"true\">\n {{$index+1}}\n </td>\n <td disabled=\"true\">\n Current Sensor {{$index+1}}\n </td>\n <td>\n <input type=\"number\" id=\"EmpHighInput{{$index}}\" ng-model=\"Set.Current\" disabled=\"true\" required> <!--ng-model=\"IntMsg.payload.SetData[$index].Name\"-->\n </td>\n <td>\n <input type=\"number\" id=\"EmpHighInput{{$index}}\" ng-model=\"Set.slaveID\" disabled=\"true\" required> <!--ng-model=\"IntMsg.payload.SetData[$index].Name\"-->\n </td>\n <td>\n <input type=\"number\" id=\"EmpHighInput{{$index}}\" ng-model=\"Set.Address\" disabled=\"true\" required> <!--ng-model=\"IntMsg.payload.SetData[$index].Name\"-->\n </td>\n <td>\n <button type=\"button\" ng-click=\"TableFormRowEditBtn($index)\" ng-style=\"{background: '#ffc399', color:'black', border : '1px solid #0093dc', cursor: 'allowed'}\">\n Edit\n </button>\n \n </td>\n <td>\n <button type=\"button\" ng-click=\"TableFormAddRowBtn($index)\" ng-style=\"{background: '#ffc399', color:'black', border : '1px solid #0093dc', cursor: 'allowed'}\">\n Add Record\n </button>\n \n </td>\n <td>\n <button type=\"button\" ng-click=\"TableFormRowDeleteBtn($index)\" ng-style=\"{background: '#ffc399', color:'black', border : '1px solid #0093dc', cursor: 'allowed'}\">\n Delete\n </button>\n </td>\n </tr>\n </table>\n <br>\n <br>\n\n <button type=\"Submit\" name=\"Submit\" ng-style=\"{float: 'right', background: '#54e18a', color:'Black',padding: '4px 6px', border: 'none', cursor: 'allowed'}\"> \n Submit Data\n </button>\n <button type=\"button\" ng-click=\"TableAddFirstRecord()\" ng-style=\"{float: 'left', background: '#54e18a', color:'Black',padding: '4px 6px', border: 'none', cursor: 'allowed'}\"> Add Record\n \n </button>\n \n \n </form>\n</div>\n</div>\n<script>\n//send({payload:myFunction1()})\n//few learnigs: if msg.pyload is used to link data to html tags like \n//<input type=\"text\" id=\"EmpId\" name=\"fname\" value={{msg.payload.TSetData.Selectedobj}} disabled > \n//then \n//ensure orginal data variables in msg.payload are intact through out the session/user interaction. \n\n//\"{{angular_var}}\" syntax is used in html to pass varible data from angular to html tags\n//angular function send({payload:var/funct}) is used to send the msg to node red using ng-click directives. it updates msg.payload of entire template. \n// if your html view tags like input msg/table/dropdowns are getting reset that means\n//while sending msg, orginal msg got disturbed.\n// to solve this issue you can preserve original msg by adding new varibles to orginal msg.payload .\n// this is allowed but you should not disturb incoming msg.payload varibales data structure.\n// i.e say incoming msg.payload had data structure like msg={\"payload\":{\"emp\":employees}}\n//employees=[{\"name\":\"e1\",\"id\":1,\"dept\":\"dept1\",\"div\":\"div1\"},{\"name\":\"e2\",\"id\":2,\"dept\":\"dept2\",\"div\":\"div2\"},{\"name\":\"e3\",\"id\":3,\"dept\":\"dept3\",\"div\":\"div3\"}]\n// in this case you can add msg={\"payload\":{\"emp\":employees},{\"newVar\":newVarData}} this will works as orignal msg.payload.emp is not disturbed and new object \"NewVar is added\"\n// you can chage values of all varibles . that will not create any error or reset of view.\n\n\n// to check node-red ui is working properly , type \"http://127.0.0.1:1880/ui/\" in chrome browser and click\n//on broweser three dots menu-->more tools-->developer tools ensure at riht side of broweser debug window is opend\n// click on Consol tab to see error/status mssages.\n// you can use console.log(\"your_var_name\"); to see the value\n\n var test=document.getElementById(\"EmpId\");\n\n(function(scope) {\n // use this func\n scope.IntMsg={\"payload\":{\"SetData\":[{}]}};\n \n scope.$watch('msg', function(msg) {\n if (msg) {\n // Do something when msg arrives\n scope.IntMsg=msg;\n \n console.log(msg.payload);\n }\n });\n\n \n //\n scope.TableFormRowEditBtn=function MyTableFormEditBtn(index){\n console.log(\"hi\");\n document.getElementById(\"EmptableWithEditDelete6\").rows[index+1].cells[2].getElementsByTagName(\"input\")[0].disabled=false\n document.getElementById(\"EmptableWithEditDelete6\").rows[index+1].cells[3].getElementsByTagName(\"input\")[0].disabled=false\n document.getElementById(\"EmptableWithEditDelete6\").rows[index+1].cells[4].getElementsByTagName(\"input\")[0].disabled=false\n \n //document.getElementById(\"DivtableWithEditDelete\").rows[index+1].cells[1] provides row-1 column 1 cell. in this cell. as index in JS starts with zero,need to do +1 to get first row.\n //to access input tag from row-1,column-1, \"getElementsByTagName(\"input\")[0]\" is used.[0] provides first input tag in this context.\n \n //console.log(scope.msg.payload.MyFormData.Edit[index]);\n \n }\n\n\n scope.TableAddFirstRecord=function MyTableAddFirstRecordBtn(){\n //Array index in JS variable starts from Zero where as table row index starts from 1 so index is added with +1\n console.log(\"TableAddFirstRecord clicked\");\n var dummy={\"Current\":\"\",};\n scope.IntMsg.payload.SetData.push(dummy);\n }\n\n\n scope.TableFormAddRowBtn=function MyTableFormAddRowBtn(index){\n //Array index in JS variable starts from Zero where as table row index starts from 1 so index is added with +1\n var dummy={\"Current\":\"\"};\n scope.IntMsg.payload.SetData.splice(index+1, 0, dummy);\n }\n scope.MyTableFormAction= function MyTableFormData(){\n var i;\n for (i = 0; i < scope.IntMsg.payload.SetData.length; i++) {\n document.getElementById(\"EmptableWithEditDelete6\").rows[i+1].cells[2].getElementsByTagName(\"input\")[0].disabled=true\n document.getElementById(\"EmptableWithEditDelete6\").rows[i+1].cells[3].getElementsByTagName(\"input\")[0].disabled=true\n document.getElementById(\"EmptableWithEditDelete6\").rows[i+1].cells[4].getElementsByTagName(\"input\")[0].disabled=true\n \n }\n \n console.log(\"MyTableFormData\");\n console.log(scope.IntMsg.payload.SetData);\n window.confirm(\"Data Saved\");\n scope.send({\"payload\":(scope.IntMsg.payload)});\n \n }\n scope.TableFormRowDeleteBtn=function MyTableFormRowDeleteBtn(index){\n var txt;\n var r = confirm(\"Press OK to Confim Delete \");\n if (r == true) {\n scope.IntMsg.payload.SetData.splice(index,1);\n scope.MyTableFormAction();\n console.log([\"TableFormRowDeleteBtn\"],index);\n }\n \n\n }\n \n})(scope);\n\n\n</script>\n</body>\n</html>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":850,"y":2320,"wires":[["b85cec15.8a1af"]]},{"id":"b85cec15.8a1af","type":"file","z":"a14027eb.55f138","name":"CurrentCal.txt","filename":"/home/pi/Desktop/CurrentCal.txt","appendNewline":false,"createDir":true,"overwriteFile":"true","x":1060,"y":2320,"wires":[["a606eb44.a76aa8","bc7cbda2.ad705"]]},{"id":"bc7cbda2.ad705","type":"function","z":"a14027eb.55f138","name":"SetVal","func":"var data = msg.payload.SetData;\n\nvar n= data.length;\nfor(i=0;i<n;i++)\n{\n var sID=msg.payload.SetData[i].slaveID\n var Address=msg.payload.SetData[i].Address\n global.set('CurrentCal['+sID+']['+Address+']',msg.payload.SetData[i].Current);\n //node.warn(global.get('CurrentCal['+sID+']['+Address+']'))\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":1230,"y":2360,"wires":[["a606eb44.a76aa8"]]},{"id":"a606eb44.a76aa8","type":"debug","z":"a14027eb.55f138","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1390,"y":2320,"wires":[]},{"id":"b41d82a8.b3ff6","type":"debug","z":"a14027eb.55f138","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":740,"y":1860,"wires":[]},{"id":"13958efc.8204e1","type":"debug","z":"a14027eb.55f138","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":650,"y":400,"wires":[]},{"id":"3b599b52.2060e4","type":"tab","label":"Advanced Settings","disabled":false,"info":""},{"id":"f470c340.d0f22","type":"ui_button","z":"3b599b52.2060e4","name":"","group":"93017876.34e658","order":1,"width":6,"height":1,"passthru":false,"label":"Edit Parameter Names","tooltip":"","color":"","bgcolor":"","icon":"","payload":"Enter admin password","payloadType":"str","topic":"","x":160,"y":80,"wires":[["e98ce807.471aa8"]]},{"id":"e98ce807.471aa8","type":"ui_toast","z":"3b599b52.2060e4","position":"prompt","displayTime":"3","highlight":"","sendall":true,"outputs":1,"ok":"OK","cancel":"Cancel","raw":false,"topic":"Admin access required","name":"","x":390,"y":80,"wires":[["73977add.632734","c44e0ebc.e754d"]]},{"id":"73977add.632734","type":"function","z":"3b599b52.2060e4","name":"","func":"if(msg.payload == \"AdminPro\")\n{\n msg.payload = {\"tab\":\"Parameters\"}\n return msg;\n}","outputs":1,"noerr":0,"x":580,"y":80,"wires":[["25cf3592.73b5fa"]]},{"id":"c44e0ebc.e754d","type":"function","z":"3b599b52.2060e4","name":"","func":"if(msg.payload != \"AdminPro\")\n{\n msg.payload = \"Incorrect Password\"\n return msg;\n}","outputs":1,"noerr":0,"x":580,"y":140,"wires":[["294d8f3d.fff37"]]},{"id":"294d8f3d.fff37","type":"ui_toast","z":"3b599b52.2060e4","position":"dialog","displayTime":"3","highlight":"","sendall":true,"outputs":1,"ok":"OK","cancel":"","raw":false,"topic":"","name":"","x":770,"y":140,"wires":[[]]},{"id":"25cf3592.73b5fa","type":"ui_ui_control","z":"3b599b52.2060e4","name":"","events":"all","x":760,"y":80,"wires":[[]]},{"id":"b9cb016a.d9b01","type":"inject","z":"3b599b52.2060e4","name":"","repeat":"","crontab":"","once":true,"onceDelay":"0.1","topic":"","payload":"","payloadType":"date","x":150,"y":280,"wires":[["837b903f.7c5a4"]]},{"id":"837b903f.7c5a4","type":"file in","z":"3b599b52.2060e4","name":"commParameters.txt","filename":"/home/pi/Desktop/commParameters.txt","format":"utf8","chunk":false,"sendError":false,"x":360,"y":280,"wires":[["274a272.85e80d8"]]},{"id":"274a272.85e80d8","type":"function","z":"3b599b52.2060e4","name":"settings obj","func":"//global.set(\"settings\",msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":570,"y":280,"wires":[["9225d026.c32"]]},{"id":"9225d026.c32","type":"json","z":"3b599b52.2060e4","name":"","property":"payload","action":"","pretty":false,"x":730,"y":280,"wires":[["9f459a1e.89fae8"]]},{"id":"9f459a1e.89fae8","type":"ui_template","z":"3b599b52.2060e4","group":"42f4fa02.ebe974","name":"Comm Parameters","order":1,"width":"0","height":"0","format":"<html>\n <head>\n \n </head>\n <body>\n<style>\ntable, th, tr, td\n{\n border: 1px black solid;\n border-collapse: collapse;\n text-align: center;\n}\n\ninput[type = number], input[type = text]\n{\n background-color: white;\n border: none;\n word-wrap: break-word;\n word-break: break-all;\n text-align: center;\n}\n\nth\n{\n background-color: #2a92b5;\n padding : 7px 3px;\n color: white;\n}\n\n</style>\n \n\n <form id=\"TableForm\" ng-submit=\"MyTableFormAction()\" >\n <table align = \"center\" id=\"EmptableWithEditDelete3\">\n <tr>\n <th>\n Port\n </th>\n <th>\n Baud Rate\n </th>\n <th>\n Parity\n </th>\n <th>\n Stop Bits\n </th>\n <th>\n Edit\n </th>\n </tr>\n \n <tr ng-repeat=\"Set in IntMsg.payload.SetData\" >\n <td>\n <input type=\"text\" id=\"EmpHighInput{{$index}}\" ng-model=\"Set.port\" disabled=\"true\" required>\n </td>\n <td>\n <input type=\"number\" step=\"0.01\" id=\"EmpHighInput{{$index}}\" ng-model=\"Set.baudRate\" disabled=\"true\" required>\n </td>\n <td>\n <input type=\"text\" id=\"EmpHighInput{{$index}}\" ng-model=\"Set.parity\" disabled=\"true\" required> <!--ng-model=\"IntMsg.payload.SetData[$index].Name\"-->\n </td>\n <td>\n <input type=\"number\" step=\"0.01\" id=\"EmpHighInput{{$index}}\" ng-model=\"Set.stopBits\" disabled=\"true\" required> <!--ng-model=\"IntMsg.payload.SetData[$index].Name\"-->\n </td>\n <td>\n <button type=\"button\" ng-click=\"TableFormRowEditBtn($index)\" ng-style=\"{background: '#ffc399', color:'black', border : '1px solid #0093dc', cursor: 'allowed'}\">\n Edit\n </button>\n </td>\n </tr>\n </table>\n <br>\n <br>\n\n <button type=\"Submit\" name=\"Submit\" ng-style=\"{float: 'right', background: '#54e18a', color:'Black',padding: '4px 6px', border: 'none', cursor: 'allowed'}\"> \n Submit Data\n </button>\n </form>\n\n<script>\n//send({payload:myFunction1()})\n//few learnigs: if msg.pyload is used to link data to html tags like \n//<input type=\"text\" id=\"EmpId\" name=\"fname\" value={{msg.payload.TSetData.Selectedobj}} disabled > \n//then \n//ensure orginal data variables in msg.payload are intact through out the session/user interaction. \n\n//\"{{angular_var}}\" syntax is used in html to pass varible data from angular to html tags\n//angular function send({payload:var/funct}) is used to send the msg to node red using ng-click directives. it updates msg.payload of entire template. \n// if your html view tags like input msg/table/dropdowns are getting reset that means\n//while sending msg, orginal msg got disturbed.\n// to solve this issue you can preserve original msg by adding new varibles to orginal msg.payload .\n// this is allowed but you should not disturb incoming msg.payload varibales data structure.\n// i.e say incoming msg.payload had data structure like msg={\"payload\":{\"emp\":employees}}\n//employees=[{\"name\":\"e1\",\"id\":1,\"dept\":\"dept1\",\"div\":\"div1\"},{\"name\":\"e2\",\"id\":2,\"dept\":\"dept2\",\"div\":\"div2\"},{\"name\":\"e3\",\"id\":3,\"dept\":\"dept3\",\"div\":\"div3\"}]\n// in this case you can add msg={\"payload\":{\"emp\":employees},{\"newVar\":newVarData}} this will works as orignal msg.payload.emp is not disturbed and new object \"NewVar is added\"\n// you can chage values of all varibles . that will not create any error or reset of view.\n\n\n// to check node-red ui is working properly , type \"http://127.0.0.1:1880/ui/\" in chrome browser and click\n//on broweser three dots menu-->more tools-->developer tools ensure at riht side of broweser debug window is opend\n// click on Consol tab to see error/status mssages.\n// you can use console.log(\"your_var_name\"); to see the value\n\n var test=document.getElementById(\"EmpId\");\n\n(function(scope) {\n // use this func\n scope.IntMsg={\"payload\":{\"SetData\":[{}]}};\n \n scope.$watch('msg', function(msg) {\n if (msg) {\n // Do something when msg arrives\n scope.IntMsg=msg;\n \n console.log(msg.payload);\n }\n });\n\n \n //\n scope.TableFormRowEditBtn=function MyTableFormEditBtn(index){\n document.getElementById(\"EmptableWithEditDelete3\").rows[index+1].cells[0].getElementsByTagName(\"input\")[0].disabled=false\n document.getElementById(\"EmptableWithEditDelete3\").rows[index+1].cells[1].getElementsByTagName(\"input\")[0].disabled=false\n document.getElementById(\"EmptableWithEditDelete3\").rows[index+1].cells[2].getElementsByTagName(\"input\")[0].disabled=false\n document.getElementById(\"EmptableWithEditDelete3\").rows[index+1].cells[3].getElementsByTagName(\"input\")[0].disabled=false\n \n //document.getElementById(\"DivtableWithEditDelete\").rows[index+1].cells[1] provides row-1 column 1 cell. in this cell. as index in JS starts with zero,need to do +1 to get first row.\n //to access input tag from row-1,column-1, \"getElementsByTagName(\"input\")[0]\" is used.[0] provides first input tag in this context.\n \n //console.log(scope.msg.payload.MyFormData.Edit[index]);\n \n }\n\n\n scope.TableAddFirstRecord=function MyTableAddFirstRecordBtn(){\n //Array index in JS variable starts from Zero where as table row index starts from 1 so index is added with +1\n console.log(\"TableAddFirstRecord clicked\");\n var dummy={\"Pressure\":\"\",};\n scope.IntMsg.payload.SetData.push(dummy);\n }\n\n\n scope.TableFormAddRowBtn=function MyTableFormAddRowBtn(index){\n //Array index in JS variable starts from Zero where as table row index starts from 1 so index is added with +1\n var dummy={\"Pressure\":\"\"};\n scope.IntMsg.payload.SetData.splice(index+1, 0, dummy);\n }\n scope.MyTableFormAction= function MyTableFormData(){\n var i;\n for (i = 0; i < scope.IntMsg.payload.SetData.length; i++) {\n document.getElementById(\"EmptableWithEditDelete3\").rows[i+1].cells[0].getElementsByTagName(\"input\")[0].disabled=true\n document.getElementById(\"EmptableWithEditDelete3\").rows[i+1].cells[1].getElementsByTagName(\"input\")[0].disabled=true\n document.getElementById(\"EmptableWithEditDelete3\").rows[i+1].cells[2].getElementsByTagName(\"input\")[0].disabled=true\n document.getElementById(\"EmptableWithEditDelete3\").rows[i+1].cells[3].getElementsByTagName(\"input\")[0].disabled=true\n }\n \n console.log(\"MyTableFormData\");\n console.log(scope.IntMsg.payload.SetData);\n window.confirm(\"Data Saved\");\n scope.send({\"payload\":(scope.IntMsg.payload)});\n \n }\n scope.TableFormRowDeleteBtn=function MyTableFormRowDeleteBtn(index){\n var txt;\n var r = confirm(\"Press OK to Confim Delete \");\n if (r == true) {\n scope.IntMsg.payload.SetData.splice(index,1);\n scope.MyTableFormAction();\n console.log([\"TableFormRowDeleteBtn\"],index);\n }\n \n\n }\n \n})(scope);\n\n</script>\n</body>\n</html>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":910,"y":280,"wires":[["5fd296a6.05e178"]]},{"id":"5fd296a6.05e178","type":"file","z":"3b599b52.2060e4","name":"commParameters.txt","filename":"/home/pi/Desktop/commParameters.txt","appendNewline":false,"createDir":true,"overwriteFile":"true","x":1140,"y":280,"wires":[["1f053dc0.059d72","41d97a02.dc0964"]]},{"id":"1f053dc0.059d72","type":"debug","z":"3b599b52.2060e4","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1490,"y":280,"wires":[]},{"id":"41d97a02.dc0964","type":"function","z":"3b599b52.2060e4","name":"SetVal","func":"var data = msg.payload.SetData;\nvar n= data.length;\n\n\nfor(i=0;i<n;i++)\n{\n global.set('port', msg.payload.SetData[i].port);\n global.set('baudRate', msg.payload.SetData[i].baudRate);\n global.set('parity', msg.payload.SetData[i].parity);\n global.set('stopBits', msg.payload.SetData[i].stopBits);\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":1330,"y":320,"wires":[["1f053dc0.059d72"]]},{"id":"e6169771.afe8c8","type":"ui_button","z":"3b599b52.2060e4","name":"","group":"93017876.34e658","order":2,"width":6,"height":1,"passthru":false,"label":"Edit Communication Settings","tooltip":"","color":"","bgcolor":"","icon":"","payload":"Enter admin password","payloadType":"str","topic":"","x":180,"y":380,"wires":[["5f3909f2.8e35a8"]]},{"id":"5f3909f2.8e35a8","type":"ui_toast","z":"3b599b52.2060e4","position":"prompt","displayTime":"3","highlight":"","sendall":true,"outputs":1,"ok":"OK","cancel":"Cancel","raw":false,"topic":"Admin access required","name":"","x":410,"y":380,"wires":[["5b882bc5.f44b54","930f252f.e8fb78"]]},{"id":"5b882bc5.f44b54","type":"function","z":"3b599b52.2060e4","name":"","func":"if(msg.payload == \"AdminLite\")\n{\n msg.payload = {\"tab\":\"Communication Settings\"}\n return msg;\n}","outputs":1,"noerr":0,"x":580,"y":380,"wires":[["fe515aa2.fb0298"]]},{"id":"930f252f.e8fb78","type":"function","z":"3b599b52.2060e4","name":"","func":"if(msg.payload != \"AdminLite\")\n{\n msg.payload = \"Incorrect Password\"\n return msg;\n}","outputs":1,"noerr":0,"x":580,"y":440,"wires":[["3c2281ea.0fb43e"]]},{"id":"3c2281ea.0fb43e","type":"ui_toast","z":"3b599b52.2060e4","position":"dialog","displayTime":"3","highlight":"","sendall":true,"outputs":1,"ok":"OK","cancel":"","raw":false,"topic":"","name":"","x":770,"y":440,"wires":[[]]},{"id":"fe515aa2.fb0298","type":"ui_ui_control","z":"3b599b52.2060e4","name":"","events":"all","x":760,"y":380,"wires":[[]]},{"id":"382fa945.348246","type":"tab","label":"Alert system","disabled":false,"info":""},{"id":"bbfcbd09.a3ab1","type":"inject","z":"382fa945.348246","name":"","repeat":"","crontab":"","once":true,"onceDelay":"5","topic":"","payload":"","payloadType":"date","x":150,"y":140,"wires":[["e54cd99.1a4df28"]]},{"id":"e54cd99.1a4df28","type":"file in","z":"382fa945.348246","name":"Notification.txt","filename":"/home/pi/Desktop/Notification.txt","format":"utf8","chunk":false,"sendError":false,"x":380,"y":140,"wires":[["d24530a6.b4bf4"]]},{"id":"d76820c5.a8ace","type":"function","z":"382fa945.348246","name":"settings obj","func":"var Dropdown=global.get('ParaDrop2');\nvar RecipDetails = msg.payload.RecipDetails\nvar NoOfRecip = msg.payload.NoOfRecip\nmsg.payload.Dropdown=Dropdown;\nmsg.payload={\"RecipDetails\":RecipDetails,\"NoOfRecip\":NoOfRecip,\"Dropdown\":Dropdown}\n//node.warn(Dropdown)\nreturn msg;","outputs":1,"noerr":0,"x":710,"y":140,"wires":[["80ca4521.1ef738"]]},{"id":"1810e383.40b3fc","type":"file","z":"382fa945.348246","name":"Notification.txt","filename":"/home/pi/Desktop/Notification.txt","appendNewline":false,"createDir":true,"overwriteFile":"true","x":1080,"y":140,"wires":[["c2c09d32.69b8","43c66f1a.39d15"]]},{"id":"43c66f1a.39d15","type":"function","z":"382fa945.348246","name":"SetVal","func":"var data = msg.payload.RecipDetails;\nvar n = data.length;\n\nflow.set('Details',msg.payload.RecipDetails)\nflow.set('alertLength',n)\n\nfor(var i =0; i<n;i++)\n{\n var id = data[i].id\n global.set(\"id\"+i,id)\n global.set(\"Low\"+id,data[i].Low)\n global.set(\"LowCritical\"+id,data[i].LowCritical)\n global.set(\"High\"+id,data[i].High)\n global.set(\"HighCritical\"+id,data[i].HighCritical)\n //global.set(\"Parameter\" + i, msg.payload.Dropdown[i].name);\n \n}\n\n//node.warn(global.get(\"Parameter0\"))","outputs":1,"noerr":0,"x":1250,"y":180,"wires":[["c2c09d32.69b8"]]},{"id":"c2c09d32.69b8","type":"debug","z":"382fa945.348246","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1430,"y":140,"wires":[]},{"id":"d24530a6.b4bf4","type":"json","z":"382fa945.348246","name":"","property":"payload","action":"","pretty":false,"x":550,"y":140,"wires":[["d76820c5.a8ace"]]},{"id":"80ca4521.1ef738","type":"ui_template","z":"382fa945.348246","group":"5b5cd7e5.976718","name":"Alert List","order":1,"width":"0","height":"0","format":"<html>\n<body>\n<style>\nbody{\n background-image : url(\"/background9.jpg\");\n}\n \n input[type=text]{\n \tbackground-color: white;\n \ttext-align : center;\n \tcolor : black;\n border:none;\n padding : 7px;\n }\n input[type=submit] {\n background-color: #4CAF50;\n color: white;\n padding: 5px 7px;\n text-align : center;\n border: none;\n border-radius: 1px;\n cursor: allowed;\n float: left;\n}\n\ninput[type=submit]:hover {\n background-color: #45a049;\n}\ntable, tr, th, td {\n \n background-color: white;\n border-collapse: collapse;\n\t\tborder: 1px solid black;\n\t\tcolor: black;\n\t\ttext-align: center;\n\t\tpadding: 1px;\n}\n\n input[type=number]{\n background-color: white;\n color : black;\n text-align : center;\n border : 1px solid #0093dc;\n padding : 7px 6px;\n text-align : center;\n } \n th{\n\t text-align : center;\n\t color: white;\n\t font-weight: normal;\n\t font-family: candara;\n\t font-size: 110%;\n\t background-color: #097479;\n\t padding : 7px 3px\n\t }\n\t td {\n \n background-color: white;\n border-collapse: collapse;\n\t\tborder: 1px solid black;\n\t\tcolor : black;\n\t\ttext-align : center;\n\t\tpadding: 1px;\n}\n \n</style>\n\n \n<form id=\"MobileNoForm\" ng-submit=\"submitlist()\" align=\"justify\">\n<br>\n<div padding: 5px; margin: 5px; >\n<div class = \"addrow\">\n<div class = \"column\">\n\n\n<table id=\"mytable\" class=\"table table-bordered\" align = \"center\">\n<thead>\n<tr>\n<th style=\"width:20% type='text' name ='Parametr' ;\">Parameter</th>\n<th style=\"width:20% type='text' name ='LowCritical';\">LowCritical</th>\n<th style=\"width:20% type='text' name ='Low';\">Low</th>\n<th style=\"width:20% type='text' name ='High';\">High</th>\n<th style=\"width:20% type='text' name ='HighCritical';\">HighCritical</th>\n<th style=\"width:30% type='text' name ='Code';\">Remove</th>\n</tr>\n</thead>\n<tbody align=\"center\">\n<tr ng-repeat=\"Details in recipients\">\n<!--<td><select id=\"sel\" name=\"Details.id{{$index}}\" placeholder = \"-\" ng-model=\"Details.id\" required></select></td>-->\n <td>\n <select id=\"EmpDropdown\" ng-model=\"Details.id\" >\n <!-- when user selects option from dropdown, value attrubite in option tag will receive the varible value assigned to it. This value will be passed to \"ng-model=\"your_variable\"\" and can be accessed\n in java script . another way of accessing it is using DOM:document.getElementById(\"Your Select ID\").value syntax -->\n <option ng-repeat=\"Tasklist in Drop\" value=\"{{Tasklist.Location}}\" required >{{Tasklist.name}}\n <!--ng-repeat repeas html tag for each object in the list/array assigned to it -->\n </option>\n </select>\n </td>\n<td><input type=\"number\" name=\"LowCritical{{$index}}\" placeholder = \"Enter LowCritical\" ng-model=\"Details.LowCritical\" required></td>\n<td><input type=\"number\" name=\"Low{{$index}}\" placeholder = \"Enter Low\" ng-model=\"Details.Low\" required></td>\n<td><input type=\"number\" name=\"High{{$index}}\" placeholder = \"Enter High\" ng-model=\"Details.High\" required></td>\n<td><input type=\"number\" name=\"HighCritical{{$index}}\" placeholder = \"Enter HighCritical\" ng-model=\"Details.HighCritical\" required></td>\n \n<td><input type=\"button\" value=\"Remove\" ng-click=\"deleteDetails($index)\" ng-style=\"{background: '#ffc399', color:'black', border : '1px solid #0093dc', cursor: 'allowed'}\"></td>\n</tbody>\n</table>\n<br>\n<br>\n</div>\n</div>\n</div>\n<input type=\"submit\" class=\"btn btn-primary\" value=\"Submit\" ng-style=\"{float: 'right', background: '#54e18a', color:'Black',padding: '4px 6px', border: 'none', cursor: 'allowed'}\"/> \n<input type=\"button\" name=\"NoOfRecip\" value =\"Add Parameter\" ng-click=\"addRecipient()\" ng-style=\"{align:'right',float: 'left',background: '#7dcfff', color:'Black',padding: '4px 6px', border: 'none', cursor: 'allowed'}\">\n\n</form>\n<script>\nvar dropdata;\n\t (function(scope) { \t\n scope.$watch('msg', function(msg) {\n console.log([\"msg\",msg]);\n if (msg) {\n $(\"#my_\"+scope.$id).html(msg.payload);\n scope.data = angular.copy(msg.payload.RecipDetails);\n scope.Drop = angular.copy(msg.payload.Dropdown);\n scope.recipients = angular.copy(scope.data);\n dropdata = angular.copy(scope.Drop);\n \n }\n \n // var msg={\"payload\":{\"dropdata\" :(scope.dropdata)}};\n//scope.send(msg);\n });\n\n\t scope.enabledEdit = [];\t\n//scope.data = [{ id:\"\",Low:\"\",LowCritical:\"\",High:\"\",HighCritical:\"\"}];\n \n//scope.recipients = angular.copy(scope.data);\n\n\t\n\t scope.addRecipient = function(){\n\t \n\tvar Details ={ id:\"\",Low:\"\",LowCritical:\"\",High:\"\",HighCritical:\"\"};\n\t\tscope.recipients.push(Details);\n\t\tscope.enabledEdit[scope.recipients.length-1]=true;\n\t\n\n}\n\t scope.editDetails = function(index){\n\t console.log(\"edit index\"+index);\n\t scope.enabledEdit[index] = true;\n\t}\n\tscope.deleteDetails = function(index) {\n\t\tvar r = confirm(\"Are you sure you want to delete?\");\n if (r == true) {\n txt = \"You pressed OK!\";\n scope.recipients.splice(index,1);\n scope.submitlist();\n } else {\n txt = \"You pressed Cancel!\";\n }\n document.getElementById(\"demo\").innerHTML = txt;\n\t}\n\nscope.submitlist = function(){\n \n for(var i = 0 ; i < scope.recipients.length ; i++)\n {\n //window.confirm([\"for loopin sg=umbmit\"]);\n scope.recipients[i].GenCode = dropdata[scope.recipients[i].id].code;\n }\n//window.confirm([\"above msg\"]);\nvar msg={\"payload\":{\"RecipDetails\" :(scope.recipients),\"NoOfRecip\":(scope.recipients.length),\"Dropdown\":(scope.Drop)}};//,\"SetVal\":(dropdata[scope.recipients[0].Value]\n//window.confirm([\"msg\",msg]);\nscope.send(msg);\nwindow.confirm(\"Data Saved\");\nconsole.log([\"form submitted:\",(msg)]);\n\n}\n})(scope);\n</script> \n</body>\n</html>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":900,"y":140,"wires":[["1810e383.40b3fc"]]},{"id":"3ee44ed9.974022","type":"inject","z":"382fa945.348246","name":"","repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":150,"y":200,"wires":[["450c17f6.ff7a08"]]},{"id":"450c17f6.ff7a08","type":"function","z":"382fa945.348246","name":"","func":"if(global.get('Para2DropUpdated')==1)\n{\n global.set('Para2DropUpdated',0);\n return msg;\n}","outputs":1,"noerr":0,"x":360,"y":200,"wires":[["e54cd99.1a4df28"]]},{"id":"4cdb9707.1be9e8","type":"inject","z":"382fa945.348246","d":true,"name":"","repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":150,"y":680,"wires":[["da827a39.999528","3f299fc7.864e"]]},{"id":"da827a39.999528","type":"function","z":"382fa945.348246","name":"Alert counter","func":"var alertLength = flow.get('alertLength')\nvar alertArray = []\n\nfor( j = 0; j < alertLength ; j++)\n{\n if(global.get('Status[' + global.get('sID'+j) + ']') == 'Connected')\n {\n var Details =flow.get('Details')\n var Low= global.get(\"Low\"+global.get('id' + j));\n var LowCritical= global.get(\"LowCritical\"+global.get('id' + j));\n var High= global.get(\"High\"+global.get('id' + j));\n var HighCritical= global.get(\"HighCritical\"+global.get('id' + j));\n var para=global.get('ParaDrop2')[j]\n var Alert = global.get('parameterName'+ global.get('id' + j))\n \n //node.warn([\"Low\",global.get(\"Low0\")])\n var LiveValue=parseFloat(global.get('sensorData[' + global.get('sID'+global.get('id' + j)) + '][' + global.get('sregisterAddress'+global.get('id' + j)) + ']'));\n \n \n if(LiveValue<LowCritical)\n {\n flow.set(\"id\"+j+\"LowCount\",0)\n flow.set(\"id\"+j+\"HighCount\",0)\n flow.set(\"id\"+j+\"HighCriticalCount\", 0)\n flow.set(\"id\"+j+\"LowCriticalCount\", flow.get(\"id\"+j+\"LowCriticalCount\") + 1)\n alertArray.push([Alert,'Low Critical', flow.get(\"id\"+j+\"LowCriticalCount\")])\n }\n \n else if((LowCritical<LiveValue)&&(LiveValue<Low))\n {\n flow.set(\"id\"+j+\"LowCriticalCount\",0)\n flow.set(\"id\"+j+\"HighCount\",0)\n flow.set(\"id\"+j+\"HighCriticalCount\", 0)\n flow.set(\"id\"+j+\"LowCount\", flow.get(\"id\"+j+\"LowCount\") + 1)\n alertArray.push([Alert,'Low', flow.get(\"id\"+j+\"LowCount\")])\n }\n \n else if((Low<LiveValue)&&(LiveValue<High))\n {\n flow.set(\"id\"+j+\"LowCriticalCount\",0)\n flow.set(\"id\"+j+\"LowCount\",0)\n flow.set(\"id\"+j+\"HighCount\",0)\n flow.set(\"id\"+j+\"HighCriticalCount\", 0)\n }\n \n else if((High<LiveValue)&&(LiveValue<HighCritical))\n {\n flow.set(\"id\"+j+\"LowCriticalCount\",0)\n flow.set(\"id\"+j+\"LowCount\",0)\n flow.set(\"id\"+j+\"HighCriticalCount\", 0)\n flow.set(\"id\"+j+\"HighCount\", flow.get(\"id\"+j+\"HighCount\") + 1)\n alertArray.push([Alert,'High', flow.get(\"id\"+j+\"HighCount\")])\n }\n \n else if(HighCritical<LiveValue)\n {\n flow.set(\"id\"+j+\"LowCriticalCount\",0)\n flow.set(\"id\"+j+\"LowCount\",0)\n flow.set(\"id\"+j+\"HighCount\",0)\n flow.set(\"id\"+j+\"HighCriticalCount\", flow.get(\"id\"+j+\"HighCriticalCount\") + 1)\n alertArray.push([Alert,'High Critical', flow.get(\"id\"+j+\"HighCriticalCount\")])\n }\n }\n \n else\n {\n flow.set(\"id\"+j+\"LowCriticalCount\",0)\n flow.set(\"id\"+j+\"LowCount\",0)\n flow.set(\"id\"+j+\"HighCount\",0)\n flow.set(\"id\"+j+\"HighCriticalCount\", 0)\n }\n}\n\nmsg.payload = alertArray\nnode.send(msg)","outputs":1,"noerr":0,"x":350,"y":680,"wires":[["4e78c3e4.02865c"]]},{"id":"2cc92d.eab146d4","type":"comment","z":"382fa945.348246","name":"Alert Display","info":"","x":130,"y":640,"wires":[]},{"id":"5b863302.f6544c","type":"inject","z":"382fa945.348246","name":"","repeat":"","crontab":"","once":true,"onceDelay":"1","topic":"","payload":"","payloadType":"date","x":150,"y":80,"wires":[["1fafe888.eaced7"]]},{"id":"1fafe888.eaced7","type":"function","z":"382fa945.348246","name":"Flow Variables","func":"var n = global.get('slaveLength')\n\nfor(i = 0; i<n ; i++)\n{\n flow.set('id' + i + 'LowCriticalCount', 0);\n flow.set('id' + i + 'LowCount', 0);\n flow.set('id' + i + 'HighCount', 0);\n flow.set('id' + i + 'HighCriticalCount', 0);\n flow.set('ConnectCount['+ global.get('sID'+i) + ']',0)\n}","outputs":1,"noerr":0,"x":340,"y":80,"wires":[[]]},{"id":"3b5570ff.bdbd5","type":"inject","z":"382fa945.348246","name":"","repeat":"","crontab":"","once":false,"onceDelay":"1","topic":"","payload":"","payloadType":"date","x":580,"y":80,"wires":[["84859341.79acf"]]},{"id":"84859341.79acf","type":"function","z":"382fa945.348246","name":"testing","func":"node.warn(global.get('Status[' + global.get('sID0') + ']'))","outputs":1,"noerr":0,"x":750,"y":80,"wires":[[]]},{"id":"4e78c3e4.02865c","type":"function","z":"382fa945.348246","name":"display data","func":"var alertArray = msg.payload\nvar len = alertArray.length\n\nif(len > 0)\n{\n msg = {};\n msg.payload = {};\n \n msg.payload.RecipDetails=[{Name:alertArray[0][0],Condition:alertArray[0][1],Time:alertArray[0][2]}]\n \n for(i=1;i<len;i++)\n {\n msg.payload.RecipDetails[i] = {Name:alertArray[i][0],Condition:alertArray[i][1],Time:alertArray[i][2]}\n }\n return msg;\n}\nelse\n{\n msg.payload.RecipDetails=[];\n return msg;\n}","outputs":1,"noerr":0,"x":550,"y":680,"wires":[["ae04b8ca.451548"]]},{"id":"ae04b8ca.451548","type":"ui_template","z":"382fa945.348246","group":"affbfac1.b16068","name":"Alert Table","order":1,"width":0,"height":0,"format":"<html>\n <head>\n \n </head>\n <body>\n<style>\ntable, th, tr, td\n{\n border: 1px black solid;\n border-collapse: collapse;\n text-align: center;\n}\n\ninput[type = number], input[type = text]\n{\n background-color: white;\n border: none;\n word-wrap: break-word;\n word-break: break-all;\n text-align: center;\n}\n\nth\n{\n background-color: #2a92b5;\n padding : 7px 3px;\n color: white;\n}\n</style>\n \n \n<div>\n\n\n<div>\n <form id=\"TableForm\" ng-submit=\"MyTableFormAction()\" >\n \n <table align = \"center\" id=\"EmptableWithEditDelete\">\n <tr>\n <th>\n Sr. No.\n </th>\n <th>\n Name\n </th>\n <th>\n Condition\n </th>\n <th>\n Time\n </th>\n\n </tr>\n <tr ng-repeat=\"RawData in msg.payload.RecipDetails\" >\n <td disabled=\"true\">\n {{$index+1}}\n </td>\n <td>\n <input type=\"text\" id=\"Parameter{{$index}}\" ng-model=\"RawData.Name\" disabled=\"true\" required><!--ng-model=-->\n </td>\n <td>\n <input type=\"text\" id=\"Parameter{{$index}}\" ng-model=\"RawData.Condition\" disabled=\"true\" required><!--ng-model=-->\n </td>\n <td>\n <input type=\"text\" id=\"Parameter{{$index}}\" ng-model=\"RawData.Time\" disabled=\"true\" required> <!--ng-model=\"IntMsg.payload.EmpData[$index].Name\"-->\n </td>\n </tr>\n </table>\n </form>\n</div>\n</div>\n<script>\n\n(function(scope) {\n // use this func\n \n scope.$watch('msg', function(msg) {\n if (msg) {\n // Do something when msg arrives\n \n console.log(msg.payload);\n }\n });\n\n})(scope);\n\n\n</script>\n</body>\n</html>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":750,"y":680,"wires":[[]]},{"id":"aabba73.e8ae258","type":"inject","z":"382fa945.348246","name":"Notifications","repeat":"5","crontab":"","once":true,"onceDelay":"1","topic":"","payload":"","payloadType":"date","x":160,"y":420,"wires":[["96fcb25.fc36f5"]]},{"id":"96fcb25.fc36f5","type":"file in","z":"382fa945.348246","name":"myform.txt","filename":"/home/pi/Desktop/myform.txt","format":"utf8","chunk":false,"sendError":false,"x":350,"y":420,"wires":[["d3ad5ba0.fea8c8"]]},{"id":"d3ad5ba0.fea8c8","type":"json","z":"382fa945.348246","name":"","property":"payload","action":"","pretty":false,"x":510,"y":420,"wires":[["b2817cef.ddb3f"]]},{"id":"bb151ac3.f4b908","type":"json","z":"382fa945.348246","name":"","property":"payload","action":"","pretty":false,"x":1150,"y":440,"wires":[["7e5c1e2e.4a7a5","5ac280cb.0790e","e6c4bd9d.e26bb"]]},{"id":"7e5c1e2e.4a7a5","type":"debug","z":"382fa945.348246","name":"SMS","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1330,"y":580,"wires":[]},{"id":"b2817cef.ddb3f","type":"function","z":"382fa945.348246","name":"SMS and Email for alerts","func":"var alertLength = flow.get('alertLength')\nvar NoOfRecip = msg.payload.NoOfRecip;\nvar Name = [];\nvar MobileNo = [];\nvar EmailId =[];\nvar MsgStr = {};\nvar Email = {};\nvar time = new Date();\nvar timeFormat = (time.getDate() + \"-\" + (time.getMonth() + 1) + \"-\" + time.getFullYear() + \",\" + time.getHours() + \":\" + time.getMinutes() + \":\" + time.getSeconds()).toString();\n\nfor(i = 0 ; i<NoOfRecip;i++)\n{\n Name[i] = msg.payload.RecipDetails[i].Name;\n MobileNo[i] = msg.payload.RecipDetails[i].Mobile;\n EmailId[i] = msg.payload.RecipDetails[i].EmailId;\n}\n\nEmail.to = EmailId[0];\n\nfor(j=1;j<NoOfRecip;j++)\n{\n\tEmail.cc = Email.cc+\",\"+EmailId[j];\n}\n\nfor( k = 0; k < alertLength ; k++)\n{\n var Low= global.get(\"Low\" + global.get('id' + k));\n var LowCritical= global.get(\"LowCritical\" + global.get('id' + k));\n var High= global.get(\"High\" + global.get('id' + k));\n var HighCritical= global.get(\"HighCritical\" + global.get('id' + k));\n \n var Alert = global.get('parameterName'+ global.get('id' + k))\n var LiveValue=parseFloat(global.get('sensorData[' + global.get('sID'+global.get('id' + k)) + '][' + global.get('sregisterAddress'+global.get('id' + k)) + ']'));\n \n if(flow.get(\"id\"+k+\"LowCriticalCount\") > 30)\n {\n global.set('lowDose' + global.get('id' + k), 1)\n Email.payload = Alert+\" below low critcal level \\nCurrent \"+Alert+\": \" +LiveValue+\"\\nSet values\\nHigher Limit :\"+High+\"\\nLower Limit :\"+Low+\"\\n\\n\\nThis is an autogenerated email. Please do not reply.\";\n Email.topic = global.get('projectName') + \", \" + Alert + \" Alert\"\n Email.Check= Alert + \" LowCritical\"\n \n\t\tMsgStr.payload = {\n\t\t RBE : Alert + \" LowCritical\",\n \t\t\t\t\t\ttime : timeFormat,\n \t\t\t\t\t\tMobilNo : MobileNo,\n \t\t\t\t\t\tNoOfRecip : NoOfRecip,\n \t\t\t\t\t\tAlertType : Alert+\" below low critcal level \\nCurrent \"+Alert+\": \" +LiveValue+\"\\nSet values\\nHigher Limit :\"+High+\"\\nLower Limit :\"+Low\n \t\t\t };\n \tMsgStr.topic = global.get('projectName') + \", \" + Alert + \" Alert\"\n node.send([Email,MsgStr])\n }\n \n else if(flow.get(\"id\"+k+\"LowCount\") > 30)\n {\n global.set('lowDose' + global.get('id' + k), 1)\n Email.payload = Alert+\" below low level \\nCurrent \"+Alert+\": \" +LiveValue+\"\\nSet values\\nHigher Limit :\"+High+\"\\nLower Limit :\"+Low+\"\\n\\n\\nThis is an autogenerated email. Please do not reply.\";\n Email.topic = global.get('projectName') + \", \" + Alert + \" Alert\"\n Email.Check= Alert + \" Low\"\n \n\t\tMsgStr.payload = {\n\t\t RBE : Alert + \" Low\",\n \t\t\t\t\t\ttime : timeFormat,\n \t\t\t\t\t\tMobilNo : MobileNo,\n \t\t\t\t\t\tNoOfRecip : NoOfRecip,\n \t\t\t\t\t\tAlertType : Alert+\" below low level \\nCurrent \"+Alert+\": \" +LiveValue+\"\\nSet values\\nHigher Limit :\"+High+\"\\nLower Limit :\"+Low\n \t\t\t };\n MsgStr.topic = global.get('projectName') + \", \" + Alert + \" Alert\"\n node.send([Email,MsgStr])\n }\n \n else if(flow.get(\"id\"+k+\"HighCount\") > 30)\n {\n global.set('highDose' + global.get('id' + k), 1)\n Email.payload = Alert+\" above high level \\nCurrent \"+Alert+\": \" +LiveValue+\"\\nSet values\\nHigher Limit :\"+High+\"\\nLower Limit :\"+Low+\"\\n\\n\\nThis is an autogenerated email. Please do not reply.\";\n Email.topic = global.get('projectName') + \", \" + Alert + \" Alert\"\n Email.to = EmailId[0];\n Email.Check= Alert + \" High\"\n for(j=1;j<NoOfRecip;j++)\n {\n \tEmail.cc = Email.cc+\",\"+EmailId[j];\n \t}\n\t\tMsgStr.payload = {\n\t\t RBE : Alert + \" High\",\n \t\t\t\t\t\ttime : timeFormat,\n \t\t\t\t\t\tMobilNo : MobileNo,\n \t\t\t\t\t\tNoOfRecip : NoOfRecip,\n \t\t\t\t\t\tAlertType : Alert+\" above high level \\nCurrent \"+Alert+\": \" +LiveValue+\"\\nSet values\\nHigher Limit :\"+High+\"\\nLower Limit :\"+Low\n \t\t\t };\n MsgStr.topic = global.get('projectName') + \", \" + Alert + \" Alert\"\n node.send([Email,MsgStr])\n }\n \n else if(flow.get(\"id\"+k+\"HighCriticalCount\") > 30)\n {\n global.set('highDose' + global.get('id' + k), 1)\n Email.payload = Alert+\" above high critical level \\nCurrent \"+Alert+\": \" +LiveValue+\"\\nSet values\\nHigher Limit :\"+High+\"\\nLower Limit :\"+Low+\"\\n\\n\\nThis is an autogenerated email. Please do not reply.\";\n Email.topic = global.get('projectName') + \", \" + Alert + \" Alert\"\n Email.to = EmailId[0];\n Email.Check= Alert + \" HighCritical\"\n for(j=1;j<NoOfRecip;j++)\n {\n \tEmail.cc = Email.cc+\",\"+EmailId[j];\n \t}\n\t\tMsgStr.payload = {\n\t\t RBE : Alert + \" HighCritical\",\n \t\t\t\t\t\ttime : timeFormat,\n \t\t\t\t\t\tMobilNo : MobileNo,\n \t\t\t\t\t\tNoOfRecip : NoOfRecip,\n \t\t\t\t\t\tAlertType : Alert+\" above high critical level \\nCurrent \"+Alert+\": \" +LiveValue+\"\\nSet values\\nHigher Limit :\"+High+\"\\nLower Limit :\"+Low\n \t\t\t };\n MsgStr.topic = global.get('projectName') + \", \" + Alert + \" Alert\"\n node.send([Email,MsgStr])\n }\n \n else\n {\n global.set('lowDose' + global.get('id' + k), 0)\n global.set('highDose' + global.get('id' + k), 0)\n\n Email.payload = Alert + \" restored at time: \" + timeFormat;\n Email.topic = global.get('projectName') + \", \" + Alert + \" Alert\"\n Email.to = EmailId[0];\n Email.Check= \"None\"\n for(j=1;j<NoOfRecip;j++)\n {\n \tEmail.cc = Email.cc+\",\"+EmailId[j];\n \t}\n\t\tMsgStr.payload = {\n\t\t RBE : \"None\",\n \t\t\t\t\t\ttime : timeFormat,\n \t\t\t\t\t\tMobilNo : MobileNo,\n \t\t\t\t\t\tNoOfRecip : NoOfRecip,\n \t\t\t\t\t\tAlertType : Alert + \" restored at time: \" + timeFormat\n \t\t\t };\n \tMsgStr.topic = global.get('projectName') + \", \" + Alert + \" Alert\"\n node.send([Email,MsgStr])\n }\n}","outputs":2,"noerr":0,"x":730,"y":420,"wires":[["8e0a3a86.2071c8"],["4f4238e8.437f98"]]},{"id":"8e0a3a86.2071c8","type":"rbe","z":"382fa945.348246","name":"","func":"rbei","gap":"","start":"","inout":"out","property":"Check","x":990,"y":400,"wires":[["e95f8e50.46797","d6ac38e1.8d0e88"]]},{"id":"4f4238e8.437f98","type":"rbe","z":"382fa945.348246","name":"","func":"rbei","gap":"","start":"","inout":"out","property":"payload.RBE","x":990,"y":440,"wires":[["bb151ac3.f4b908"]]},{"id":"e95f8e50.46797","type":"e-mail","z":"382fa945.348246","d":true,"server":"vikmail.godrej.com","port":"25","secure":false,"tls":false,"name":"","dname":"","x":1330,"y":400,"wires":[]},{"id":"d6ac38e1.8d0e88","type":"debug","z":"382fa945.348246","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1130,"y":360,"wires":[]},{"id":"5ac280cb.0790e","type":"link out","z":"382fa945.348246","d":true,"name":"","links":["b6f35875.845998"],"x":1295,"y":460,"wires":[]},{"id":"1282ba3d.e1f3f6","type":"inject","z":"382fa945.348246","name":"","repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1870,"y":80,"wires":[["7a86f5d8.62128c"]]},{"id":"7a86f5d8.62128c","type":"function","z":"382fa945.348246","name":"","func":"var n = flow.get('alertLength')\nvar op = []\nvar color = []\nvar label = []\nvar font = []\n\nfor(i=0; i< n ;i++)\n{\n if(flow.get(\"id\"+i+\"LowCriticalCount\") > 0)\n {\n label.push(global.get('parameterName'+ global.get('id' + i)) + ' Low Critical: ' + flow.get(\"id\"+i+\"LowCriticalCount\"))\n color.push(\"red\")\n font.push(\"white\")\n }\n if(flow.get(\"id\"+i+\"LowCount\") > 0)\n {\n //label.push(global.get('parameterName'+ global.get('id' + i)) + ' Low: ' + flow.get(\"id\"+i+\"LowCount\"))\n //color.push(\"red\")\n //font.push(\"white\")\n label[global.get('id' + i) - 1] = global.get('parameterName'+ global.get('id' + i)) + ' Low: ' + flow.get(\"id\"+i+\"LowCount\")\n color[global.get('id' + i) - 1] = \"red\"\n }\n if(flow.get(\"id\"+i+\"HighCount\") > 0)\n {\n label.push(global.get('parameterName'+ global.get('id' + i)) + ' High: ' + flow.get(\"id\"+i+\"HighCount\"))\n color.push(\"red\")\n font.push(\"white\")\n }\n if(flow.get(\"id\"+i+\"HighCriticalCount\") > 0)\n {\n label.push(global.get('parameterName'+ global.get('id' + i)) + ' HighCritical: ' + flow.get(\"id\"+i+\"HighCriticalCount\"))\n color.push(\"red\")\n font.push(\"white\")\n }\n else\n {\n label.push(\" \")\n color.push(\"transparent\")\n font.push(\"white\")\n }\n}\n\nmsg.payload = label\nmsg.color = color\nreturn msg;","outputs":1,"noerr":0,"x":2060,"y":80,"wires":[["f4ccef39.9c5ca","570f1b17.562c94","491aa58f.58d64c","56e2ffd7.12f43","e109f5fe.023698","3d501d16.3949c2","e0968f15.b2e1c","ba63021c.3b38d","f391a752.d47c68","1bc21ca5.457833","e90e2002.d2d19","2136cda8.d3d9e2","21351bd2.f9efa4","1506f02a.f545b","4b4ce2ff.b2d94c","41076c3f.599c44","ecbc59ce.02e818","f4352eb3.28661","571b809f.cedbb","b2df5224.307bc","b04080ab.58013"]]},{"id":"f4ccef39.9c5ca","type":"ui_button","z":"382fa945.348246","name":"alert 0","group":"751bbf3a.6f61d","order":9,"width":6,"height":1,"passthru":false,"label":"{{msg.payload[0]}}","tooltip":"","color":"","bgcolor":"{{msg.color[0]}}","icon":"","payload":"","payloadType":"str","topic":"","x":2230,"y":80,"wires":[[]]},{"id":"491aa58f.58d64c","type":"ui_button","z":"382fa945.348246","name":"alert 1","group":"751bbf3a.6f61d","order":10,"width":6,"height":1,"passthru":false,"label":"{{msg.payload[1]}}","tooltip":"","color":"","bgcolor":"{{msg.color[1]}}","icon":"","payload":"","payloadType":"str","topic":"","x":2230,"y":140,"wires":[[]]},{"id":"56e2ffd7.12f43","type":"ui_button","z":"382fa945.348246","name":"alert 2","group":"751bbf3a.6f61d","order":23,"width":6,"height":1,"passthru":false,"label":"{{msg.payload[2]}}","tooltip":"","color":"","bgcolor":"{{msg.color[2]}}","icon":"","payload":"","payloadType":"str","topic":"","x":2230,"y":200,"wires":[[]]},{"id":"e109f5fe.023698","type":"ui_button","z":"382fa945.348246","name":"alert 3","group":"751bbf3a.6f61d","order":24,"width":6,"height":1,"passthru":false,"label":"{{msg.payload[3]}}","tooltip":"","color":"","bgcolor":"{{msg.color[3]}}","icon":"","payload":"","payloadType":"str","topic":"","x":2230,"y":260,"wires":[[]]},{"id":"3d501d16.3949c2","type":"ui_button","z":"382fa945.348246","name":"alert 4","group":"751bbf3a.6f61d","order":37,"width":6,"height":1,"passthru":false,"label":"{{msg.payload[4]}}","tooltip":"","color":"","bgcolor":"{{msg.color[4]}}","icon":"","payload":"","payloadType":"str","topic":"","x":2230,"y":320,"wires":[[]]},{"id":"570f1b17.562c94","type":"ui_button","z":"382fa945.348246","name":"alert 5","group":"751bbf3a.6f61d","order":38,"width":6,"height":1,"passthru":false,"label":"{{msg.payload[5]}}","tooltip":"","color":"","bgcolor":"{{msg.color[5]}}","icon":"","payload":"","payloadType":"str","topic":"","x":2230,"y":380,"wires":[[]]},{"id":"e0968f15.b2e1c","type":"ui_button","z":"382fa945.348246","name":"alert 6","group":"751bbf3a.6f61d","order":51,"width":6,"height":1,"passthru":false,"label":"{{msg.payload[6]}}","tooltip":"","color":"","bgcolor":"{{msg.color[6]}}","icon":"","payload":"","payloadType":"str","topic":"","x":2230,"y":440,"wires":[[]]},{"id":"ba63021c.3b38d","type":"ui_button","z":"382fa945.348246","name":"alert 7","group":"751bbf3a.6f61d","order":52,"width":6,"height":1,"passthru":false,"label":"{{msg.payload[7]}}","tooltip":"","color":"","bgcolor":"{{msg.color[7]}}","icon":"","payload":"","payloadType":"str","topic":"","x":2230,"y":500,"wires":[[]]},{"id":"f391a752.d47c68","type":"ui_button","z":"382fa945.348246","name":"alert 8","group":"751bbf3a.6f61d","order":65,"width":6,"height":1,"passthru":false,"label":"{{msg.payload[8]}}","tooltip":"","color":"","bgcolor":"{{msg.color[8]}}","icon":"","payload":"","payloadType":"str","topic":"","x":2230,"y":560,"wires":[[]]},{"id":"1bc21ca5.457833","type":"ui_button","z":"382fa945.348246","name":"alert 9","group":"751bbf3a.6f61d","order":66,"width":6,"height":1,"passthru":false,"label":"{{msg.payload[9]}}","tooltip":"","color":"","bgcolor":"{{msg.color[9]}}","icon":"","payload":"","payloadType":"str","topic":"","x":2230,"y":620,"wires":[[]]},{"id":"e90e2002.d2d19","type":"ui_button","z":"382fa945.348246","name":"alert 10","group":"751bbf3a.6f61d","order":79,"width":6,"height":1,"passthru":false,"label":"{{msg.payload[10]}}","tooltip":"","color":"","bgcolor":"{{msg.color[10]}}","icon":"","payload":"","payloadType":"str","topic":"","x":2400,"y":80,"wires":[[]]},{"id":"2136cda8.d3d9e2","type":"ui_button","z":"382fa945.348246","name":"alert 11","group":"751bbf3a.6f61d","order":80,"width":6,"height":1,"passthru":false,"label":"{{msg.payload[11]}}","tooltip":"","color":"","bgcolor":"{{msg.color[11]}}","icon":"","payload":"","payloadType":"str","topic":"","x":2400,"y":140,"wires":[[]]},{"id":"21351bd2.f9efa4","type":"ui_button","z":"382fa945.348246","name":"alert 12","group":"751bbf3a.6f61d","order":93,"width":6,"height":1,"passthru":false,"label":"{{msg.payload[12]}}","tooltip":"","color":"","bgcolor":"{{msg.color[12]}}","icon":"","payload":"","payloadType":"str","topic":"","x":2400,"y":200,"wires":[[]]},{"id":"1506f02a.f545b","type":"ui_button","z":"382fa945.348246","name":"alert 13","group":"751bbf3a.6f61d","order":94,"width":6,"height":1,"passthru":false,"label":"{{msg.payload[13]}}","tooltip":"","color":"","bgcolor":"{{msg.color[13]}}","icon":"","payload":"","payloadType":"str","topic":"","x":2400,"y":260,"wires":[[]]},{"id":"4b4ce2ff.b2d94c","type":"ui_button","z":"382fa945.348246","name":"alert 14","group":"751bbf3a.6f61d","order":107,"width":6,"height":1,"passthru":false,"label":"{{msg.payload[14]}}","tooltip":"","color":"","bgcolor":"{{msg.color[14]}}","icon":"","payload":"","payloadType":"str","topic":"","x":2400,"y":320,"wires":[[]]},{"id":"41076c3f.599c44","type":"ui_button","z":"382fa945.348246","name":"alert 15","group":"751bbf3a.6f61d","order":108,"width":6,"height":1,"passthru":false,"label":"{{msg.payload[15]}}","tooltip":"","color":"","bgcolor":"{{msg.color[15]}}","icon":"","payload":"","payloadType":"str","topic":"","x":2400,"y":380,"wires":[[]]},{"id":"ecbc59ce.02e818","type":"ui_button","z":"382fa945.348246","name":"alert 16","group":"751bbf3a.6f61d","order":121,"width":6,"height":1,"passthru":false,"label":"{{msg.payload[16]}}","tooltip":"","color":"","bgcolor":"{{msg.color[16]}}","icon":"","payload":"","payloadType":"str","topic":"","x":2400,"y":440,"wires":[[]]},{"id":"f4352eb3.28661","type":"ui_button","z":"382fa945.348246","name":"alert 17","group":"751bbf3a.6f61d","order":122,"width":6,"height":1,"passthru":false,"label":"{{msg.payload[17]}}","tooltip":"","color":"","bgcolor":"{{msg.color[17]}}","icon":"","payload":"","payloadType":"str","topic":"","x":2400,"y":500,"wires":[[]]},{"id":"571b809f.cedbb","type":"ui_button","z":"382fa945.348246","name":"alert 18","group":"751bbf3a.6f61d","order":135,"width":6,"height":1,"passthru":false,"label":"{{msg.payload[18]}}","tooltip":"","color":"","bgcolor":"{{msg.color[18]}}","icon":"","payload":"","payloadType":"str","topic":"","x":2400,"y":560,"wires":[[]]},{"id":"b2df5224.307bc","type":"ui_button","z":"382fa945.348246","name":"alert 19","group":"751bbf3a.6f61d","order":136,"width":6,"height":1,"passthru":false,"label":"{{msg.payload[19]}}","tooltip":"","color":"","bgcolor":"{{msg.color[19]}}","icon":"","payload":"","payloadType":"str","topic":"","x":2400,"y":620,"wires":[[]]},{"id":"b04080ab.58013","type":"debug","z":"382fa945.348246","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":2250,"y":40,"wires":[]},{"id":"70c91807.623138","type":"inject","z":"382fa945.348246","name":"Notifications","repeat":"5","crontab":"","once":true,"onceDelay":"1","topic":"","payload":"","payloadType":"date","x":160,"y":540,"wires":[["37666680.d3510a"]]},{"id":"37666680.d3510a","type":"file in","z":"382fa945.348246","name":"myform.txt","filename":"/home/pi/Desktop/myform.txt","format":"utf8","chunk":false,"sendError":false,"x":350,"y":540,"wires":[["5de42035.3916b"]]},{"id":"5de42035.3916b","type":"json","z":"382fa945.348246","name":"","property":"payload","action":"","pretty":false,"x":510,"y":540,"wires":[["aa346981.c20058"]]},{"id":"aa346981.c20058","type":"function","z":"382fa945.348246","name":"SMS and Email for connections","func":"var slaveLength = global.get('slaveLength')\nvar NoOfRecip = msg.payload.NoOfRecip;\nvar Name = [];\nvar MobileNo = [];\nvar EmailId =[];\nvar MsgStr = {};\nvar Email = {};\nvar time = new Date();\nvar timeFormat = (time.getDate() + \"-\" + (time.getMonth() + 1) + \"-\" + time.getFullYear() + \",\" + time.getHours() + \":\" + time.getMinutes() + \":\" + time.getSeconds()).toString();\n \n \n for(i = 0 ; i<NoOfRecip;i++)\n {\n Name[i] = msg.payload.RecipDetails[i].Name;\n MobileNo[i] = msg.payload.RecipDetails[i].Mobile;\n EmailId[i] = msg.payload.RecipDetails[i].EmailId;\n }\n\nfor( k = 0; k < slaveLength ; k++)\n{\n var Alert = 'Slave ' + global.get('sID'+k) \n if(flow.get('ConnectCount['+ global.get('sID'+k) + ']') > 30)\n {\n Email.payload = Alert + \" Disonnected at time: \" + timeFormat + \"\\n\\n\\nThis is an autogenerated email. Please do not reply.\";\n Email.topic = global.get('projectName') + \", \" + Alert + \" Alert\"\n Email.to = EmailId[0];\n Email.Check= Alert + \"Disconnected\"\n for(j=1;j<NoOfRecip;j++)\n {\n \tEmail.cc = Email.cc+\",\"+EmailId[j];\n \t}\n\t\tMsgStr.payload = {\n\t\t RBE : Alert + \" Disconnected\",\n \t\t\t\t\t\ttime : timeFormat,\n \t\t\t\t\t\tMobilNo : MobileNo,\n \t\t\t\t\t\tNoOfRecip : NoOfRecip,\n \t\t\t\t\t\tAlertType : Alert + \" Disonnected at time: \" + timeFormat\n \t\t\t };\n \tMsgStr.topic = global.get('projectName') + \", \" + Alert + \" Alert\"\n node.send([Email,MsgStr])\n \n }\n else\n {\n \n Email.payload = Alert + \" Connected at time: \" + timeFormat;\n Email.topic = global.get('projectName') + \", \" + Alert + \" Alert\"\n Email.to = EmailId[0];\n Email.Check= \"None\"\n for(j=1;j<NoOfRecip;j++)\n {\n \tEmail.cc = Email.cc+\",\"+EmailId[j];\n \t}\n\t\tMsgStr.payload = {\n\t\t RBE : \"None\",\n \t\t\t\t\t\ttime : timeFormat,\n \t\t\t\t\t\tMobilNo : MobileNo,\n \t\t\t\t\t\tNoOfRecip : NoOfRecip,\n \t\t\t\t\t\tAlertType : Alert + \" Connected at time: \" + timeFormat\n \t\t\t };\n \tMsgStr.topic = global.get('projectName') + \", \" + Alert + \" Alert\"\n node.send([Email,MsgStr])\n }\n}","outputs":2,"noerr":0,"x":750,"y":540,"wires":[["3c68c598.3586fa"],["7bc81fdb.ae29b"]]},{"id":"3c68c598.3586fa","type":"rbe","z":"382fa945.348246","name":"","func":"rbei","gap":"","start":"","inout":"out","property":"Check","x":990,"y":520,"wires":[["e95f8e50.46797","e6c4bd9d.e26bb"]]},{"id":"7bc81fdb.ae29b","type":"rbe","z":"382fa945.348246","name":"","func":"rbei","gap":"","start":"","inout":"out","property":"payload.RBE","x":990,"y":560,"wires":[["a78355c0.9fd528"]]},{"id":"a78355c0.9fd528","type":"json","z":"382fa945.348246","name":"","property":"payload","action":"","pretty":false,"x":1150,"y":560,"wires":[["7e5c1e2e.4a7a5","5ac280cb.0790e"]]},{"id":"3f299fc7.864e","type":"function","z":"382fa945.348246","name":"Connection counter","func":"var slaveLength = global.get('slaveLength')\n\nfor( j = 0; j < slaveLength ; j++)\n{\n var Status =global.get('Status[' + global.get('sID'+j) + ']')\n \n if(Status==\"Connected\")\n {\n flow.set('ConnectCount['+ global.get('sID'+j) + ']',0)\n }\n else if(Status==\"Disconnected\")\n {\n flow.set('ConnectCount['+ global.get('sID'+j) + ']',(flow.get('ConnectCount['+ global.get('sID'+j) + ']')+1))\n }\n //node.warn(flow.get('ConnectCount['+ global.get('sID'+j) + ']'))\n}\n","outputs":1,"noerr":0,"x":370,"y":740,"wires":[[]]},{"id":"20bf536.40dadac","type":"debug","z":"382fa945.348246","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1450,"y":260,"wires":[]},{"id":"44ca1af4.8c1304","type":"function","z":"382fa945.348246","name":"settings obj","func":"global.set(\"Esettings\",msg.payload);\nvar NoOfRecip=msg.payload.NoOfRecip;\nvar email=[];\nvar Mobile=[];\nvar RecipDetails=msg.payload.RecipDetails;\nfor(i=0;i<NoOfRecip;i++)\n{\n email[i]=RecipDetails[i].EmailId;\n Mobile[i]=RecipDetails[i].Mobile;\n}\n//node.warn([email,Mobile]);\nflow.set('NoOfRecip',NoOfRecip)\nflow.set('MobileNo',Mobile);\nflow.set('EmailID',email);\nreturn msg;","outputs":1,"noerr":0,"x":1270,"y":260,"wires":[["20bf536.40dadac"]]},{"id":"a6d07fc0.7c966","type":"file","z":"382fa945.348246","name":"myform.txt","filename":"/home/pi/Desktop/myform.txt","appendNewline":false,"createDir":true,"overwriteFile":"true","x":1070,"y":260,"wires":[["44ca1af4.8c1304"]]},{"id":"f4e03db.98e18c","type":"ui_template","z":"382fa945.348246","group":"f6d76b04.b24f88","name":"NotificationSetting","order":0,"width":"15","height":"11","format":"<html>\n<body>\n<style>\ninput[type=text]{\n \tbackground-color: white;\n \ttext-align : center;\n \tcolor : black;\n border:none;\n padding : 7px;\n }\n input[type=submit] {\n background-color: #4CAF50;\n color: white;\n padding: 5px 7px;\n text-align : center;\n border: none;\n border-radius: 1px;\n cursor: allowed;\n float: left;\n}\n\ninput[type=submit]:hover {\n background-color: #45a049;\n}\ntable, tr, th, td {\n \n background-color: white;\n border-collapse: collapse;\n\t\tborder: 1px solid black;\n\t\tcolor : black;\n\t\ttext-align : center;\n\t\tpadding: 1px\n}\n\n input[type=number]{\n background-color: white;\n color : black;\n text-align : center;\n border : 1px solid #0093dc;\n padding : 7px 6px;\n text-align : center;\n } \n th{\n\talign : center;\n\t color: white;\n\t font-weight: normal;\n\t font-family: Candara;\n\t font-size: 110%;\n\t background-color:#097479;\n\t padding : 7px 3px\n\t }\n</style>\n\n \n<form id=\"MobileNoForm\" ng-submit=\"submitlist()\" ng-repeat=\"SetVal in Val\" align=\"justify\">\n<br>\n<div padding: 5px; margin: 5px;\" >\n<div class = \"addrow\">\n<div class = \"column\">\n<br><br>\n\n<table id=\"mytable\" class=\"table table-bordered\">\n<thead>\n<tr>\n<th style=\"width:5%;\">Sr.No.</th>\n<th style=\"width:20% type='text' name ='Name';\">Name</th>\n<th style=\"width:30% type='text' name ='Mobile';\">Mobile Number</th>\n<th style=\"width:30% type='text' name ='EmailId';\">E-mail Id</th>\n<th style=\"width:15%;\">Actions</th> \n</tr>\n</thead>\n<tbody align=\"center\">\n<tr ng-repeat=\"Details in recipients\">\n<td>{{$index+1}}</td>\n<td><input type=\"text\" name=\"Name{{$index}}\" placeholder = \"Enter Name of recipient..\" ng-model=\"Details.Name\" required></td>\n<td><input type=\"text\" name=\"Mobile{{$index}}\" placeholder = \"Enter Mobile No...\" ng-model=\"Details.Mobile\" required></td>\n<td><input type=\"text\" name=\"EmailId{{$index}}\" placeholder = \"Enter Email Id...\" ng-model=\"Details.EmailId\" required></td>\n<td><div class=\"buttons\">\n<input type=\"button\" value=\"Delete\" ng-click=\"deleteDetails($index)\" ng-style=\"{background: '#ffc399', color:'black', border : '1px solid #0093dc', cursor: 'allowed'}\"></div></td>\n</tr>\n</tbody>\n</table>\n<input type=\"button\" name=\"NoOfRecip\" value =\"Add Recipient\" ng-click=\"addRecipient()\" ng-style=\"{align:'right',float: 'left',background: '#7dcfff', color:'Black',padding: '4px 6px', border: 'none', cursor: 'allowed'}\">\n<br><br>\n</div>\n</div>\n</div>\n<input type=\"submit\" class=\"btn btn-primary\" value=\"Submit\" ng-style=\"{float: 'right', background: '#54e18a', color:'Black',padding: '4px 6px', border: 'none', cursor: 'allowed'}\"/> \n\n</form>\n<script>\n\t (function(scope) { \t\n scope.$watch('msg', function(msg) {\n if (msg) {\n \t\n $(\"#my_\"+scope.$id).html(msg.payload);\n scope.data = angular.copy(msg.payload.RecipDetails);\n scope.SetVal = angular.copy(msg.payload.SetVal);\n }\n scope.recipients = angular.copy(scope.data);\n scope.Val = angular.copy(scope.SetVal); \n });\n\n//scope.SetVal =[{XBand1:150,YBand1:150,ZBand1:150}];\n \n//scope.Val = angular.copy(scope.SetVal);\n\t scope.enabledEdit = [];\t\n //scope.data = [{ Name:\"\",Mobile:\"\",EmailId:\"\"}];\n \n//\tscope.recipients = angular.copy(scope.data);\n\n\t \n\t scope.addRecipient = function(){\n\t \n\t if(scope.recipients.length< 15)\n\t {\n\tvar Details ={Name:\"\",Mobile:\"\",EmailId:\"\"};\n\t\tscope.recipients.push(Details);\n\t\tscope.enabledEdit[scope.recipients.length-1]=true;\n\t\t\n\t\t}\n\t\telse\n\t\t{\n\talert(\"Only 15 entries allowed\");\n\t\t}\n}\n\t scope.editDetails = function(index){\n\t console.log(\"edit index\"+index);\n\t scope.enabledEdit[index] = true;\n\t}\n\tscope.deleteDetails = function(index) {\n\t\tvar r = confirm(\"Are you sure you want to delete?\");\n if (r == true) {\n txt = \"You pressed OK!\";\n scope.recipients.splice(index,1);\n } else {\n txt = \"You pressed Cancel!\";\n }\n document.getElementById(\"demo\").innerHTML = txt;\n\t\n\t}\n\n\t\n\t scope.submitlist = function(){\n\nvar msg={\"payload\":{\"RecipDetails\" :(scope.recipients),\"NoOfRecip\":(scope.recipients.length),\"SetVal\":(scope.Val)}};\nscope.send(msg);\n\twindow.confirm(\"Data Saved\");\n\nconsole.log(\"form submitted:\"+angular.toJson(scope.recipients));\n\n}\n})(scope);\n</script> \n</body>\n</html>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":870,"y":260,"wires":[["a6d07fc0.7c966"]]},{"id":"6bc6b985.455be8","type":"json","z":"382fa945.348246","name":"","property":"payload","action":"","pretty":false,"x":690,"y":260,"wires":[["f4e03db.98e18c"]]},{"id":"a68d9984.639568","type":"function","z":"382fa945.348246","name":"settings obj","func":"global.set(\"Esettings\",msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":530,"y":260,"wires":[["6bc6b985.455be8"]]},{"id":"ef1fd644.ba01b8","type":"file in","z":"382fa945.348246","name":"myform.txt","filename":"/home/pi/Desktop/myform.txt","format":"utf8","chunk":false,"sendError":false,"x":330,"y":260,"wires":[["a68d9984.639568"]]},{"id":"5887dc22.d2e644","type":"inject","z":"382fa945.348246","name":"","repeat":"","crontab":"","once":true,"onceDelay":"5","topic":"","payload":"","payloadType":"date","x":150,"y":260,"wires":[["ef1fd644.ba01b8"]]},{"id":"e6c4bd9d.e26bb","type":"tcp out","z":"382fa945.348246","host":"172.24.117.160","port":"7500","beserver":"client","base64":false,"end":false,"name":"","x":1390,"y":520,"wires":[]},{"id":"8709a184.03c18","type":"inject","z":"382fa945.348246","name":"Notifications","repeat":"","crontab":"","once":false,"onceDelay":"1","topic":"","payload":"","payloadType":"date","x":150,"y":860,"wires":[["e06ad303.6f94e"]]},{"id":"e06ad303.6f94e","type":"file in","z":"382fa945.348246","name":"myform.txt","filename":"/home/pi/Desktop/myform.txt","format":"utf8","chunk":false,"sendError":false,"x":350,"y":860,"wires":[["da54437a.93b0a"]]},{"id":"da54437a.93b0a","type":"json","z":"382fa945.348246","name":"","property":"payload","action":"","pretty":false,"x":510,"y":860,"wires":[["6f0dacaa.f73644"]]},{"id":"6f0dacaa.f73644","type":"function","z":"382fa945.348246","name":"Test SMS","func":"var alertLength = flow.get('alertLength')\nvar NoOfRecip = msg.payload.NoOfRecip;\nvar Name = [];\nvar MobileNo = [];\nvar EmailId =[];\nvar MsgStr = {};\nvar Email = {};\nvar time = new Date();\nvar timeFormat = (time.getDate() + \"-\" + (time.getMonth() + 1) + \"-\" + time.getFullYear() + \",\" + time.getHours() + \":\" + time.getMinutes() + \":\" + time.getSeconds()).toString();\n\nfor(i = 0 ; i<NoOfRecip;i++)\n{\n Name[i] = msg.payload.RecipDetails[i].Name;\n MobileNo[i] = msg.payload.RecipDetails[i].Mobile;\n EmailId[i] = msg.payload.RecipDetails[i].EmailId;\n}\n\nEmail.to = EmailId[0];\n\nfor(j=1;j<NoOfRecip;j++)\n{\n\tEmail.cc = Email.cc+\",\"+EmailId[j];\n}\n\nEmail.payload = \"this is a test email to check of logic is working\"\nEmail.topic = \"sample subject\"\nEmail.Check= \"None\"\n\nMsgStr.payload = {\n RBE : \"None\",\n\t\t\t\t\ttime : timeFormat,\n\t\t\t\t\tMobilNo : MobileNo,\n\t\t\t\t\tNoOfRecip : NoOfRecip,\n\t\t\t\t\tAlertType : \"this is a test email to check of logic is working\"\n\t\t };\nnode.send([Email,MsgStr])","outputs":2,"noerr":0,"x":680,"y":860,"wires":[[],["ea867abf.d51938"]]},{"id":"ea867abf.d51938","type":"json","z":"382fa945.348246","name":"","property":"payload","action":"","pretty":false,"x":850,"y":900,"wires":[["5f79f753.bb7948","1c728f34.d5c521"]]},{"id":"1c728f34.d5c521","type":"tcp out","z":"382fa945.348246","host":"172.24.117.160","port":"7500","beserver":"client","base64":false,"end":false,"name":"","x":1070,"y":900,"wires":[]},{"id":"5f79f753.bb7948","type":"debug","z":"382fa945.348246","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1030,"y":960,"wires":[]},{"id":"9eddeb3b.b8d348","type":"tab","label":"SMS Logic","disabled":false,"info":""},{"id":"85e7a250.dea03","type":"serial in","z":"9eddeb3b.b8d348","name":"","serial":"7900ae80.b682a","x":130,"y":320,"wires":[["bcac72c4.bb4e8","908f8e27.f711f"]]},{"id":"bcac72c4.bb4e8","type":"function","z":"9eddeb3b.b8d348","name":"GSM_Module_Response","func":"var ready_from_GSM=msg.payload;\n\nif (ready_from_GSM.search(\"Ready\")===0)\n{\n flow.set(\"Comm\",1);\n}\nelse if (ready_from_GSM.search(\"failed\")===0)\n{\n flow.set(\"Comm\",0);\n}","outputs":1,"noerr":0,"x":370,"y":320,"wires":[[]]},{"id":"8b687b64.bc0678","type":"fs-ops-access","z":"9eddeb3b.b8d348","name":"File test","path":"","pathType":"str","filename":"/home/pi/Desktop/smsMaster.txt","filenameType":"str","read":true,"write":false,"throwerror":false,"x":240,"y":400,"wires":[["86066d42.740e1"],["74b64abe.d1c3f4","ad930f35.00a79"]]},{"id":"ad930f35.00a79","type":"file","z":"9eddeb3b.b8d348","name":"smsMaster.txt","filename":"/home/pi/Desktop/smsMaster.txt","appendNewline":true,"createDir":true,"overwriteFile":"false","x":460,"y":500,"wires":[[]]},{"id":"86066d42.740e1","type":"file","z":"9eddeb3b.b8d348","name":"smsMaster.txt","filename":"/home/pi/Desktop/smsMaster.txt","appendNewline":true,"createDir":false,"overwriteFile":"false","x":660,"y":400,"wires":[[]]},{"id":"74b64abe.d1c3f4","type":"delay","z":"9eddeb3b.b8d348","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":440,"y":440,"wires":[["86066d42.740e1"]]},{"id":"e0294e25.51f7e","type":"inject","z":"9eddeb3b.b8d348","name":"","repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":150,"y":620,"wires":[["445d71a2.40212"]]},{"id":"445d71a2.40212","type":"function","z":"9eddeb3b.b8d348","name":"","func":"if(flow.get(\"Comm\") == 1)\n{\n return msg;\n}","outputs":1,"noerr":0,"x":340,"y":620,"wires":[["fa125698.27f348"]]},{"id":"723587ad.119e78","type":"function","z":"9eddeb3b.b8d348","name":"","func":"if(msg.payload > 0)\n{\n return msg;\n}","outputs":1,"noerr":0,"x":720,"y":620,"wires":[["7a63839c.0ac25c"]]},{"id":"c6f141e1.6c684","type":"serial out","z":"9eddeb3b.b8d348","name":"","serial":"7900ae80.b682a","x":1110,"y":620,"wires":[]},{"id":"e413575.fd119a8","type":"debug","z":"9eddeb3b.b8d348","name":"outMsg","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1100,"y":560,"wires":[]},{"id":"dbf7c026.b3aa1","type":"function","z":"9eddeb3b.b8d348","name":"","func":"flow.set(\"Comm\", 0)\nflow.set(\"smsCounter\", flow.get(\"smsCounter\") + 1)\nmsg.payload = flow.get(\"smsCounter\")\nreturn msg;","outputs":1,"noerr":0,"x":1340,"y":680,"wires":[["7d14360b.3b7858"]]},{"id":"f2db1b6.272e5e8","type":"ui_button","z":"9eddeb3b.b8d348","name":"","group":"82c9d654.2ecfc8","order":1,"width":4,"height":1,"passthru":false,"label":"Display pending sms lines","tooltip":"","color":"","bgcolor":"","icon":"","payload":"1","payloadType":"str","topic":"","x":170,"y":780,"wires":[["a1e91ccd.55b8b"]]},{"id":"efccac76.3da26","type":"ui_template","z":"9eddeb3b.b8d348","group":"82c9d654.2ecfc8","name":"","order":6,"width":24,"height":10,"format":"<html>\n <body>\n <style>\n .display\n {\n background-color: white;\n }\n </style>\n <p class = \"display\">\n {{msg.payload}}\n </p>\n </body>\n</html>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":1040,"y":780,"wires":[[]]},{"id":"285e0392.567e2c","type":"ui_button","z":"9eddeb3b.b8d348","name":"","group":"82c9d654.2ecfc8","order":5,"width":4,"height":1,"passthru":false,"label":"Delete Last Line","tooltip":"","color":"","bgcolor":"","icon":"","payload":"1","payloadType":"str","topic":"","x":140,"y":860,"wires":[["21702d52.6d7dc2"]]},{"id":"a1e91ccd.55b8b","type":"function","z":"9eddeb3b.b8d348","name":"","func":"if(msg.payload == 1)\n{\n return msg;\n}","outputs":1,"noerr":0,"x":400,"y":780,"wires":[["4caa4d63.386df4"]]},{"id":"21702d52.6d7dc2","type":"function","z":"9eddeb3b.b8d348","name":"","func":"if(msg.payload == 1)\n{\n return msg;\n}","outputs":1,"noerr":0,"x":400,"y":860,"wires":[["34cf4400.a7dedc"]]},{"id":"8178e404.41b2c8","type":"ui_toast","z":"9eddeb3b.b8d348","position":"dialog","displayTime":"3","highlight":"","sendall":true,"outputs":1,"ok":"OK","cancel":"","raw":false,"topic":"","name":"","x":830,"y":860,"wires":[[]]},{"id":"234fb45.768f64c","type":"debug","z":"9eddeb3b.b8d348","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":210,"y":460,"wires":[]},{"id":"908f8e27.f711f","type":"debug","z":"9eddeb3b.b8d348","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":330,"y":260,"wires":[]},{"id":"4fefb9bb.591b88","type":"inject","z":"9eddeb3b.b8d348","name":"","repeat":"","crontab":"55 11 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":150,"y":80,"wires":[["37a7f5d2.57b3da"]]},{"id":"37a7f5d2.57b3da","type":"function","z":"9eddeb3b.b8d348","name":"csv data","func":"flow.set(\"smsCounter\", 0)\nvar date = new Date()\n\nmsg.payload = flow.get(\"smsCounter\") + \",\" + date;\nreturn msg;","outputs":1,"noerr":0,"x":320,"y":80,"wires":[["11b2ade8.e51ee2","2c43b24.c49324e"]]},{"id":"7d14360b.3b7858","type":"file","z":"9eddeb3b.b8d348","name":"smsCounter.txt","filename":"/home/pi/Desktop/smsCounter.txt","appendNewline":true,"createDir":true,"overwriteFile":"false","encoding":"none","x":1540,"y":680,"wires":[[]]},{"id":"776ac9c.831d538","type":"inject","z":"9eddeb3b.b8d348","name":"","repeat":"","crontab":"","once":true,"onceDelay":"1","topic":"","payload":"","payloadType":"date","x":1290,"y":80,"wires":[["73aa5614.1e3908"]]},{"id":"73aa5614.1e3908","type":"file in","z":"9eddeb3b.b8d348","name":"smsCounter.txt","filename":"/home/pi/Desktop/smsCounter.txt","format":"utf8","chunk":false,"sendError":false,"encoding":"none","x":1480,"y":80,"wires":[["e08d8f28.c2121"]]},{"id":"e08d8f28.c2121","type":"function","z":"9eddeb3b.b8d348","name":"","func":"flow.set(\"smsCounter\", Number(msg.payload))\nreturn msg;","outputs":1,"noerr":0,"x":1650,"y":80,"wires":[[]]},{"id":"2c43b24.c49324e","type":"function","z":"9eddeb3b.b8d348","name":"flow varialbles","func":"flow.set(\"smsCounter\", 0)\nreturn msg;","outputs":1,"noerr":0,"x":500,"y":140,"wires":[[]]},{"id":"11b2ade8.e51ee2","type":"fs-ops-access","z":"9eddeb3b.b8d348","name":"smsCounterBackup.csv","path":"","pathType":"str","filename":"/home/pi/Desktop/smsCounterBackup.csv","filenameType":"str","read":true,"write":false,"throwerror":false,"x":530,"y":80,"wires":[["3a87d308.d6661c"],["e0d4a2ea.fc03f","af3d5778.e852a8"]]},{"id":"af3d5778.e852a8","type":"file","z":"9eddeb3b.b8d348","name":"smsCounterBackup.csv","filename":"/home/pi/Desktop/smsCounterBackup.csv","appendNewline":true,"createDir":true,"overwriteFile":"false","x":790,"y":180,"wires":[[]]},{"id":"3a87d308.d6661c","type":"file","z":"9eddeb3b.b8d348","name":"smsCounterBackup.csv","filename":"/home/pi/Desktop/smsCounterBackup.csv","appendNewline":true,"createDir":false,"overwriteFile":"false","x":930,"y":80,"wires":[[]]},{"id":"e0d4a2ea.fc03f","type":"delay","z":"9eddeb3b.b8d348","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":740,"y":120,"wires":[["3a87d308.d6661c"]]},{"id":"bad16ec1.4a12f","type":"ui_text","z":"9eddeb3b.b8d348","group":"82c9d654.2ecfc8","order":3,"width":8,"height":1,"name":"","label":"No. of SMS sent:","format":"{{msg.payload}}","layout":"row-spread","x":1670,"y":140,"wires":[]},{"id":"fbb01343.70347","type":"inject","z":"9eddeb3b.b8d348","name":"","repeat":"3600","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1290,"y":140,"wires":[["4db31c1a.56cf04"]]},{"id":"4db31c1a.56cf04","type":"function","z":"9eddeb3b.b8d348","name":"smsCounter","func":"msg.payload = flow.get(\"smsCounter\")\nreturn msg;","outputs":1,"noerr":0,"x":1470,"y":140,"wires":[["bad16ec1.4a12f"]]},{"id":"fa125698.27f348","type":"python3-function","z":"9eddeb3b.b8d348","name":"no_of_lines.py","func":"filename = '/home/pi/Desktop/smsMaster.txt'\n\nwith open(filename, 'r') as f:\n lines = f.read().splitlines()\n no_of_lines = len(lines)\n msg['payload'] = no_of_lines\n node.send(msg)\n","outputs":1,"x":520,"y":620,"wires":[["723587ad.119e78"]]},{"id":"7a63839c.0ac25c","type":"python3-function","z":"9eddeb3b.b8d348","name":"first_line.py","func":"filename = '/home/pi/Desktop/smsMaster.txt'\n\nwith open(filename, 'r') as f:\n lines = f.read().splitlines()\n first_line = lines[0]\n msg['payload'] = first_line\n node.send(msg)","outputs":1,"x":910,"y":620,"wires":[["e413575.fd119a8","c6f141e1.6c684","878b3c10.6dc71"]]},{"id":"878b3c10.6dc71","type":"python3-function","z":"9eddeb3b.b8d348","name":"deleteFirstLine.py","func":"filename = '/home/pi/Desktop/smsMaster.txt'\n\nwith open(filename, 'r') as f:\n lines = f.readlines()\n\ndel lines[0]\n\nwith open(filename, 'w+') as f:\n for i in range(len(lines)):\n f.write(lines[i])\n\nmsg['payload'] = 'nextStep'\nnode.send(msg)","outputs":1,"x":1130,"y":680,"wires":[["dbf7c026.b3aa1"]]},{"id":"4caa4d63.386df4","type":"python3-function","z":"9eddeb3b.b8d348","name":"displayLines.py","func":"filename = '/home/pi/Desktop/smsMaster.txt'\nlineArray = []\n\nwith open(filename, 'r') as f:\n lines = f.readlines()\n\nif(lines == []):\n msg['payload'] = []\n node.send(msg)\n\nelse:\n for i in range(len(lines)):\n lineArray.append(lines[i])\n msg['payload'] = lineArray\n node.send(msg)","outputs":1,"x":600,"y":780,"wires":[["8c78a8c1.0593e8","2db8ac2f.38cb44"]]},{"id":"34cf4400.a7dedc","type":"python3-function","z":"9eddeb3b.b8d348","name":"deleteLastLine.py","func":"filename = '/home/pi/Desktop/smsMaster.txt'\n\ntry:\n with open(filename, 'r') as f:\n lines = f.readlines()\n\n del lines[-1]\n\n with open(filename, 'w+') as f:\n for i in range(len(lines)):\n f.write(lines[i])\n \n msg['payload'] = \"Last line deleted\"\n node.send(msg)\n\nexcept:\n msg['payload'] = \"No line to delete, file is empty\"\n node.send(msg)","outputs":1,"x":610,"y":860,"wires":[["8178e404.41b2c8","d1ba2953.ec7db8"]]},{"id":"d1ba2953.ec7db8","type":"python3-function","z":"9eddeb3b.b8d348","name":"displayLines.py","func":"filename = '/home/pi/Desktop/smsMaster.txt'\n\nwith open(filename, 'r') as f:\n lines = f.readlines()\n\nfor i in range(len(lines)):\n msg['payload'] = str(lines[i])\n node.send(msg)","outputs":1,"x":840,"y":920,"wires":[["efccac76.3da26"]]},{"id":"b6f35875.845998","type":"link in","z":"9eddeb3b.b8d348","name":"","links":["5ac280cb.0790e"],"x":75,"y":400,"wires":[["8b687b64.bc0678","234fb45.768f64c"]]},{"id":"8c78a8c1.0593e8","type":"debug","z":"9eddeb3b.b8d348","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":820,"y":720,"wires":[]},{"id":"2db8ac2f.38cb44","type":"function","z":"9eddeb3b.b8d348","name":"","func":"var len = msg.payload.length\nvar arr = msg.payload\nvar str = \"\"\n\nfor(i = 0; i<len ; i++)\n{\n str = str + arr[i] + \"\\n\"\n}\n\nmsg.payload = str;\nreturn msg;","outputs":1,"noerr":0,"x":820,"y":780,"wires":[["efccac76.3da26"]]},{"id":"86566441.c29458","type":"tab","label":"IP Address","disabled":false,"info":""},{"id":"84996fb7.199a5","type":"inject","z":"86566441.c29458","name":"get IP","repeat":"10","crontab":"","once":true,"onceDelay":"1","topic":"Node-Red IP Address","payload":"eth0","payloadType":"str","x":220,"y":140,"wires":[["5d2c61dd.2309e"]]},{"id":"5d2c61dd.2309e","type":"exec","z":"86566441.c29458","command":"ifconfig","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"ifconfig","x":340,"y":220,"wires":[["82e05a4.2e9ffa8","f1060d48.17815"],[],[]]},{"id":"82e05a4.2e9ffa8","type":"function","z":"86566441.c29458","name":"Extract network config","func":"var input, tokens, inet;\ninput = msg.payload;\n//node.warn(input)\ntokens = input.split(\":\", 11);\n//node.warn(tokens)\ninet = tokens[10].split(\" \", 40);\n//node.warn(inet)\nglobal.set('IP_Address',inet[13])\n//node.warn(inet[13])","outputs":1,"noerr":0,"x":540,"y":300,"wires":[["f1060d48.17815"]]},{"id":"f1060d48.17815","type":"debug","z":"86566441.c29458","name":"test out","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":700,"y":160,"wires":[]},{"id":"451cbafb.cd7fe4","type":"tab","label":"CSV Settings","disabled":false,"info":""},{"id":"c1e90646.924678","type":"fs-ops-access","z":"451cbafb.cd7fe4","name":"pHLog.csv","path":"","pathType":"str","filename":"/home/pi/Desktop/pHLog.csv","filenameType":"str","read":true,"write":false,"throwerror":false,"x":730,"y":320,"wires":[["f8dee7a7.d74c08"],["8d1f34be.581e78","404d583e.3438b8"]]},{"id":"8d1f34be.581e78","type":"function","z":"451cbafb.cd7fe4","name":"StructTitleString","func":"var n = global.get('slaveLength')\nvar op = \"Date,Time\"\n\nfor(i=0; i< n ;i++)\n{\n if((global.get('parameterID'+i))==\"3\")\n {\n op = op + \",\" + global.get('parameterName'+ (i))\n }\n}\n\nmsg.payload=op;\nreturn msg;","outputs":1,"noerr":0,"x":980,"y":440,"wires":[["a629d3d6.19651"]]},{"id":"a629d3d6.19651","type":"file","z":"451cbafb.cd7fe4","name":"pHLog.csv","filename":"/home/pi/Desktop/pHLog.csv","appendNewline":true,"createDir":true,"overwriteFile":"false","x":1190,"y":440,"wires":[[]]},{"id":"f8dee7a7.d74c08","type":"file","z":"451cbafb.cd7fe4","name":"pHLog.csv","filename":"/home/pi/Desktop/pHLog.csv","appendNewline":true,"createDir":false,"overwriteFile":"false","x":1190,"y":320,"wires":[[]]},{"id":"404d583e.3438b8","type":"delay","z":"451cbafb.cd7fe4","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":980,"y":380,"wires":[["f8dee7a7.d74c08"]]},{"id":"89c8ae63.2cd29","type":"function","z":"451cbafb.cd7fe4","name":"csv data","func":"var timestamp= new Date();\nvar time = timestamp.getTime()\nvar Local_time=new Date(time).toLocaleString()\nvar op = Local_time\nvar n = global.get('slaveLength')\n\nfor(i=0; i< n ;i++)\n{\n if((global.get('parameterID'+i))==\"2\")\n {\n op = op + \",\" + global.get('sensorData[' + global.get('sID'+i) + '][' + global.get('sregisterAddress'+i) + ']')\n }\n}\n\nmsg.payload = op\nreturn msg;","outputs":1,"noerr":0,"x":520,"y":320,"wires":[["c1e90646.924678"]]},{"id":"ca97a606.59d1c8","type":"inject","z":"451cbafb.cd7fe4","name":"","repeat":"1","crontab":"","once":true,"onceDelay":"5","topic":"","payload":"","payloadType":"date","x":150,"y":320,"wires":[["67c69a49.cba0c4","3877812b.15601e"]]},{"id":"67c69a49.cba0c4","type":"function","z":"451cbafb.cd7fe4","name":"pHcsvDelay","func":"flow.set(\"pHcsvDelay\", flow.get(\"pHcsvDelay\") + 1);\n\nif(flow.get(\"pHcsvDelay\") > (global.get(\"pHcsvLogDelay\")*60))\n{\n flow.set(\"pHcsvDelay\", 0);\n return msg;\n}","outputs":1,"noerr":0,"x":350,"y":320,"wires":[["89c8ae63.2cd29"]]},{"id":"3877812b.15601e","type":"function","z":"451cbafb.cd7fe4","name":"IP Address","func":"var ip=global.get('IP_Address')\nmsg.payload=\"http://\"+ip+\":1880/pHLog.csv\";\nreturn msg;","outputs":1,"noerr":0,"x":350,"y":400,"wires":[["9a8f718a.e1fb"]]},{"id":"9a8f718a.e1fb","type":"ui_template","z":"451cbafb.cd7fe4","group":"4b822b91.60aa64","name":"Download Button","order":2,"width":4,"height":1,"format":"<!DOCTYPE html>\n<html>\n<body>\n \n<md-button ng-style=\"{background: '#0000FF', \n color:'white',\n padding: '10px',\n cursor: 'allowed'\n \n }\"\n\n ng-click href=\"{{msg.payload}}\"\n>\n<i class=\"fa fa-download\" style = \"color: white;\"></i>\npHLog.csv\n</md-button>\n</body>\n</html>\n","storeOutMessages":false,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","x":550,"y":400,"wires":[[]]},{"id":"6abc1f91.1ec0b","type":"inject","z":"451cbafb.cd7fe4","name":"","repeat":"","crontab":"","once":true,"onceDelay":"5","topic":"","payload":"","payloadType":"date","x":150,"y":120,"wires":[["950ba8ca.dc71f8","c4c10c3b.b22e5"]]},{"id":"950ba8ca.dc71f8","type":"file in","z":"451cbafb.cd7fe4","name":"csvlogdelay.txt","filename":"/home/pi/Desktop/csvlogdelay.txt","format":"utf8","chunk":false,"sendError":false,"x":360,"y":120,"wires":[["f61d5413.5f1c08"]]},{"id":"f61d5413.5f1c08","type":"function","z":"451cbafb.cd7fe4","name":"settings obj","func":"//global.set(\"settings\",msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":530,"y":120,"wires":[["5f201e79.0e86"]]},{"id":"5f201e79.0e86","type":"json","z":"451cbafb.cd7fe4","name":"","property":"payload","action":"","pretty":false,"x":670,"y":120,"wires":[["a028ea12.8bc0f8"]]},{"id":"a028ea12.8bc0f8","type":"ui_template","z":"451cbafb.cd7fe4","group":"4b822b91.60aa64","name":"csv log delay","order":1,"width":"0","height":"0","format":"<html>\n <head>\n \n </head>\n <body>\n<style>\ntable, th, tr, td\n{\n border: 1px black solid;\n border-collapse: collapse;\n text-align: center;\n}\n\ninput[type = number], input[type = text]\n{\n background-color: white;\n border: none;\n word-wrap: break-word;\n word-break: break-all;\n text-align: center;\n}\n\nth\n{\n background-color: #2a92b5;\n padding : 7px 3px;\n color: white;\n}\n\n</style>\n \n\n <form id=\"TableForm\" ng-submit=\"MyTableFormAction()\" >\n <table align = \"center\" id=\"EmptableWithEditDelete5\">\n <tr>\n <th>\n Sr. No.\n </th>\n <th>\n Parameter\n </th>\n <th>\n csv log delay (min)\n </th>\n <th>\n Edit\n </th>\n </tr>\n \n <tr ng-repeat=\"Set in IntMsg.payload.SetData\" >\n <td disabled=\"true\">\n {{$index+1}}\n </td>\n <td>\n <input type=\"text\" id=\"EmpHighInput{{$index}}\" ng-model=\"Set.Parameter\" disabled=\"true\" required> <!--ng-model=\"IntMsg.payload.SetData[$index].Name\"-->\n </td>\n <td>\n <input type=\"number\" step=\"0.01\" id=\"EmpHighInput{{$index}}\" ng-model=\"Set.csvLogDelay\" disabled=\"true\" required> <!--ng-model=\"IntMsg.payload.SetData[$index].Name\"-->\n </td>\n <td>\n <button type=\"button\" ng-click=\"TableFormRowEditBtn($index)\" ng-style=\"{background: '#ffc399', color:'black', border : '1px solid #0093dc', cursor: 'allowed'}\">\n Edit\n </button>\n </td>\n </tr>\n </table>\n <br>\n <br>\n\n <button type=\"Submit\" name=\"Submit\" ng-style=\"{float: 'right', background: '#54e18a', color:'Black',padding: '4px 6px', border: 'none', cursor: 'allowed'}\"> \n Submit Data\n </button>\n <!--<button type=\"button\" ng-click=\"TableAddFirstRecord()\" ng-style=\"{float: 'left', background: '#54e18a', color:'Black',padding: '4px 6px', border: 'none', cursor: 'allowed'}\"> Add Record\n \n </button>-->\n \n \n </form>\n\n<script>\n//send({payload:myFunction1()})\n//few learnigs: if msg.pyload is used to link data to html tags like \n//<input type=\"text\" id=\"EmpId\" name=\"fname\" value={{msg.payload.TSetData.Selectedobj}} disabled > \n//then \n//ensure orginal data variables in msg.payload are intact through out the session/user interaction. \n\n//\"{{angular_var}}\" syntax is used in html to pass varible data from angular to html tags\n//angular function send({payload:var/funct}) is used to send the msg to node red using ng-click directives. it updates msg.payload of entire template. \n// if your html view tags like input msg/table/dropdowns are getting reset that means\n//while sending msg, orginal msg got disturbed.\n// to solve this issue you can preserve original msg by adding new varibles to orginal msg.payload .\n// this is allowed but you should not disturb incoming msg.payload varibales data structure.\n// i.e say incoming msg.payload had data structure like msg={\"payload\":{\"emp\":employees}}\n//employees=[{\"name\":\"e1\",\"id\":1,\"dept\":\"dept1\",\"div\":\"div1\"},{\"name\":\"e2\",\"id\":2,\"dept\":\"dept2\",\"div\":\"div2\"},{\"name\":\"e3\",\"id\":3,\"dept\":\"dept3\",\"div\":\"div3\"}]\n// in this case you can add msg={\"payload\":{\"emp\":employees},{\"newVar\":newVarData}} this will works as orignal msg.payload.emp is not disturbed and new object \"NewVar is added\"\n// you can chage values of all varibles . that will not create any error or reset of view.\n\n\n// to check node-red ui is working properly , type \"http://127.0.0.1:1880/ui/\" in chrome browser and click\n//on broweser three dots menu-->more tools-->developer tools ensure at riht side of broweser debug window is opend\n// click on Consol tab to see error/status mssages.\n// you can use console.log(\"your_var_name\"); to see the value\n\n var test=document.getElementById(\"EmpId\");\n\n(function(scope) {\n // use this func\n scope.IntMsg={\"payload\":{\"SetData\":[{}]}};\n \n scope.$watch('msg', function(msg) {\n if (msg) {\n // Do something when msg arrives\n scope.IntMsg=msg;\n \n console.log(msg.payload);\n }\n });\n\n \n //\n scope.TableFormRowEditBtn=function MyTableFormEditBtn(index){\n //document.getElementById(\"EmptableWithEditDelete5\").rows[index+1].cells[1].getElementsByTagName(\"input\")[0].disabled=false\n document.getElementById(\"EmptableWithEditDelete5\").rows[index+1].cells[2].getElementsByTagName(\"input\")[0].disabled=false\n //document.getElementById(\"DivtableWithEditDelete\").rows[index+1].cells[1] provides row-1 column 1 cell. in this cell. as index in JS starts with zero,need to do +1 to get first row.\n //to access input tag from row-1,column-1, \"getElementsByTagName(\"input\")[0]\" is used.[0] provides first input tag in this context.\n \n //console.log(scope.msg.payload.MyFormData.Edit[index]);\n \n }\n\n\n scope.TableAddFirstRecord=function MyTableAddFirstRecordBtn(){\n //Array index in JS variable starts from Zero where as table row index starts from 1 so index is added with +1\n console.log(\"TableAddFirstRecord clicked\");\n var dummy={\"Pressure\":\"\",};\n scope.IntMsg.payload.SetData.push(dummy);\n }\n\n\n scope.TableFormAddRowBtn=function MyTableFormAddRowBtn(index){\n //Array index in JS variable starts from Zero where as table row index starts from 1 so index is added with +1\n var dummy={\"Pressure\":\"\"};\n scope.IntMsg.payload.SetData.splice(index+1, 0, dummy);\n }\n scope.MyTableFormAction= function MyTableFormData(){\n var i;\n for (i = 0; i < scope.IntMsg.payload.SetData.length; i++) {\n //document.getElementById(\"EmptableWithEditDelete5\").rows[i+1].cells[1].getElementsByTagName(\"input\")[0].disabled=true\n document.getElementById(\"EmptableWithEditDelete5\").rows[i+1].cells[2].getElementsByTagName(\"input\")[0].disabled=true\n }\n \n console.log(\"MyTableFormData\");\n console.log(scope.IntMsg.payload.SetData);\n window.confirm(\"Data Saved\");\n scope.send({\"payload\":(scope.IntMsg.payload)});\n \n }\n scope.TableFormRowDeleteBtn=function MyTableFormRowDeleteBtn(index){\n var txt;\n var r = confirm(\"Press OK to Confim Delete \");\n if (r == true) {\n scope.IntMsg.payload.SetData.splice(index,1);\n scope.MyTableFormAction();\n console.log([\"TableFormRowDeleteBtn\"],index);\n }\n \n\n }\n \n})(scope);\n\n</script>\n</body>\n</html>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":830,"y":120,"wires":[["8fe200e2.45344"]]},{"id":"8fe200e2.45344","type":"file","z":"451cbafb.cd7fe4","name":"csvlogdelay.txt","filename":"/home/pi/Desktop/csvlogdelay.txt","appendNewline":false,"createDir":true,"overwriteFile":"true","x":1060,"y":120,"wires":[["ffb30fa0.f4321","326e7a85.4c2d26"]]},{"id":"ffb30fa0.f4321","type":"debug","z":"451cbafb.cd7fe4","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1390,"y":120,"wires":[]},{"id":"326e7a85.4c2d26","type":"function","z":"451cbafb.cd7fe4","name":"SetVal","func":"var data = msg.payload.SetData;\nvar n= data.length;\n\n\nfor(i=0;i<n;i++)\n{\n global.set('csvName' + i, msg.payload.SetData[i].Parameter);\n global.set(global.get('csvName' + i) + 'csvLogDelay', msg.payload.SetData[i].csvLogDelay);\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":1230,"y":160,"wires":[["ffb30fa0.f4321"]]},{"id":"f6e71276.7d1c5","type":"inject","z":"451cbafb.cd7fe4","d":true,"name":"CSV BACKUP","repeat":"10","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":560,"wires":[["f1d4466a.c8c578"]]},{"id":"f1d4466a.c8c578","type":"function","z":"451cbafb.cd7fe4","name":"","func":"var timestamp= new Date();\nvar Month=(timestamp.getMonth()+1);\nvar mon=[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"June\",\"Jul\",\"Aug\",\"Sept\",\"Oct\",\"Nov\",\"Dec\"];\nif((Month-2)==-1)\n{\nmsg.month=\"Dec\" \n}\nelse\n{\nmsg.month=mon[Month-2]\n}\nmsg.payload= Month;\n//node.warn(msg)\nreturn msg;","outputs":1,"noerr":0,"x":370,"y":560,"wires":[["37a9fc61.fdadb4"]]},{"id":"37a9fc61.fdadb4","type":"rbe","z":"451cbafb.cd7fe4","name":"","func":"rbei","gap":"","start":"","inout":"out","property":"payload","x":530,"y":560,"wires":[["11db4fb0.3b51d"]]},{"id":"11db4fb0.3b51d","type":"function","z":"451cbafb.cd7fe4","name":"","func":"var month=msg.month;\nmsg.payload=\"pHLogBackup\"+\"_\"+month+\".csv\";\nmsg.path=global.get('path');\nreturn msg;","outputs":1,"noerr":0,"x":700,"y":560,"wires":[["6903889f.794d48","dd84254a.dc37e8"]]},{"id":"6903889f.794d48","type":"fs-ops-copy","z":"451cbafb.cd7fe4","name":"pHLog.csv","sourcePath":"/home/pi/Desktop/","sourcePathType":"str","sourceFilename":"pHLog.csv","sourceFilenameType":"str","destPath":"path","destPathType":"msg","destFilename":"payload","destFilenameType":"msg","link":false,"overwrite":false,"x":890,"y":540,"wires":[[]]},{"id":"dd84254a.dc37e8","type":"delay","z":"451cbafb.cd7fe4","name":"","pauseType":"delay","timeout":"20","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":880,"y":580,"wires":[["1821ed5a.341403"]]},{"id":"1821ed5a.341403","type":"fs-ops-move","z":"451cbafb.cd7fe4","name":"pHLog.csv","sourcePath":"/home/pi/Desktop/","sourcePathType":"str","sourceFilename":"pHLog.csv","sourceFilenameType":"str","destPath":"/home/pi/Desktop/","destPathType":"str","destFilename":"payload","destFilenameType":"msg","link":false,"x":1050,"y":580,"wires":[[]]},{"id":"ece46252.96acc","type":"comment","z":"451cbafb.cd7fe4","name":"csv settings table","info":"","x":140,"y":80,"wires":[]},{"id":"f7a7ff8.6f9ac","type":"comment","z":"451cbafb.cd7fe4","name":"transferring pH records to csv file","info":"","x":190,"y":280,"wires":[]},{"id":"128a7be3.15a494","type":"comment","z":"451cbafb.cd7fe4","name":"monthly backup of pH csv file","info":"","x":180,"y":520,"wires":[]},{"id":"c4c10c3b.b22e5","type":"function","z":"451cbafb.cd7fe4","name":"flow variables","func":"flow.set(\"pHcsvDelay\", 0);\nflow.set(\"DensitycsvDelay\", 0);\nreturn msg;","outputs":1,"noerr":0,"x":360,"y":200,"wires":[[]]},{"id":"7272c3be.c15f6c","type":"inject","z":"451cbafb.cd7fe4","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1700,"y":80,"wires":[["ba202219.6d4d9"]]},{"id":"ba202219.6d4d9","type":"function","z":"451cbafb.cd7fe4","name":"csv data","func":"var timestamp= new Date();\nvar time = timestamp.getTime()\nvar Local_time=new Date(time).toLocaleString()\nvar op = Local_time\nvar n = global.get('slaveLength')\n\nfor(i=0; i< n ;i++)\n{\n if((global.get('parameterID'+i))==\"3\")\n {\n op = op + \",\" + global.get('sensorData[' + global.get('sID'+i) + '][' + global.get('sregisterAddress'+i) + ']')\n }\n}\n\nmsg.payload = op\nreturn msg;","outputs":1,"noerr":0,"x":1880,"y":80,"wires":[["c2c2b615.5da4a8"]]},{"id":"c2c2b615.5da4a8","type":"debug","z":"451cbafb.cd7fe4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":2080,"y":80,"wires":[]},{"id":"3554289c.37ad78","type":"fs-ops-access","z":"451cbafb.cd7fe4","name":"DensityLog.csv","path":"","pathType":"str","filename":"/home/pi/Desktop/DensityLog.csv","filenameType":"str","read":true,"write":false,"throwerror":false,"x":760,"y":740,"wires":[["b4e781ee.c2cc"],["66f40123.5ed4d","f6c3d2ce.22023"]]},{"id":"66f40123.5ed4d","type":"function","z":"451cbafb.cd7fe4","name":"StructTitleString","func":"var n = global.get('slaveLength')\nvar op = \"Date,Time\"\n\nfor(i=0; i< n ;i++)\n{\n if((global.get('parameterID'+i))==\"11\")\n {\n op = op + \",\" + global.get('parameterName'+ (i))\n }\n}\n\nmsg.payload=op;\nreturn msg;","outputs":1,"noerr":0,"x":1000,"y":860,"wires":[["252878ed.ebc8b8"]]},{"id":"252878ed.ebc8b8","type":"file","z":"451cbafb.cd7fe4","name":"DensityLog.csv","filename":"/home/pi/Desktop/DensityLog.csv","appendNewline":true,"createDir":true,"overwriteFile":"false","x":1220,"y":860,"wires":[[]]},{"id":"b4e781ee.c2cc","type":"file","z":"451cbafb.cd7fe4","name":"DensityLog.csv","filename":"/home/pi/Desktop/DensityLog.csv","appendNewline":true,"createDir":false,"overwriteFile":"false","x":1220,"y":740,"wires":[[]]},{"id":"f6c3d2ce.22023","type":"delay","z":"451cbafb.cd7fe4","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1000,"y":800,"wires":[["b4e781ee.c2cc"]]},{"id":"f54b716e.e8bb5","type":"function","z":"451cbafb.cd7fe4","name":"csv data","func":"var timestamp= new Date();\nvar time = timestamp.getTime()\nvar Local_time=new Date(time).toLocaleString()\nvar op = Local_time\nvar n = global.get('slaveLength')\n\nfor(i=0; i< n ;i++)\n{\n if((global.get('parameterID'+i))==\"5\")\n {\n op = op + \",\" + global.get('sensorData[' + global.get('sID'+i) + '][' + global.get('sregisterAddress'+i) + ']')\n }\n}\n\nmsg.payload = op\nreturn msg;","outputs":1,"noerr":0,"x":560,"y":740,"wires":[["3554289c.37ad78"]]},{"id":"3272fa64.c23d76","type":"inject","z":"451cbafb.cd7fe4","name":"","repeat":"1","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":170,"y":740,"wires":[["2a6bcbdb.79dab4","2e69906d.b2f21"]]},{"id":"2a6bcbdb.79dab4","type":"function","z":"451cbafb.cd7fe4","name":"DensitycsvDelay","func":"flow.set(\"DensitycsvDelay\", flow.get(\"DensitycsvDelay\") + 1);\n\nif(flow.get(\"DensitycsvDelay\") > (global.get(\"DensitycsvLogDelay\")*60))\n{\n flow.set(\"DensitycsvDelay\", 0);\n return msg;\n}","outputs":1,"noerr":0,"x":380,"y":740,"wires":[["f54b716e.e8bb5"]]},{"id":"2e69906d.b2f21","type":"function","z":"451cbafb.cd7fe4","name":"IP Address","func":"var ip=global.get('IP_Address')\nmsg.payload=\"http://\"+ip+\":1880/DensityLog.csv\";\nreturn msg;","outputs":1,"noerr":0,"x":370,"y":820,"wires":[["8e88a1a.ccbeb6"]]},{"id":"8e88a1a.ccbeb6","type":"ui_template","z":"451cbafb.cd7fe4","group":"4b822b91.60aa64","name":"Download Button","order":2,"width":4,"height":1,"format":"<!DOCTYPE html>\n<html>\n<body>\n \n<md-button ng-style=\"{background: '#0000FF', \n color:'white',\n padding: '10px',\n cursor: 'allowed'\n \n }\"\n\n ng-click href=\"{{msg.payload}}\"\n>\n<i class=\"fa fa-download\" style = \"color: white;\"></i>\nDensityLog.csv\n</md-button>\n</body>\n</html>\n","storeOutMessages":false,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","x":570,"y":820,"wires":[[]]},{"id":"d6d82be0.db6d78","type":"inject","z":"451cbafb.cd7fe4","d":true,"name":"CSV BACKUP","repeat":"10","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":980,"wires":[["25bfcff7.f8427"]]},{"id":"25bfcff7.f8427","type":"function","z":"451cbafb.cd7fe4","name":"","func":"var timestamp= new Date();\nvar Month=(timestamp.getMonth()+1);\nvar mon=[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"June\",\"Jul\",\"Aug\",\"Sept\",\"Oct\",\"Nov\",\"Dec\"];\nif((Month-2)==-1)\n{\nmsg.month=\"Dec\" \n}\nelse\n{\nmsg.month=mon[Month-2]\n}\nmsg.payload= Month;\n//node.warn(msg)\nreturn msg;","outputs":1,"noerr":0,"x":390,"y":980,"wires":[["8174ece4.a56da"]]},{"id":"8174ece4.a56da","type":"rbe","z":"451cbafb.cd7fe4","name":"","func":"rbei","gap":"","start":"","inout":"out","property":"payload","x":550,"y":980,"wires":[["2f080918.57e876"]]},{"id":"2f080918.57e876","type":"function","z":"451cbafb.cd7fe4","name":"","func":"var month=msg.month;\nmsg.payload=\"DensityLogBackup\"+\"_\"+month+\".csv\";\nmsg.path=global.get('path');\nreturn msg;","outputs":1,"noerr":0,"x":720,"y":980,"wires":[["1f4f0b63.482435","6bd02eb7.c2999"]]},{"id":"1f4f0b63.482435","type":"fs-ops-copy","z":"451cbafb.cd7fe4","name":"DensityLog.csv","sourcePath":"/home/pi/Desktop/","sourcePathType":"str","sourceFilename":"DensityLog.csv","sourceFilenameType":"str","destPath":"path","destPathType":"msg","destFilename":"payload","destFilenameType":"msg","link":false,"overwrite":false,"x":920,"y":960,"wires":[[]]},{"id":"6bd02eb7.c2999","type":"delay","z":"451cbafb.cd7fe4","name":"","pauseType":"delay","timeout":"20","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":900,"y":1000,"wires":[["f8c83718.b588f8"]]},{"id":"f8c83718.b588f8","type":"fs-ops-move","z":"451cbafb.cd7fe4","name":"DensityLog.csv","sourcePath":"/home/pi/Desktop/","sourcePathType":"str","sourceFilename":"DensityLog.csv","sourceFilenameType":"str","destPath":"/home/pi/Desktop/","destPathType":"str","destFilename":"payload","destFilenameType":"msg","link":false,"x":1080,"y":1000,"wires":[[]]},{"id":"601e0de6.ac9de4","type":"comment","z":"451cbafb.cd7fe4","name":"transferring Density records to csv file","info":"","x":230,"y":700,"wires":[]},{"id":"2396136.dbf60ec","type":"comment","z":"451cbafb.cd7fe4","name":"monthly backup of Density csv file","info":"","x":220,"y":940,"wires":[]},{"id":"196652fc.0d4e3d","type":"ui_group","name":"Modbus Dashboard","tab":"3b00797f.4d2596","order":1,"disp":true,"width":"24","collapse":false},{"id":"744f5e6.759fba","type":"ui_group","name":"Parameter Type","tab":"b043b05b.f2d0a","order":1,"disp":true,"width":"24","collapse":false},{"id":"2f99bea8.cf2d52","type":"ui_group","name":"Modbus Settings","tab":"abdd96d8.57e188","order":1,"disp":true,"width":"24","collapse":false},{"id":"f443a0cc.b77b1","type":"ui_group","name":"Pressure Calibration","tab":"bf336764.0a5cd8","order":5,"disp":true,"width":"24","collapse":false},{"id":"11baa1b6.36d60e","type":"ui_group","name":"4 pH calibration ","tab":"bf336764.0a5cd8","order":2,"disp":true,"width":"12","collapse":false},{"id":"1f6d099b.aef646","type":"ui_group","name":"Clear calibration input","tab":"bf336764.0a5cd8","order":3,"disp":true,"width":"12","collapse":false},{"id":"55ef55ec.0ce6cc","type":"ui_group","name":"Buttons","tab":"bf336764.0a5cd8","order":4,"disp":false,"width":"6","collapse":false},{"id":"c3b0f085.aa123","type":"ui_group","name":"7 pH calibration","tab":"bf336764.0a5cd8","order":1,"disp":true,"width":"12","collapse":true},{"id":"93017876.34e658","type":"ui_group","name":"Advanced Settings","tab":"abdd96d8.57e188","order":4,"disp":true,"width":"24","collapse":false},{"id":"42f4fa02.ebe974","type":"ui_group","name":"Communication Parameters","tab":"d0e2cc89.7d336","order":1,"disp":true,"width":"24","collapse":false},{"id":"5b5cd7e5.976718","type":"ui_group","name":"Alerts list","tab":"aea62a8b.c3cb28","order":1,"disp":true,"width":"24","collapse":false},{"id":"affbfac1.b16068","type":"ui_group","name":"Alert Dashboard","tab":"3b00797f.4d2596","order":2,"disp":true,"width":"24","collapse":false},{"id":"751bbf3a.6f61d","type":"ui_group","name":"Live Values","tab":"3004ac3b.36ae74","order":1,"disp":true,"width":"24","collapse":false},{"id":"f6d76b04.b24f88","type":"ui_group","name":"Notification Settings","tab":"3e08a07.f809b6","order":1,"disp":true,"width":"15","collapse":true},{"id":"7900ae80.b682a","type":"serial-port","serialport":"/dev/ttyS0","serialbaud":"9600","databits":"8","parity":"none","stopbits":"1","waitfor":"","newline":"\\n","bin":"false","out":"char","addchar":"","responsetimeout":"10000"},{"id":"82c9d654.2ecfc8","type":"ui_group","name":"Display","tab":"f64a1457.ac3c58","order":1,"disp":true,"width":"24","collapse":false},{"id":"4b822b91.60aa64","type":"ui_group","name":"CSV delay settings","tab":"11bfe031.e32e4","order":1,"disp":true,"width":"24","collapse":false},{"id":"3b00797f.4d2596","type":"ui_tab","name":"Modbus Dashboard","icon":"dashboard","order":2,"disabled":false,"hidden":false},{"id":"b043b05b.f2d0a","type":"ui_tab","name":"Parameters","icon":"dashboard","order":10,"disabled":false,"hidden":true},{"id":"abdd96d8.57e188","type":"ui_tab","name":"Settings","icon":"dashboard","order":3,"disabled":false,"hidden":false},{"id":"bf336764.0a5cd8","type":"ui_tab","name":"Calibration","icon":"fa-cog","order":4,"disabled":false,"hidden":false},{"id":"d0e2cc89.7d336","type":"ui_tab","name":"Communication Settings","icon":"dashboard","order":11,"disabled":false,"hidden":true},{"id":"aea62a8b.c3cb28","type":"ui_tab","name":"Alerts","icon":"dashboard","order":5,"disabled":false,"hidden":false},{"id":"3004ac3b.36ae74","type":"ui_tab","name":"Live Dashboard","icon":"dashboard","order":1,"disabled":false,"hidden":false},{"id":"3e08a07.f809b6","type":"ui_tab","name":"Alert Notification Settings","icon":"fa-address-book","order":8,"disabled":false,"hidden":false},{"id":"f64a1457.ac3c58","type":"ui_tab","name":"Network Que","icon":"dashboard","order":9,"disabled":false,"hidden":false},{"id":"11bfe031.e32e4","type":"ui_tab","name":"CSV Settings","icon":"dashboard","order":6,"disabled":false,"hidden":false}]