RPISensehat with MQTT

raspberry pi sense hat with mqtt flow

[{"id":"d0bbbd4e.cb3f28","type":"rpi-sensehat in","z":"fdb263ed.73e5e8","name":"","motion":false,"env":true,"stick":false,"x":96.75003433227539,"y":59.949997901916504,"wires":[["4f71696b.b6c2b8","6547ad6a.b3da1c","a5881e1d.21f728","6f7e1d47.dff704"]]},{"id":"4f71696b.b6c2b8","type":"function","z":"fdb263ed.73e5e8","name":"temperature","func":"var o = msg.payload;\nmsg.payload = o.temperature;\nreturn msg;","outputs":"1","noerr":0,"x":290.5000457763672,"y":85.69999694824219,"wires":[[]]},{"id":"b2ebbcac.c1426","type":"ui_gauge","z":"fdb263ed.73e5e8","name":"humidity","group":"d2d4dd54.dc244","order":4,"width":"3","height":"2","gtype":"gage","title":"Humidity","label":"%","format":"{{value}}","min":"-10","max":"100","colors":["#ffffff","#dedeed","#6666ff"],"seg1":"","seg2":"","x":523.2501220703125,"y":417.75,"wires":[]},{"id":"a5881e1d.21f728","type":"function","z":"fdb263ed.73e5e8","name":"humidity","func":"var o = msg.payload\nmsg.payload = o.humidity;\nreturn msg;","outputs":1,"noerr":0,"x":295.25000762939453,"y":201.75001621246338,"wires":[[]]},{"id":"19db21f4.00c226","type":"ui_gauge","z":"fdb263ed.73e5e8","name":"pressure","group":"d2d4dd54.dc244","order":3,"width":"3","height":"2","gtype":"gage","title":"Air Pressure","label":"mb","format":"{{value}}","min":"600","max":"1300","colors":["#55555e","#47476b","#1f1f93"],"seg1":"","seg2":"","x":510.45001220703125,"y":473.7500305175781,"wires":[]},{"id":"6547ad6a.b3da1c","type":"function","z":"fdb263ed.73e5e8","name":"pressure","func":"var o = msg.payload\nmsg.payload = o.pressure;\nreturn msg;","outputs":1,"noerr":0,"x":286.4500274658203,"y":136.75,"wires":[[]]},{"id":"fafbfcdf.07a878","type":"function","z":"fdb263ed.73e5e8","name":"time","func":"// Create a Date object from the payload\nvar date = new Date(msg.payload);\n// Change the payload to be a formatted Date string\nmsg.payload = date.toString();\n// Return the message so it can be sent on\nreturn msg;\n","outputs":1,"noerr":0,"x":286.15020751953125,"y":301.35003662109375,"wires":[["421a440d.98153c"]]},{"id":"421a440d.98153c","type":"ui_text","z":"fdb263ed.73e5e8","group":"d2d4dd54.dc244","order":1,"width":"6","height":"1","name":"","label":"","format":"{{msg.payload}}","layout":"row-left","x":469.1500549316406,"y":274.9500427246094,"wires":[]},{"id":"199bd943.f75657","type":"inject","z":"fdb263ed.73e5e8","name":"","topic":"","payload":"","payloadType":"date","repeat":"10","crontab":"","once":false,"x":120.15000915527344,"y":233.75,"wires":[["fafbfcdf.07a878"]]},{"id":"65d18d6e.ba2e9c","type":"rpi-sensehat out","z":"fdb263ed.73e5e8","name":"","x":291.14996337890625,"y":373.54998779296875,"wires":[]},{"id":"6f7e1d47.dff704","type":"function","z":"fdb263ed.73e5e8","name":"test","func":"var sensor = msg.payload;\nvar msg1 = {payload:sensor.temperature};\nvar msg2 = {payload:sensor.humidity};\nvar msg3 = {payload:sensor.pressure};\nreturn[msg1,msg2,msg3];","outputs":"3","noerr":0,"x":260.5,"y":443,"wires":[["83bf84a4.2a4d5","a72b8951.57c678","eab5e249.67706"],["b2ebbcac.c1426","dd469bac.80be9","66a41171.5bffe8"],["19db21f4.00c226"]],"inputLabels":["Sense Hat"],"outputLabels":["humidity","",""]},{"id":"83bf84a4.2a4d5","type":"ui_gauge","z":"fdb263ed.73e5e8","name":"","group":"d2d4dd54.dc244","order":2,"width":"3","height":"2","gtype":"gage","title":"Office Temp2","label":"F","format":"{{(value*1.8)+32 | number:0}}","min":"-20","max":"50","colors":["#4b0082","#00ffff","#e6e600"],"seg1":"","seg2":"","x":628,"y":313,"wires":[]},{"id":"5bf018be.f189b8","type":"change","z":"fdb263ed.73e5e8","name":"Store temp","rules":[{"t":"set","p":"timestamp","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":603.5000076293945,"y":674.5000095367432,"wires":[[]]},{"id":"626663d9.aa4efc","type":"http in","z":"fdb263ed.73e5e8","name":"","url":"/time-test","method":"get","upload":false,"swaggerDoc":"","x":266.50000762939453,"y":725.5000114440918,"wires":[["c637d43e.108df"]]},{"id":"c637d43e.108df","type":"change","z":"fdb263ed.73e5e8","name":"Copy temp","rules":[{"t":"set","p":"timestamp","pt":"msg","to":"timestamp","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":442.75003814697266,"y":758.0000114440918,"wires":[["4031f4b2.7caa34"]]},{"id":"4031f4b2.7caa34","type":"template","z":"fdb263ed.73e5e8","name":"page","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<html>\n    <head></head>\n    <body>\n        <h1>{{ timestamp }}</h1>\n    </body>\n</html>","output":"str","x":607.7500114440918,"y":770.5000114440918,"wires":[["1ab78eb1.338019"]]},{"id":"1ab78eb1.338019","type":"http response","z":"fdb263ed.73e5e8","name":"","x":814,"y":723,"wires":[]},{"id":"a72b8951.57c678","type":"mqtt out","z":"fdb263ed.73e5e8","name":"","topic":"sensors/livingroom/temp","qos":"0","retain":"true","broker":"9decd9f3.3618c","x":532,"y":583,"wires":[]},{"id":"a600b1a7.8fb3b8","type":"inject","z":"fdb263ed.73e5e8","name":"","topic":"","payload":"22","payloadType":"num","repeat":"","crontab":"","once":false,"x":244,"y":847,"wires":[["a72b8951.57c678"]]},{"id":"302f5e83.865602","type":"mqtt in","z":"fdb263ed.73e5e8","name":"","topic":"sensors/livingroom/temp","qos":"2","broker":"23a52e45.84357a","x":322,"y":927,"wires":[[]]},{"id":"83c1a5f9.24eff8","type":"debug","z":"fdb263ed.73e5e8","name":"","active":true,"console":"false","complete":"false","x":522,"y":927,"wires":[]},{"id":"dd469bac.80be9","type":"mqtt out","z":"fdb263ed.73e5e8","name":"","topic":"sensors/livingroom/hum","qos":"0","retain":"","broker":"9decd9f3.3618c","x":525,"y":637,"wires":[]},{"id":"eab5e249.67706","type":"mqtt out","z":"fdb263ed.73e5e8","name":"","topic":"sensors/livingroom/temp2","qos":"0","retain":"true","broker":"9decd9f3.3618c","x":740,"y":478.75,"wires":[]},{"id":"66a41171.5bffe8","type":"mqtt out","z":"fdb263ed.73e5e8","name":"","topic":"sensors/livingroom/hum2","qos":"0","retain":"","broker":"9decd9f3.3618c","x":733,"y":532.75,"wires":[]},{"id":"d2d4dd54.dc244","type":"ui_group","z":"","name":"Indoor Climate and Outdoor Status","tab":"9fdc3dfb.d40c98","order":1,"disp":false,"width":"6"},{"id":"9decd9f3.3618c","type":"mqtt-broker","z":"","broker":"10.0.0.243","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willRetain":"false","willPayload":"","birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":""},{"id":"23a52e45.84357a","type":"mqtt-broker","z":"","broker":"10.0.0.243","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willRetain":"false","willPayload":"","birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":""},{"id":"9fdc3dfb.d40c98","type":"ui_tab","z":"","name":"Macanhan Institute of Techonology (MacIT)","icon":"dashboard","order":1}]

Flow Info

Created 5 years, 8 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • change (x2)
  • debug (x1)
  • function (x5)
  • http in (x1)
  • http response (x1)
  • inject (x2)
  • mqtt in (x1)
  • mqtt out (x4)
  • mqtt-broker (x2)
  • template (x1)
Other

Tags

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