Luong Vinh Phuc

Demo Node-RED giám sát nhiệt độ phòng đông lạnh. Flow giả lập dữ liệu nhiệt độ trong khoảng -25 đến -10 độ C, kiểm tra nhiệt độ so với ngưỡng -18 độ C để phát hiện cảnh báo khi nhiệt độ quá cao. Kết quả hiển thị trên dashboard với đồng hồ đo và trạng thái cảnh báo, giúp giám sát nhiệt độ dễ dàng và trực quan.

[{"id":"inject-temp","type":"inject","z":"flow1","name":"Simulate Temperature","props":[{"p":"payload"}],"repeat":"5","crontab":"","once":true,"onceDelay":0.1,"payload":"","payloadType":"date","x":150,"y":100,"wires":[["function-gen-temp"]]},{"id":"function-gen-temp","type":"function","z":"flow1","name":"Generate Temp (-25 to -10 °C)","func":"msg.payload = (Math.random() * 15 - 25).toFixed(2); // random từ -25 đến -10\nreturn msg;","outputs":1,"noerr":0,"x":370,"y":100,"wires":[["function-check-temp","debug-temp","gauge-temp"]]},{"id":"function-check-temp","type":"function","z":"flow1","name":"Check Temp Threshold","func":"let temp = parseFloat(msg.payload);\nlet limit = -18;\n\nif(temp > limit) {\n    msg.alert = \"WARNING: Temp too high!\";\n    msg.payload = temp;\n} else {\n    msg.alert = \"Temperature OK\";\n    msg.payload = temp;\n}\nreturn msg;","outputs":1,"noerr":0,"x":620,"y":100,"wires":[["text-alert","debug-alert"]]},{"id":"debug-temp","type":"debug","z":"flow1","name":"Temp Value","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":600,"y":40,"wires":[]},{"id":"debug-alert","type":"debug","z":"flow1","name":"Alert Message","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"alert","targetType":"msg","x":850,"y":140,"wires":[]},{"id":"gauge-temp","type":"ui_gauge","z":"flow1","name":"Temperature Gauge","group":"dashboard-group","order":1,"width":6,"height":6,"gtype":"gage","title":"Temp (°C)","label":"°C","format":"{{value}}","min":-30,"max":0,"colors":["#00b500","#e6e600","#ca3838"],"seg1":-22,"seg2":-18,"x":600,"y":160,"wires":[]},{"id":"text-alert","type":"ui_text","z":"flow1","group":"dashboard-group","order":2,"width":6,"height":1,"name":"Alert Text","label":"Status","format":"{{msg.alert}}","layout":"row-spread","x":850,"y":100,"wires":[]},{"id":"dashboard-group","type":"ui_group","name":"Cold Room Monitoring","tab":"dashboard-tab","order":1,"disp":true,"width":"12","collapse":false},{"id":"dashboard-tab","type":"ui_tab","name":"Temperature Monitor","icon":"thermometer","order":1}]

Flow Info

Created 1 month ago
Rating: not yet rated

Actions

Rate:

Node Types

Core
  • debug (x2)
  • function (x2)
  • inject (x1)
Other
  • ui_gauge (x1)
  • ui_group (x1)
  • ui_tab (x1)
  • ui_text (x1)

Tags

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