Hi guys ! I want to set the button state after i start the node-red server , from a file .... I tried , and if i send a true or false value to the button , i can controll it ...like this:
but , when i want to read the values from a file , and then send a true or false boolean to the switches ,it doesn't work ... could somebody help me ?
[{"id":"ce673659.151b88","type":"ui_switch","z":"40d60af2.cf9d14","name":"","label":"Befúvás be :50%","tooltip":"","group":"1892c41.a11ce3c","order":2,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"on","onvalueType":"str","onicon":"","oncolor":"","offvalue":"off","offvalueType":"str","officon":"","offcolor":"","x":190,"y":60,"wires":[["97198341.91665"]]},{"id":"40f98b39.c2f0b4","type":"ui_switch","z":"40d60af2.cf9d14","name":"","label":"Befúvás be :100%","tooltip":"","group":"1892c41.a11ce3c","order":2,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"on","onvalueType":"str","onicon":"","oncolor":"","offvalue":"off","offvalueType":"str","officon":"","offcolor":"","x":190,"y":100,"wires":[["617b0f17.dac41"]]},{"id":"a2910f29.dda35","type":"ui_switch","z":"40d60af2.cf9d14","name":"","label":"Elszívás be :50%","tooltip":"","group":"1892c41.a11ce3c","order":2,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"on","onvalueType":"str","onicon":"","oncolor":"","offvalue":"off","offvalueType":"str","officon":"","offcolor":"","x":190,"y":140,"wires":[["91e0ef01.20a4e"]]},{"id":"532e8d4.68b2074","type":"ui_switch","z":"40d60af2.cf9d14","name":"","label":"Elszívás be :100%","tooltip":"","group":"1892c41.a11ce3c","order":2,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"on","onvalueType":"str","onicon":"","oncolor":"","offvalue":"off","offvalueType":"str","officon":"","offcolor":"","x":190,"y":180,"wires":[["909e1c34.083d7"]]},{"id":"ce130d9c.434aa","type":"ui_switch","z":"40d60af2.cf9d14","name":"","label":"Fűtés be :33%","tooltip":"Fizikailag korlátozva 33%ra","group":"1892c41.a11ce3c","order":2,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"on","onvalueType":"str","onicon":"","oncolor":"","offvalue":"off","offvalueType":"str","officon":"","offcolor":"","x":180,"y":220,"wires":[["372347bb.d916f8"]]},{"id":"a01afab9.ef5588","type":"function","z":"40d60af2.cf9d14","name":"SET-COLOR","func":"msg.color3 = (msg.payload === \"on\")?\"lime\":\"red\";\nglobal.set(\"color3\",msg.color3)\n\nmsg.color2 = context.get('color2')||\"black\";\nmsg.color1 = context.get('color1')||\"black\";\nmsg.color4 = context.get('color4')||\"black\";\nmsg.color5 = context.get('color5')||\"black\";\n\nreturn msg;","outputs":1,"noerr":0,"x":630,"y":140,"wires":[["5eee63dd.14224c","f5e791ce.e5f"]]},{"id":"25a63c4b.876284","type":"function","z":"40d60af2.cf9d14","name":"SET-COLOR","func":"msg.color4 = (msg.payload === \"on\")?\"lime\":\"red\";\nglobal.set(\"color4\",msg.color4)\n\nmsg.color2 = context.get('color2')||\"black\";\nmsg.color3 = context.get('color3')||\"black\";\nmsg.color1 = context.get('color1')||\"black\";\nmsg.color5 = context.get('color5')||\"black\";\n\nreturn msg;","outputs":1,"noerr":0,"x":630,"y":180,"wires":[["5eee63dd.14224c","f5e791ce.e5f"]]},{"id":"c3e4368c.ed8118","type":"function","z":"40d60af2.cf9d14","name":"SET-COLOR","func":"msg.color5 = (msg.payload === \"on\")?\"lime\":\"red\";\nglobal.set(\"color5\",msg.color5)\n\nmsg.color2 = context.get('color2')||\"black\";\nmsg.color3 = context.get('color3')||\"black\";\nmsg.color4 = context.get('color4')||\"black\";\nmsg.color1 = context.get('color1')||\"black\";\n\nreturn msg;","outputs":1,"noerr":0,"x":630,"y":220,"wires":[["5eee63dd.14224c","f5e791ce.e5f"]]},{"id":"1ed964f6.3bab0b","type":"ui_template","z":"40d60af2.cf9d14","group":"1892c41.a11ce3c","name":"","order":0,"width":"15","height":"10","format":"<div ng-bind-html=\"msg.payload\"></div>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":1080,"y":60,"wires":[[]]},{"id":"5eee63dd.14224c","type":"template","z":"40d60af2.cf9d14","name":"","field":"template","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<svg width=\"625\" height=\"400.00000000000006\" xmlns=\"http://www.w3.org/2000/svg\">\n <!-- Created with Method Draw - http://github.com/duopixel/Method-Draw/ -->\n <g>\n <title>background</title>\n <rect fill=\"#fff\" id=\"canvas_background\" height=\"402\" width=\"627\" y=\"-1\" x=\"-1\"/>\n <g display=\"none\" overflow=\"visible\" y=\"0\" x=\"0\" height=\"100%\" width=\"100%\" id=\"canvasGrid\">\n <rect fill=\"url(#gridpattern)\" stroke-width=\"0\" y=\"0\" x=\"0\" height=\"100%\" width=\"100%\"/>\n </g>\n </g>\n <g>\n <title>Layer 1</title>\n <rect id=\"also\" height=\"101.481327\" width=\"266.666262\" y=\"193.703711\" x=\"159.537269\" stroke-width=\"1.5\" stroke=\"#000\" fill=\"#fff\"/>\n <rect id=\"felso\" height=\"101.481327\" width=\"266.666262\" y=\"92.22238\" x=\"159.537269\" stroke-width=\"1.5\" stroke=\"#000\" fill=\"#fff\"/>\n <rect id=\"hocserelo\" height=\"200.740431\" width=\"68.888784\" y=\"93.703858\" x=\"196.57425\" stroke-width=\"1.5\" fill=\"#fff\" />\n <rect id=\"zsalu\" height=\"99.25911\" width=\"27.407366\" y=\"92.963118\" x=\"281.018566\" fill-opacity=\"null\" stroke-opacity=\"null\" stroke-width=\"1.5\" fill=\"#fff\"/>\n <rect id=\"befuvo\" height=\"70.370263\" width=\"39.999939\" y=\"110.740871\" x=\"360.277705\" fill-opacity=\"null\" stroke-opacity=\"null\" stroke-width=\"1.5\" stroke=\"#000\" fill={{global.color1}}/>\n <rect id=\"kifuvo\" height=\"70.370263\" width=\"39.999939\" y=\"211.851877\" x=\"360.277705\" fill-opacity=\"null\" stroke-opacity=\"null\" stroke-width=\"1.5\" stroke=\"#000\" fill={{global.color2}}/>\n <rect id=\"svg_10\" height=\"59.259169\" width=\"22.222188\" y=\"108.148267\" x=\"138.055821\" fill-opacity=\"null\" stroke-opacity=\"null\" stroke-width=\"1.5\" stroke=\"#000\" fill=\"#fff\"/>\n <rect id=\"svg_11\" height=\"59.259169\" width=\"22.222188\" y=\"215.555538\" x=\"136.944696\" fill-opacity=\"null\" stroke-opacity=\"null\" stroke-width=\"1.5\" stroke=\"#000\" fill=\"#fff\"/>\n <rect id=\"svg_12\" height=\"59.259169\" width=\"22.222188\" y=\"108.518651\" x=\"421.759502\" fill-opacity=\"null\" stroke-opacity=\"null\" stroke-width=\"1.5\" stroke=\"#000\" fill=\"#fff\"/>\n <ellipse ry=\"9.259245\" rx=\"9.999985\" id=\"ho1\" cy=\"218.88887\" cx=\"328.796272\" fill-opacity=\"null\" stroke-opacity=\"null\" stroke-width=\"1.5\" stroke=\"#000\" fill=\"#fff\"/>\n <ellipse ry=\"9.259245\" rx=\"9.999985\" id=\"ho2\" cy=\"248.88887\" cx=\"328.796272\" fill-opacity=\"null\" stroke-opacity=\"null\" stroke-width=\"1.5\" stroke=\"#000\" fill=\"#fff\"/>\n <ellipse ry=\"9.259245\" rx=\"9.999985\" id=\"ho3\" cy=\"278.88887\" cx=\"328.796272\" fill-opacity=\"null\" stroke-opacity=\"null\" stroke-width=\"1.5\" stroke=\"#000\" fill=\"#fff\"/>\n <ellipse id=\"svg_16\" cy=\"301.110952\" cx=\"533.610775\" fill-opacity=\"null\" stroke-opacity=\"null\" stroke-width=\"1.5\" stroke=\"#000\" fill=\"#fff\"/>\n <rect stroke=\"#000\" id=\"svg_17\" height=\"77.036917\" width=\"41.481411\" y=\"210.7409\" x=\"421.759511\" fill-opacity=\"null\" stroke-opacity=\"null\" stroke-width=\"1.5\" fill=\"#fff\"/>\n <path stroke=\"#000\" id=\"svg_18\" d=\"m217.878701,179.133184c0.754926,2.360887 1.505702,5.422662 2.276026,8.881573c0.111105,-0.529407 0.215967,-1.042628 0.327108,-1.583226c1.114932,-5.422867 2.3784,-11.562891 3.794211,-17.504215c0.224725,-0.965252 0.460712,-1.776319 0.689604,-2.686675c-1.062494,-4.131864 -2.234416,-8.098275 -3.648156,-11.507601c-2.186134,-5.340065 -5.042315,-9.052745 -8.217272,-8.975671l-13.758989,0l0,26.060733l13.761489,0c1.913539,0.121346 3.126682,2.17334 4.775984,7.315084l-0.000005,0zm29.813955,21.327421l0,16.312486c-2.011752,-0.016616 -5.345686,-0.016616 -6.290398,-0.016616c-2.792866,-0.215028 -4.625716,-3.166483 -6.532611,-8.302408c-0.824856,-2.245155 -1.614728,-5.058882 -2.393803,-8.192215c-0.584701,2.719605 -1.174011,5.52768 -1.773704,8.445773c-0.728723,3.530877 -1.47949,7.160868 -2.262724,10.73004c-0.194362,0.877169 -0.412423,1.781722 -0.617605,2.670142c3.17458,11.049578 7.578031,20.576622 13.532174,20.692588l6.338671,0l0,16.312517l7.669613,-14.64636l7.682548,-14.679668l-7.682548,-14.663067l-7.669613,-14.663203l0,-0.000008zm-12.823012,-20.334566c1.906895,-5.146987 3.739745,-8.087273 6.532611,-8.302506c0.944715,0 4.278646,0 6.290398,-0.010979l0,16.312797l7.669613,-14.652239l7.682548,-14.663203l-7.682548,-14.67444l-7.669613,-14.651975l0,16.296037l-6.338671,0c-7.184742,0.143637 -12.137997,13.957207 -15.362881,27.638239c-3.285692,13.82495 -5.668672,28.405435 -8.112403,36.023751c-1.651798,5.1249 -2.862442,7.198997 -4.775984,7.314955l-13.761489,0l0,26.060514l13.761489,0c3.17456,0.077255 6.030714,-3.62981 8.216852,-8.980915c2.20822,-5.312424 3.866646,-11.937946 5.354451,-18.607558c2.926086,-13.433112 5.354433,-27.367929 8.195624,-35.102469l0.000002,-0.000008z\" fill-opacity=\"null\" stroke-opacity=\"null\" stroke-width=\"1.5\" fill=\"#fff\"/>\n <path id=\"svg_20\" d=\"m474.339878,164.657057c-2.029058,-1.529091 -1.762847,-2.455034 3.1704,-11.026562c2.49105,-4.328177 4.529164,-7.995193 4.529164,-8.148919c0,-0.153714 -6.878645,-0.279491 -15.285927,-0.279491l-15.285927,0l0,-8.10624l0,-8.10624l15.407075,0c11.879722,0 15.274449,-0.2442 14.82787,-1.066614c-0.318559,-0.586636 -2.491607,-4.479448 -4.828998,-8.650681c-4.40601,-7.862873 -4.404627,-9.971504 0.006808,-10.625105c2.195406,-0.325262 36.375262,24.666115 37.550092,27.455625c-11.385011,9.960076 -24.993958,20.38572 -37.530014,29.578177c-0.660998,0 -1.813228,-0.460777 -2.560542,-1.02395l-0.000003,0z\" fill-opacity=\"null\" stroke-opacity=\"null\" stroke-width=\"1.5\" stroke=\"#000\" fill=\"#fff\"/>\n <path id=\"svg_21\" d=\"m495.080589,278.730958c-2.02906,-1.52909 -1.76285,-2.45504 3.1704,-11.02656c2.49105,-4.32818 4.52916,-7.9952 4.52916,-8.14892c0,-0.15372 -6.87864,-0.27949 -15.28592,-0.27949l-15.28593,0l0,-8.10624l0,-8.10624l15.40707,0c11.87973,0 15.27445,-0.2442 14.82787,-1.06662c-0.31856,-0.58663 -2.4916,-4.47945 -4.82899,-8.65068c-4.40601,-7.86287 -4.40463,-9.9715 0.0068,-10.6251c2.19541,-0.32527 36.37527,24.66611 37.5501,27.45562c-11.38502,9.96008 -24.99396,20.38572 -37.53002,29.57818c-0.661,0 -1.81323,-0.46078 -2.56054,-1.02395l0,0z\" fill-opacity=\"null\" stroke-opacity=\"null\" stroke-width=\"1.5\" stroke=\"#000\" fill=\"#fff\"/>\n <path id=\"svg_22\" d=\"m81.74787,277.249482c-2.02906,-1.52909 -1.76285,-2.45504 3.1704,-11.02656c2.49105,-4.32818 4.52916,-7.9952 4.52916,-8.14892c0,-0.15372 -6.87864,-0.27949 -15.28592,-0.27949l-15.28593,0l0,-8.10624l0,-8.10624l15.40707,0c11.87973,0 15.27445,-0.2442 14.82787,-1.06662c-0.31856,-0.58663 -2.4916,-4.47945 -4.82899,-8.65068c-4.40601,-7.86287 -4.40463,-9.9715 0.0068,-10.6251c2.19541,-0.32527 36.37527,24.66611 37.5501,27.45562c-11.38502,9.96008 -24.99396,20.38572 -37.53002,29.57818c-0.661,0 -1.81323,-0.46078 -2.56054,-1.02395l0,0z\" fill-opacity=\"null\" stroke-opacity=\"null\" stroke-width=\"1.5\" stroke=\"#000\" fill=\"#fff\"/>\n <path id=\"svg_23\" d=\"m80.266394,165.3978c-2.02906,-1.52909 -1.76285,-2.45504 3.1704,-11.02656c2.49105,-4.32818 4.52916,-7.9952 4.52916,-8.14892c0,-0.15372 -6.87864,-0.27949 -15.28592,-0.27949l-15.28593,0l0,-8.10624l0,-8.10624l15.40707,0c11.87973,0 15.27445,-0.2442 14.82787,-1.06662c-0.31856,-0.58663 -2.4916,-4.47945 -4.82899,-8.65068c-4.40601,-7.86287 -4.40463,-9.9715 0.0068,-10.6251c2.19541,-0.32527 36.37527,24.66611 37.5501,27.45562c-11.38502,9.96008 -24.99396,20.38572 -37.53002,29.57818c-0.661,0 -1.81323,-0.46078 -2.56054,-1.02395l0,0z\" fill-opacity=\"null\" stroke-opacity=\"null\" stroke-width=\"1.5\" stroke=\"#000\" fill=\"#fff\"/>\n </g>\n</svg>","output":"str","x":920,"y":60,"wires":[["1ed964f6.3bab0b"]]},{"id":"24741d29.e5eb42","type":"function","z":"40d60af2.cf9d14","name":"SET-COLOR","func":"msg.color2 = (msg.payload === \"on\")?\"lime\":\"red\";\nglobal.set(\"color2\",msg.color2)\n\nmsg.color3 = context.get('color3')||\"black\";\nmsg.color1 = context.get('color1')||\"black\";\nmsg.color4 = context.get('color4')||\"black\";\nmsg.color5 = context.get('color5')||\"black\";\n\nreturn msg;","outputs":1,"noerr":0,"x":630,"y":100,"wires":[["5eee63dd.14224c","f5e791ce.e5f"]]},{"id":"ed506b06.fc3d48","type":"function","z":"40d60af2.cf9d14","name":"SET-COLOR","func":"msg.color1 = (msg.payload === \"on\")?\"lime\":\"red\";\nglobal.set(\"color1\",msg.color1)\n\nmsg.color2 = context.get('color2')||\"black\";\nmsg.color3 = context.get('color3')||\"black\";\nmsg.color4 = context.get('color4')||\"black\";\nmsg.color5 = context.get('color5')||\"black\";\n\nreturn msg;","outputs":1,"noerr":0,"x":630,"y":60,"wires":[["5eee63dd.14224c","f5e791ce.e5f"]]},{"id":"97198341.91665","type":"change","z":"40d60af2.cf9d14","name":"","rules":[{"t":"set","p":"Data.1","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":410,"y":60,"wires":[["ed506b06.fc3d48"]]},{"id":"617b0f17.dac41","type":"change","z":"40d60af2.cf9d14","name":"","rules":[{"t":"set","p":"Data.2","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":410,"y":100,"wires":[["24741d29.e5eb42"]]},{"id":"91e0ef01.20a4e","type":"change","z":"40d60af2.cf9d14","name":"","rules":[{"t":"set","p":"Data.3","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":410,"y":140,"wires":[["a01afab9.ef5588"]]},{"id":"909e1c34.083d7","type":"change","z":"40d60af2.cf9d14","name":"","rules":[{"t":"set","p":"Data.4","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":410,"y":180,"wires":[["25a63c4b.876284"]]},{"id":"372347bb.d916f8","type":"change","z":"40d60af2.cf9d14","name":"","rules":[{"t":"set","p":"Data.5","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":410,"y":220,"wires":[["c3e4368c.ed8118"]]},{"id":"e119434f.797f9","type":"file","z":"40d60af2.cf9d14","name":"","filename":"\\Users\\user\\.node-red\\data\\test.log","appendNewline":false,"createDir":false,"overwriteFile":"true","x":1320,"y":200,"wires":[[]]},{"id":"f3933034.12eed","type":"json","z":"40d60af2.cf9d14","name":"","property":"payload","action":"","pretty":false,"x":1090,"y":200,"wires":[["e119434f.797f9"]]},{"id":"f5e791ce.e5f","type":"function","z":"40d60af2.cf9d14","name":"","func":"var msg={};\nmsg.payload=global.get(\"Data\");\nreturn msg;","outputs":1,"noerr":0,"x":910,"y":200,"wires":[["f3933034.12eed"]]},{"id":"68584dde.ee9274","type":"file in","z":"40d60af2.cf9d14","name":"","filename":"\\Users\\user\\.node-red\\data\\test.log","format":"lines","chunk":false,"sendError":false,"x":240,"y":400,"wires":[["182358f6.6b4457"]]},{"id":"182358f6.6b4457","type":"json","z":"40d60af2.cf9d14","name":"","property":"payload","action":"","pretty":false,"x":450,"y":400,"wires":[["66903e31.3bd5e","407df2f.7f3990c","b2180e57.881e7","fcb2f1a6.542aa","ba6195e9.dc3948"]]},{"id":"66903e31.3bd5e","type":"change","z":"40d60af2.cf9d14","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.1","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":360,"wires":[["80cee83.10d5f18"]]},{"id":"407df2f.7f3990c","type":"change","z":"40d60af2.cf9d14","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.2","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":400,"wires":[["7a4e92f1.a2f3dc"]]},{"id":"b2180e57.881e7","type":"change","z":"40d60af2.cf9d14","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.2","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":440,"wires":[["6769fea2.ef353"]]},{"id":"fcb2f1a6.542aa","type":"change","z":"40d60af2.cf9d14","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.2","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":480,"wires":[["6f0ff889.6546f8"]]},{"id":"ba6195e9.dc3948","type":"change","z":"40d60af2.cf9d14","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.2","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":520,"wires":[["a73294c4.0fef28"]]},{"id":"a7a71585.67e158","type":"inject","z":"40d60af2.cf9d14","name":"LOAD LAST STATE","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":320,"wires":[["68584dde.ee9274"]]},{"id":"80cee83.10d5f18","type":"function","z":"40d60af2.cf9d14","name":"","func":"if(msg.payload==\"on\")\nreturn true;","outputs":1,"noerr":0,"x":850,"y":360,"wires":[["ce673659.151b88"]]},{"id":"7a4e92f1.a2f3dc","type":"function","z":"40d60af2.cf9d14","name":"","func":"if(msg.payload==\"on\")\nreturn true;","outputs":1,"noerr":0,"x":850,"y":400,"wires":[["40f98b39.c2f0b4"]]},{"id":"6769fea2.ef353","type":"function","z":"40d60af2.cf9d14","name":"","func":"if(msg.payload==\"on\")\nreturn true;","outputs":1,"noerr":0,"x":850,"y":440,"wires":[["a2910f29.dda35"]]},{"id":"6f0ff889.6546f8","type":"function","z":"40d60af2.cf9d14","name":"","func":"if(msg.payload==\"on\")\nreturn true;","outputs":1,"noerr":0,"x":850,"y":480,"wires":[["532e8d4.68b2074"]]},{"id":"a73294c4.0fef28","type":"function","z":"40d60af2.cf9d14","name":"","func":"if(msg.payload==\"on\")\nreturn true;","outputs":1,"noerr":0,"x":850,"y":520,"wires":[["ce130d9c.434aa"]]},{"id":"1892c41.a11ce3c","type":"ui_group","z":"","name":"Irányítás","tab":"5a911674.6e4218","order":4,"disp":true,"width":"12","collapse":true},{"id":"5a911674.6e4218","type":"ui_tab","z":"","name":"Dashboard","icon":"dashboard","order":1,"disabled":false,"hidden":false}]