Skip to content

Instantly share code, notes, and snippets.

@chrowe

chrowe/README.md Secret

Created March 19, 2018 04:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrowe/b513365783b6603d6981d83f2c0d56a9 to your computer and use it in GitHub Desktop.
Save chrowe/b513365783b6603d6981d83f2c0d56a9 to your computer and use it in GitHub Desktop.
Root cellar control

In order to turn on an off the fan for a root cellar we check the outdoor temp and compare it to the temp in the root cellar and the set temp for the cellar.

[{"id":"7e0e7de5.bee364","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"a9907be2.7346d8","type":"inject","z":"7e0e7de5.bee364","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":100,"y":320,"wires":[["5e0bf330.3b4fbc","db8d5eb5.71726"]]},{"id":"bae5f714.9062a8","type":"debug","z":"7e0e7de5.bee364","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":670,"y":120,"wires":[]},{"id":"5e0bf330.3b4fbc","type":"1-Wire","z":"7e0e7de5.bee364","identifier":"28-0000052f687f","name":"inside","format":"1","x":250,"y":280,"wires":[["76081024.51d218"]]},{"id":"db8d5eb5.71726","type":"1-Wire","z":"7e0e7de5.bee364","identifier":"28-0000053055be","name":"Outside","format":"1","x":260,"y":360,"wires":[["692cacc3.1c027c"]]},{"id":"7c6e3e65.06eaf","type":"exec","z":"7e0e7de5.bee364","command":"ls /sys/bus/w1/devices/ | grep 28-*","addpay":false,"append":"","useSpawn":"false","timer":"10","oldrc":true,"name":"","x":200,"y":100,"wires":[["bae5f714.9062a8"],[],[]]},{"id":"c319d271.3e71","type":"inject","z":"7e0e7de5.bee364","name":"Get available 1-wire sensor ids","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":40,"wires":[["7c6e3e65.06eaf"]]},{"id":"b08d9d3c.e49d9","type":"rpi-gpio out","z":"7e0e7de5.bee364","name":"","pin":"11","set":true,"level":"0","freq":"","out":"out","x":700,"y":320,"wires":[]},{"id":"d10c139c.4132d8","type":"function","z":"7e0e7de5.bee364","name":"Relay logic","func":"var SET = 35\nvar IN = global.get(\"IN\")\nvar OUT = global.get(\"OUT\")\n\nif(IN > OUT && IN > SET)\n{\n msg.payload = 1;\n}\nelse\n{\n msg.payload = 0;\n}\nreturn msg;","outputs":1,"noerr":0,"x":550,"y":320,"wires":[["b08d9d3c.e49d9"]]},{"id":"76081024.51d218","type":"function","z":"7e0e7de5.bee364","name":"","func":"global.set(\"IN\",msg.payload)\nmsg.topic = \"inside\"\nvar tempc = msg.payload;\ntempf = tempc * 9/5 + 32;\ntempf = Math.round(tempf * 10) / 10;\nmsg.payload = tempf;\nreturn msg;\n\n","outputs":1,"noerr":0,"x":390,"y":280,"wires":[["d10c139c.4132d8","bae5f714.9062a8"]]},{"id":"692cacc3.1c027c","type":"function","z":"7e0e7de5.bee364","name":"","func":"global.set(\"OUT\",msg.payload)\nmsg.topic = \"outside\"\nvar tempc = msg.payload;\ntempf = tempc * 9/5 + 32;\ntempf = Math.round(tempf * 10) / 10;\nmsg.payload = tempf;\nreturn msg;","outputs":1,"noerr":0,"x":390,"y":360,"wires":[["d10c139c.4132d8","bae5f714.9062a8"]]}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment