2023年9月29日 星期五

Node-Red 利用亂數產生 溫度 濕度 給MQTT , 接收MQTT的溫度 濕度 顯示於Dashboard UI上

 Node-Red 利用亂數產生 溫度 濕度 給MQTT ,  接收MQTT的溫度 濕度 顯示於Dashboard UI上





[{"id":"1ce19c7d.1392e4","type":"debug","z":"4ce6f98c.254bf","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":390,"y":200,"wires":[]},{"id":"49ce87c1.4ec838","type":"change","z":"4ce6f98c.254bf","name":"Chart Temperature","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.d.temp","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":410,"y":60,"wires":[["1d4ec5b5.82c9f2"]]},{"id":"2f57084.22acd78","type":"change","z":"4ce6f98c.254bf","name":"Chart Humidity","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.d.humidity","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":120,"wires":[["fda5229a.103b8"]]},{"id":"d7a2c22e.f27d1","type":"switch","z":"4ce6f98c.254bf","name":"Warn on High Values","property":"payload.d.temp","propertyType":"msg","rules":[{"t":"gt","v":"30","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":420,"y":160,"wires":[["732cea1.a542294"]]},{"id":"732cea1.a542294","type":"template","z":"4ce6f98c.254bf","name":"Alert Msg","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Alert : Critical Value Detected {{payload.d.temp}}","output":"str","x":600,"y":160,"wires":[["80bbdd78.c69ae8"]]},{"id":"1d4ec5b5.82c9f2","type":"ui_chart","z":"4ce6f98c.254bf","name":"","group":"1bb2d88d.8be177","order":1,"width":0,"height":0,"label":"DHT Temp","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"50","removeOlder":"10","removeOlderPoints":"","removeOlderUnit":"60","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"x":610,"y":60,"wires":[[]]},{"id":"fda5229a.103b8","type":"ui_chart","z":"4ce6f98c.254bf","name":"","group":"1bb2d88d.8be177","order":2,"width":0,"height":0,"label":"DHT Humidity","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"100","removeOlder":"10","removeOlderPoints":"","removeOlderUnit":"60","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"className":"","x":620,"y":120,"wires":[[]]},{"id":"80bbdd78.c69ae8","type":"ui_toast","z":"4ce6f98c.254bf","position":"top right","displayTime":"5","highlight":"","outputs":0,"ok":"OK","cancel":"","topic":"","name":"","x":770,"y":160,"wires":[]},{"id":"46f3a55.224d15c","type":"mqtt in","z":"4ce6f98c.254bf","name":"","topic":"alex9ufo/iot-2/evt/status/fmt/json/+","qos":"2","datatype":"json","broker":"841df58d.ee5e98","nl":false,"rap":false,"inputs":0,"x":160,"y":180,"wires":[["1ce19c7d.1392e4","d7a2c22e.f27d1"]]},{"id":"1194ab7312cf9746","type":"mqtt out","z":"4ce6f98c.254bf","name":"Temp","topic":"alex9ufo/iot-2/evt/status/fmt/json/temp","qos":"1","retain":"true","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"841df58d.ee5e98","x":570,"y":340,"wires":[]},{"id":"d25b400442aa7613","type":"ui_switch","z":"4ce6f98c.254bf","name":"","label":"Switch","tooltip":"","group":"1bb2d88d.8be177","order":2,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","topicType":"str","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","animate":true,"className":"","x":230,"y":360,"wires":[["402ceecea723bf3f","c3517a29fc190ba1"]]},{"id":"402ceecea723bf3f","type":"function","z":"4ce6f98c.254bf","name":"Random #s","func":"if( msg.payload === false ) {\n    return null;\n}\n\nconst max = 48\nconst min= 10\n\nmsg.payload = Math.round(Math.random()*(max - min) + min);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":390,"y":340,"wires":[["1194ab7312cf9746","62f7ebeb6cac163c"]]},{"id":"b002857713981950","type":"inject","z":"4ce6f98c.254bf","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"5","crontab":"","once":false,"onceDelay":"","topic":"","payload":"","payloadType":"date","x":100,"y":360,"wires":[["d25b400442aa7613"]]},{"id":"c3517a29fc190ba1","type":"function","z":"4ce6f98c.254bf","name":"Random #s","func":"if( msg.payload === false ) {\n    return null;\n}\nmsg.payload = Math.round(Math.random()*100);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":390,"y":400,"wires":[["498875a7d2184286","2d6d36c45c830afa"]]},{"id":"498875a7d2184286","type":"mqtt out","z":"4ce6f98c.254bf","name":"Humi","topic":"alex9ufo/iot-2/evt/status/fmt/json/humi","qos":"2","retain":"true","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"841df58d.ee5e98","x":570,"y":400,"wires":[]},{"id":"62f7ebeb6cac163c","type":"debug","z":"4ce6f98c.254bf","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":590,"y":300,"wires":[]},{"id":"2d6d36c45c830afa","type":"debug","z":"4ce6f98c.254bf","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":590,"y":440,"wires":[]},{"id":"6d4bcb15e8043a96","type":"mqtt in","z":"4ce6f98c.254bf","name":"Temp","topic":"alex9ufo/iot-2/evt/status/fmt/json/temp","qos":"2","datatype":"json","broker":"841df58d.ee5e98","nl":false,"rap":false,"inputs":0,"x":70,"y":60,"wires":[["49ce87c1.4ec838"]]},{"id":"b7565f4395ce8725","type":"mqtt in","z":"4ce6f98c.254bf","name":"Humi","topic":"alex9ufo/iot-2/evt/status/fmt/json/humi","qos":"2","datatype":"json","broker":"841df58d.ee5e98","nl":false,"rap":false,"inputs":0,"x":70,"y":120,"wires":[["2f57084.22acd78"]]},{"id":"1bb2d88d.8be177","type":"ui_group","name":"ESP8266 Sensors","tab":"88fe602a.e1955","order":1,"disp":true,"width":"6","collapse":false},{"id":"841df58d.ee5e98","type":"mqtt-broker","name":"","broker":"broker.mqtt-dashboard.com","port":"1883","clientid":"","autoConnect":true,"usetls":false,"compatmode":false,"protocolVersion":4,"keepalive":"15","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"88fe602a.e1955","type":"ui_tab","name":"ESP8266 Workshop","icon":"dashboard","order":3}]

沒有留言:

張貼留言

2024產專班 作業2 (純模擬)

2024產專班 作業2  (純模擬) 1) LED ON,OFF,TIMER,FLASH 模擬 (switch 控制) 2)RFID卡號模擬 (buttom  模擬RFID UID(不從ESP32) Node-Red 程式 [{"id":"d8886...