[{"id":"a945bb2b.c285e8","type":"tab","label":"Alarm Area 1","disabled":false,"info":""},{"id":"d98403e3.50a96","type":"ui_button","z":"a945bb2b.c285e8","name":"Acknowledge","group":"f939857c.dafb1","order":3,"width":3,"height":1,"passthru":true,"label":"Acknowledge","tooltip":"Caution :Clicking Will Acknowlwedge Alarms","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":220,"y":80,"wires":[["ff144e27.94dd98"]]},{"id":"ff144e27.94dd98","type":"trigger","z":"a945bb2b.c285e8","name":"","op1":"1","op2":"0","op1type":"num","op2type":"num","duration":"1","extend":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":2,"x":480,"y":80,"wires":[["9434025.ae8ac"],["33b6bf82.227548"]]},{"id":"33b6bf82.227548","type":"trigger","z":"a945bb2b.c285e8","name":"","op1":"0","op2":"","op1type":"num","op2type":"nul","duration":"2","extend":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":660,"y":140,"wires":[["c643bb7f.bebcd8"]]},{"id":"e4ede60.31c0d18","type":"ui_button","z":"a945bb2b.c285e8","name":"Reset","group":"f939857c.dafb1","order":4,"width":3,"height":1,"passthru":true,"label":"Reset","tooltip":"Caution :Clicking Will Attempt To Reset All Alarms","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":110,"y":260,"wires":[["38961cfb.f806ac"]],"info":"<style>\nmd-button {\n background-image: linear-gradient(to right, rgba(255,0,0,1),rgba(255,0,0,0),\n}\n</style>"},{"id":"38961cfb.f806ac","type":"trigger","z":"a945bb2b.c285e8","name":"","op1":"1","op2":"0","op1type":"num","op2type":"num","duration":"2","extend":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":2,"x":340,"y":260,"wires":[["16897b7e.09fad5"],["d794e355.5080f"]]},{"id":"d794e355.5080f","type":"trigger","z":"a945bb2b.c285e8","name":"","op1":"0","op2":"","op1type":"num","op2type":"nul","duration":"3","extend":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":620,"y":280,"wires":[["5432c057.6df59"]]},{"id":"da105059.55fab8","type":"function","z":"a945bb2b.c285e8","name":"","func":"//var modbusCode = msg.payload[0];\n//var lastCode = flow.get('lastModbusCode') || 0;\n//\n//if (lastCode == modbusCode) {\n// return null;\n//}\n\n//flow.set('lastModbusCode', modbusCode);\n\n//if (modbusCode === 0) {\n // return null;\n//}\n\n//const mapCodeDescription = {\n// 1: \"Plantroom 1 Fault\",\n//};\nif (msg.payload==1){\nmsg.topic = \"Plantroom 1 New Alarm \"\nmsg.payload = \"<p>Dear Portal User,</p>\" +\n\"<p>Please note that you have a fault at: Boyd Wilson Electrical Renwick Plant - Plantroom 1.</p>\" +\n\"<p>Visit <a href=\\\"https://bwel-portal.co.nz/login\\\">bwel-portal.co.nz/</a> to clear the fault if possible.</p>\" +\n\"<p></p>\" +\n\"<p></p>\" +\n\"<p><p/>\" +\n\"Portal Admin</p>\" +\n\"<p>Boyd Wilson Electrical Ltd<br />\" +\n\"PO Box 110, Renwick 7243<br />\" +\n\"11a Uxbridge Street, Renwick 7204<br />\" +\n\"Marlborough</p>\" +\n\"<p></p>\" +\n\"+P: 03 572 7448</p>\" +\n\"<p></p>\" +\n\"<img src=\\\"https://fakeimg.pl/300x70/?text=Boyd%20Wilson&font=lobster\\\">\";\n\nreturn msg;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","x":660,"y":440,"wires":[["2dd2623c.db4786"]]},{"id":"2dd2623c.db4786","type":"debug","z":"a945bb2b.c285e8","name":"","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":900,"y":380,"wires":[]},{"id":"e6992b02.6b7828","type":"trigger","z":"a945bb2b.c285e8","name":"","op1":"1","op2":"","op1type":"str","op2type":"nul","duration":"500","extend":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":500,"y":440,"wires":[["da105059.55fab8"]]},{"id":"8a9d3537.bd2a68","type":"function","z":"a945bb2b.c285e8","name":"","func":"if (msg.payload ==false ){\nreturn null;\n}\nif (msg.payload ==true ){\nreturn {payload : \"1\"};\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":320,"y":440,"wires":[["e6992b02.6b7828"]]},{"id":"67340e27.bd1b68","type":"pccc in","z":"a945bb2b.c285e8","endpoint":"ba0b9c2b.a3c1","mode":"single","variable":"Alarm Status","diff":true,"name":"","x":150,"y":340,"wires":[["5dc38291.a6aa64","38f753c4.dcf3cc"]]},{"id":"d3aa7eac.f4ab48","type":"pccc in","z":"a945bb2b.c285e8","endpoint":"ba0b9c2b.a3c1","mode":"single","variable":"New Alarm","diff":true,"name":"","x":140,"y":440,"wires":[["8a9d3537.bd2a68"]]},{"id":"9434025.ae8ac","type":"pccc out","z":"a945bb2b.c285e8","endpoint":"ba0b9c2b.a3c1","variable":"","name":"","x":730,"y":40,"wires":[]},{"id":"c643bb7f.bebcd8","type":"pccc out","z":"a945bb2b.c285e8","endpoint":"ba0b9c2b.a3c1","variable":"","name":"","x":890,"y":140,"wires":[]},{"id":"16897b7e.09fad5","type":"pccc out","z":"a945bb2b.c285e8","endpoint":"ba0b9c2b.a3c1","variable":"","name":"","x":650,"y":220,"wires":[]},{"id":"5432c057.6df59","type":"pccc out","z":"a945bb2b.c285e8","endpoint":"ba0b9c2b.a3c1","variable":"","name":"","x":870,"y":280,"wires":[]},{"id":"5dc38291.a6aa64","type":"ui_led","z":"a945bb2b.c285e8","order":1,"group":"f939857c.dafb1","width":1,"height":1,"label":"","labelPlacement":"left","labelAlignment":"left","colorForValue":[{"color":"#f5f5f5","value":"0","valueType":"num"},{"color":"#ff8000","value":"1","valueType":"num"},{"color":"#ff0000","value":"2","valueType":"num"}],"allowColorForValueInMessage":false,"shape":"circle","showGlow":false,"name":"","x":370,"y":340,"wires":[]},{"id":"38f753c4.dcf3cc","type":"function","z":"a945bb2b.c285e8","name":"","func":"if (msg.payload ==0 ){\n {color: \"white\"};\nreturn {payload : \"No Fault\"}; \n\n}\nif (msg.payload ==1 ){\nreturn {payload : \"Fault Acknowledged\"};\n}\nif (msg.payload ==2 ){\nreturn {payload : \"Fault Active\"};\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":380,"y":380,"wires":[["c7d4a2e2.7894"]]},{"id":"c7d4a2e2.7894","type":"ui_text","z":"a945bb2b.c285e8","group":"f939857c.dafb1","order":2,"width":5,"height":1,"name":"","label":"","format":"{{msg.payload}}","layout":"row-left","x":530,"y":380,"wires":[]},{"id":"1f5bf84a.1a2278","type":"ui_template","z":"a945bb2b.c285e8","group":"4c346a10.bf931c","name":"","order":5,"width":0,"height":0,"format":"<head>\n<Style>\n\n:root{\n --base-color:#d3d3d3;\n --shadow-dark:0, 0, 0;\n --shadow-light:255, 255, 255;\n --widgetColor:#cccccc;\n --widgetColorAccent:#b6b6b6;\n --accentColor:#6a87a3;\n \n \n --h1:10px;\n --v1:10px;\n --h2:-8px;\n --v2:-8px;\n --blur1:16px;\n --blur2:12px;\n\n --shadowColor: var(--h1) var(--v1) var(--blur1) 0 rgba(var(--shadow-dark), 0.3),\n var(--h2) var(--v2) var(--blur2) 0 rgba(var(--shadow-light), 0.25);\n\n --text-color:#000000;\n --nr-dashboard-widgetTextColor:#000000;\n}\n\nbody.md-default-theme, body, html.md-default-theme, html {\n color: var(--text-color);\n border:3px solid #a6a6a6;\n font-size: 18px;\n\n}\n.masonry-container {\n position: relative;\n width: 100%;\n margin: 0 auto;\n min-height:unset !important;\n}\nbody.nr-dashboard-theme {\n background:var(--base-color)\n}\nbody.nr-dashboard-theme md-toolbar {\n background:var(--base-color);\n color: var(--text-color);\n}\nbody.nr-dashboard-theme md-sidenav {\n color: var(--text-color);\n background:var(--base-color)\n}\nbody.nr-dashboard-theme md-sidenav div.md-list-item-inner {\n color: var(--text-color);\n background-color: transparent;\n}\n.nr-dashboard-theme ui-card-panel {\n background:linear-gradient(-45deg, rgba(var(--shadow-dark),0.2), rgba(var(--shadow-light),0.3));\n border-radius: 1em;\n box-shadow: var(--shadowColor);\n border:none;\n\n}\nbody.nr-dashboard-theme md-content md-card {\n background:transparent;\n color: var(--text-color);\n}\n.nr-dashboard-theme .nr-dashboard-template {\n background:transparent;\n}\n.nr-dashboard-theme ui-card-panel p.nr-dashboard-cardtitle {\n color:var(--text-color);\n \n}\n\n.md-button{\n border-radius:0.6em;\n color: var(--text-color);\n \n}\n.nr-dashboard-theme .nr-dashboard-button .md-button {\n background-color: var(--widgetColor);\n box-shadow: var(--shadowColor);\n color: #000000;\n border: 1.5px solid #b3b3b3;\n \n \n}\n.md-button.md-raised:not([disabled]) {\n box-shadow: 2px 4px 7px 0 rgb(0 0 0 / 26%);\n}\n.md-button:not([disabled]).md-fab:active, .md-button:not([disabled]).md-raised:active {\n box-shadow: 1px 1px 2px 0 rgb(0 0 0 / 30%);\n}\n.nr-dashboard-theme .nr-dashboard-button .md-button:hover {\n background-color: var(--widgetColor);\n}\n.nr-dashboard-theme .nr-dashboard-button .md-button:focus {\n background-color: var(--widgetColor);\n}\nmd-list-item.md-no-proxy.md-button, md-list-item .md-no-style.md-button {\n box-shadow: 2px 4px 7px 0 rgb(0 0 0 / 26%);\n}\n.nr-dashboard-theme .nr-dashboard-numeric .value {\n background:unset;\n color:var(--text-color);\n}\n.nr-dashboard-theme .nr-dashboard-form {\n color:var(--text-color);\n}\n.nr-dashboard-theme .nr-dashboard-form-button {\n background-color: var(--widgetColor);\n color:var(--text-color);\n}\n\n.nr-dashboard-theme .nr-dashboard-form-button:hover {\n background-color: var(--widgetColor) !important;\n}\n.nr-dashboard-theme .nr-dashboard-form-button:focus {\n background-color: var(--widgetColor) !important;\n}\n.nr-dashboard-theme md-input-container.md-default-theme .md-input, md-input-container .md-input {\n color:var(--text-color);\n border-color: var(--widgetColor) !important;\n}\n.nr-dashboard-theme .nr-dashboard-switch md-switch .md-thumb {\n background-color: var(--widgetColor);\n\n}\n.nr-dashboard-theme .nr-dashboard-switch md-switch .md-bar {\n background-color: rgb(var(--widgetColor));\n box-shadow: inset var(--shadowColor);\n}\n.nr-dashboard-theme .nr-dashboard-switch md-switch.md-checked .md-bar {\n background-color: var(--widgetColorAccent);\n box-shadow: 0 0 10px 0px var(--widgetColor);\n}\n.nr-dashboard-theme .nr-dashboard-switch md-switch.md-checked .md-thumb {\n background-color: var(--accentColor);\n box-shadow: 0 0 10px 0px rgba(var(--shadow-dark),25%);\n}\n.nr-dashboard-theme .nr-dashboard-slider .md-track {\n background-color: var(--accentColor);\n}\nmd-slider .md-thumb {\n box-shadow: var(--shadowColor)\n}\n\n.nr-dashboard-theme .nr-dashboard-slider .md-thumb:after {\n background-color: var(--accentColor);\n border-color: var(--accentColor);\n}\n\n.nr-dashboard-theme md-select-menu, .nr-dashboard-theme md-select-menu md-option {\n background-color: rgb(255 255 255 / 20%);\n color:var(--text-color);\n border-radius:0.8em;\n}\n\n.nr-dashboard-theme .nr-dashboard-dropdown md-select .md-select-value, .nr-dashboard-theme .nr-dashboard-dropdown md-select .md-select-value.md-select-placeholder {\n margin-top: -3px;\n border-color: #eeeeee7a;\n \n}\n.nr-dashboard-theme .md-select-menu-container {\n max-height: 85%;\n overflow-y: auto;\n border: none;\n border-radius: 0.8em;\n}\n\n.nr-dashboard-theme md-select-menu md-option {\n background-color: var(--widgetColor);\n \n height: 29px;\n border-radius: 0.6em;\n margin-left: 10px;\n margin-right: 10px;\n margin-top: 2px;\n box-shadow: 0 0 6px 6px #24202133;\n transition: 0.3s;\n}\n.nr-dashboard-theme md-select-menu md-option[selected] {\n color: var(--base-color) !important;\n background-color: var(--accentColor) !important;\n}\n.nr-dashboard-theme md-select-menu md-option:nth-child(even) {\n background-color: var(--widgetColorAccent);\n}\n.nr-dashboard-theme md-select-menu md-option:last-child {\n margin-bottom: 8px;\n}\n.nr-dashboard-theme md-select-menu md-option:hover {\n background-color: var(--widgetColorAccent) !important;\n padding-left: 26px;\n}\n.nr-dashboard-theme md-select-menu md-option > .md-ripple-container{\n border-radius: 14px;\n}\n.nr-dashboard-theme .nr-dashboard-dropdown md-select .md-select-value, .nr-dashboard-theme .nr-dashboard-dropdown md-select .md-select-value.md-select-placeholder {\n color: var(--text-color);\n border-color: var(--text-color);\n border-bottom-width: 1px;\n padding: 0px 2px;\n}\n\n\n \n</style>\n </head>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":1200,"y":240,"wires":[[]]},{"id":"704118ab.a99698","type":"tab","label":"Alarm Area 2","disabled":false,"info":""},{"id":"99fd9886.e85c68","type":"ui_button","z":"704118ab.a99698","name":"Acknowledge Alarm","group":"6fd69085.28bef8","order":3,"width":3,"height":1,"passthru":true,"label":"Acknowledge","tooltip":"Caution :Clicking Will Acknowlwedge Alarms","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":220,"y":140,"wires":[["aad1fafd.4120e8"]]},{"id":"aad1fafd.4120e8","type":"trigger","z":"704118ab.a99698","name":"","op1":"1","op2":"0","op1type":"num","op2type":"num","duration":"1","extend":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":2,"x":460,"y":140,"wires":[["cb124bd2.55d3e8"],["c58f18cb.84ca38"]]},{"id":"c58f18cb.84ca38","type":"trigger","z":"704118ab.a99698","name":"","op1":"0","op2":"","op1type":"num","op2type":"nul","duration":"2","extend":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":640,"y":200,"wires":[["54fb1726.96cda"]]},{"id":"97f30b22.41f4a","type":"ui_button","z":"704118ab.a99698","name":"Reset","group":"6fd69085.28bef8","order":4,"width":3,"height":1,"passthru":true,"label":"Reset","tooltip":"Caution :Clicking Will Attempt To Reset All Alarms","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":90,"y":320,"wires":[["593508c7.a4613"]],"info":"<style>\nmd-button {\n background-image: linear-gradient(to right, rgba(255,0,0,1),rgba(255,0,0,0),\n}\n</style>"},{"id":"593508c7.a4613","type":"trigger","z":"704118ab.a99698","name":"","op1":"1","op2":"0","op1type":"num","op2type":"num","duration":"2","extend":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":2,"x":320,"y":320,"wires":[["a697bf82.b0acf"],["d7588702.c15ac8"]]},{"id":"d7588702.c15ac8","type":"trigger","z":"704118ab.a99698","name":"","op1":"0","op2":"","op1type":"num","op2type":"nul","duration":"3","extend":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":600,"y":340,"wires":[["868dd652.d83a58"]]},{"id":"c84f9c6a.2c2eb","type":"function","z":"704118ab.a99698","name":"","func":"//var modbusCode = msg.payload[0];\n//var lastCode = flow.get('lastModbusCode') || 0;\n//\n//if (lastCode == modbusCode) {\n// return null;\n//}\n\n//flow.set('lastModbusCode', modbusCode);\n\n//if (modbusCode === 0) {\n // return null;\n//}\n\n//const mapCodeDescription = {\n// 1: \"Plantroom 1 Fault\",\n//};\nif (msg.payload==1){\nmsg.topic = \"Plantroom 1 New Alarm \"\nmsg.payload = \"<p>Dear Portal User,</p>\" +\n\"<p>Please note that you have a fault at: Boyd Wilson Electrical Renwick Plant - Plantroom 1.</p>\" +\n\"<p>Visit <a href=\\\"https://bwel-portal.co.nz/login\\\">bwel-portal.co.nz/</a> to clear the fault if possible.</p>\" +\n\"<p></p>\" +\n\"<p></p>\" +\n\"<p><p/>\" +\n\"Portal Admin</p>\" +\n\"<p>Boyd Wilson Electrical Ltd<br />\" +\n\"PO Box 110, Renwick 7243<br />\" +\n\"11a Uxbridge Street, Renwick 7204<br />\" +\n\"Marlborough</p>\" +\n\"<p></p>\" +\n\"+P: 03 572 7448</p>\" +\n\"<p></p>\" +\n\"<img src=\\\"https://fakeimg.pl/300x70/?text=Boyd%20Wilson&font=lobster\\\">\";\n\nreturn msg;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","x":660,"y":500,"wires":[["72117d4d.0547f4","56d03800.83975"]]},{"id":"72117d4d.0547f4","type":"e-mail","z":"704118ab.a99698","server":"mail.1stdomainz.co.nz","port":"25","secure":false,"tls":false,"name":"","dname":"","x":840,"y":500,"wires":[]},{"id":"56d03800.83975","type":"debug","z":"704118ab.a99698","name":"","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":860,"y":460,"wires":[]},{"id":"87c59b59.6d9158","type":"trigger","z":"704118ab.a99698","name":"","op1":"1","op2":"","op1type":"str","op2type":"nul","duration":"500","extend":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":480,"y":500,"wires":[["c84f9c6a.2c2eb"]]},{"id":"34a66bd3.dab4cc","type":"function","z":"704118ab.a99698","name":"","func":"if (msg.payload ==false ){\nreturn null;\n}\nif (msg.payload ==true ){\nreturn {payload : \"1\"};\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":300,"y":500,"wires":[["87c59b59.6d9158"]]},{"id":"c9447fc4.4c3ab","type":"pccc in","z":"704118ab.a99698","endpoint":"ba0b9c2b.a3c1","mode":"single","variable":"Alarm Status","diff":true,"name":"","x":130,"y":400,"wires":[["1eac6792.0fdcd8","88025018.1b0488"]]},{"id":"b0efc1f3.681918","type":"pccc in","z":"704118ab.a99698","endpoint":"ba0b9c2b.a3c1","mode":"single","variable":"New Alarm","diff":true,"name":"","x":120,"y":500,"wires":[["34a66bd3.dab4cc"]]},{"id":"cb124bd2.55d3e8","type":"pccc out","z":"704118ab.a99698","endpoint":"ba0b9c2b.a3c1","variable":"Acknowledge Alarm","name":"","x":710,"y":100,"wires":[]},{"id":"54fb1726.96cda","type":"pccc out","z":"704118ab.a99698","endpoint":"ba0b9c2b.a3c1","variable":"Acknowledge Alarm","name":"","x":870,"y":200,"wires":[]},{"id":"a697bf82.b0acf","type":"pccc out","z":"704118ab.a99698","endpoint":"ba0b9c2b.a3c1","variable":"Reset","name":"","x":580,"y":280,"wires":[]},{"id":"868dd652.d83a58","type":"pccc out","z":"704118ab.a99698","endpoint":"ba0b9c2b.a3c1","variable":"Reset","name":"","x":800,"y":340,"wires":[]},{"id":"1eac6792.0fdcd8","type":"ui_led","z":"704118ab.a99698","order":1,"group":"6fd69085.28bef8","width":1,"height":1,"label":"","labelPlacement":"left","labelAlignment":"center","colorForValue":[{"color":"#f5f5f5","value":"0","valueType":"num"},{"color":"#ff0000","value":"1","valueType":"num"},{"color":"#ff8000","value":"2","valueType":"num"}],"allowColorForValueInMessage":false,"shape":"circle","showGlow":false,"name":"","x":390,"y":380,"wires":[]},{"id":"e71576ec.c3dc18","type":"ui_text","z":"704118ab.a99698","group":"6fd69085.28bef8","order":2,"width":5,"height":1,"name":"","label":"","format":"{{msg.payload}}","layout":"row-left","x":550,"y":440,"wires":[]},{"id":"88025018.1b0488","type":"function","z":"704118ab.a99698","name":"","func":"if (msg.payload ==0 ){\nreturn {payload : \"No Fault\"};\n}\nif (msg.payload ==1 ){\nreturn {payload : \"Fault Present\"};\n}\nif (msg.payload ==2 ){\nreturn {payload : \"Fault Active\"};\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":380,"y":440,"wires":[["e71576ec.c3dc18"]]},{"id":"874d52bc.49c108","type":"tab","label":"Alarm Area 3","disabled":false,"info":""},{"id":"d9bf3f85.88548","type":"ui_button","z":"874d52bc.49c108","name":"Acknowledge Alarm","group":"20ffb11.b36b64e","order":3,"width":3,"height":1,"passthru":true,"label":"Acknowledge","tooltip":"Caution :Clicking Will Acknowlwedge Alarms","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":220,"y":120,"wires":[["483a0743.7dafb8"]]},{"id":"483a0743.7dafb8","type":"trigger","z":"874d52bc.49c108","name":"","op1":"1","op2":"0","op1type":"num","op2type":"num","duration":"1","extend":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":2,"x":460,"y":120,"wires":[["53f52100.038c58"],["f9481a6f.10d848"]]},{"id":"f9481a6f.10d848","type":"trigger","z":"874d52bc.49c108","name":"","op1":"0","op2":"","op1type":"num","op2type":"nul","duration":"2","extend":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":640,"y":180,"wires":[["35036958.d2e636"]]},{"id":"104dcdd1.32ecca","type":"ui_button","z":"874d52bc.49c108","name":"Reset","group":"20ffb11.b36b64e","order":4,"width":3,"height":1,"passthru":true,"label":"Reset","tooltip":"Caution :Clicking Will Attempt To Reset All Alarms","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":90,"y":300,"wires":[["3e201bb5.096a5c"]],"info":"<style>\nmd-button {\n background-image: linear-gradient(to right, rgba(255,0,0,1),rgba(255,0,0,0),\n}\n</style>"},{"id":"3e201bb5.096a5c","type":"trigger","z":"874d52bc.49c108","name":"","op1":"1","op2":"0","op1type":"num","op2type":"num","duration":"2","extend":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":2,"x":320,"y":300,"wires":[["5ec754b3.a1bdc4"],["c3a6dca9.a9f428"]]},{"id":"c3a6dca9.a9f428","type":"trigger","z":"874d52bc.49c108","name":"","op1":"0","op2":"","op1type":"num","op2type":"nul","duration":"3","extend":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":600,"y":320,"wires":[["b4d8eee7.dca578"]]},{"id":"225d2cf2.f58834","type":"function","z":"874d52bc.49c108","name":"","func":"//var modbusCode = msg.payload[0];\n//var lastCode = flow.get('lastModbusCode') || 0;\n//\n//if (lastCode == modbusCode) {\n// return null;\n//}\n\n//flow.set('lastModbusCode', modbusCode);\n\n//if (modbusCode === 0) {\n // return null;\n//}\n\n//const mapCodeDescription = {\n// 1: \"Plantroom 1 Fault\",\n//};\nif (msg.payload==1){\nmsg.topic = \"Plantroom 1 New Alarm \"\nmsg.payload = \"<p>Dear Portal User,</p>\" +\n\"<p>Please note that you have a fault at: Boyd Wilson Electrical Renwick Plant - Plantroom 1.</p>\" +\n\"<p>Visit <a href=\\\"https://bwel-portal.co.nz/login\\\">bwel-portal.co.nz/</a> to clear the fault if possible.</p>\" +\n\"<p></p>\" +\n\"<p></p>\" +\n\"<p><p/>\" +\n\"Portal Admin</p>\" +\n\"<p>Boyd Wilson Electrical Ltd<br />\" +\n\"PO Box 110, Renwick 7243<br />\" +\n\"11a Uxbridge Street, Renwick 7204<br />\" +\n\"Marlborough</p>\" +\n\"<p></p>\" +\n\"+P: 03 572 7448</p>\" +\n\"<p></p>\" +\n\"<img src=\\\"https://fakeimg.pl/300x70/?text=Boyd%20Wilson&font=lobster\\\">\";\n\nreturn msg;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","x":660,"y":480,"wires":[["c79c5fad.ff7798","1d910fad.fad558"]]},{"id":"c79c5fad.ff7798","type":"e-mail","z":"874d52bc.49c108","server":"mail.1stdomainz.co.nz","port":"25","secure":false,"tls":false,"name":"","dname":"","x":840,"y":480,"wires":[]},{"id":"1d910fad.fad558","type":"debug","z":"874d52bc.49c108","name":"","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":860,"y":440,"wires":[]},{"id":"40a25010.017c18","type":"trigger","z":"874d52bc.49c108","name":"","op1":"1","op2":"","op1type":"str","op2type":"nul","duration":"500","extend":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":480,"y":480,"wires":[["225d2cf2.f58834"]]},{"id":"4933b479.c7cbf4","type":"function","z":"874d52bc.49c108","name":"","func":"if (msg.payload ==false ){\nreturn null;\n}\nif (msg.payload ==true ){\nreturn {payload : \"1\"};\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":300,"y":480,"wires":[["40a25010.017c18"]]},{"id":"89d21995.5bfb58","type":"pccc in","z":"874d52bc.49c108","endpoint":"ba0b9c2b.a3c1","mode":"single","variable":"Alarm Status","diff":true,"name":"","x":130,"y":380,"wires":[["7308e799.9bcb68","6b7e5dd4.dd516c"]]},{"id":"97bd60f6.fb0f3","type":"pccc in","z":"874d52bc.49c108","endpoint":"ba0b9c2b.a3c1","mode":"single","variable":"New Alarm","diff":true,"name":"","x":120,"y":480,"wires":[["4933b479.c7cbf4"]]},{"id":"53f52100.038c58","type":"pccc out","z":"874d52bc.49c108","endpoint":"ba0b9c2b.a3c1","variable":"Acknowledge Alarm","name":"","x":710,"y":80,"wires":[]},{"id":"35036958.d2e636","type":"pccc out","z":"874d52bc.49c108","endpoint":"ba0b9c2b.a3c1","variable":"Acknowledge Alarm","name":"","x":870,"y":180,"wires":[]},{"id":"5ec754b3.a1bdc4","type":"pccc out","z":"874d52bc.49c108","endpoint":"ba0b9c2b.a3c1","variable":"Reset","name":"","x":580,"y":260,"wires":[]},{"id":"b4d8eee7.dca578","type":"pccc out","z":"874d52bc.49c108","endpoint":"ba0b9c2b.a3c1","variable":"Reset","name":"","x":800,"y":320,"wires":[]},{"id":"7308e799.9bcb68","type":"ui_led","z":"874d52bc.49c108","order":1,"group":"20ffb11.b36b64e","width":1,"height":1,"label":"","labelPlacement":"left","labelAlignment":"center","colorForValue":[{"color":"#f5f5f5","value":"0","valueType":"num"},{"color":"#ff0000","value":"1","valueType":"num"},{"color":"#ff8000","value":"2","valueType":"num"}],"allowColorForValueInMessage":false,"shape":"circle","showGlow":false,"name":"","x":390,"y":360,"wires":[]},{"id":"324e9cb0.64b9ec","type":"ui_text","z":"874d52bc.49c108","group":"20ffb11.b36b64e","order":2,"width":5,"height":1,"name":"","label":"","format":"{{msg.payload}}","layout":"row-left","x":550,"y":420,"wires":[]},{"id":"6b7e5dd4.dd516c","type":"function","z":"874d52bc.49c108","name":"","func":"if (msg.payload ==0 ){\nreturn {payload : \"No Fault\"};\n}\nif (msg.payload ==1 ){\nreturn {payload : \"Fault Present\"};\n}\nif (msg.payload ==2 ){\nreturn {payload : \"Fault Active\"};\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":380,"y":420,"wires":[["324e9cb0.64b9ec"]]},{"id":"f939857c.dafb1","type":"ui_group","z":"","name":"Alarm Area 1","tab":"862fc89c.1e2e58","order":1,"disp":true,"width":6,"collapse":false},{"id":"ba0b9c2b.a3c1","type":"pccc endpoint","z":"","address":"192.168.1.151","port":"44818","userouting":false,"routing":"0x01,0x00,0x01,0x00","cycletime":"500","timeout":"1500","name":"","vartable":[{"addr":"N99:0/0","name":"New Alarm"},{"addr":"N99:0/1","name":"Alarm Active"},{"addr":"N99:1/0","name":"Sewer Exit Sump Pump1 FTR"},{"addr":"N99:1/1","name":"Sewer Exit Sump Pump2 FTR"},{"addr":"N99:1/2","name":"Sewer Tanks Pump1 FTR"},{"addr":"N99:1/3","name":"Sewer Tanks Pump2 FTR"},{"addr":"N99:1/4","name":"Wastewater Sump Pump1 FTR"},{"addr":"N99:1/5","name":"Wastewater Sump Pump2 FTR"},{"addr":"N99:1/6","name":"Wastewater Sump Mixer FTR"},{"addr":"N99:19/0","name":"Crevis Comms Fault"},{"addr":"N99:19/1","name":"Sewer Exit Sump Levels Fault"},{"addr":"N99:19/2","name":"Sewer Tanks Levels Fault"},{"addr":"N99:19/3","name":"Sewer Exit Sump Low Level"},{"addr":"N99:19/4","name":"Sewer Exit Sump High Level"},{"addr":"N99:19/5","name":"Sewer Tanks Low Level"},{"addr":"N99:19/6","name":"Sewer Tanks High Level"},{"addr":"N9:41","name":"Alarm Status"},{"addr":"N10:0/0","name":"Reset"},{"addr":"N199:46/0","name":"Acknowledge Alarm"}]},{"id":"4c346a10.bf931c","type":"ui_group","z":"","name":"Alarm Area 6","tab":"862fc89c.1e2e58","order":6,"disp":true,"width":"6","collapse":false},{"id":"6fd69085.28bef8","type":"ui_group","z":"","name":"Alarm Area 2","tab":"862fc89c.1e2e58","order":2,"disp":true,"width":"6","collapse":false},{"id":"20ffb11.b36b64e","type":"ui_group","z":"","name":"Alarm Area 3","tab":"862fc89c.1e2e58","order":3,"disp":true,"width":"6","collapse":false},{"id":"862fc89c.1e2e58","type":"ui_tab","z":"","name":"Kono Seafoods Site Alarm Overview","icon":"dashboard","disabled":false,"hidden":false}]