hello dynamicdave,
I am programming a view of machines that whose status should be shown in a visualization. There are 3 states, on, off and standby. The 3 states should be displayed in the correct color.
I can not send you the complete flow, because server and node ids are included. but I send the part after the opc ua nodes.
Only boolean values are sent from the OPC ua server to the part. The current question is not so much about opc ua, because that works reliably.
my problem is much more the ng-if statement in the template. there the traffic lights are displayed. with one data string everything works fine, if a second one is added, both traffic lights start to flicker and are not displayed at the same time.
[{"id":"7e3348b2.34bc08","type":"tab","label":"Flow 3","disabled":false,"info":""},{"id":"356cbc14.13c304","type":"debug","z":"7e3348b2.34bc08","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":630,"y":580,"wires":[]},{"id":"973f2476.f56778","type":"debug","z":"7e3348b2.34bc08","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":650,"y":780,"wires":[]},{"id":"8ffd67eb.b456e8","type":"switch","z":"7e3348b2.34bc08","name":"off","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":670,"y":420,"wires":[["646e0e0e.81aa4"],["e918cb9a.33b7f8"]]},{"id":"646e0e0e.81aa4","type":"change","z":"7e3348b2.34bc08","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"red_machine1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":930,"y":420,"wires":[["ed6054a0.5a2668"]]},{"id":"d7d93678.bc7b58","type":"switch","z":"7e3348b2.34bc08","name":"standby","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":710,"y":700,"wires":[["4da1c7fc.dfaaf8"],["a0af85e3.0347a8"]]},{"id":"4da1c7fc.dfaaf8","type":"change","z":"7e3348b2.34bc08","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"yellow_machine1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":950,"y":700,"wires":[["ed6054a0.5a2668"]]},{"id":"d547629e.aa75","type":"switch","z":"7e3348b2.34bc08","name":"on","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":670,"y":880,"wires":[["84b93439.3b00f8"],["69bf8640.a81a28"]]},{"id":"84b93439.3b00f8","type":"change","z":"7e3348b2.34bc08","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"green_machine1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":930,"y":880,"wires":[["ed6054a0.5a2668"]]},{"id":"a0af85e3.0347a8","type":"debug","z":"7e3348b2.34bc08","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":920,"y":780,"wires":[]},{"id":"e918cb9a.33b7f8","type":"debug","z":"7e3348b2.34bc08","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":900,"y":520,"wires":[]},{"id":"69bf8640.a81a28","type":"debug","z":"7e3348b2.34bc08","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":860,"y":980,"wires":[]},{"id":"1446d565.c391cb","type":"debug","z":"7e3348b2.34bc08","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":630,"y":1120,"wires":[]},{"id":"5d9501ce.0fb01","type":"debug","z":"7e3348b2.34bc08","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":630,"y":1380,"wires":[]},{"id":"83443921.f68a48","type":"debug","z":"7e3348b2.34bc08","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":650,"y":1580,"wires":[]},{"id":"fdb8ec22.77eb","type":"switch","z":"7e3348b2.34bc08","name":"off","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":670,"y":1220,"wires":[["83e251fa.b9952"],["bfb3c1a6.f1c5b"]]},{"id":"83e251fa.b9952","type":"change","z":"7e3348b2.34bc08","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"red_machine2","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":930,"y":1220,"wires":[["ed6054a0.5a2668"]]},{"id":"963d97d1.37ec68","type":"switch","z":"7e3348b2.34bc08","name":"standby","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":710,"y":1500,"wires":[["555da881.af6b18"],["fecb80f3.9b133"]]},{"id":"555da881.af6b18","type":"change","z":"7e3348b2.34bc08","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"yellow_machine2","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":950,"y":1500,"wires":[["ed6054a0.5a2668"]]},{"id":"1527e7ad.7a4ac8","type":"switch","z":"7e3348b2.34bc08","name":"on","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":670,"y":1680,"wires":[["9220cba5.232898"],["95797ba8.6cbb58"]]},{"id":"9220cba5.232898","type":"change","z":"7e3348b2.34bc08","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"green_machine2","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":930,"y":1680,"wires":[["ed6054a0.5a2668"]]},{"id":"fecb80f3.9b133","type":"debug","z":"7e3348b2.34bc08","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":920,"y":1580,"wires":[]},{"id":"bfb3c1a6.f1c5b","type":"debug","z":"7e3348b2.34bc08","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":900,"y":1320,"wires":[]},{"id":"95797ba8.6cbb58","type":"debug","z":"7e3348b2.34bc08","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":860,"y":1780,"wires":[]},{"id":"ed6054a0.5a2668","type":"ui_template","z":"7e3348b2.34bc08","group":"e3008e05.4d498","name":"","order":4,"width":"23","height":"20","format":"\n<style>\n .redButton{\n background-color: red;\n }\n \n .yellowButton{\n background-color: yellow;\n }\n \n .greenButton{\n background-color: green;\n }\n .normalAmpel{\n position: absolute;\n width: 50px;\n height: 50px;\n border-radius: 50%;\n color: white;\n padding-left: 10px;\n padding-top: 10px;\n font-size: 16px;\n z-index: 5;\n background-color: black;\n }\n \n .machine1{\n top: 150px;\n left: 100px;\n }\n \n .machine2{\n top: 100px;\n left: 150px;\n }\n \n</style>\n\n\n<!-- Machine 1 -->\n<div id= machine1 class=\"normalAmpel machine2\"></div>\n\n\n<!-- Machine 2 -->\n<div id= machine2 class=\"normalAmpel machine2\"></div>\n\n<script>\n document.getElementbyId(\"machine1\").style.color = color_func_machine1;\n document.getElementbyId(\"machine2\").style.color = color_func_machine2;\n \n function color_func_machine1 (red_machine1, green_machine1, yellow_machine1 ){\n let = color;\n \n if (red_machine1== true){\n color = red;\n }\n else\n if (green_machine1== true){\n color = green;\n }\n else\n if (yellow_machine1== true){\n color = yellow;\n }\n return color;\n }\n \n function color_func_machine2 (red_machine2, green_machine2, yellow_machine2){\n let = color;\n \n if (red_machine2 == true){\n color = 'red';\n }\n else\n if (green_machine2 == true){\n color = 'green';\n }\n else\n if (yellow_machine2 == true){\n color = 'yellow';\n }\n return color;\n }\n</script>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","x":1930,"y":1140,"wires":[[]]},{"id":"e3008e05.4d498","type":"ui_group","name":"Test","tab":"cbad0788.89be9","order":1,"disp":false,"width":"25","collapse":false},{"id":"cbad0788.89be9","type":"ui_tab","name":"Test","icon":"dashboard","order":2,"disabled":false,"hidden":false}]