Skip to content

Instantly share code, notes, and snippets.

@ionware-io
Last active September 29, 2020 22:20
Show Gist options
  • Save ionware-io/a27acd1fd11cb3b748daef7a646450c8 to your computer and use it in GitHub Desktop.
Save ionware-io/a27acd1fd11cb3b748daef7a646450c8 to your computer and use it in GitHub Desktop.
iHome Smart Thermostat Part 5 of 5

iHome Smart Thermostat Part 5 of 5 .. this flow handles the RPi Zero system parameters /ui Dashboard and mqtt coms to Ubidots Cloud .. Details here ionware.io

Monitoring

  • CPU Temperature
  • CPU Load
  • Disk Space
  • Memory Use
  • System IP address

Control

  • Reboot
  • Shut Down

iHome Nest Type Flow Diagram

iHome rpi0 Adapted from gestadieu flow. Kudos.

iHome Monitoring & Control User Interface

iHome rpi0

iHome RPi Zero Ubidots Dashboard

iHome rpi0

[{"id":"57fc7de4.8601d4","type":"tab","label":"Raspberry monitoring","disabled":false,"info":""},{"id":"eb7860d4.3bebe","type":"ui_gauge","z":"57fc7de4.8601d4","name":"","group":"61b0dbd0.c67624","order":1,"width":3,"height":3,"gtype":"gage","title":"CPU Temperature","label":"C","format":"{{value}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"35","seg2":"60","x":370,"y":100,"wires":[]},{"id":"45d1429d.9f0acc","type":"exec","z":"57fc7de4.8601d4","command":"vcgencmd measure_temp","addpay":false,"append":"","useSpawn":"","timer":"","name":"RPi Temp.","x":325.2221908569336,"y":46.33333683013916,"wires":[["ecc8ae39.03e51"],[],[]]},{"id":"b561c237.dc0cb","type":"inject","z":"57fc7de4.8601d4","name":"","topic":"","payload":"","payloadType":"date","repeat":"600","crontab":"","once":true,"onceDelay":"","x":107.49996185302734,"y":46.805556297302246,"wires":[["45d1429d.9f0acc","ecaa6d3b.7b104","95f4747d.5fe1c8"]]},{"id":"ecc8ae39.03e51","type":"function","z":"57fc7de4.8601d4","name":"","func":"str = msg.payload\nmsg.payload = str.substring(5,9);\nreturn msg;","outputs":1,"noerr":0,"x":471.888858795166,"y":33.00000190734863,"wires":[["eb7860d4.3bebe","4724a79d.3a35c8","ad93ec3b.ed9f4"]]},{"id":"3a320cc7.fc6634","type":"ui_button","z":"57fc7de4.8601d4","name":"","group":"61b0dbd0.c67624","order":7,"width":0,"height":0,"passthru":true,"label":"Reboot","tooltip":"","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":120,"y":580,"wires":[["39e2b1de.f70dee"]]},{"id":"39e2b1de.f70dee","type":"exec","z":"57fc7de4.8601d4","command":"sudo reboot","addpay":false,"append":"","useSpawn":"","timer":"","name":"Reboot","x":317.2222213745117,"y":579.9999761581421,"wires":[[],[],[]]},{"id":"bf596179.5461a","type":"ui_button","z":"57fc7de4.8601d4","name":"","group":"61b0dbd0.c67624","order":8,"width":0,"height":0,"passthru":true,"label":"Shutdown","tooltip":"","color":"","bgcolor":"red","icon":"","payload":"","payloadType":"str","topic":"","x":109.61107635498047,"y":656.4722290039062,"wires":[["363d2f61.d73c3"]]},{"id":"363d2f61.d73c3","type":"exec","z":"57fc7de4.8601d4","command":"sudo shutdown -h now","addpay":false,"append":"","useSpawn":"","timer":"","name":"Shutdown","x":329.49996185302734,"y":656.6944227218628,"wires":[[],[],[]]},{"id":"4724a79d.3a35c8","type":"ui_chart","z":"57fc7de4.8601d4","name":"","group":"61b0dbd0.c67624","order":5,"width":6,"height":4,"label":"CPU Temperature","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"24","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#dbf702","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":true,"outputs":1,"x":650,"y":100,"wires":[[]]},{"id":"ecaa6d3b.7b104","type":"exec","z":"57fc7de4.8601d4","command":"top -d 0.5 -b -n2 | grep \"Cpu(s)\"|tail -n 1 | awk '{print $2 + $4}'","addpay":false,"append":"","useSpawn":"","timer":"","name":"CPU Load","x":330,"y":180,"wires":[["599b2e42.307be","95da79a5.d1f0c8","87d798b.2aef668"],[],[]]},{"id":"95f4747d.5fe1c8","type":"exec","z":"57fc7de4.8601d4","command":"free | grep Mem | awk '{print $3/$2 * 100.0}'","addpay":false,"append":"","useSpawn":"","timer":"","name":"Memory Use","x":330,"y":320,"wires":[["25845421.05389c"],[],[]]},{"id":"599b2e42.307be","type":"ui_gauge","z":"57fc7de4.8601d4","name":"","group":"61b0dbd0.c67624","order":4,"width":3,"height":3,"gtype":"gage","title":"CPU","label":"%","format":"{{value}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":490,"y":240,"wires":[]},{"id":"e3547e5e.933","type":"ui_gauge","z":"57fc7de4.8601d4","name":"","group":"61b0dbd0.c67624","order":2,"width":3,"height":3,"gtype":"gage","title":"Memory Use","label":"%","format":"{{value}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":550,"y":360,"wires":[]},{"id":"dd95b6f.1ed2f48","type":"exec","z":"57fc7de4.8601d4","command":"df -h","addpay":false,"append":"","useSpawn":"","timer":"","name":"Disk Usage","x":330,"y":440,"wires":[["63551e0.9b677e4"],[],[]]},{"id":"e43cb015.7f881","type":"ui_gauge","z":"57fc7de4.8601d4","name":"","group":"61b0dbd0.c67624","order":3,"width":3,"height":3,"gtype":"gage","title":"Disk Space","label":"%","format":"{{value}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":550,"y":480,"wires":[]},{"id":"63551e0.9b677e4","type":"function","z":"57fc7de4.8601d4","name":"","func":"var re = /([0-9]{2})%/\nvar idx = msg.payload.search(re);\nvar str = msg.payload;\nif (idx >=0) {\n str = msg.payload.substring(idx, idx + 2);\n}\nmsg.payload = str;\nreturn msg;","outputs":1,"noerr":0,"x":477.7777671813965,"y":426.66665744781494,"wires":[["e43cb015.7f881","5a20e3a1.a7519c"]]},{"id":"6f39251a.f2327c","type":"inject","z":"57fc7de4.8601d4","name":"","topic":"","payload":"","payloadType":"date","repeat":"600","crontab":"","once":true,"onceDelay":"","x":130,"y":440,"wires":[["dd95b6f.1ed2f48"]]},{"id":"cc0b494a.4206d8","type":"ui_text","z":"57fc7de4.8601d4","group":"61b0dbd0.c67624","order":6,"width":6,"height":1,"name":"","label":"IP Address","format":"{{value.substring(0, value.indexOf(\" \"))}}","layout":"col-center","x":530,"y":800,"wires":[]},{"id":"e722d688.3ab408","type":"inject","z":"57fc7de4.8601d4","name":"","topic":"","payload":"","payloadType":"date","repeat":"600","crontab":"","once":true,"onceDelay":"","x":127.35261917114258,"y":794.6781711578369,"wires":[["a04b6917.257b88"]]},{"id":"a04b6917.257b88","type":"exec","z":"57fc7de4.8601d4","command":"hostname","addpay":false,"append":"-I","useSpawn":"","timer":"","name":"Get Local IP","x":331.9081726074219,"y":795.1781845092773,"wires":[["cc0b494a.4206d8"],[],[]]},{"id":"95da79a5.d1f0c8","type":"ui_chart","z":"57fc7de4.8601d4","name":"","group":"61b0dbd0.c67624","order":5,"width":6,"height":4,"label":"CPU Load","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"24","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#0703fc","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":true,"outputs":1,"x":710,"y":240,"wires":[[]]},{"id":"25845421.05389c","type":"range","z":"57fc7de4.8601d4","minin":"0","maxin":"100.00","minout":"0","maxout":"100","action":"scale","round":true,"property":"payload","name":"","x":524.7778091430664,"y":313.66666316986084,"wires":[["e3547e5e.933","41e16285.b8784c"]]},{"id":"ad93ec3b.ed9f4","type":"template","z":"57fc7de4.8601d4","name":"change","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"cput1a\":{{payload}} }","output":"json","x":680,"y":40,"wires":[["c02d8890.b4bbc8"]]},{"id":"c02d8890.b4bbc8","type":"mqtt out","z":"57fc7de4.8601d4","name":"","topic":"/v1.6/devices/rpi0aa","qos":"","retain":"","broker":"b39a9b0c.dff308","x":880,"y":40,"wires":[]},{"id":"c6859f56.b1148","type":"template","z":"57fc7de4.8601d4","name":"change","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"cpul1a\":{{payload}} }","output":"json","x":680,"y":180,"wires":[["be1361b.86643a","fd40832d.5a14"]]},{"id":"be1361b.86643a","type":"mqtt out","z":"57fc7de4.8601d4","name":"","topic":"/v1.6/devices/rpi0aa","qos":"","retain":"","broker":"b39a9b0c.dff308","x":880,"y":180,"wires":[]},{"id":"87d798b.2aef668","type":"function","z":"57fc7de4.8601d4","name":"","func":"msg.payload = Number(msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":530,"y":180,"wires":[["c6859f56.b1148"]]},{"id":"41e16285.b8784c","type":"template","z":"57fc7de4.8601d4","name":"change","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"memuse1a\":{{payload}} }","output":"json","x":720,"y":320,"wires":[["cb417d05.ef442"]]},{"id":"cb417d05.ef442","type":"mqtt out","z":"57fc7de4.8601d4","name":"","topic":"/v1.6/devices/rpi0aa","qos":"","retain":"","broker":"b39a9b0c.dff308","x":920,"y":320,"wires":[]},{"id":"5a20e3a1.a7519c","type":"template","z":"57fc7de4.8601d4","name":"change","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"diskuse1a\":{{payload}} }","output":"json","x":720,"y":420,"wires":[["3af0bbd6.982d54"]]},{"id":"3af0bbd6.982d54","type":"mqtt out","z":"57fc7de4.8601d4","name":"","topic":"/v1.6/devices/rpi0aa","qos":"","retain":"","broker":"b39a9b0c.dff308","x":920,"y":420,"wires":[]},{"id":"fd40832d.5a14","type":"debug","z":"57fc7de4.8601d4","name":"cpuLaa","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":940,"y":240,"wires":[]},{"id":"61b0dbd0.c67624","type":"ui_group","z":"","name":"System","tab":"e0db49ad.4f0df8","order":1,"disp":true,"width":"6","collapse":false},{"id":"b39a9b0c.dff308","type":"mqtt-broker","z":"","name":"","broker":"industrial.api.ubidots.com","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"15","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"e0db49ad.4f0df8","type":"ui_tab","z":"57fc7de4.8601d4","name":"RPi Zero","icon":"dashboard","order":7,"disabled":false,"hidden":false}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment