-
Notifications
You must be signed in to change notification settings - Fork 15
/
mobi_scheduler_flow.json
1 lines (1 loc) · 61.3 KB
/
mobi_scheduler_flow.json
1
[{"id":"c66445d5.585f48","type":"websocket-listener","path":"/ws/mobiui","wholemsg":"false"},{"id":"99f054f9.660fa8","type":"http in","name":"http request: mobiui","url":"/mobiui","method":"get","x":185,"y":138,"z":"ff75fda.f008a","wires":[["1dbf010e.e240ff"]]},{"id":"e8632033.179ce","type":"http response","name":"http responce: mobiui","x":783.0000152587891,"y":138,"z":"ff75fda.f008a","wires":[]},{"id":"ad6e14da.5291e8","type":"function","name":"ui handler","func":"/* \tUI dispatcher v0.1b 08/10/2014\n\tRecives changes from UI and actions them \n\tNow uses context.global.dataPionts to hold state */\nvar obj = JSON.parse(msg.payload);\ndelete msg.payload;\ndelete msg._session;\n\n// toggle switch tsw-1\t- output 1 \nif(obj.id==\"tsw-1\"){\n\tcontext.global.dataPionts[\"tsw-1\"].v=obj.v;\n\tmsg.payload = {\"id\": obj.id, \"v\": obj.v};\t\n\treturn [msg, null, null, null, null];\n\n// toggle switch tsw-2\t- output 2 \n} else if(obj.id==\"tsw-2\"){\n context.global.dataPionts[\"tsw-2\"].v=obj.v;\n\tmsg.payload = {\"id\": obj.id, \"v\": obj.v};\t\n\treturn [null, msg, null, null, null];\n\t\n// slider sld-1 \t\t- output 3 \t\n} else if(obj.id==\"sld-1\"){\n\tcontext.global.dataPionts[\"sld-1\"].v=obj.v;\n\tmsg.payload = {\"id\": obj.id, \"v\": obj.v};\t\n\treturn [null, null, msg, null, null, null];\n\n// txt popup txt-1 \t\t- output 4 \t\n} else if(obj.id==\"txt-1\"){\n\tcontext.global.dataPionts[\"txt-1\"].v=obj.v;\n\tmsg.payload = {\"id\": obj.id, \"v\": obj.v};\t\n\treturn [null, null, null, msg, null, null];\n\n// init request \t\t- output 5 \n} else if(obj.id==\"init\"){\t\n\tcontext.global.dataPionts[\"shd\"].v = JSON.stringify(context.global.schedule);\n\tmsg.payload = {id:\"init\", v: context.global.dataPionts}; \n\treturn [null, null, null, null, msg, null];\n\t\n// save shedule \t\t- output 6 \n} else if(obj.id==\"shd-save\"){\n\tcontext.global.schedule = null;\n\t//context.global.schedule = JSON.stringify(obj.v);\n\tcontext.global.schedule = obj.v;\n\tmsg.payload = obj.v;\n\treturn [null, null, null, null, null, msg];\n\n// do nothing\n} else {\n\treturn [null, null, null, null, null, null];\n}","outputs":"6","x":382.4444351196289,"y":649.666633605957,"z":"ff75fda.f008a","wires":[["d2e327f.f2d1cd8"],["ced064ee.312f98"],["107c621a.ef839e"],["2b00902a.d4ff7"],["f6900423.096ff8","6843f107.97bc1"],["6441cc91.9bbe34"]]},{"id":"79793f94.8686c","type":"inject","name":"pulse","topic":"10","payload":"","payloadType":"date","repeat":"14400","crontab":"","once":false,"x":163,"y":318.99999713897705,"z":"ff75fda.f008a","wires":[["c6345f77.39cba"]]},{"id":"c6345f77.39cba","type":"function","name":"move slider ui: sld-1","func":"context.count = context.count || parseInt(context.global.dataPionts[\"sld-1\"].v); \ncontext.count = parseInt(context.count) + parseInt(msg.topic);\nif(context.count>100){context.count=0;}\ncontext.global.dataPionts[\"sld-1\"].v=context.count; // used by ui init\nmsg.payload = {id:\"sld-1\", v: context.count}; \nreturn msg;","outputs":1,"x":405,"y":319.99999713897705,"z":"ff75fda.f008a","wires":[["6843f107.97bc1"]]},{"id":"a7923bac.586dc8","type":"function","name":"toggle swithch ui: tsw-1","func":"if(context.global.dataPionts[\"tsw-1\"].v==1){\n\tcontext.global.dataPionts[\"tsw-1\"].v=0;\n} else {\n\tcontext.global.dataPionts[\"tsw-1\"].v=1;\n}\nmsg.payload = {id:\"tsw-1\", v: context.global.dataPionts[\"tsw-1\"].v}; \nreturn msg;","outputs":1,"x":412,"y":235.99999713897705,"z":"ff75fda.f008a","wires":[["6843f107.97bc1"]]},{"id":"33956f66.cc6a9","type":"inject","name":"toggle","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":163,"y":236.99999713897705,"z":"ff75fda.f008a","wires":[["a7923bac.586dc8"]]},{"id":"d2e327f.f2d1cd8","type":"debug","name":"ui: tsw-1 toggle switch","active":false,"console":"false","complete":"true","x":673.4444351196289,"y":616.666633605957,"z":"ff75fda.f008a","wires":[]},{"id":"ced064ee.312f98","type":"debug","name":"ui: tsw-2 toggle switch","active":false,"console":"false","complete":"true","x":674.4444351196289,"y":652.666633605957,"z":"ff75fda.f008a","wires":[]},{"id":"107c621a.ef839e","type":"debug","name":"u1: sld-1 slider","active":false,"console":"false","complete":"true","x":655.4444351196289,"y":688.666633605957,"z":"ff75fda.f008a","wires":[]},{"id":"dca61599.2359e8","type":"comment","name":"Update mobilw web app via web scokets ","info":"","x":198.44444274902344,"y":194.22222518920898,"z":"ff75fda.f008a","wires":[]},{"id":"a97e2318.5681e","type":"comment","name":"Handler mobile web app UI commands via web sockets","info":"","x":283.11109924316406,"y":580.3332862854004,"z":"ff75fda.f008a","wires":[]},{"id":"6843f107.97bc1","type":"websocket out","name":"ws - mobiui","server":"c66445d5.585f48","x":761.0000152587891,"y":229,"z":"ff75fda.f008a","wires":[]},{"id":"45a5dfaa.ba5a2","type":"websocket in","name":"ws - mobiui","server":"c66445d5.585f48","x":158.44441986083984,"y":648.6666460037231,"z":"ff75fda.f008a","wires":[["ad6e14da.5291e8","8e56196b.71a9e8"]]},{"id":"4397e4b0.bc681c","type":"function","name":"set ui value val-1","func":"msg.payload = {id:\"val-1\", v: parseFloat(msg.topic).toFixed(1)+\"C\"};\ncontext.global.dataPionts[\"val-1\"].v=parseFloat(msg.topic).toFixed(1)+\"C\"; // used by ui init\nreturn msg;","outputs":1,"x":397,"y":355.99999713897705,"z":"ff75fda.f008a","wires":[["6843f107.97bc1"]]},{"id":"90a24a5b.6f5db8","type":"inject","name":"set","topic":"22.12","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":165,"y":356.99999713897705,"z":"ff75fda.f008a","wires":[["4397e4b0.bc681c"]]},{"id":"ce3a3054.31c5d","type":"inject","name":"toggle","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":164,"y":278.99999713897705,"z":"ff75fda.f008a","wires":[["624d3c66.9db2c4"]]},{"id":"624d3c66.9db2c4","type":"function","name":"toggle swithch ui: tsw-2","func":"if(context.global.dataPionts[\"tsw-2\"].v==1){\n\tcontext.global.dataPionts[\"tsw-2\"].v=0;\n} else {\n\tcontext.global.dataPionts[\"tsw-2\"].v=1;\n}\nmsg.payload = {id:\"tsw-2\", v: context.global.dataPionts[\"tsw-2\"].v}; \nreturn msg;","outputs":1,"x":411,"y":277.99999713897705,"z":"ff75fda.f008a","wires":[["6843f107.97bc1"]]},{"id":"d3ad4119.2c52c","type":"inject","name":"set","topic":"Flow to plant High!!","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":163,"y":392.99999713897705,"z":"ff75fda.f008a","wires":[["4af5e553.b50a1c"]]},{"id":"4af5e553.b50a1c","type":"function","name":"set ui status msg","func":"var statusMsg = {stMsg: msg.topic, dur:0, pri:1};\nmsg.payload = {id:\"sta-1\", v:statusMsg};\nreturn msg;","outputs":1,"x":394,"y":392.99999713897705,"z":"ff75fda.f008a","wires":[["6843f107.97bc1"]]},{"id":"94dae3c3.6b252","type":"inject","name":"set","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":163,"y":429.99999713897705,"z":"ff75fda.f008a","wires":[["f1809c57.0e7f6"]]},{"id":"f1809c57.0e7f6","type":"function","name":"show a chart","func":"var chart = {\n \"values\": [\n \"[[1404954324794,22.7],[1404955378037,22.7],[1404956431240,22.7],[1404957484513,22.6],[1404958537898,22.6],[1404959591350,22.6],[1404960644836,22.4],[1404961698366,22.4],[1404962752021,22.4],[1404963805731,22.4],[1404965913194,22.3],[1404966967038,22.1],[1404968020953,22.1],[1404969074807,22.1],[1404970128704,22.1],[1404971182719,22.1],[1404972236829,22.1],[1404973290883,22.1],[1404974345054,22.0]]\",\n \"[[1404954324794,40.0],[1404955378037,40.0],[1404956431240,40.0],[1404957484513,40.0],[1404958537898,40.0],[1404959591350,40.0],[1404960644836,40.0],[1404961698366,40.0],[1404962752021,40.0],[1404963805731,40.0],[1404965913194,40.0],[1404966967038,40.0],[1404968020953,40.0],[1404969074807,40.0],[1404970128704,40.0],[1404971182719,40.0],[1404972236829,40.0],[1404973290883,40.0],[1404974345054,40.0]]\"\n ],\n \"engs\": [\n \"C\",\n \"C\"\n ],\n \"colors\": [\n \"#615B5B\",\n \"#EE4900\"\n ],\n \"names\": [\n \"EnOcean: office temp\",\n \"EnOcean: office SP\"\n ],\n \"tags\": [\n \"v3\",\n \"v4\"\n ],\n \"nos\": 2,\n \"title\": \"Office temp & SP\",\n \"xtitle\": \"Time\",\n \"ytitle\": \"C\"\n}\nmsg.payload = {id:\"chart-1\", v: chart}; \nreturn msg; ","outputs":1,"x":384,"y":430.99999713897705,"z":"ff75fda.f008a","wires":[["6843f107.97bc1"]]},{"id":"2b00902a.d4ff7","type":"debug","name":"txt-1 popup large text","active":false,"console":"false","complete":"true","x":675.4444351196289,"y":724.666633605957,"z":"ff75fda.f008a","wires":[]},{"id":"8e56196b.71a9e8","type":"debug","name":"","active":false,"console":"false","complete":"true","x":371.44441986083984,"y":716.6666460037231,"z":"ff75fda.f008a","wires":[]},{"id":"1f98cf10.e06731","type":"function","name":"DataPionts Object init ","func":"context.global.dataPionts = {\n\"tsw-1\": {\"v\": 1},\n\"tsw-2\": {\"v\": 0},\n\"sld-1\": {\"v\": 10},\n\"val-1\": {\"v\": 20.0},\n\"txt-1\": {\"v\": null},\n\"sta-1\": {\"v\": \"init message\"},\n\"shd\" : {\"v\": null},\n};\nreturn msg;","outputs":1,"x":414.00001525878906,"y":471.99998474121094,"z":"ff75fda.f008a","wires":[[]]},{"id":"22612a0d.dd9ed6","type":"inject","name":"init on start","topic":"","payload":"","payloadType":"string","repeat":"","crontab":"","once":true,"x":159,"y":471.99999713897705,"z":"ff75fda.f008a","wires":[["1f98cf10.e06731","e30c0332.1cf4"]]},{"id":"f6900423.096ff8","type":"debug","name":"init responce to client","active":false,"console":"false","complete":"true","x":677.4444351196289,"y":759.666633605957,"z":"ff75fda.f008a","wires":[]},{"id":"3bc45489.c43bac","type":"comment","name":"mobile web app: mobiui ","info":"","x":150,"y":53.99999713897705,"z":"ff75fda.f008a","wires":[]},{"id":"1dbf010e.e240ff","type":"template","name":"Mobile web-App v1.2 ","field":"","template":"<!DOCTYPE HTML>\n<html lang=\"en\">\n<head>\n <meta charset=\"utf-8\" />\n <meta HTTP-EQUIV=\"CACHE-CONTROL\" CONTENT=\"NO-CACHE\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" /> \n <meta name=\"apple-mobile-web-app-capable\" content=\"yes\" />\n <title>Node-RED mobi ui</title>\n <link rel=\"stylesheet\" href=\"//code.jquery.com/mobile/1.4.3/jquery.mobile-1.4.3.min.css\" />\n <script src=\"//code.jquery.com/jquery-1.11.1.min.js\"></script>\n <script src=\"//code.jquery.com/mobile/1.4.3/jquery.mobile-1.4.3.min.js\"></script>\n <script src=\"//cdnjs.cloudflare.com/ajax/libs/highcharts/4.0.3/highcharts.js\"></script>\n <script>//Node-Red mobi ui - LHG industrialinternet.co.uk\n\tconsole.log(\"NR mobi UI 1.1.a : Controls, Chart & Schedule\");\n\tvar schedule = null;\t\t\t\t// schedule Obj \n\tvar itemLookup = null; \t\t\t// pointer to current schedule event\n\tvar statusMsgDisplayed= false;\t// flag to stop msg disco effect\n\tvar prioritySet =false;\t\t \t// flag showing if high prio msg being displayed\n\tvar daiableWidgets = false; \n\tvar connected = false;\n \tif(location.protocol==\"https:\"){\n\t\tvar wsUri=\"wss://\"+window.location.hostname+\":1880/ws/mobiui\";\n\t} else {\n\t\tvar wsUri=\"ws://\"+window.location.hostname+\":1880/ws/mobiui\";\n\t}\n\tvar ws=null;\n\tfunction appInit(){\n\t\tif ( schedule == null && localStorage[\"schedule\"]) {\n\t\t\tschedule = localStorage[\"schedule\"];\n\t\t\tconsole.log(\"loaded schedule from local.\");\n\t\t} \n\t}\n\tappInit();\n\tfunction wsConn() {\n\t\tws = new WebSocket(wsUri);\n\t\tws.onmessage = function(m) {\n\t\t\tconsole.log('< from-node-red:',m.data);\n\t\t\tif (typeof(m.data) === \"string\" && m. data !== null){\n\t\t\t\tvar msg =JSON.parse(m.data);\n\t\t\t\tvar ftc = msg.id.substring(0, 3);\n\t\t\t\t//console.log(\"id:\"+msg.id+\" fct:\"+ftc);\n\t\t\t\tif(ftc== \"ini\") {uiInit(msg.v);}\n\t\t\t\tif(ftc==\"tsw\"){setFlip(msg.id,msg.v);}\n\t\t\t\tif(ftc==\"sld\"){setSlider(msg.id,msg.v);}\n\t\t\t\tif(ftc==\"val\"){setValue(msg.id,msg.v);}\n\t\t\t\t//if(ftc==\"cha\"){showCharts( msg.v.values,msg.v.colors,msg.v.engs,msg.v.tags,msg.v.names,msg.v.nos,msg.v.title,.msg.v.yTitle)};\n\t\t\t\tif(ftc==\"cha\"){showCharts( msg.v.values,msg.v.colors,msg.v.engs,msg.v.tags,msg.v.names,msg.v.nos,msg.v.title,msg.v.xtitle,msg.v.ytitle)};\n\t\t\t\tif(ftc==\"shd\"){setSchedule(msg.v);}\n\t\t\t\tif(ftc==\"sta\"){statusMsgDisplayed= false;setStatus(msg.v.stMsg,msg.v.dur,msg.v.pri);}\n\t\t\t\tif(ftc==\"ack\"){clearReq();}\n\t\t\t}\n\t\t}\n\t\tws.onopen = function() { \n\t\t\tstatusMsgDisplayed=false;\n\t\t\tif(daiableWidgets==true){enablePage();}\n\t\t\tsetStatus(\"Connected\",5,0); \n\t\t\tconnected = true;\n\t\t\tvar obj = {\"id\":\"init\",\"v\":document.cookie};\n\t\t\tgetRequest = JSON.stringify(obj); \t\n\t\t\tws.send(getRequest);\t\t\t// Request ui status from NR\n\t\t\tconsole.log(\"sent init requeset\");\n\t\t}\n\t\tws.onclose = function() {\n\t\t\tconsole.log('Node-RED connection closed: '+new Date().toUTCString()); \n\t\t\tconnected = false; \n\t\t\tws = null;\n\t\t\tsetStatus(\"No connection to server!\",0,1);\n\t\t\tif(daiableWidgets==false){disablePage();}\n\t\t\tsetTimeout(wsConn, 10000);\n\t\t}\t\n\t\tws.onerror = function(){\n\t\t\tconsole.log(\"connection error\");\n\t\t}\n\t}\n\twsConn(); \t\t\t\t\t// connect to Node-RED server\n\t\n\tfunction uiInit(values){ \t\t// initialise UI controls\n\t\tvar ui = values; // JSON.parse(values);\n\t\t for (var item in ui) {\n\t\t\tconsole.log(\"id:\"+item.toString() +\" v:\"+ui[item].v);\n\t\t\tvar m = {\"id\" : item.toString(), \"v\": ui[item].v};\n\t\t\t//console.log(\"m: \"+m);\n\t\t\tinitSetters(m);\n\t\t}\n\t}\n\tfunction initSetters(msg){ \t// update UI widgets on connect \n\t\tconsole.log(\"init item id:\"+msg.id+\" value:\"+ msg.v);\n\t\tvar ftc = msg.id.substring(0, 3);\n\t\tif(ftc==\"tsw\"){setFlip(msg.id,msg.v);}\n\t\tif(ftc==\"sld\"){setSlider(msg.id,msg.v);}\n\t\tif(ftc==\"val\"){setValue(msg.id,msg.v);}\n\t\tif(ftc==\"cha\"){showCharts( msg.v.values,msg.v.colors,msg.v.engs,msg.v.tags,msg.v.names,msg.v.nos,msg.v.title,msg.v.xTitle.msg.v.yTitle)};\n\t\tif(ftc==\"shd\"){setSchedule(msg.v);}\n\t\tif(ftc==\"sta\"){setStatus(msg.v);}\n\t}\n\tfunction setFlip(_id,_v){ \t// update flip \n\t\tmyselect = $(\"#\"+_id);\n\t\t//console.log(\"flip id:\"+_id+\" value:\"+_v+\" tyepof:\"+ typeof _v +\" state:\"+myselect.data('state')+\" req:\"+myselect.data('req'));\n\t\t//if(myselect.data('req')==1) return; // request on progress stops flip UI chatter \n\t\tif(myselect.data('state')!=_v){\n\t\t\tif(_v== true || _v=='true'){\n\t\t\t\tmyselect[0].selectedIndex=1; \n\t\t\t\tmyselect.data('state',1)\n\t\t\t} \n\t\t\telse { \n\t\t\t\tmyselect[0].selectedIndex=0;\n\t\t\t\tmyselect.data('state',0);\n\t\t\t}\n\t\t\tmyselect.flipswitch(\"refresh\");\n\t\t\t//myselect.stopImmediatePropagation();\n\t\t\t//console.log(\"jq:\"+myselect[0].selectedIndex+\" flip id:\"+_id+\" v:\"+value+\" data-state:\"+myselect.data('state'));\n\t\t}\n\t}\n\tfunction setSlider(_id,_v){\t// update slider\n\t\tmyselect = $(\"#\"+_id);\n\t\t myselect.val(_v);\n\t\t myselect.slider('refresh');\n\t}\n\tfunction setValue(_id,_v){\t// update value display\n\t\tmyselect = $(\"#\"+_id);\n\t\tmyselect.val(_v);\n\t}\n\tfunction showCharts(_data,colors,engs,tags,names,nos,cTitle,xTitle,yTitle){ // render chart\n\t\tvar seriesNo = [];\n\t\tfor (i=0; i<nos; i++){\n\t\t\tseriesNo.push({}); \n\t\t}\n\t\tconsole.log(\"seriesNo:\"+seriesNo);\n\t\tvar options = {\n\t\t\tchart: {\n\t\t\t\tmarginRight: 30,\n\t\t\t\trenderTo: 'container',\n\t\t\t\ttype: 'spline',\n\t\t\t\t},\n\t\t\t\t title: {\n\t\t\t\t\t\ttext: cTitle\n\t\t\t\t},\n\t\t\t\t xAxis: {\n\t\t\t\t\t type: 'datetime',\n\t\t\t\t\tdateTimeLabelFormats: {\n\t\t\t\t\t\thour: '%H',\n\t\t\t\t\t\tday: '%H <br/>%a %d %b' \n\t\t\t\t\t},\n\t\t\t\t\tgridLineColor: '#C0C0C0',\n\t\t\t\t\ttickInterval: 1 * 3600 * 1000,\n\t\t\t\t\ttitle: {\n\t\t\t\t\t\ttext: xTitle\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t yAxis: {\n\t\t\t\t\ttitle: {\n\t\t\t\t\t\ttext: yTitle\n\t\t\t\t\t},\n\t\t\t\t\tmin: 0,\n\t\t\t\t\tgridLineWidth: 0.5\t\t\t\n\t\t\t\t},\n\t\t\t\ttooltip: {\n\t\t\t\t\tformatter: function() {\n\t\t\t\t\t\teng=engs[this.series.options.id];\n\t\t\t\t\t\ttag=tags[this.series.options.id]; \n\t\t\t\t\t\treturn \"<strong>\"+ Highcharts.numberFormat(this.y, 1) +\"</strong>\"+eng+\" \"+tag+\"<br/>\"+ Highcharts.dateFormat('%a %d %b %H:%M:%S', this.x) +'<br/>';\t\t\t \n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\tseries: seriesNo\n\t\t};\n\t\tfor (i=0; i<nos; i++){\n\t\t\toptions.series[i].id=i;\n\t\t\toptions.series[i].color=colors[i];\n\t\t\toptions.series[i].lineWidth=1;\n\t\t\toptions.series[i].name= names[i];\n\t\t\toptions.series[i].data = JSON.parse(_data[i]);\n\t\t}\n\t\tvar chart = new Highcharts.Chart(options);\n\t}\n\tfunction setSchedule(_v){\t// update schedule \n\t\tconsole.log(\"shed:\"+typeof _v);\n\t\tif(typeof _v == \"string\") { // update from NR\n\t\t\tschedule = JSON.parse(_v);\n\t\t\tlocalStorage[\"schedule\"] = schedule;\n\t\t}\n\t\tconsole.log(\"shed:\"+schedule.items[0].id);\n\t\t$(\"#shd-1\").prop( \"checked\", true ).checkboxradio( \"refresh\" );\n\t\titemLookup = 0;\n\t\t$('#shd-tag').val(schedule.items[0].tag);\n\t\t$('#shd-st').val(schedule.items[0].startTime);\n\t\t$('#shd-st-v').val(schedule.items[0].startValue);\n\t\t$('#shd-et').val(schedule.items[0].endTime);\n\t\t$('#shd-et-v').val(schedule.items[0].endValue);\n\t\t$(\"checkbox\").prop( \"checked\", false ).checkboxradio( \"refresh\" );\n\t\tfor (dow = 0; dow< 7; dow++) {\n\t\t\tvar dowUI = '#shd-dow-'+dow;\n\t\t\tif (schedule.items[0].dofWeek[dow]==1){\n\t\t\t\t$(dowUI).prop( \"checked\", true ).checkboxradio( \"refresh\" );\n\t\t\t} else {\n\t\t\t\t$(dowUI).prop( \"checked\", false ).checkboxradio( \"refresh\" );\n\t\t\t}\n\t\t}\t\n\t}\n\tfunction setStatus(msg,dur,pri){\t // show msg on status bar\n\t\tconsole.log(\"statusMsgDisplayed:\"+statusMsgDisplayed);\n\t\tif(statusMsgDisplayed== true){return};\n\t\tstatusMsgDisplayed=true;\n\t\tif(pri>0 && prioritySet == false ){\n\t\t\tprioritySet = true;\t\t\t\n\t\t\t$(\"#statusView\").toggleClass(\"statusViewAlert\"); // toggle ON\n\t\t} else if ( pri==0 && prioritySet == true) {\n\t\t\tprioritySet = false;\n\t\t\t$(\"#statusView\").toggleClass(\"statusViewAlert\"); // toggle Off\n\t\t}\n\t\t$(\"#statusView\").show();\n\t\t$(\"#statusView\").html(msg);\n\t\tdur = dur*1000;\n\t\tif(dur >0){\n\t\t\tsetTimeout(function(){$(\"#statusView\").hide(200);$(\"#statusView\").html(\"\"); statusMsgDisplayed= false;prioritySet=false;},dur)\n\t\t}\n\t}\n\tfunction disablePage(){\t\t\n\t\t$(\"[data-role=flipswitch]\").flipswitch( \"disable\" );\n\t\t//$(\"[data-role=range]\").disabled = true;\n\t\t$(\"[data-role=range]\").slider( \"option\", \"disabled\", true );\n\t\t$(\"[data-rel=popup]\").toggleClass(\"ui-disabled\");\n\t\tdaiableWidgets = true;\n\t}\n\tfunction enablePage(){\n\t\t$(\"[data-role=flipswitch]\").flipswitch( \"enable\" );\n\t\t$(\"[data-role=range]\").slider( \"option\", \"enabled\", true );\n\t\t$(\"[data-role=range]\").slider( \"enable\" );\n\t\t$(\"[data-rel=popup]\").toggleClass(\"ui-disabled\");\n\t\tdaiableWidgets = false;\n\t}\t\n\t$(function() { \t\t\t\t// UI event handlers \n\t\t// Flip-switch change\n\t\t$(\"[data-role=flipswitch]\").bind( \"change\", function(event, ui) {\n\t\t\t//console.log(\"id:\"+this.id+\" val:\"+$(this).flipswitch().val()+\" state:\"+$(this).data('state')+\" req:\"+$(this).data('reqstate'));\n\t\t\tvar _value = $(this).flipswitch().val();\n\t\t\tif($(this).data('state') != _value){\n\t\t\t\t$(this).data('state',_value); \n\t\t\t\tvar obj = {\"id\":\"\"+this.id+\"\",\"v\":_value};\n\t\t\t\tsetActions = JSON.stringify(obj); \t\n\t\t\t\tws.send(setActions);\n\t\t\t}\n\t\t});\n\t\t// Slider end\n\t\t$(\".ui-slider\").bind( \"slidestop\", function(event, ui) {\n\t\t\tvar obj = {\"id\":\"\"+event.target.id+\"\",\"v\":event.target.value};\n\t\t\tsetActions = JSON.stringify(obj); \t\n\t\t\tws.send(setActions);\n\t\t});\n\t\t// Popup send\n\t\t$(\"[data-ui-type=pop-save]\").bind( \"click\", function(event, ui) {\n\t\t\tbid = this.id.split(\"_\");\n\t\t\twid =\"#\"+bid[0]+\"-pop\";\n\t\t\t$(wid ).popup( \"close\" );\n\t\t\ttid=\"#\"+bid[0];\n\t\t\tvar obj = {\"id\":\"\"+bid[0]+\"\",\"v\":$(tid ).val()};\n\t\t\tsetActions = JSON.stringify(obj); \t\n\t\t\tws.send(setActions);\n\t\t});\n\t\t$( document ).on( \"vmouseout\", \"textarea\", function() {\n\t\t\tconsole.log(\"text id: \"+this.id+\" v:\"+$(this ).val());\n\t\t\tvar obj = {\"id\":\"\"+this.id+\"\",\"v\":$(this ).val()};\n\t\t\tsetActions = JSON.stringify(obj); \t\n\t\t\tws.send(setActions);\n\t\t});\n\t\t// Grouped Radio buttons click\n\t\t$(\"[data-ui-type=shd-sel]\").bind( \"click\", function(event, ui) {\n\t\t\t$(\"[data-ui-type=shd-sel]\").prop( \"checked\", false ).checkboxradio( \"refresh\" );\n\t\t\t$(this ).prop( \"checked\", true ).checkboxradio( \"refresh\" );\n\t\t\tvar item = this.id.split(\"-\");\n\t\t\tif( itemLookup == null){\n\t\t\t\t itemLookup = item[1]-1;\n\t\t\t } else { // Copy item edits back obj\n\t\t\t\tschedule.items[itemLookup].tag\t\t = $('#shd-tag').val();\n\t\t\t\tschedule.items[itemLookup].startTime = $('#shd-st').val();\n\t\t\t\tschedule.items[itemLookup].startValue = $('#shd-st-v').val();\n\t\t\t\tschedule.items[itemLookup].endTime\t = $('#shd-et').val();\n\t\t\t\tschedule.items[itemLookup].endValue\t = $('#shd-et-v').val();\n\t\t\t\tfor (dow = 0; dow< 7; dow++) {\n\t\t\t\t\tvar dowUI = '#shd-dow-'+dow;\n\t\t\t\t\tif( $(dowUI).prop( \"checked\")){\n\t\t\t\t\t\tschedule.items[itemLookup].dofWeek[dow] = 1 ;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tschedule.items[itemLookup].dofWeek[dow] = 0 ;\n\t\t\t\t\t}\n\t\t\t\t} \n\t\t\t\titemLookup = item[1]-1;\n\t\t\t }\n\t\t\tconsole.log(\"shed item\"+item[1]+\" lookup tag:\"+schedule.items[itemLookup].tag);\n\t\t\t$('#shd-tag').val(schedule.items[itemLookup].tag);\n\t\t\t$('#shd-st').val(schedule.items[itemLookup].startTime);\n\t\t\t$('#shd-st-v').val(schedule.items[itemLookup].startValue);\n\t\t\t$('#shd-et').val(schedule.items[itemLookup].endTime);\n\t\t\t$('#shd-et-v').val(schedule.items[itemLookup].endValue);\n\t\t\t//console.log(\"group radio - id:\"+ this.id+\" val:\"+$(this).val());\n\t\t\tfor (dow = 0; dow< 7; dow++) {\n\t\t\t\tvar dowUI = '#shd-dow-'+dow;\n\t\t\t\tif (schedule.items[itemLookup].dofWeek[dow]==1){\n\t\t\t\t\t$(dowUI).prop( \"checked\", true ).checkboxradio( \"refresh\" )\n\t\t\t\t} else {\n\t\t\t\t\t$(dowUI).prop( \"checked\", false ).checkboxradio( \"refresh\" )\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\t// Schedule save\n\t\t$( \"#shd-save\" ).bind( \"click\", function(event, ui) {\n\t\t\tconsole.log(\"shd-save\");\n\t\t\tif( itemLookup != null){\n\t\t\t\tschedule.items[itemLookup].tag\t\t = $('#shd-tag').val();\n\t\t\t\tschedule.items[itemLookup].startTime = $('#shd-st').val();\n\t\t\t\tschedule.items[itemLookup].startValue = $('#shd-st-v').val();\n\t\t\t\tschedule.items[itemLookup].endTime\t = $('#shd-et').val();\n\t\t\t\tschedule.items[itemLookup].endValue\t = $('#shd-et-v').val();\n\t\t\t\tfor (dow = 0; dow< 7; dow++) {\n\t\t\t\t\tvar dowUI = '#shd-dow-'+dow;\n\t\t\t\t\tif( $(dowUI).prop( \"checked\")){\n\t\t\t\t\t\tschedule.items[itemLookup].dofWeek[dow] = 1 ;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tschedule.items[itemLookup].dofWeek[dow] = 0 ;\n\t\t\t\t\t}\n\t\t\t\t} \n\t\t\t\tlocalStorage[\"schedule\"] = schedule;\n\t\t\t\tvar obj = {\"id\":\"shd-save\",\"v\":schedule};\n\t\t\t\tgetRequest = JSON.stringify(obj); \t\n\t\t\t\tws.send(getRequest);\n\t\t\t}\n\t\t});\n\t\t// Utills\n\t\tvar showHide=0;\n\t\t$(window).keydown(function(event) {\n\t\t\tif(event.shiftKey && event.keyCode == 68 ) { \n\t\t\t\t//console.log(event.keyCode);\n\t\t\t\tif(showHide==0){$(\"#foo\").show('slow');showHide=1;}else{$(\"#foo\").hide();showHide=0;}\n\t\t\t\tevent.preventDefault(); \n\t\t\t}\n\t\t}); \n\t\t$( document ).on( \"vclick\", \"#b1\", function() {\n\t\t\tlocation.reload();\n\t\t\tconsole.log(\"reload button\");\n\t\t});\t\n\t});\n </script>\n <style>\n\t\t#c1, #c2 {background-color: #FFF !important;}\n \t\tdiv .ui-input-text {padding:0 .4em;} \n\t\t.valLable {float: left !important; min-width: 85px !important; margin-top:4px !important; padding: 0;}\n\t\t.valSmall {width:70px; height: 40px !important; float: left !important; margin-top:-12px !important;}\n\t\t.valMedium {width:156px; height: 40px !important; float: left !important; margin-top:-12px !important;}\n\t\t.valLarge {width:220px; height: 40px !important; float: left !important; margin-top:-12px !important;}\n\t\t.valHour {width:100px; height: 40px !important; float: left !important; margin-top:-12px !important;}\n\t\t.flipLable {float: left !important; min-width: 140px !important;}\n\t\t@media only screen and (min-width: 521px){\n\t\t\t#header1 {width: 507px !important; margin:auto auto !important; position: relative !important; border:1px solid #cccccc;}\n\t\t\t#c1 {width: 475px !important; min-height:500px !important; margin:auto auto !important; position: relative !important; border:1px solid #cccccc; border-top:0px;}\n\t\t\t#c2 {width: 475px !important; min-height:500px !important; margin:auto auto !important; position: relative !important; border:1px solid #cccccc; border-top:0px;}\n\t\t\t.t1 {width: 506px !important; margin:auto auto !important; position: relative !important; padding-right: 4px !important;}\n\t\t\t.flipLable {float: left !important; min-width: 320px !important;}\n\t\t\t.valMedium {width:330px; height: 40px !important; float: left !important; margin-top:-12px !important;}\n\t\t\t.sep {display: none !important;}\n\t\t}\t\n\t\t.alert {font-weight: bold; color: #FF6C01;}\n\t\t.smallin .ui-input-text {width: 200px !important; color:red;}\n\t\tlegend.h1lb {padding:0 0 0 0;}\n\t\t.statusView {width: 100% !important; margin:0px; position: relative !important; height:28px; padding:10px 0 0 0; background-color:#E9E9E9; font-weight:bold; -webkit-border-radius: 0.7em !important; border-radius: 0.7em; text-align:center; }\n\t\t.statusViewAlert {width: 100% !important; margin:0px; position: relative !important; height:28px; padding:10px 0 0 0; background-color:#F8B584 !important; font-weight:bold; -webkit-border-radius: 0.7em !important; border-radius: 0.7em; display:none; text-align:center; }\n\t\t.ui-flipswitch {\"border-radius: 2em !important; -webkit-border-radius: 2em !important; -moz-border-radius: 2em !important;}\n\t\t/* Active button */\n\t\t.ui-page-theme-a .ui-btn.ui-btn-active,html .ui-bar-a .ui-btn.ui-btn-active,html .ui-body-a .ui-btn.ui-btn-active,html body .ui-group-theme-a .ui-btn.ui-btn-active,html head + body .ui-btn.ui-btn-a.ui-btn-active,\n\t\t/* Active checkbox icon */\n\t\t.ui-page-theme-a .ui-checkbox-on:after,html .ui-bar-a .ui-checkbox-on:after,html .ui-body-a .ui-checkbox-on:after,html body .ui-group-theme-a .ui-checkbox-on:after,.ui-btn.ui-checkbox-on.ui-btn-a:after,\n\t\t/* Active flipswitch background */.ui-page-theme-a .ui-flipswitch-active,html .ui-bar-a .ui-flipswitch-active,html .ui-body-a .ui-flipswitch-active,html body .ui-group-theme-a .ui-flipswitch-active,\n\t\thtml body .ui-flipswitch.ui-bar-a.ui-flipswitch-active,\n\t\t/* Active slider track */\n\t\t.ui-page-theme-a .ui-slider-track .ui-btn-active,html .ui-bar-a .ui-slider-track .ui-btn-active,html .ui-body-a .ui-slider-track .ui-btn-active,html body .ui-group-theme-a .ui-slider-track .ui-btn-active,html body div.ui-slider-track.ui-body-a .ui-btn-active {\n\t\t\tbackground-color: \t\t#FF6C01 !important;\n\t\t\tborder-color:\t \t\t#FF6C01 !important;\n\t\t\tcolor: \t\t\t\t\t#fff /*{a-active-color}*/;\n\t\t\ttext-shadow: 0 /*{a-active-shadow-x}*/ 1px /*{a-active-shadow-y}*/ 0 /*{a-active-shadow-radius}*/ #005599 /*{a-active-shadow-color}*/;\n\t\t}\n </style>\n</head>\n<body>\n <!-- Home -->\n <div data-role=\"page\" id=\"noderedmobiui\">\n <div id=\"header1\" data-role=\"header\">\n <h3 style=\"color:#FF6C01\">mobi ui v1.1</h3>\n\t\t<a href=\"#\" title=\"reload\" class=\"ui-btn ui-shadow ui-corner-all ui-icon-refresh ui-btn-icon-notext ui-btn-inline\" id=\"b1\" >Reload</a>\t\n\t</div>\n\t\t<div id=\"c1\" class=\"ui-content\">\n\t\t\t<div id=\"statusView\" class=\"statusView\" style=\"display:none;\"></div>\t\t\n\t\t\t<ul data-role=\"listview\" data-inset=\"true\">\n\t\t\t\t<li class=\"ui-field-contain\" >\n\t\t\t\t\t<label for=\"tsw-1\" class=\"flipLable\">flip sw1</label>\n\t\t\t\t\t<select id=\"tsw-1\" data-role=\"flipswitch\" data-state=\"0\" data-req=\"\">\n\t\t\t\t\t <option value=\"0\">Off</option>\n\t\t\t\t\t <option value=\"1\">On</option>\n\t\t\t\t\t</select>\n\t\t\t\t</li>\n\t\t\t\t<li class=\"ui-field-contain\">\n\t\t\t\t\t<label for=\"tsw-2\" class=\"flipLable\">flip sw2</label>\n\t\t\t\t\t<select id=\"tsw-2\" data-role=\"flipswitch\" data-state=\"0\" data-req=\"\">\n\t\t\t\t\t <option value=\"0\">Off</option>\n\t\t\t\t\t <option value=\"1\">On</option>\n\t\t\t\t\t</select>\n\t\t\t\t</li>\n\t\t\t\t<li class=\"ui-field-contain\">\n\t\t\t\t\t<label for=\"sld-1\">slider 1</label>\n\t\t\t\t\t<input id=\"sld-1\" type=\"range\" data-role=\"range\" value=\"0\" min=\"0\" max=\"100\" step=\"1\" data-highlight=\"true\" />\n\t\t\t\t</li>\n\t\t\t\t<li class=\"ui-field-contain\">\n\t\t\t\t\t<label for=\"val-1\" class=\"valLable\">value 1</label>\n\t\t\t\t\t<div class=\"valSmall\"><input type=\"text\" id=\"val-1\" placeholder=\"\" value=\"\" readonly=\"readonly\"></div>\n\t\t\t\t</li>\n\t\t\t\t<li class=\"ui-field-contain\"> \n\t\t\t\t\t<label for=\"txt-1\">txt 1</label>\t\n\t\t\t\t <textarea id=\"txt-1\" cols=\"30\" rows=\"60\" maxlength=\"140\"></textarea>\n\t\t\t\t</li>\n\t\t\t </ul>\n\t\t\t<div id=\"container\" style=\"width: 100%; margin-left:-5px;\"></div>\t\t\n\t\t</div>\n\t</div><!-- eof page -->\n </body>\n</html>","x":427.00001525878906,"y":138,"z":"ff75fda.f008a","wires":[["e8632033.179ce"]]},{"id":"4f097e6e.b0f68","type":"http in","name":"/mobiuiShed","url":"/mobiuiShed","method":"get","x":209.14283752441406,"y":98.42857360839844,"z":"ff75fda.f008a","wires":[["970fd084.68f03"]]},{"id":"79b4bbb6.864b44","type":"http response","name":"mobiuiShed","x":749.1428375244141,"y":98.42857360839844,"z":"ff75fda.f008a","wires":[]},{"id":"1f3da4f7.e0c25b","type":"function","name":"init context.global.schedule","func":"context.global.schedule = JSON.parse(msg.payload);\n//context.global.schedule = msg.payload;\nreturn msg;","outputs":1,"x":694.1428375244141,"y":509.42857360839844,"z":"ff75fda.f008a","wires":[["9cb192d1.634e7"]]},{"id":"e30c0332.1cf4","type":"file in","name":"schedule.json","filename":"/home/pi/node-red/data/schedule.json","format":"utf8","x":389.14283752441406,"y":512.4285736083984,"z":"ff75fda.f008a","wires":[["1f3da4f7.e0c25b","e0c0fcb6.1f3f"]]},{"id":"6441cc91.9bbe34","type":"file","name":"schedule.json","filename":"/home/pi/node-red/data/schedule.json","appendNewline":false,"overwriteFile":true,"x":654.5872573852539,"y":795.0952224731445,"z":"ff75fda.f008a","wires":[]},{"id":"42ef7946.bd1088","type":"inject","name":"20 Sec","topic":"","payload":"","payloadType":"date","repeat":"20","crontab":"","once":false,"x":447.5872573852539,"y":830.0952224731445,"z":"ff75fda.f008a","wires":[["9cb192d1.634e7","8a5c23bf.75a3e"]]},{"id":"c183911b.3e7c7","type":"switch","name":"Actions","property":"payload.id","rules":[{"t":"eq","v":1,"v2":null},{"t":"eq","v":2,"v2":null},{"t":"eq","v":3,"v2":null},{"t":"eq","v":4,"v2":null},{"t":"eq","v":5,"v2":null}],"checkall":"true","outputs":5,"x":841.5872344970703,"y":832.0951995849609,"z":"ff75fda.f008a","wires":[["ba4cf87c.45b308"],["ba4cf87c.45b308"],["ba4cf87c.45b308"],["ba4cf87c.45b308"],["ba4cf87c.45b308"]]},{"id":"ba4cf87c.45b308","type":"debug","name":"","active":true,"console":"false","complete":"false","x":1024.5872344970703,"y":832.0951995849609,"z":"ff75fda.f008a","wires":[]},{"id":"e0c0fcb6.1f3f","type":"debug","name":"","active":false,"console":"false","complete":"false","x":721.1428375244141,"y":439.42857360839844,"z":"ff75fda.f008a","wires":[]},{"id":"9cb192d1.634e7","type":"function","name":"Web UI Scheduler ","func":" // Web User created Scheduler v0.1b \ncontext.dayOfWeek = context.dayOfWeek || null; \ncontext.scheduledState = context.scheduledState || [];\n//console.log(\"len:\"+context.scheduledState.length); \nif(context.scheduledState.length==0){\n\tfor(var i = 0; i < 21; i++) {\n\t context.scheduledState[i]=null;\n\t}\n}\nvar d = new Date();\nvar _tm = \"d:\"+d.getDay()+\" h:\"+d.getHours()+\" m:\"+ d.getMinutes()+\" s:\"+ d.getSeconds();\nmsg.payload = \"Scheduled run\";\n\nfunction getEvents(){\n\t\n\tconsole.log(\"schedule run at:\"+_tm);\n\t\n\tfor (var item in context.global.schedule.items) {\n\t\tvar itemI = parseInt(item);\n\t\tvar event = context.global.schedule.items[item];\n\t\t//console.log(\"id:\"+event.id+\" dow:\"+event.dofWeek[d.getDay()]+\" state:\"+ context.scheduledState[itemI]+\" type:\"+ typeof itemI);\n\t\t\n\t\t// Check for scheduled Start event\t\t\n\t\tvar hrmin=event.startTime.split(\":\");\n\t\tif(parseInt(hrmin[0]) ==d.getHours() && parseInt(hrmin[1]) ==d.getMinutes() && context.scheduledState[itemI]==null && event.dofWeek[d.getDay()] ==1){\n\t\t\tmsg.payload = {id: event.id, v:event.startValue};\n\t\t\tcontext.scheduledState[itemI]=1;\n\t\t\tconsole.log(\"id:\"+event.id+\" start scheduled state:\"+context.scheduledState[itemI]);\n\t\t\treturn\n\t\t}\n\t\t// Check for scheduled End event\n\t\thrmin=event.endTime.split(\":\");\n\t\tif(parseInt(hrmin[0]) ==d.getHours() && parseInt(hrmin[1]) ==d.getMinutes() && context.scheduledState[itemI]==1 && event.dofWeek[d.getDay()] ==1){\n\t\t\tmsg.payload = {id: event.id, v:event.endValue};\n\t\t\tcontext.scheduledState[itemI]= null;\n\t\t\treturn\n\t\t}\n\t}\n}\n\nfunction scheduleReset(){\n\tif(context.dayOfWeek != d.getDay()){\n\t\t\n\t\tif(context.dayOfWeek == null){\n\t\t\tconsole.log( \"reset scheduel due to node-red restart\");\t\n\t\t} else {\n\t\t\tconsole.log( \"reset scheduel due to change of day:\"+d.getDay());\t\t\n\t\t}\n\t\t\n\t\tcontext.dayOfWeek = d.getDay();\n\t\tfor (var item in context.global.schedule.items) {\n\t\t\tvar itemI = parseInt(item);\n\t\t\tif(context.scheduledState[itemI]==1 && context.global.schedule.items[item].noEndTime==true ){\n\t\t\t\tcontext.scheduledState[itemI]=null;\n\t\t\t\tconsole.log(\"schedule item:\"+itemI+\" reset\");\n\t\t\t}\n\t\t}\n\t\tmsg.payload = \"schedule reset\";\n\t}\n}\n\nscheduleReset();\ngetEvents();\nreturn msg;","outputs":1,"x":667.5872344970703,"y":831.2063446044922,"z":"ff75fda.f008a","wires":[["c183911b.3e7c7","b4bb5647.4b44a8"]]},{"id":"b4bb5647.4b44a8","type":"debug","name":"","active":false,"console":"false","complete":"payload","x":855.5872344970703,"y":890.0951995849609,"z":"ff75fda.f008a","wires":[]},{"id":"970fd084.68f03","type":"template","name":"mobi UI Controls, Chart & Schedule: v1.2","field":"payload","template":"<!DOCTYPE HTML>\n<html lang=\"en\">\n<head>\n <meta charset=\"utf-8\" />\n <meta HTTP-EQUIV=\"CACHE-CONTROL\" CONTENT=\"NO-CACHE\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" /> \n <meta name=\"apple-mobile-web-app-capable\" content=\"yes\" />\n <title>Node-RED mobi ui</title>\n <link rel=\"stylesheet\" href=\"//code.jquery.com/mobile/1.4.3/jquery.mobile-1.4.3.min.css\" />\n <script src=\"//code.jquery.com/jquery-1.11.1.min.js\"></script>\n <script src=\"//code.jquery.com/mobile/1.4.3/jquery.mobile-1.4.3.min.js\"></script>\n <script src=\"//cdnjs.cloudflare.com/ajax/libs/highcharts/4.0.4/highcharts.js\"></script>\n <script>//Node-Red mobi ui - LHG industrialinternet.co.uk\n\tconsole.log(\"NR mobi UI Controls, Chart & Schedule: v1.2\");\n\tvar schedule = null;\t\t\t\t// schedule Obj \n\tvar itemLookup = null; \t\t\t// pointer to current schedule event\n\tvar statusMsgDisplayed= false;\t// flag to stop msg disco effect\n\tvar prioritySet =false;\t\t \t// flag showing if high prio msg being displayed\n\tvar daiableWidgets = false; \n\tvar connected = false;\n\tif(location.protocol==\"https:\"){\n\t\tvar wsUri=\"wss://\"+window.location.hostname+\":1880/ws/mobiui\";\n\t} else {\n\t\tvar wsUri=\"ws://\"+window.location.hostname+\":1880/ws/mobiui\";\n\t}\n\tvar ws=null;\n\tfunction appInit(){\n\t\tif ( schedule == null && localStorage[\"schedule\"]) {\n\t\t\tschedule = localStorage[\"schedule\"];\n\t\t\tconsole.log(\"loaded schedule from local.\");\n\t\t} \n\t}\n\tappInit();\n\tfunction wsConn() {\n\t\tws = new WebSocket(wsUri);\n\t\tws.onmessage = function(m) {\n\t\t\t//console.log('< from-node-red:',m.data);\n\t\t\tif (typeof(m.data) === \"string\" && m. data !== null){\n\t\t\t\tvar msg =JSON.parse(m.data);\n\t\t\t\tvar ftc = msg.id.substring(0, 3);\n\t\t\t\t//console.log(\"id:\"+msg.id+\" fct:\"+ftc);\n\t\t\t\tif(ftc== \"ini\") {uiInit(msg.v);}\n\t\t\t\tif(ftc==\"tsw\"){setFlip(msg.id,msg.v);}\n\t\t\t\tif(ftc==\"sld\"){setSlider(msg.id,msg.v);}\n\t\t\t\tif(ftc==\"val\"){setValue(msg.id,msg.v);}\n\t\t\t\t//if(ftc==\"cha\"){showCharts( msg.v.values,msg.v.colors,msg.v.engs,msg.v.tags,msg.v.names,msg.v.nos,msg.v.title,.msg.v.yTitle)};\n\t\t\t\tif(ftc==\"cha\"){showCharts( msg.v.values,msg.v.colors,msg.v.engs,msg.v.tags,msg.v.names,msg.v.nos,msg.v.title,msg.v.xtitle,msg.v.ytitle)};\n\t\t\t\tif(ftc==\"shd\"){setSchedule(msg.v);}\n\t\t\t\tif(ftc==\"sta\"){statusMsgDisplayed= false;setStatus(msg.v.stMsg,msg.v.dur,msg.v.pri);}\n\t\t\t\tif(ftc==\"ack\"){clearReq();}\n\t\t\t}\n\t\t}\n\t\tws.onopen = function() { \n\t\t\tstatusMsgDisplayed=false;\n\t\t\tif(daiableWidgets==true){enablePage();}\n\t\t\tsetStatus(\"Connected\",5,0); \n\t\t\tconnected = true;\n\t\t\tvar obj = {\"id\":\"init\",\"v\":document.cookie};\n\t\t\tgetRequest = JSON.stringify(obj); \t\n\t\t\tws.send(getRequest);\t\t\t// Request ui status from NR\n\t\t\tconsole.log(\"sent init requeset\");\n\t\t}\n\t\tws.onclose = function() {\n\t\t\tconsole.log('Node-RED connection closed: '+new Date().toUTCString()); \n\t\t\tconnected = false; \n\t\t\tws = null;\n\t\t\tsetStatus(\"No connection to server!\",0,1);\n\t\t\tif(daiableWidgets==false){disablePage();}\n\t\t\tsetTimeout(wsConn, 10000);\n\t\t}\t\n\t\tws.onerror = function(){\n\t\t\tconsole.log(\"connection error\");\n\t\t}\n\t}\n\twsConn(); \t\t\t\t\t// connect to Node-RED server\n\t\n\tfunction uiInit(values){ \t\t// initialise UI controls\n\t\tvar ui = values; // JSON.parse(values);\n\t\t for (var item in ui) {\n\t\t\tconsole.log(\"init id:\"+item.toString()+\" v:\"+ui[item].v);\n\t\t\tvar m = {\"id\" : item.toString(), \"v\": ui[item].v};\n\t\t\t//console.log(\"m: \"+m);\n\t\t\tinitSetters(m);\n\t\t}\n\t}\n\tfunction initSetters(msg){ \t// update UI widgets on connect \n\t\t//console.log(\"init item id:\"+msg.id+\" value:\"+ msg.v);\n\t\tvar ftc = msg.id.substring(0, 3);\n\t\tif(ftc==\"tsw\"){setFlip(msg.id,msg.v);}\n\t\tif(ftc==\"sld\"){setSlider(msg.id,msg.v);}\n\t\tif(ftc==\"val\"){setValue(msg.id,msg.v);}\n\t\tif(ftc==\"cha\"){showCharts( msg.v.values,msg.v.colors,msg.v.engs,msg.v.tags,msg.v.names,msg.v.nos,msg.v.title,msg.v.xTitle.msg.v.yTitle)};\n\t\tif(ftc==\"shd\"){setSchedule(msg.v);}\n\t\tif(ftc==\"sta\"){setStatus(msg.v);}\n\t}\n\tfunction setFlip(_id,_v){ \t// update flip \n\t\tmyselect = $(\"#\"+_id);\n\t\t//console.log(\"flip id:\"+_id+\" value:\"+_v+\" tyepof:\"+ typeof _v +\" state:\"+myselect.data('state')+\" req:\"+myselect.data('req'));\n\t\t//if(myselect.data('req')==1) return; // request on progress stops flip UI chatter \n\t\tif(myselect.data('state')!=_v){\n\t\t\tif(_v== true || _v=='true'){\n\t\t\t\tmyselect[0].selectedIndex=1; \n\t\t\t\tmyselect.data('state',1)\n\t\t\t} \n\t\t\telse { \n\t\t\t\tmyselect[0].selectedIndex=0;\n\t\t\t\tmyselect.data('state',0);\n\t\t\t}\n\t\t\tmyselect.flipswitch(\"refresh\");\n\t\t\t//myselect.stopImmediatePropagation();\n\t\t\t//console.log(\"jq:\"+myselect[0].selectedIndex+\" flip id:\"+_id+\" v:\"+value+\" data-state:\"+myselect.data('state'));\n\t\t}\n\t}\n\tfunction setSlider(_id,_v){\t// update slider\n\t\tmyselect = $(\"#\"+_id);\n\t\t myselect.val(_v);\n\t\t myselect.slider('refresh');\n\t}\n\tfunction setValue(_id,_v){\t// update value display\n\t\tmyselect = $(\"#\"+_id);\n\t\tmyselect.val(_v);\n\t}\n\tfunction showCharts(_data,colors,engs,tags,names,nos,cTitle,xTitle,yTitle){ // render chart\n\t\tvar seriesNo = [];\n\t\tfor (i=0; i<nos; i++){\n\t\t\tseriesNo.push({}); \n\t\t}\n\t\tconsole.log(\"seriesNo:\"+seriesNo);\n\t\tvar options = {\n\t\t\tchart: {\n\t\t\t\tmarginRight: 30,\n\t\t\t\trenderTo: 'container',\n\t\t\t\ttype: 'spline',\n\t\t\t\t},\n\t\t\t\t title: {\n\t\t\t\t\t\ttext: cTitle\n\t\t\t\t},\n\t\t\t\t xAxis: {\n\t\t\t\t\t type: 'datetime',\n\t\t\t\t\tdateTimeLabelFormats: {\n\t\t\t\t\t\thour: '%H',\n\t\t\t\t\t\tday: '%H <br/>%a %d %b' \n\t\t\t\t\t},\n\t\t\t\t\tgridLineColor: '#C0C0C0',\n\t\t\t\t\ttickInterval: 1 * 3600 * 1000,\n\t\t\t\t\ttitle: {\n\t\t\t\t\t\ttext: xTitle\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t yAxis: {\n\t\t\t\t\ttitle: {\n\t\t\t\t\t\ttext: yTitle\n\t\t\t\t\t},\n\t\t\t\t\tmin: 0,\n\t\t\t\t\tgridLineWidth: 0.5\t\t\t\n\t\t\t\t},\n\t\t\t\ttooltip: {\n\t\t\t\t\tformatter: function() {\n\t\t\t\t\t\teng=engs[this.series.options.id];\n\t\t\t\t\t\ttag=tags[this.series.options.id]; \n\t\t\t\t\t\treturn \"<strong>\"+ Highcharts.numberFormat(this.y, 1) +\"</strong>\"+eng+\" \"+tag+\"<br/>\"+ Highcharts.dateFormat('%a %d %b %H:%M:%S', this.x) +'<br/>';\t\t\t \n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\tseries: seriesNo\n\t\t};\n\t\tfor (i=0; i<nos; i++){\n\t\t\toptions.series[i].id=i;\n\t\t\toptions.series[i].color=colors[i];\n\t\t\toptions.series[i].lineWidth=1;\n\t\t\toptions.series[i].name= names[i];\n\t\t\toptions.series[i].data = JSON.parse(_data[i]);\n\t\t}\n\t\tvar chart = new Highcharts.Chart(options);\n\t}\n\tfunction setSchedule(_v){\t// update schedule \n\t\tconsole.log(\"shed:\"+typeof _v);\n\t\tif(typeof _v == \"string\") { // update from NR\n\t\t\tschedule = JSON.parse(_v);\n\t\t\tlocalStorage[\"schedule\"] = schedule;\n\t\t}\n\t\tconsole.log(\"shed:\"+schedule.items[0].id);\n\t\t$(\"#shd-1\").prop( \"checked\", true ).checkboxradio( \"refresh\" );\n\t\titemLookup = 0;\n\t\t$('#shd-tag').val(schedule.items[0].tag);\n\t\t$('#shd-st').val(schedule.items[0].startTime);\n\t\t$('#shd-st-v').val(schedule.items[0].startValue);\n\t\t$('#shd-et').val(schedule.items[0].endTime);\n\t\t$('#shd-et-v').val(schedule.items[0].endValue);\n\t\t$(\"checkbox\").prop( \"checked\", false ).checkboxradio( \"refresh\" );\n\t\tfor (dow = 0; dow< 7; dow++) {\n\t\t\tvar dowUI = '#shd-dow-'+dow;\n\t\t\tif (schedule.items[0].dofWeek[dow]==1){\n\t\t\t\t$(dowUI).prop( \"checked\", true ).checkboxradio( \"refresh\" );\n\t\t\t} else {\n\t\t\t\t$(dowUI).prop( \"checked\", false ).checkboxradio( \"refresh\" );\n\t\t\t}\n\t\t}\t\n\t\tif(schedule.items[0].noEndTime == true){\n\t\t\t$(\"#shd-noet\").prop( \"checked\", true ).checkboxradio( \"refresh\" );\n\t\t\t$('#shd-et').textinput( \"disable\" );\n\t\t\t$('#shd-et-v').textinput( \"disable\" );\n\t\t}else {\n\t\t\t$(\"#shd-noet\").prop( \"checked\", false ).checkboxradio( \"refresh\" );\n\t\t}\n\t}\n\tfunction setStatus(msg,dur,pri){\t // show msg on status bar\n\t\tconsole.log(\"statusMsgDisplayed:\"+statusMsgDisplayed);\n\t\tif(statusMsgDisplayed== true){return};\n\t\tstatusMsgDisplayed=true;\n\t\tif(pri>0 && prioritySet == false ){\n\t\t\tprioritySet = true;\t\t\t\n\t\t\t$(\"#statusView\").toggleClass(\"statusViewAlert\"); // toggle ON\n\t\t} else if ( pri==0 && prioritySet == true) {\n\t\t\tprioritySet = false;\n\t\t\t$(\"#statusView\").toggleClass(\"statusViewAlert\"); // toggle Off\n\t\t}\n\t\t$(\"#statusView\").show();\n\t\t$(\"#statusView\").html(msg);\n\t\tdur = dur*1000;\n\t\tif(dur >0){\n\t\t\tsetTimeout(function(){$(\"#statusView\").hide(200);$(\"#statusView\").html(\"\"); statusMsgDisplayed= false;prioritySet=false;},dur)\n\t\t}\n\t}\n\tfunction disablePage(){\t\t\n\t\t$(\"[data-role=flipswitch]\").flipswitch( \"disable\" );\n\t\t//$(\"[data-role=range]\").disabled = true;\n\t\t$(\"[data-role=range]\").slider( \"option\", \"disabled\", true );\n\t\t$(\"[data-rel=popup]\").toggleClass(\"ui-disabled\");\n\t\tdaiableWidgets = true;\n\t}\n\tfunction enablePage(){\n\t\t$(\"[data-role=flipswitch]\").flipswitch( \"enable\" );\n\t\t$(\"[data-role=range]\").slider( \"option\", \"enabled\", true );\n\t\t$(\"[data-role=range]\").slider( \"enable\" );\n\t\t$(\"[data-rel=popup]\").toggleClass(\"ui-disabled\");\n\t\tdaiableWidgets = false;\n\t}\t\n\t$(function() { \t\t\t\t// UI event handlers \n\t\t// Flip-switch change\n\t\t$(\"[data-role=flipswitch]\").bind( \"change\", function(event, ui) {\n\t\t\t//console.log(\"id:\"+this.id+\" val:\"+$(this).flipswitch().val()+\" state:\"+$(this).data('state')+\" req:\"+$(this).data('reqstate'));\n\t\t\tvar _value = $(this).flipswitch().val();\n\t\t\tif($(this).data('state') != _value){\n\t\t\t\t$(this).data('state',_value); \n\t\t\t\tvar obj = {\"id\":\"\"+this.id+\"\",\"v\":_value};\n\t\t\t\tsetActions = JSON.stringify(obj); \t\n\t\t\t\tws.send(setActions);\n\t\t\t}\n\t\t});\n\t\t// Slider end\n\t\t$(\".ui-slider\").bind( \"slidestop\", function(event, ui) {\n\t\t\tvar obj = {\"id\":\"\"+event.target.id+\"\",\"v\":event.target.value};\n\t\t\tsetActions = JSON.stringify(obj); \t\n\t\t\tws.send(setActions);\n\t\t});\n\t\t// Popup send\n\t\t$(\"[data-ui-type=pop-save]\").bind( \"click\", function(event, ui) {\n\t\t\tbid = this.id.split(\"_\");\n\t\t\twid =\"#\"+bid[0]+\"-pop\";\n\t\t\t$(wid ).popup( \"close\" );\n\t\t\ttid=\"#\"+bid[0];\n\t\t\tvar obj = {\"id\":\"\"+bid[0]+\"\",\"v\":$(tid ).val()};\n\t\t\tsetActions = JSON.stringify(obj); \t\n\t\t\tws.send(setActions);\n\t\t});\n\t\t$( document ).on( \"vmouseout\", \"textarea\", function() {\n\t\t\tconsole.log(\"text id: \"+this.id+\" v:\"+$(this ).val());\n\t\t\tvar obj = {\"id\":\"\"+this.id+\"\",\"v\":$(this ).val()};\n\t\t\tsetActions = JSON.stringify(obj); \t\n\t\t\tws.send(setActions);\n\t\t});\n\t\t// Grouped Radio buttons click\n\t\t$(\"[data-ui-type=shd-sel]\").bind( \"click\", function(event, ui) {\n\t\t\t$(\"[data-ui-type=shd-sel]\").prop( \"checked\", false ).checkboxradio( \"refresh\" );\n\t\t\t$(this ).prop( \"checked\", true ).checkboxradio( \"refresh\" );\n\t\t\tvar item = this.id.split(\"-\");\n\t\t\tif( itemLookup == null){\n\t\t\t\t itemLookup = item[1]-1;\n\t\t\t } else {\n\t\t\t\t// Copy current item edits back schedule in memory obj\n\t\t\t\tschedule.items[itemLookup].tag\t\t = $('#shd-tag').val();\n\t\t\t\tschedule.items[itemLookup].startTime = $('#shd-st').val();\n\t\t\t\tschedule.items[itemLookup].startValue = $('#shd-st-v').val();\n\t\t\t\tschedule.items[itemLookup].endTime\t = $('#shd-et').val();\n\t\t\t\tschedule.items[itemLookup].endValue\t = $('#shd-et-v').val();\n\t\t\t\tschedule.items[itemLookup].noEndTime = $('#shd-noet').prop( \"checked\");\n\t\t\t\tfor (dow = 0; dow< 7; dow++) {\n\t\t\t\t\tvar dowUI = '#shd-dow-'+dow;\n\t\t\t\t\tif( $(dowUI).prop( \"checked\")){\n\t\t\t\t\t\tschedule.items[itemLookup].dofWeek[dow] = 1 ;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tschedule.items[itemLookup].dofWeek[dow] = 0 ;\n\t\t\t\t\t}\n\t\t\t\t} \n\t\t\t\titemLookup = item[1]-1;\n\t\t\t }\n\t\t\t // now update UI widgets with next item values\n\t\t\tconsole.log(\"shed item\"+item[1]+\" lookup tag:\"+schedule.items[itemLookup].tag);\n\t\t\t$('#shd-tag').val(schedule.items[itemLookup].tag);\n\t\t\t$('#shd-st').val(schedule.items[itemLookup].startTime);\n\t\t\t$('#shd-st-v').val(schedule.items[itemLookup].startValue);\n\t\t\t$('#shd-et').val(schedule.items[itemLookup].endTime);\n\t\t\t$('#shd-et-v').val(schedule.items[itemLookup].endValue);\n\t\t\t\n\t\t\tif(schedule.items[itemLookup].noEndTime == true){\n\t\t\t\t$(\"#shd-noet\").prop( \"checked\", true ).checkboxradio( \"refresh\" );\n\t\t\t\t$('#shd-et').textinput( \"disable\" );\n\t\t\t\t$('#shd-et-v').textinput( \"disable\" );\n\t\t\t}else {\n\t\t\t\t$(\"#shd-noet\").prop( \"checked\", false ).checkboxradio( \"refresh\" );\n\t\t\t\t$('#shd-et').textinput( \"enable\" );\n\t\t\t\t$('#shd-et-v').textinput( \"enable\" );\n\t\t\t}\n\t\t\t\n\t\t\t//console.log(\"group radio - id:\"+ this.id+\" val:\"+$(this).val());\n\t\t\tfor (dow = 0; dow< 7; dow++) {\n\t\t\t\tvar dowUI = '#shd-dow-'+dow;\n\t\t\t\tif (schedule.items[itemLookup].dofWeek[dow]==1){\n\t\t\t\t\t$(dowUI).prop( \"checked\", true ).checkboxradio( \"refresh\" )\n\t\t\t\t} else {\n\t\t\t\t\t$(dowUI).prop( \"checked\", false ).checkboxradio( \"refresh\" )\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\t// Schedule save\n\t\t$( \"#shd-save\" ).bind( \"click\", function(event, ui) {\n\t\t\tconsole.log(\"shd-save\");\n\t\t\tif( itemLookup != null){\n\t\t\t\tschedule.items[itemLookup].tag\t\t = $('#shd-tag').val();\n\t\t\t\tschedule.items[itemLookup].startTime = $('#shd-st').val();\n\t\t\t\tschedule.items[itemLookup].startValue = $('#shd-st-v').val();\n\t\t\t\tschedule.items[itemLookup].endTime\t = $('#shd-et').val();\n\t\t\t\tschedule.items[itemLookup].endValue\t = $('#shd-et-v').val();\n\t\t\t\tschedule.items[itemLookup].noEndTime = $('#shd-noet').prop( \"checked\");\n\t\t\t\tfor (dow = 0; dow< 7; dow++) {\n\t\t\t\t\tvar dowUI = '#shd-dow-'+dow;\n\t\t\t\t\tif( $(dowUI).prop( \"checked\")){\n\t\t\t\t\t\tschedule.items[itemLookup].dofWeek[dow] = 1 ;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tschedule.items[itemLookup].dofWeek[dow] = 0 ;\n\t\t\t\t\t}\n\t\t\t\t} \n\t\t\t\tlocalStorage[\"schedule\"] = schedule;\n\t\t\t\tvar obj = {\"id\":\"shd-save\",\"v\":schedule};\n\t\t\t\tgetRequest = JSON.stringify(obj); \t\n\t\t\t\tws.send(getRequest);\n\t\t\t}\n\t\t});\n\t\t// Schedule noEndTime\n\t\t$( \"#shd-noet\" ).bind( \"click\", function(event, ui) {\t\n\t\t\tvar isChecked = $('#shd-noet').prop( \"checked\");\n\t\t\t//console.log(\" isChecked :\"+ isChecked );\n\t\t\tif(isChecked ==true){\n\t\t\t\t$('#shd-et').textinput( \"disable\" );\n\t\t\t\t$('#shd-et-v').textinput( \"disable\" );\n\t\t\t} else {\n\t\t\t\t$('#shd-et').textinput( \"enable\" );\n\t\t\t\t$('#shd-et-v').textinput( \"enable\" );\n\t\t\t}\n\t\t});\n\t\t// Utills\n\t\tvar showHide=0;\n\t\t$(window).keydown(function(event) {\n\t\t\tif(event.shiftKey && event.keyCode == 68 ) { \n\t\t\t\t//console.log(event.keyCode);\n\t\t\t\tif(showHide==0){$(\"#foo\").show('slow');showHide=1;}else{$(\"#foo\").hide();showHide=0;}\n\t\t\t\tevent.preventDefault(); \n\t\t\t}\n\t\t}); \n\t\t$( document ).on( \"vclick\", \"#b1\", function() {\n\t\t\tlocation.reload();\n\t\t\tconsole.log(\"reload button\");\n\t\t});\t\n\t});\n </script>\n <style>\n\t\t#c1, #c2 {background-color: #FFF !important;}\n \t\tdiv .ui-input-text {padding:0 .4em;} \n\t\t.valLable {float: left !important; min-width: 85px !important; margin-top:4px !important; padding: 0;}\n\t\t.valLableEnd {float: left !important; min-width: 85px !important; margin-top:14px !important; padding: 0;}\n\t\t.valSmall {width:70px; height: 40px !important; float: left !important; margin-top:-12px !important;}\n\t\t.valMedium {width:156px; height: 40px !important; float: left !important; margin-top:-12px !important;}\n\t\t.valLarge {width:220px; height: 40px !important; float: left !important; margin-top:-12px !important;}\n\t\t.valHour {width:100px; height: 40px !important; float: left !important; margin-top:-12px !important;}\n\t\t.valHourEnd {width:100px; height: 40px !important; float: left !important; margin-top:0 !important; margin-left:12px !important; }\n\t\t.flipLable {float: left !important; min-width: 140px !important;}\n\t\t@media only screen and (min-width: 521px){\n\t\t\t#header1 {width: 507px !important; margin:auto auto !important; position: relative !important; border:1px solid #cccccc;}\n\t\t\t#c1 {width: 475px !important; min-height:500px !important; margin:auto auto !important; position: relative !important; border:1px solid #cccccc; border-top:0px;}\n\t\t\t#c2 {width: 475px !important; min-height:500px !important; margin:auto auto !important; position: relative !important; border:1px solid #cccccc; border-top:0px;}\n\t\t\t.t1 {width: 506px !important; margin:auto auto !important; position: relative !important; padding-right: 4px !important;}\n\t\t\t.flipLable {float: left !important; min-width: 320px !important;}\n\t\t\t.valMedium {width:330px; height: 40px !important; float: left !important; margin-top:-12px !important;}\n\t\t\t.sep {display: none !important;}\n\t\t}\t\n\t\t.alert {font-weight: bold; color: #FF6C01;}\n\t\t.smallin .ui-input-text {width: 200px !important; color:red;}\n\t\tlegend.h1lb {padding:0 0 0 0;}\n\t\t.statusView {width: 100% !important; margin:0px; position: relative !important; height:28px; padding:10px 0 0 0; background-color:#E9E9E9; font-weight:bold; -webkit-border-radius: 0.7em !important; border-radius: 0.7em; text-align:center; }\n\t\t.statusViewAlert {width: 100% !important; margin:0px; position: relative !important; height:28px; padding:10px 0 0 0; background-color:#F8B584 !important; font-weight:bold; -webkit-border-radius: 0.7em !important; border-radius: 0.7em; display:none; text-align:center; }\n\t\t.ui-flipswitch {\"border-radius: 2em !important; -webkit-border-radius: 2em !important; -moz-border-radius: 2em !important;}\n\t\t/* Active button */\n\t\t.ui-page-theme-a .ui-btn.ui-btn-active,html .ui-bar-a .ui-btn.ui-btn-active,html .ui-body-a .ui-btn.ui-btn-active,html body .ui-group-theme-a .ui-btn.ui-btn-active,html head + body .ui-btn.ui-btn-a.ui-btn-active,\n\t\t/* Active checkbox icon */\n\t\t.ui-page-theme-a .ui-checkbox-on:after,html .ui-bar-a .ui-checkbox-on:after,html .ui-body-a .ui-checkbox-on:after,html body .ui-group-theme-a .ui-checkbox-on:after,.ui-btn.ui-checkbox-on.ui-btn-a:after,\n\t\t/* Active flipswitch background */.ui-page-theme-a .ui-flipswitch-active,html .ui-bar-a .ui-flipswitch-active,html .ui-body-a .ui-flipswitch-active,html body .ui-group-theme-a .ui-flipswitch-active,\n\t\thtml body .ui-flipswitch.ui-bar-a.ui-flipswitch-active,\n\t\t/* Active slider track */\n\t\t.ui-page-theme-a .ui-slider-track .ui-btn-active,html .ui-bar-a .ui-slider-track .ui-btn-active,html .ui-body-a .ui-slider-track .ui-btn-active,html body .ui-group-theme-a .ui-slider-track .ui-btn-active,html body div.ui-slider-track.ui-body-a .ui-btn-active {\n\t\t\tbackground-color: \t\t#FF6C01 !important;\n\t\t\tborder-color:\t \t\t#FF6C01 !important;\n\t\t\tcolor: \t\t\t\t\t#fff /*{a-active-color}*/;\n\t\t\ttext-shadow: 0 /*{a-active-shadow-x}*/ 1px /*{a-active-shadow-y}*/ 0 /*{a-active-shadow-radius}*/ #005599 /*{a-active-shadow-color}*/;\n\t\t}\n </style>\n</head>\n<body>\n <!-- Home -->\n <div data-role=\"page\" id=\"noderedmobiui\">\n <div id=\"header1\" data-role=\"header\">\n <h3 style=\"color:#FF6C01\">mobi ui v1.1</h3>\n\t\t<a href=\"#\" title=\"reload\" class=\"ui-btn ui-shadow ui-corner-all ui-icon-refresh ui-btn-icon-notext ui-btn-inline\" id=\"b1\" >Reload</a>\t\n\t</div>\n\t<div data-role=\"tabs\" style=\"margin-top: -5px;\">\n\t\t<div data-role=\"navbar\">\n\t\t\t<ul class=\"t1\">\n\t\t\t <li><a id=\"c1tab\" href=\"#c1\" data-theme=\"a\" data-ajax=\"false\">Controls</a></li>\n\t\t\t <li><a id=\"c2tab\" href=\"#c2\" data-theme=\"a\" data-ajax=\"false\" style=\"border-right: 1px solid #D8D8D8;\">Schedule</a></li>\n\t\t\t</ul>\n\t\t</div>\n\t\t<div id=\"c1\" class=\"ui-content\">\n\t\t\t<div id=\"statusView\" class=\"statusView\" style=\"display:none;\"></div>\t\t\n\t\t\t<ul data-role=\"listview\" data-inset=\"true\">\n\t\t\t\t<li class=\"ui-field-contain\" >\n\t\t\t\t\t<label for=\"tsw-1\" class=\"flipLable\">tsw-1</label>\n\t\t\t\t\t<select id=\"tsw-1\" data-role=\"flipswitch\" data-state=\"0\" data-req=\"\">\n\t\t\t\t\t <option value=\"0\">Off</option>\n\t\t\t\t\t <option value=\"1\">On</option>\n\t\t\t\t\t</select>\n\t\t\t\t</li>\n\t\t\t\t<li class=\"ui-field-contain\">\n\t\t\t\t\t<label for=\"tsw-2\" class=\"flipLable\">tsw-2</label>\n\t\t\t\t\t<select id=\"tsw-2\" data-role=\"flipswitch\" data-state=\"0\" data-req=\"\">\n\t\t\t\t\t <option value=\"0\">Off</option>\n\t\t\t\t\t <option value=\"1\">On</option>\n\t\t\t\t\t</select>\n\t\t\t\t</li>\n\t\t\t\t<li class=\"ui-field-contain\">\n\t\t\t\t\t<label for=\"sld-1\">sld-1</label>\n\t\t\t\t\t<input id=\"sld-1\" type=\"range\" data-role=\"range\" value=\"0\" min=\"0\" max=\"100\" step=\"1\" data-highlight=\"true\" />\n\t\t\t\t</li>\n\t\t\t\t<li class=\"ui-field-contain\">\n\t\t\t\t\t<label for=\"val-1\" class=\"valLable\">val-1</label>\n\t\t\t\t\t<div class=\"valSmall\"><input type=\"text\" id=\"val-1\" placeholder=\"\" value=\"\" readonly=\"readonly\"></div>\n\t\t\t\t</li>\n\t\t\t\t<li class=\"ui-field-contain\"> \n\t\t\t\t\t<label for=\"txt-1\">txt-1</label>\t\n\t\t\t\t <textarea id=\"txt-1\" cols=\"30\" rows=\"60\" maxlength=\"140\"></textarea>\n\t\t\t\t</li>\n\t\t\t </ul>\n\t\t\t<div id=\"container\" style=\"width: 100%; margin-left:-5px;\"></div>\t\t\n\t\t</div>\n\t\t<div id=\"c2\" data-role=\"content\">\n\t\t\t<ul data-role=\"listview\" data-inset=\"true\" style=\"padding:10px;\">\n\t\t\t\t<fieldset data-role=\"controlgroup\" data-type=\"horizontal\" data-mini=\"true\">\n\t\t\t\t\t<legend>Event</legend>\n\t\t\t\t\t<label for=\"shd-1\">1</label>\t\n\t\t\t\t\t<input type=\"checkbox\" id=\"shd-1\" data-ui-type=\"shd-sel\">\n\t\t\t\t\t<label for=\"shd-2\">2</label>\t\n\t\t\t\t\t<input type=\"checkbox\" id=\"shd-2\" data-ui-type=\"shd-sel\">\n\t\t\t\t\t<label for=\"shd-3\">3</label>\t\n\t\t\t\t\t<input type=\"checkbox\" id=\"shd-3\" data-ui-type=\"shd-sel\">\n\t\t\t\t\t<label for=\"shd-4\">4</label>\t\n\t\t\t\t\t<input type=\"checkbox\" id=\"shd-4\" data-ui-type=\"shd-sel\">\n\t\t\t\t\t<label for=\"shd-5\">5</label>\t\n\t\t\t\t\t<input type=\"checkbox\" id=\"shd-5\" data-ui-type=\"shd-sel\">\n\t\t\t\t\t<label for=\"shd-6\">6</label>\t\n\t\t\t\t\t<input type=\"checkbox\" id=\"shd-6\" data-ui-type=\"shd-sel\">\n\t\t\t\t\t<label for=\"shd-7\">07</label>\t\n\t\t\t\t\t<input type=\"checkbox\" id=\"shd-7\" data-ui-type=\"shd-sel\">\n\t\t\t\t\t<label for=\"shd-8\">08</label>\t\n\t\t\t\t\t<input type=\"checkbox\" id=\"shd-8\" data-ui-type=\"shd-sel\">\n\t\t\t\t\t<label for=\"shd-9\">09</label>\t\n\t\t\t\t\t<input type=\"checkbox\" id=\"shd-9\" data-ui-type=\"shd-sel\">\n\t\t\t\t\t<label for=\"shd-10\">10</label>\t\n\t\t\t\t\t<input type=\"checkbox\" id=\"shd-10\" data-ui-type=\"shd-sel\">\n\t\t\t\t\t<label for=\"shd-11\">11</label>\t\n\t\t\t\t\t<input type=\"checkbox\" id=\"shd-11\" data-ui-type=\"shd-sel\">\n\t\t\t\t\t<label for=\"shd-12\">12</label>\t\n\t\t\t\t\t<input type=\"checkbox\" id=\"shd-12\" data-ui-type=\"shd-sel\">\n\t\t\t\t\t<label for=\"shd-13\">13</label>\t\n\t\t\t\t\t<input type=\"checkbox\" id=\"shd-13\" data-ui-type=\"shd-sel\">\n\t\t\t\t\t<label for=\"shd-14\">14</label>\t\n\t\t\t\t\t<input type=\"checkbox\" id=\"shd-14\" data-ui-type=\"shd-sel\">\n\t\t\t\t\t<label for=\"shd-15\">15</label>\t\n\t\t\t\t\t<input type=\"checkbox\" id=\"shd-15\" data-ui-type=\"shd-sel\">\n\t\t\t\t\t<label for=\"shd-16\">16</label>\t\n\t\t\t\t\t<input type=\"checkbox\" id=\"shd-16\" data-ui-type=\"shd-sel\">\n\t\t\t\t\t<label for=\"shd-17\">17</label>\t\n\t\t\t\t\t<input type=\"checkbox\" id=\"shd-17\" data-ui-type=\"shd-sel\">\n\t\t\t\t\t<label for=\"shd-18\">18</label>\t\n\t\t\t\t\t<input type=\"checkbox\" id=\"shd-18\" data-ui-type=\"shd-sel\">\n\t\t\t\t\t<label for=\"shd-19\">19</label>\t\n\t\t\t\t\t<input type=\"checkbox\" id=\"shd-19\" data-ui-type=\"shd-sel\">\n\t\t\t\t\t<label for=\"shd-20\">20</label>\t\n\t\t\t\t\t<input type=\"checkbox\" id=\"shd-20\" data-ui-type=\"shd-sel\">\n\t\t\t\t\t<label for=\"shd-21\">21</label>\t\n\t\t\t\t\t<input type=\"checkbox\" id=\"shd-21\" data-ui-type=\"shd-sel\">\n\t\t\t\t</fieldset>\n\t\t\t\t</ul>\t\n\t\t\t\t<ul data-role=\"listview\" data-inset=\"true\">\n\t\t\t\t<li class=\"ui-field-contain\">\n\t\t\t\t\t<label for=\"shd-tag\" class=\"valLable\">Tag:</label>\n\t\t\t\t\t<div class=\"valMedium\"><input type=\"text\" data-clear-btn=\"\" id=\"shd-tag\" value=\"\"></div>\n\t\t\t\t</li>\n\t\t\t\t<li class=\"ui-field-contain\">\n\t\t\t\t\t<label for=\"shd-st\" class=\"valLable\">Start time</label>\n\t\t\t\t\t<div class=\"valHour\"><input type=\"time\" data-clear-btn=\"\" id=\"shd-st\" value=\"\"></div><br /><br />\n\t\t\t\t\t<label for=\"shd-st-v\" class=\"valLable\">Value</label>\n\t\t\t\t\t<div class=\"valMedium\"><input type=\"text\" data-clear-btn=\"false\" id=\"shd-st-v\" value=\"\"></div>\n\t\t\t\t</li>\n\t\t\t\t<li class=\"ui-field-contain\" id=\"endTime\">\t\t\t\t\n\t\t\t\t\t<div class=\"ui-grid-a\">\n\t\t\t\t\t<div class=\"ui-block-a\"><label for=\"shd-et\" class=\"valLableEnd\">End time</label><div class=\"valHourEnd\">\n\t\t\t\t\t<input type=\"time\" data-clear-btn=\"\" name=\"shd-et\" id=\"shd-et\" value=\"\"></div></div>\n\t\t\t\t\t<div class=\"ui-block-b\" style=\"width:100px\"><label for=\"shd-noet\">No</label><input type=\"checkbox\" id=\"shd-noet\" data-inset=\"true\"></div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<label for=\"shd-et-v\" class=\"valLable\">Value</label><div class=\"valMedium\"><input type=\"text\" data-clear-btn=\"false\" name=\"shd-et-v\" id=\"shd-et-v\" value=\"\"></div>\t\t\t\t\n\t\t\t\t</li>\t\t\n\t\t\t\t<li class=\"ui-field-contain\" class=\"flab\">\n\t\t\t\t\t<fieldset data-role=\"controlgroup\" data-type=\"horizontal\" data-mini=\"true\">\n\t\t\t\t\t\t<legend>Days</legend>\n\t\t\t\t\t\t<label for=\"shd-dow-1\">Mn</label>\t\n\t\t\t\t\t\t<input type=\"checkbox\" name=\"\" id=\"shd-dow-1\">\n\t\t\t\t\t\t<label for=\"shd-dow-2\">Tu</label>\n\t\t\t\t\t\t<input type=\"checkbox\" id=\"shd-dow-2\">\n\t\t\t\t\t\t<label for=\"shd-dow-3\">Wd</label>\n\t\t\t\t\t\t<input type=\"checkbox\" name=\"\" id=\"shd-dow-3\">\n\t\t\t\t\t\t<label for=\"shd-dow-4\">Th</label>\n\t\t\t\t\t\t<input type=\"checkbox\" id=\"shd-dow-4\">\n\t\t\t\t\t\t<label for=\"shd-dow-5\" >Fr</label>\n\t\t\t\t\t\t<input type=\"checkbox\" name=\"\" id=\"shd-dow-5\"><br class=\"sep\" />\n\t\t\t\t\t\t<label for=\"shd-dow-6\" >St</label>\n\t\t\t\t\t\t<input type=\"checkbox\" id=\"shd-dow-6\">\n\t\t\t\t\t\t<label for=\"shd-dow-0\" >Sn</label> \n\t\t\t\t\t\t<input type=\"checkbox\" id=\"shd-dow-0\">\n\t\t\t\t\t</fieldset>\n\t\t\t\t\t<button id=\"shd-save\" type=\"submit\" data-theme=\"a\" value=\"submit-value\" >Save</button>\n\t\t\t\t</li>\n\t\t\t</ul>\n\t\t</div><!-- eof c2 content -->\n\t </div><!-- eof tabs -->\n\t</div><!-- eof page -->\n </body>\n</html>","x":488.14283752441406,"y":98.42857360839844,"z":"ff75fda.f008a","wires":[["79b4bbb6.864b44"]]},{"id":"8a5c23bf.75a3e","type":"debug","name":"","active":false,"console":"false","complete":"false","x":648.5872955322266,"y":866.6508026123047,"z":"ff75fda.f008a","wires":[]}]