-
Notifications
You must be signed in to change notification settings - Fork 7
/
DHT22-complete-example-flow.json
1 lines (1 loc) · 9.33 KB
/
DHT22-complete-example-flow.json
1
[{"id":"baf90545.54f398","type":"tab","label":"DHT22 complete example","disabled":false,"info":""},{"id":"b7a06949.f02718","type":"rpi-dht22","z":"baf90545.54f398","name":"DHT22","topic":"rpi-dht22","dht":22,"pintype":"0","pin":"17","x":780,"y":480,"wires":[["5fe7c074.e1f6d","a3a46396.9fa97","f8ea7905.c6c258","5593ca1e.666654","66cec1cc.e2a68"]]},{"id":"d26774a1.e97438","type":"inject","z":"baf90545.54f398","name":"Start sensor readings","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":180,"y":300,"wires":[["8f27c805.bf4c38","b11400c3.f7ade"]]},{"id":"5fe7c074.e1f6d","type":"debug","z":"baf90545.54f398","name":"Show temperature reading","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1080,"y":520,"wires":[]},{"id":"8f27c805.bf4c38","type":"trigger","z":"baf90545.54f398","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"-10","extend":false,"units":"s","reset":"","bytopic":"all","name":"Get reading every 10 seconds","x":510,"y":380,"wires":[["b7a06949.f02718","d991f1cf.6aba8"]],"info":"# What is this node about?\n\nThis node triggers the DHT22 sensor every 10 seconds."},{"id":"b11400c3.f7ade","type":"debug","z":"baf90545.54f398","name":"1","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":450,"y":240,"wires":[]},{"id":"d991f1cf.6aba8","type":"debug","z":"baf90545.54f398","name":"2","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":770,"y":260,"wires":[]},{"id":"a3a46396.9fa97","type":"debug","z":"baf90545.54f398","name":"3","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1010,"y":460,"wires":[]},{"id":"f8ea7905.c6c258","type":"debug","z":"baf90545.54f398","name":"Show humidity reading","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"humidity","targetType":"msg","x":1060,"y":560,"wires":[]},{"id":"5593ca1e.666654","type":"change","z":"baf90545.54f398","name":"","rules":[{"t":"set","p":"temperature","pt":"flow","to":"payload","tot":"msg"},{"t":"set","p":"humidity","pt":"flow","to":"humidity","tot":"msg"},{"t":"set","p":"temperature","pt":"global","to":"payload","tot":"msg"},{"t":"set","p":"humidity","pt":"global","to":"humidity","tot":"msg"},{"t":"set","p":"payload","pt":"msg","to":"Variables set","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1050,"y":380,"wires":[["5ad4dbef.ffa7d4"]]},{"id":"5ad4dbef.ffa7d4","type":"debug","z":"baf90545.54f398","name":"Variables set confirmation","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1310,"y":380,"wires":[]},{"id":"cd781f84.b09b6","type":"inject","z":"baf90545.54f398","name":"Read flow temperature var","topic":"","payload":"temperature","payloadType":"flow","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":350,"y":780,"wires":[["a1f4986d.0e3b28"]]},{"id":"a1f4986d.0e3b28","type":"debug","z":"baf90545.54f398","name":"Show flow values","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":690,"y":820,"wires":[]},{"id":"e4df5d10.c2f9c","type":"inject","z":"baf90545.54f398","name":"Read flow humidity var","topic":"","payload":"humidity","payloadType":"flow","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":340,"y":840,"wires":[["a1f4986d.0e3b28"]]},{"id":"66cec1cc.e2a68","type":"function","z":"baf90545.54f398","name":"Set global and flow variables","func":"flow.set(\"humidity\", msg.humidity);\nflow.set(\"temperature\", msg.payload);\n\nglobal.set(\"humidity\", msg.humidity);\nglobal.set(\"temperature\", msg.payload);\n\n\nreturn msg;","outputs":1,"noerr":0,"x":1080,"y":260,"wires":[[]]},{"id":"db48cad4.a38ca8","type":"function","z":"baf90545.54f398","name":"Get global and flow variables","func":"humidity = flow.get(\"humidity\");\ntemperature = flow.get(\"temperature\");\n\nreturn [{payload: temperature},{payload:humidity}];","outputs":2,"noerr":0,"x":460,"y":660,"wires":[["52a867df.09bbf8"],["98028624.2cdd08"]]},{"id":"52a867df.09bbf8","type":"debug","z":"baf90545.54f398","name":"Flow temperature","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":780,"y":620,"wires":[]},{"id":"98028624.2cdd08","type":"debug","z":"baf90545.54f398","name":"Flow humidity","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":770,"y":700,"wires":[]},{"id":"cbe5aa02.d27768","type":"inject","z":"baf90545.54f398","name":"Trigger","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":660,"wires":[["db48cad4.a38ca8"]]},{"id":"a74309e9.a0d508","type":"change","z":"baf90545.54f398","name":"Clean all variables","rules":[{"t":"delete","p":"humidity","pt":"flow"},{"t":"delete","p":"humidity","pt":"global"},{"t":"delete","p":"temperature","pt":"flow"},{"t":"delete","p":"temperature","pt":"global"},{"t":"set","p":"payload","pt":"msg","to":"Variables deleted.","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":520,"y":980,"wires":[["518b727b.0a445c"]]},{"id":"518b727b.0a445c","type":"debug","z":"baf90545.54f398","name":"Delete confirmation","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":790,"y":980,"wires":[]},{"id":"3fc53d92.dab5a2","type":"inject","z":"baf90545.54f398","name":"Trigger","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":290,"y":980,"wires":[["a74309e9.a0d508"]]},{"id":"8b84b5cc.0a1558","type":"mqtt out","z":"baf90545.54f398","name":"Update temperature","topic":"dht22/temperature","qos":"1","retain":"","broker":"693ee85f.c34638","x":1760,"y":700,"wires":[]},{"id":"88fe6279.f661e","type":"mqtt out","z":"baf90545.54f398","name":"Update humidity","topic":"dht22/humidity","qos":"1","retain":"","broker":"693ee85f.c34638","x":1750,"y":820,"wires":[]},{"id":"110c6c25.dc67a4","type":"complete","z":"baf90545.54f398","name":"Start when DHT22 finishes","scope":["66cec1cc.e2a68"],"uncaught":false,"x":1190,"y":780,"wires":[["1aad34.d1c472cc"]]},{"id":"1aad34.d1c472cc","type":"function","z":"baf90545.54f398","name":"Publish temp and hum","func":"\nreturn [{payload:msg.payload},{payload:msg.humidity}];","outputs":2,"noerr":0,"x":1460,"y":780,"wires":[["8b84b5cc.0a1558"],["88fe6279.f661e"]]},{"id":"4ae42eb8.9aea2","type":"mqtt in","z":"baf90545.54f398","name":"Get temperature","topic":"dht22/temperature","qos":"2","datatype":"auto","broker":"693ee85f.c34638","x":1170,"y":980,"wires":[["96dc22de.17674","21f7a0a5.08a0c"]]},{"id":"b2ef51f0.70fee","type":"mqtt in","z":"baf90545.54f398","name":"Get humidity","topic":"dht22/humidity","qos":"2","datatype":"auto","broker":"693ee85f.c34638","x":1170,"y":1100,"wires":[["e53ef782.35ee28","6124494c.79d3b8"]]},{"id":"96dc22de.17674","type":"ui_gauge","z":"baf90545.54f398","name":"Temperature","group":"94c7afb4.27d2f","order":1,"width":5,"height":4,"gtype":"gage","title":"Temperature","label":"°C","format":"{{value | number:1}}°C","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":1430,"y":980,"wires":[]},{"id":"e53ef782.35ee28","type":"ui_gauge","z":"baf90545.54f398","name":"Humidity","group":"94c7afb4.27d2f","order":2,"width":5,"height":4,"gtype":"gage","title":"Humidity","label":"%","format":"{{value | number:1}}%","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":1430,"y":1100,"wires":[]},{"id":"21f7a0a5.08a0c","type":"ui_chart","z":"baf90545.54f398","name":"Historical Temperature","group":"94c7afb4.27d2f","order":7,"width":5,"height":4,"label":"Historical Temperature","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"Waiting for data","dot":true,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":1470,"y":1040,"wires":[[]]},{"id":"6124494c.79d3b8","type":"ui_chart","z":"baf90545.54f398","name":"Historical humidity","group":"94c7afb4.27d2f","order":8,"width":5,"height":4,"label":"Historical humidity","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"Waiting for data","dot":true,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":1460,"y":1160,"wires":[[]]},{"id":"693ee85f.c34638","type":"mqtt-broker","z":"","name":"Local broker","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"techexplorations/esp32/test","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"94c7afb4.27d2f","type":"ui_group","z":"","name":"DHT22 readings","tab":"e33ae4c2.84fe78","order":1,"disp":true,"width":11,"collapse":false},{"id":"e33ae4c2.84fe78","type":"ui_tab","z":"","name":"DHT22","icon":"dashboard","disabled":false,"hidden":false}]