Hi I am working with @scargill 's wonderful "fancy buttons" I have run into some problems. I am trying to make a two state button.
-
When I click on the buttons on the computer the status is not updated on my phone or the other way around. (note the injects in the flow if I trigger these the status is updated across all devices but the attached LEDs don't change)
-
The buttons don't have an initial status, you have to click twice to get the formatting to change.
I am not sure if this is not possible because of just changing the background of the button and not really changing the state. Any help would be appreciated. Below is my sample flow.
[{"id":"60de705.e2c779","type":"tab","label":"Flow 5","disabled":false,"info":""},{"id":"712497b9.67d868","type":"inject","z":"60de705.e2c779","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":100,"wires":[["1a6dbabf.5da795","99342e02.5d917","515f2c37.fce404"]]},{"id":"15c400c6.c4d3df","type":"inject","z":"60de705.e2c779","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":160,"wires":[["1a6dbabf.5da795","515f2c37.fce404","99342e02.5d917"]]},{"id":"50959269.99d92c","type":"function","z":"60de705.e2c779","name":"","func":"\nif (msg.payload === false ){\n msg.payload = true;\n}\nelse { msg.payload = false;\n}\nreturn msg;\n","outputs":1,"noerr":0,"x":340.0001220703125,"y":137.33332061767578,"wires":[["1a6dbabf.5da795","db80c73c.1d6848"]]},{"id":"1a6dbabf.5da795","type":"ui_template","z":"60de705.e2c779","group":"1732cfe.a123c3","name":"Push-Walk","order":9,"width":6,"height":2,"format":"<md-button class=\"vibrate filled touched bigfont rounded\" style=\"background-color:#212227\" ng-click=\"send({payload: msg.payload })\">\n\n<svg width=\"360px\" height=\"100px\" version=\"1.1\" viewBox=\"0 0 800 200\">\n <g id=\"Button_Long\">\n <rect fill=\"#212227\" width=\"800\" height=\"200\"/>\n <g ng-style=\"{fill: (msg.payload || 0) % 2 === 0 ? '#23C48E' : '#212227'}\"> \n <rect width=\"800\" height=\"200\" rx=\"100\" ry=\"100\"/>\n </g>\n <g ng-style=\"{fill: (msg.payload || 0) % 2 === 0 ? '#212227' : '#23C48E'}\">\n <rect fill x=\"10\" y=\"10\" width=\"778\" height=\"180\" rx=\"90\" ry=\"90\"/>\n </g>\n <g ng-style=\"{fill: (msg.payload || 0) % 2 === 0 ? 'none' : '#212227'}\">\n <text x=\"400\" y=\"125\" style=\"text-anchor:middle\" font-weight=\"normal\" font-size=\"75\" font-family=\"Arial\">WALK LIGHTS ON</text>\n </g>\n <g ng-style=\"{fill: (msg.payload || 0) % 2 === 0 ? '#23C48E' : 'none'}\">\n <text x=\"400\" y=\"125\" style=\"text-anchor:middle\" font-weight=\"normal\" font-size=\"75\" font-family=\"Arial\">WALK LIGHTS OFF</text>\n </g>\n </g>\n</svg>\n\n\n</md-button>\n","storeOutMessages":false,"fwdInMessages":false,"resendOnRefresh":false,"templateScope":"local","x":330,"y":180,"wires":[["50959269.99d92c"]]},{"id":"515f2c37.fce404","type":"ui_template","z":"60de705.e2c779","group":"1732cfe.a123c3","name":"Push-SideWalk","order":6,"width":6,"height":2,"format":"<md-button class=\"vibrate filled touched bigfont rounded\" style=\"background-color:#212227\" ng-click=\"send({payload: msg.payload })\">\n\n<svg width=\"360px\" height=\"90px\" version=\"1.1\" viewBox=\"0 0 800 200\">\n <g id=\"Button_Long\">\n <rect fill=\"#212227\" width=\"800\" height=\"200\"/>\n <g ng-style=\"{fill: (msg.payload || 0) % 2 === 0 ? '#23C48E' : '#212227'}\"> \n <rect width=\"800\" height=\"200\" rx=\"100\" ry=\"100\"/>\n </g>\n <g ng-style=\"{fill: (msg.payload || 0) % 2 === 0 ? '#212227' : '#23C48E'}\">\n <rect fill x=\"10\" y=\"10\" width=\"778\" height=\"180\" rx=\"90\" ry=\"90\"/>\n </g>\n <g ng-style=\"{fill: (msg.payload || 0) % 2 === 0 ? '#23C48E' : '#212227'}\">\n <text x=\"400\" y=\"125\" style=\"text-anchor:middle\" font-weight=\"normal\" font-size=\"75\" font-family=\"Arial\">SIDEWALK LIGHTS</text>\n </g>\n </g>\n</svg>\n\n\n</md-button>\n","storeOutMessages":false,"fwdInMessages":false,"resendOnRefresh":false,"templateScope":"local","x":320,"y":320,"wires":[["98741886.86c3e8"]]},{"id":"1723bcb9.0afbb3","type":"ui_led","z":"60de705.e2c779","order":1,"group":"1732cfe.a123c3","width":0,"height":0,"label":"","labelPlacement":"left","labelAlignment":"left","colorForValue":[{"color":"#ff0000","value":"false","valueType":"bool"},{"color":"#008000","value":"true","valueType":"bool"}],"allowColorForValueInMessage":false,"shape":"circle","showGlow":true,"name":"","x":500,"y":380,"wires":[]},{"id":"db80c73c.1d6848","type":"ui_led","z":"60de705.e2c779","order":2,"group":"1732cfe.a123c3","width":0,"height":0,"label":"","labelPlacement":"left","labelAlignment":"left","colorForValue":[{"color":"#ff0000","value":"false","valueType":"bool"},{"color":"#008000","value":"true","valueType":"bool"}],"allowColorForValueInMessage":false,"shape":"circle","showGlow":true,"name":"","x":550,"y":80,"wires":[]},{"id":"424fc71e.976628","type":"function","z":"60de705.e2c779","name":"","func":"\nif (msg.payload === false ){\n msg.payload = true;\n}\nelse { msg.payload = false;\n}\nreturn msg;\n","outputs":1,"noerr":0,"x":130,"y":400,"wires":[["99342e02.5d917"]]},{"id":"99342e02.5d917","type":"ui_template","z":"60de705.e2c779","group":"1732cfe.a123c3","name":"Push-RND","order":13,"width":4,"height":2,"format":"<md-button class=\"vibrate filled touched bigfont rounded\" style=\"background-color:#212227\" ng-click=\"send({payload: msg.payload })\">\n\n<svg width=\"90px\" height=\"90px\" version=\"1.1\" viewBox=\"0 0 200 200\">\n <g id=\"Button_Long\">\n <rect fill=\"#212227\" width=\"200\" height=\"200\"/>\n <g ng-style=\"{fill: (msg.payload || 0) % 2 === 0 ? '#23c48e' : '#212227'}\"> \n <rect width=\"200\" height=\"200\" rx=\"100\" ry=\"100\"/>\n </g>\n <g ng-style=\"{fill: (msg.payload || 0) % 2 === 0 ? '#212227' : '#23C48E'}\">\n <rect fill x=\"10\" y=\"10\" width=\"180\" height=\"180\" rx=\"90\" ry=\"90\"/>\n </g>\n <g ng-style=\"{fill: (msg.payload || 0) % 2 === 0 ? 'none' : '#212227'}\"> \n <text x=\"100\" y=\"125\" style=\"text-anchor:middle\" font-weight=\"normal\" font-size=\"75\" font-family=\"Arial\">On</text>\n </g>\n <g ng-style=\"{fill: (msg.payload || 0) % 2 === 0 ? '#23C48e' : 'none'}\">\n <text x=\"100\" y=\"125\" style=\"text-anchor:middle\" font-weight=\"normal\" font-size=\"75\" font-family=\"Arial\">Off</text>\n </g>\n </g>\n</svg>\n\n\n</md-button>\n","storeOutMessages":false,"fwdInMessages":false,"resendOnRefresh":false,"templateScope":"local","x":142.9998779296875,"y":489.6666793823242,"wires":[["424fc71e.976628"]]},{"id":"98741886.86c3e8","type":"function","z":"60de705.e2c779","name":"","func":"\nif (msg.payload === false ){\n msg.payload = true;\n}\nelse { msg.payload = false;\n}\nreturn msg;\n","outputs":1,"noerr":0,"x":330,"y":220,"wires":[["515f2c37.fce404","1723bcb9.0afbb3"]]},{"id":"1732cfe.a123c3","type":"ui_group","z":"","name":"test","tab":"4b43e7b2.411658","order":1,"disp":true,"width":"6","collapse":false},{"id":"4b43e7b2.411658","type":"ui_tab","z":"","name":"Tab 8","icon":"dashboard","order":1,"disabled":false,"hidden":false}]