2-way 3-way 4-way
[{"id":"438a95b9.6a9eac","type":"ui_template","z":"a05ff4cd.1ae7e8","group":"9f2da61.3353758","name":"Dashboard CSS","order":2,"width":12,"height":1,"format":"<style id=\"dashboard-styles-override\">\n.switchwrapper {\n margin: auto 0;\n}\n.toggle_radio{\n margin: auto;\n overflow: hidden;\n border-radius: 50px;\n position: relative;\n height: 26px;\n border: 1px solid var(--nr-dashboard-groupBorderColor);\n background: var(--nr-dashboard-widgetBgndColor);\n}\n.toggle_radio > * {\n float: left;\n}\n.toggle_radio input[type=radio]{\n display: none;\n}\n.toggle_4{\n width: 25%;\n}\n.toggle_3{\n width: 33%;\n}\n.toggle_2{\n width: 50%;\n}\n.toggle_radio label{\n display: block;\n height: 20px;\n margin: 0;\n line-height :18px;\n border-radius: 50px;\n cursor: pointer;\n z-index: 1;\n text-align: center;\n}\n.toggle_radio label >p {\n background:transparent !important;\n}\n.toggle_option_slider{\n \n height: 20px;\n position: absolute;\n top: 3px;\n border-radius: 50px;\n transition: all .4s ease;\n z-index:0;\n left:3px;\n opacity:0.4;\n background: var(--nr-dashboard-widgetColor);\n}\n</style>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"global","x":460,"y":960,"wires":[[]]},{"id":"c770e530.b74478","type":"ui_template","z":"a05ff4cd.1ae7e8","group":"9f2da61.3353758","name":"3-way switch","order":4,"width":6,"height":1,"format":"<div id=\"{{'swc_'+$id}}\" class=\"switchwrapper\">\n <div class=\"toggle_radio\">\n <input type=\"radio\" class=\"toggle_option toggle_3\" id=\"{{'first_'+$id}}\" ng-model=\"value\" value=\"first\">\n <input type=\"radio\" class=\"toggle_option toggle_3\" id=\"{{'second_'+$id}}\" ng-model=\"value\" value=\"second\">\n <input type=\"radio\" class=\"toggle_option toggle_3\" id=\"{{'third_'+$id}}\" ng-model=\"value\" value=\"third\">\n <div id=\"{{'slider_'+$id}}\" class=\"toggle_option_slider toggle_3\"></div>\n <label class=\" toggle_3\" for=\"{{'first_'+$id}}\"><p>A</p></label>\n <label class=\" toggle_3\" for=\"{{'second_'+$id}}\"><p>B</p></label>\n <label class=\" toggle_3\" for=\"{{'third_'+$id}}\"><p>C</p></label>\n </div>\n \n</div>\n\n<script>\n(function(scope) {\n scope.incomingChange = false\n scope.$watch('value', function(value) {\n switch(value){\n case 'first':{\n $(\"#slider_\"+scope.$id).css(\"left\", \"3px\")\n break\n }\n case 'second':{\n $(\"#slider_\"+scope.$id).css(\"left\", \"33%\")\n break\n }\n case 'third':{\n $(\"#slider_\"+scope.$id).css(\"left\", \"66%\")\n break\n }\n }\n if(scope.incomingChange == true){\n scope.incomingChange = false\n return\n }\n if(!value){\n return\n }\n scope.send({payload: value})\n \n });\n scope.$watch('msg', function(msg) {\n if(msg){\n if(scope.value != msg.payload){\n scope.incomingChange = true\n scope.value = msg.payload\n }\n \n }\n });\n})(scope);\n</script>\n \n","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":450,"y":1200,"wires":[["e5fbeffc.05654"]]},{"id":"e5fbeffc.05654","type":"debug","z":"a05ff4cd.1ae7e8","name":"Selected option","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":660,"y":1200,"wires":[]},{"id":"fffca1ba.ef777","type":"inject","z":"a05ff4cd.1ae7e8","name":"Select first","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"first","payloadType":"str","x":220,"y":1160,"wires":[["c770e530.b74478"]]},{"id":"5d4d028f.3736dc","type":"inject","z":"a05ff4cd.1ae7e8","name":"Select second","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"second","payloadType":"str","x":210,"y":1200,"wires":[["c770e530.b74478"]]},{"id":"32a2f720.f367b8","type":"inject","z":"a05ff4cd.1ae7e8","name":"Select third","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"third","payloadType":"str","x":210,"y":1240,"wires":[["c770e530.b74478"]]},{"id":"de21e3f1.82753","type":"ui_template","z":"a05ff4cd.1ae7e8","group":"9f2da61.3353758","name":"2-way switch","order":4,"width":6,"height":1,"format":"<div id=\"{{'swc_'+$id}}\" class=\"switchwrapper\">\n <div class=\"toggle_radio\">\n <input type=\"radio\" class=\"toggle_option\" id=\"{{'first_'+$id}}\" ng-model=\"value\" value=\"first\">\n <input type=\"radio\" class=\"toggle_option\" id=\"{{'second_'+$id}}\" ng-model=\"value\" value=\"second\">\n \n <div id=\"{{'slider_'+$id}}\" class=\"toggle_option_slider toggle_2\"></div>\n <label class=\" toggle_2\" for=\"{{'first_'+$id}}\"><p>A</p></label>\n <label class=\" toggle_2\" for=\"{{'second_'+$id}}\"><p>B</p></label>\n\n </div>\n \n</div>\n\n<script>\n(function(scope) {\n scope.incomingChange = false\n scope.$watch('value', function(value) {\n switch(value){\n case 'first':{\n $(\"#slider_\"+scope.$id).css(\"left\", \"3px\")\n break\n }\n case 'second':{\n $(\"#slider_\"+scope.$id).css(\"left\", \"49%\")\n break\n }\n\n }\n if(scope.incomingChange == true){\n scope.incomingChange = false\n return\n }\n if(!value){\n return\n }\n scope.send({payload: value})\n \n });\n scope.$watch('msg', function(msg) {\n if(msg){\n if(scope.value != msg.payload){\n scope.incomingChange = true\n scope.value = msg.payload\n }\n \n }\n });\n})(scope);\n</script>\n \n","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":450,"y":1060,"wires":[["56b0f8.831e0f08"]]},{"id":"56b0f8.831e0f08","type":"debug","z":"a05ff4cd.1ae7e8","name":"Selected option","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":660,"y":1060,"wires":[]},{"id":"96d99491.c677b8","type":"inject","z":"a05ff4cd.1ae7e8","name":"Select first","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"first","payloadType":"str","x":220,"y":1020,"wires":[["de21e3f1.82753"]]},{"id":"a07e0e6e.4244c","type":"inject","z":"a05ff4cd.1ae7e8","name":"Select second","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"second","payloadType":"str","x":210,"y":1060,"wires":[["de21e3f1.82753"]]},{"id":"5ec61ac2.9a01c4","type":"ui_template","z":"a05ff4cd.1ae7e8","group":"9f2da61.3353758","name":"4-way switch","order":4,"width":6,"height":1,"format":"<div id=\"{{'swc_'+$id}}\" class=\"switchwrapper\">\n <div class=\"toggle_radio\">\n <input type=\"radio\" class=\"toggle_option\" id=\"{{'first_'+$id}}\" ng-model=\"value\" value=\"first\">\n <input type=\"radio\" class=\"toggle_option\" id=\"{{'second_'+$id}}\" ng-model=\"value\" value=\"second\">\n <input type=\"radio\" class=\"toggle_option\" id=\"{{'third_'+$id}}\" ng-model=\"value\" value=\"third\">\n <input type=\"radio\" class=\"toggle_option\" id=\"{{'fourth_'+$id}}\" ng-model=\"value\" value=\"fourth\">\n <div id=\"{{'slider_'+$id}}\" class=\"toggle_option_slider toggle_4\"></div>\n <label class=\" toggle_4\" for=\"{{'first_'+$id}}\"><p>A</p></label>\n <label class=\" toggle_4\" for=\"{{'second_'+$id}}\"><p>B</p></label>\n <label class=\" toggle_4\" for=\"{{'third_'+$id}}\"><p>C</p></label>\n <label class=\" toggle_4\" for=\"{{'fourth_'+$id}}\"><p>D</p></label>\n </div>\n \n</div>\n\n<script>\n(function(scope) {\n scope.incomingChange = false\n scope.$watch('value', function(value) {\n switch(value){\n case 'first':{\n $(\"#slider_\"+scope.$id).css(\"left\", \"3px\")\n break\n }\n case 'second':{\n $(\"#slider_\"+scope.$id).css(\"left\", \"25%\")\n break\n }\n case 'third':{\n $(\"#slider_\"+scope.$id).css(\"left\", \"50%\")\n break\n }\n case 'fourth':{\n $(\"#slider_\"+scope.$id).css(\"left\", \"74%\")\n break\n }\n }\n if(scope.incomingChange == true){\n scope.incomingChange = false\n return\n }\n if(!value){\n return\n }\n scope.send({payload: value})\n \n });\n scope.$watch('msg', function(msg) {\n if(msg){\n if(scope.value != msg.payload){\n scope.incomingChange = true\n scope.value = msg.payload\n }\n \n }\n });\n})(scope);\n</script>\n \n","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":430,"y":1340,"wires":[["51fb29aa.c34508"]]},{"id":"51fb29aa.c34508","type":"debug","z":"a05ff4cd.1ae7e8","name":"Selected option","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":640,"y":1340,"wires":[]},{"id":"32d36a7c.a9e9c6","type":"inject","z":"a05ff4cd.1ae7e8","name":"Select first","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"first","payloadType":"str","x":200,"y":1300,"wires":[["5ec61ac2.9a01c4"]]},{"id":"8878f3d7.188a4","type":"inject","z":"a05ff4cd.1ae7e8","name":"Select second","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"second","payloadType":"str","x":190,"y":1340,"wires":[["5ec61ac2.9a01c4"]]},{"id":"3824b305.e6cafc","type":"inject","z":"a05ff4cd.1ae7e8","name":"Select third","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"third","payloadType":"str","x":190,"y":1380,"wires":[["5ec61ac2.9a01c4"]]},{"id":"a71786e7.e950d8","type":"inject","z":"a05ff4cd.1ae7e8","name":"Select fourth","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"fourth","payloadType":"str","x":190,"y":1420,"wires":[["5ec61ac2.9a01c4"]]},{"id":"9f2da61.3353758","type":"ui_group","name":"Flight","tab":"d6d3c358.5fb46","order":1,"disp":true,"width":"12","collapse":false},{"id":"d6d3c358.5fb46","type":"ui_tab","name":"Home","icon":"dashboard","order":1,"disabled":false,"hidden":false}]