defcon display

Adds a defcon (https://en.wikipedia.org/wiki/DEFCON) display to your dashboard using angular icons in node-red-dashboard templates. Input is a number 5 to 1 in msg.payload and the appropriate icon will light up in the correct color. The unused output of the function passes the original msg object.

[{"id":"5a90e776.d8307","type":"ui_template","z":"57b2975f.f6391","group":"d53a4bc9.d84b68","name":"5 (blue)","order":14,"width":"1","height":"1","format":"<ng-md-icon icon=\"looks_5\" ng-style=\"{fill:msg.payload=='1'?'blue':'black'}\" size=\"32\"></ng-md-icon>","storeOutMessages":false,"fwdInMessages":false,"x":640,"y":540,"wires":[[]]},{"id":"47b2be2e.5c8c08","type":"function","z":"57b2975f.f6391","name":"","func":"var msg5 = {};\nmsg5.payload = 0;\nvar msg4 = {};\nmsg4.payload = 0;\nvar msg3 = {};\nmsg3.payload = 0;\nvar msg2 = {};\nmsg2.payload = 0;\nvar msg1 = {};\nmsg1.payload = 0;\n\nif (msg.payload == 5) {\n    msg5.payload = \"1\";\n}\nif (msg.payload == \"4\") {\n    msg4.payload = \"1\";\n}\nif (msg.payload == \"3\") {\n    msg3.payload = \"1\";\n}\nif (msg.payload == \"2\") {\n    msg2.payload = \"1\";\n}\nif (msg.payload == \"1\") {\n    msg1.payload = \"1\";\n}\n\nreturn [msg, msg5, msg4, msg3, msg2, msg1];","outputs":"6","noerr":0,"x":470,"y":560,"wires":[[],["5a90e776.d8307"],["5a5b9ae1.bbb444"],["ed3b33ea.726e2"],["22dcd495.944ee4"],["4255b77c.d92208"]]},{"id":"5a5b9ae1.bbb444","type":"ui_template","z":"57b2975f.f6391","group":"d53a4bc9.d84b68","name":"4 {green}","order":15,"width":"1","height":"1","format":"<ng-md-icon icon=\"looks_4\" ng-style=\"{fill:msg.payload=='1'?'green':'black'}\" size=\"32\"></ng-md-icon>","storeOutMessages":false,"fwdInMessages":false,"x":640,"y":580,"wires":[[]]},{"id":"ed3b33ea.726e2","type":"ui_template","z":"57b2975f.f6391","group":"d53a4bc9.d84b68","name":"3 (yellow)","order":16,"width":"1","height":"1","format":"<ng-md-icon icon=\"looks_3\" ng-style=\"{fill:msg.payload=='1'?'yellow':'black'}\" size=\"32\"></ng-md-icon>","storeOutMessages":false,"fwdInMessages":false,"x":640,"y":620,"wires":[[]]},{"id":"22dcd495.944ee4","type":"ui_template","z":"57b2975f.f6391","group":"d53a4bc9.d84b68","name":"2 (red)","order":17,"width":"1","height":"1","format":"<ng-md-icon icon=\"looks_two\" ng-style=\"{fill:msg.payload=='1'?'red':'black'}\" size=\"32\"></ng-md-icon>","storeOutMessages":false,"fwdInMessages":false,"x":630,"y":660,"wires":[[]]},{"id":"4255b77c.d92208","type":"ui_template","z":"57b2975f.f6391","group":"d53a4bc9.d84b68","name":"1 (white)","order":18,"width":"1","height":"1","format":"<ng-md-icon icon=\"looks_one\" ng-style=\"{fill:msg.payload=='1'?'white':'black'}\" size=\"32\"></ng-md-icon>","storeOutMessages":false,"fwdInMessages":false,"x":640,"y":700,"wires":[[]]},{"id":"d53a4bc9.d84b68","type":"ui_group","z":"","name":"defcon","tab":"3bfaeacb.bc1e5e","order":5,"disp":true,"width":"6"},{"id":"3bfaeacb.bc1e5e","type":"ui_tab","z":"57b2975f.f6391","name":"overzicht","icon":"all_out","order":1}]
egeltje

Flow Info

created 7 months ago

Node Types

Core
  • function (x1)
Other
  • ui_group (x1)
  • ui_tab (x1)
  • ui_template (x5)

Tags

  • defcon
  • dashboard
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option