-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathnode-red-flow.json
1 lines (1 loc) · 14.2 KB
/
node-red-flow.json
1
[{"id":"ab68727d.70a76","type":"mqtt in","z":"c283bf8e.d3b6f","name":"","topic":"/devices/misol/controls/temperature","qos":"2","datatype":"auto","broker":"96fca218.47807","x":320,"y":800,"wires":[["6a5d11c1.21c8a"]]},{"id":"6a5d11c1.21c8a","type":"function","z":"c283bf8e.d3b6f","name":"","func":"msg.payload = (parseInt(msg.payload)/10).toFixed(1);\nnode.status({fill:\"grey\",shape:\"dot\",text:msg.payload +' °C'});\n\nreturn msg;","outputs":1,"noerr":0,"x":550,"y":800,"wires":[["7ceee4f1.eb39dc"]]},{"id":"7ceee4f1.eb39dc","type":"ui_text","z":"c283bf8e.d3b6f","group":"bb6d39b2.df82c8","order":1,"width":"5","height":"1","name":"","label":"Температура","format":"{{msg.payload}} °C","layout":"row-spread","x":720,"y":800,"wires":[]},{"id":"6e953b81.d7c554","type":"ui_text","z":"c283bf8e.d3b6f","group":"bb6d39b2.df82c8","order":2,"width":"5","height":"1","name":"","label":"Влажность","format":"{{msg.payload}} %","layout":"row-spread","x":710,"y":860,"wires":[]},{"id":"87ff4c0b.fe0a","type":"function","z":"c283bf8e.d3b6f","name":"","func":"msg.payload = parseInt(msg.payload);\nnode.status({fill:\"grey\",shape:\"dot\",text:msg.payload +'%'});\n\nreturn msg;","outputs":1,"noerr":0,"x":550,"y":860,"wires":[["6e953b81.d7c554"]]},{"id":"15266ba3.9645c4","type":"mqtt in","z":"c283bf8e.d3b6f","name":"","topic":"/devices/misol/controls/humidity","qos":"2","datatype":"auto","broker":"96fca218.47807","x":310,"y":860,"wires":[["87ff4c0b.fe0a"]]},{"id":"67bb78bb.e216f8","type":"ui_text","z":"c283bf8e.d3b6f","group":"bb6d39b2.df82c8","order":3,"width":"5","height":"1","name":"","label":"Освещенность","format":"{{msg.payload}} лк","layout":"row-spread","x":720,"y":920,"wires":[]},{"id":"b531aed2.1e901","type":"function","z":"c283bf8e.d3b6f","name":"","func":"msg.payload = (parseInt(msg.payload)/10).toFixed(0);\nnode.status({fill:\"grey\",shape:\"dot\",text:msg.payload +' лк'});\n\nreturn msg;","outputs":1,"noerr":0,"x":550,"y":920,"wires":[["67bb78bb.e216f8"]]},{"id":"20fc3a2.08e97c6","type":"mqtt in","z":"c283bf8e.d3b6f","name":"","topic":"/devices/misol/controls/light","qos":"2","datatype":"auto","broker":"96fca218.47807","x":300,"y":920,"wires":[["b531aed2.1e901"]]},{"id":"dc712b7e.b2e138","type":"ui_text","z":"c283bf8e.d3b6f","group":"bb6d39b2.df82c8","order":4,"width":"5","height":"1","name":"","label":"Давление","format":"{{msg.payload}} кПа","layout":"row-spread","x":710,"y":980,"wires":[]},{"id":"7f2d06f1.227638","type":"function","z":"c283bf8e.d3b6f","name":"","func":"msg.payload = (parseInt(msg.payload)/1000).toFixed(2);\nnode.status({fill:\"grey\",shape:\"dot\",text:msg.payload +' кПа'});\n\nreturn msg;","outputs":1,"noerr":0,"x":550,"y":980,"wires":[["dc712b7e.b2e138"]]},{"id":"61976b86.349804","type":"mqtt in","z":"c283bf8e.d3b6f","name":"","topic":"/devices/misol/controls/bar","qos":"2","datatype":"auto","broker":"96fca218.47807","x":290,"y":980,"wires":[["7f2d06f1.227638"]]},{"id":"2c59e248.24c2ae","type":"ui_text","z":"c283bf8e.d3b6f","group":"bb6d39b2.df82c8","order":5,"width":"5","height":"1","name":"","label":"Осадки","format":"{{msg.payload}} мм","layout":"row-spread","x":700,"y":1040,"wires":[]},{"id":"5cb9870f.f2e8c8","type":"function","z":"c283bf8e.d3b6f","name":"","func":"msg.payload = parseInt(msg.payload);\nnode.status({fill:\"grey\",shape:\"dot\",text:msg.payload +' мм'});\n\nreturn msg;","outputs":1,"noerr":0,"x":550,"y":1040,"wires":[["2c59e248.24c2ae"]]},{"id":"c6c2f96c.7e8588","type":"mqtt in","z":"c283bf8e.d3b6f","name":"","topic":"/devices/misol/controls/rain","qos":"2","datatype":"auto","broker":"96fca218.47807","x":300,"y":1040,"wires":[["5cb9870f.f2e8c8"]]},{"id":"cd1a0d2c.56d81","type":"function","z":"c283bf8e.d3b6f","name":"","func":"msg.payload = parseInt(msg.payload);\nnode.status({fill:\"grey\",shape:\"dot\",text:msg.payload +' м/c'});\n\nreturn msg;","outputs":1,"noerr":0,"x":550,"y":1220,"wires":[["a811e353.6e589"]]},{"id":"b8a329db.e7e4a8","type":"mqtt in","z":"c283bf8e.d3b6f","name":"","topic":"/devices/misol/controls/wind_speed","qos":"2","datatype":"auto","broker":"96fca218.47807","x":320,"y":1220,"wires":[["cd1a0d2c.56d81"]]},{"id":"61ab9c31.474304","type":"ui_text","z":"c283bf8e.d3b6f","group":"bb6d39b2.df82c8","order":6,"width":"5","height":"1","name":"","label":"Порывы ветра","format":"{{msg.payload}} м/с","layout":"row-spread","x":720,"y":1100,"wires":[]},{"id":"79ca757f.2196ec","type":"function","z":"c283bf8e.d3b6f","name":"","func":"msg.payload = parseInt(msg.payload);\nnode.status({fill:\"grey\",shape:\"dot\",text:msg.payload +' м/c'});\n\nreturn msg;","outputs":1,"noerr":0,"x":550,"y":1100,"wires":[["61ab9c31.474304"]]},{"id":"193df403.9ee4cc","type":"mqtt in","z":"c283bf8e.d3b6f","name":"","topic":"/devices/misol/controls/wind_gust","qos":"2","datatype":"auto","broker":"96fca218.47807","x":320,"y":1100,"wires":[["79ca757f.2196ec"]]},{"id":"678395a.1ccf56c","type":"mqtt in","z":"c283bf8e.d3b6f","name":"","topic":"/devices/misol/controls/wind_direction","qos":"2","datatype":"auto","broker":"96fca218.47807","x":330,"y":1280,"wires":[["22e8f8ea.e092e8"]]},{"id":"353a5aec.0d43a6","type":"ui_gauge","z":"c283bf8e.d3b6f","name":"","group":"bb6d39b2.df82c8","order":8,"width":"5","height":"5","gtype":"gage","title":"УФ индекс","label":"","format":"{{value}}","min":0,"max":"13","colors":["#00b500","#e6e600","#ca3838"],"seg1":"2","seg2":"6","x":710,"y":1160,"wires":[]},{"id":"757bae70.88d07","type":"function","z":"c283bf8e.d3b6f","name":"","func":"msg.payload = parseInt(msg.payload);\n\nif (msg.payload <= 432) msg.payload = 0;\nelse if (msg.payload <= 851) msg.payload = 1;\nelse if (msg.payload <= 1210) msg.payload = 2;\nelse if (msg.payload <= 1570) msg.payload = 3;\nelse if (msg.payload <= 2017) msg.payload = 4;\nelse if (msg.payload <= 2761) msg.payload = 5;\nelse if (msg.payload <= 3100) msg.payload = 6;\nelse if (msg.payload <= 3512) msg.payload = 7;\nelse if (msg.payload <= 3918) msg.payload = 8;\nelse if (msg.payload <= 4277) msg.payload = 9;\nelse if (msg.payload <= 4650) msg.payload = 10;\nelse if (msg.payload <= 5029) msg.payload = 11;\nelse if (msg.payload <= 5230) msg.payload = 12;\nelse msg.payload = 13\n;\nnode.status({fill:\"grey\",shape:\"dot\",text:msg.payload});\n\nreturn msg;\n\n","outputs":1,"noerr":0,"x":550,"y":1160,"wires":[["353a5aec.0d43a6"]]},{"id":"4434c8c0.ff9058","type":"mqtt in","z":"c283bf8e.d3b6f","name":"","topic":"/devices/misol/controls/uvi","qos":"2","datatype":"auto","broker":"96fca218.47807","x":290,"y":1160,"wires":[["757bae70.88d07"]]},{"id":"5d41d696.c2b458","type":"ui_template","z":"c283bf8e.d3b6f","group":"bb6d39b2.df82c8","name":"Ветер","order":7,"width":"4","height":"4","format":"<!--\npass msg.payload.degrees, msg.payload.speed, msg.payload.speed_unit\n-->\n<script>\n // Watch the incoming message and convert the degrees to a human readable compass direction\n (function(scope){\n scope.$watch('msg', function(msg) {\n if(typeof(msg) === \"object\"){\n // Convert the degrees to cardinal directions\n var deg = msg.payload.degrees;\n var dirs = [\"С\",\"ССВ\",\"СВ\",\"ВСВ\",\"В\",\"ВЮВ\",\"ЮВ\",\"ЮЮВ\",\"Ю\",\"ЮЮЗ\",\"ЮЗ\",\"ЗЮЗ\",\"З\",\"ЗСЗ\",\"СЗ\",\"ССЗ\",\"С\"];\n var idx = Math.round(deg*(dirs.length-1)/360);\n scope.direction = dirs[idx];\n \n \n // Keep track of the highest speed value, giving it 40 as a rough starting point.\n // Works okay for MPH and KTS, but KMH will show purple at a lower speed than the rest\n scope.max_val = (msg.payload.speed > scope.max_val ? msg.payload.speed : 40);\n \n scope.p_speed = msg.payload.speed;\n scope.p_max_val = scope.max_val;\n var low_colors = [\n '#FFFFFF', // white\n '#d6f7ff', // light blue\n '#85ffd2', // blue green\n '#61ff6e' // green 10mph\n ];\n var high_colors = [\n '#61ff6e', // green 10mph\n '#d5ff61', // green yellow\n '#fffc61', // yellow\n '#ffe561', // yellow orange 20mph\n '#ffcd61', // orange\n '#ffad61', // orange red\n '#ff7661', // red\n '#ff61dd', // red purple\n '#e261ff' // purple\n ];\n \n if(msg.payload.speed <= 10){\n scope.color = low_colors[Math.round(msg.payload.speed*(low_colors.length-1)/10)];\n }else{\n scope.color = high_colors[Math.round(msg.payload.speed*(high_colors.length-1) / scope.max_val)];\n }\n \n //$(\".compass_container\").css(\"background-color\",scope.color);\n }\n \t});\n })(scope);\n \n // Hacks to improve the layout and make it scale\n $(document).ready(function(){\n setTimeout(function () {\n // Remove the auto scrolling from the parent node\n $(\".compass_container\").parent().css(\"overflow\",\"hidden\");\n \n // Adjust the color to match the theme base color by looking up the toolbar header background color;\n $(\".compass_container .triangle\").css(\"border-bottom-color\",$(\"md-toolbar\").css(\"background-color\"));\n \n // Scale the compass into the box that it's being rendered in\n // This CSS hack helps make sure the line & font size scales appropriately\n // Based on the node's grid size\n $(\".compass_container\").each(function(k,v){\n var scaleWidth = $(v).parent().width() / $(v).width();\n var scaleHeight = $(v).parent().height() / $(v).height();\n \n var translateX = ($(v).width() - $(v).parent().width()) / 2;\n var translateY = ($(v).height() - $(v).parent().height()) / 2;\n \n $(v).css(\"transform\",\"translate(-\"+translateX+\"px,-\"+translateY+\"px) scale(\"+scaleWidth+\",\"+scaleHeight+\") \");\n });\n \n $(\".compass_container\").css(\"display\",\"block\"); // Unhide it now that it's resized\n }, 1000);\n });\n</script>\n<style>\n @import url(https://fonts.googleapis.com/css?family=Dosis:200,400,500,600);\n \n .compass_container{\n transition: 1s ease-in-out;\n position: relative;\n display: none;\n width: 500px;\n height: 500px;\n border-radius: 100%;\n font-family: 'Dosis';\n font-size: 80px;\n box-shadow: inset 0px 0px 0px 30px #777; \n background-color: {{color}};\n margin:0 auto;\n color:black;\n }\n \n .compass_container .compass_header{\n font-weight: bold;\n position: absolute;\n text-align: center;\n width: 100%;\n font-size: 75%;\n top: -15px\n color:black;\n }\n .compass_container .text_container{\n height: 100%;\n width: 100%;\n padding: 0px;\n display: block;\n border-radius: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n color:black;\n }\n \n .compass_container .arrow{\n transition: 1s ease-in-out;\n width: 100%;\n height: 100%;\n display: block;\n position: absolute;\n top: 0;\n }\n \n .compass_container .arrow .triangle{\n width: 0;\n\t\theight: 0;\n\t\tborder-left: 45px solid transparent;\n\t\tborder-right: 45px solid transparent;\n\t\tborder-bottom: 90px solid black;\n\t\tposition: absolute;\n\t\ttop: -15px;\n\t\tleft: 50%;\n\t\tmargin-left: -45px;\n\t\tz-index: 99;\n }\n</style>\n\n\n<div class=\"compass_container\" style=\"\">\n <div class=\"compass_header\">N</div>\n \n <div class=\"nr-dashboard-text text_container\">\n \n <div class=\"direction\" style=\"font-size: 120%\">{{direction}}</div>\n <div style=\"flex-direction: row; font-weight: bold;\">\n <span style=\"font-size: 100%\">{{msg.payload.speed}}</span>\n <span style=\"font-size: 75%\">{{msg.payload.speed_unit}}</span>\n </div>\n </div>\n <div class=\"arrow\" style=\"transform: rotate({{msg.payload.degrees}}deg);\">\n <div class=\"triangle\"></div>\n </div>\n</div>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":1050,"y":1240,"wires":[[]]},{"id":"deb3196.7c058e8","type":"function","z":"c283bf8e.d3b6f","name":"","func":"var msg = {\n \"payload\": {\n \"speed\":flow.get('wind_speed'),\n \"speed_unit\":\"м/с\",\n \"degrees\":flow.get('wind_direction')\n \n }\n}\nreturn msg;","outputs":1,"noerr":0,"x":930,"y":1240,"wires":[["5d41d696.c2b458"]]},{"id":"a811e353.6e589","type":"change","z":"c283bf8e.d3b6f","name":"","rules":[{"t":"set","p":"wind_speed","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":1220,"wires":[["deb3196.7c058e8"]]},{"id":"22e8f8ea.e092e8","type":"function","z":"c283bf8e.d3b6f","name":"","func":"msg.payload = parseInt(msg.payload);\nnode.status({fill:\"grey\",shape:\"dot\",text:msg.payload +' м/c'});\n\nreturn msg;","outputs":1,"noerr":0,"x":550,"y":1280,"wires":[["b23b7f68.d4524"]]},{"id":"b23b7f68.d4524","type":"change","z":"c283bf8e.d3b6f","name":"","rules":[{"t":"set","p":"wind_direction","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":1280,"wires":[["deb3196.7c058e8"]]},{"id":"96fca218.47807","type":"mqtt-broker","z":"","name":"WB-MQTT","broker":"192.168.1.30","port":"1883","clientid":"node-red-pi-tarasovo","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"bb6d39b2.df82c8","type":"ui_group","z":"","name":"Метеостанция","tab":"3243b0dd.5cd84","disp":true,"width":"10","collapse":false},{"id":"3243b0dd.5cd84","type":"ui_tab","z":"","name":"Датчики","icon":"dashboard","order":2,"disabled":false,"hidden":false}]