I was gifted an old hot tub that was physically in good shape. The control system was no longer functioning however. I am not a programer at all. The electrical work is easy for me but I needed something to help make creating a DIY control panel. Below is the flow that I created. The only 2 steps I have left is getting my flow sensor to work and adding an LCD screen. I have a Raspberry PI A+ and Gredia GR-216 flow sensor and a 128x32 i2c OLED adafruit LCD screen. If anyone can assist with the physical wiring, PI code, and Node code to get those working that would be awesome. Also If anyone wants to take the time to look through the flow and point out any improvements in node-red for dummies terms that would be very helpful. I am happy with the flow over all. The one draw back I have found is because of the way it is currently written (flip function - code below) I have to press a button twice to make it work. Example to get the lights on I have to press the lights button twice. Then to turn them off I have to press the lights button twice again. I am using simple push button momentary waterproof switches. Depending on if you set them to pull up or pull down they hold either a 1 or 0 all the time. Once pressed you get a momentary switch to the opposite number then back to the original number. Example - If I set the GPIO in node-red to pulldown the pin is always at 0. Once pressed the pin switches to 1 and then when released it goes back to zero. So I have a function node that "flips" the 1 when it is read every other time. The way it should (and does with 2 presses) is it passes a 1 (or ON) through the flow the first time the button is pressed and a 0 (OFF) the second press. It works save the fact you have to press it twice. To properly view the flow you will need to install a couple of nodes in the pallete they are listed below as well. One is for the DS18b20 temp sensor and the other is a conversion node to convert the temp from Celsius to Fahrenheit. I also included some UI switches and gauges for a basic web interface for remote control from a phone or computer. The heater is controlled by the temp set point (currently at 75 for testing) vs the ds18b20 sensor after being powered on. I would like to include the flow sensor in that part of the flow to turn off the heater if the pump is off. I could not reliably get the flow or global variables to work so I am writing/reading data too/from files on the PI.
Install nodes -
node-red-contrib-sensor-ds18b20
node-red-contrib-unit-converter
Flip Function
'''
// initialise the counter to 0 if it doesn't exist already
var count = context.get('count')||1;
count += 1;
// store the value back
context.set('count',count);
// make it part of the outgoing msg object
msg.count = count;
//define function isOdd 1 === isOdd
function isOdd(num) { return num % 2;}
/*if count is odd send 1,
else send 0 */
if(isOdd((count+1)/2) ===1){
msg.payload = 1;
return msg;
} else if (isOdd((count+1)/2) ===0){
msg.payload = 0;
return msg;
}
'''
FLOW --
[{"id":"57881832.e77f68","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"eed2fd78.9712a","type":"rpi-gpio in","z":"57881832.e77f68","name":"On/Off","pin":"40","intype":"up","debounce":"150","read":true,"x":70,"y":960,"wires":[["857f6939.98e918"]]},{"id":"2b034b1f.4c86d4","type":"rpi-gpio out","z":"57881832.e77f68","name":"Pump Low","pin":"13","set":false,"level":"0","freq":"","out":"out","x":690,"y":20,"wires":},{"id":"a970e356.b94ce","type":"rpi-gpio out","z":"57881832.e77f68","name":"Heater On","pin":"15","set":true,"level":"0","freq":"","out":"out","x":1030,"y":20,"wires":},{"id":"c4124fe2.e433f","type":"delay","z":"57881832.e77f68","name":"2sec delay","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":770,"y":1180,"wires":[["71b67bc8.796594","e71c95f2.61a1e8","e647b0e1.f3e3c"]]},{"id":"c37aa57e.d9ee68","type":"comment","z":"57881832.e77f68","name":"Add Flow Sensor","info":"","x":1480,"y":200,"wires":},{"id":"a89414bf.e9fee8","type":"rpi-gpio in","z":"57881832.e77f68","name":"Jets On/Off","pin":"36","intype":"up","debounce":"150","read":true,"x":90,"y":1380,"wires":[["56150b65.511a14"]]},{"id":"2294db76.a9ca74","type":"rpi-gpio out","z":"57881832.e77f68","name":"Ozonator","pin":"16","set":false,"level":"0","freq":"","out":"out","x":1380,"y":20,"wires":},{"id":"ae0ea4be.948f98","type":"rpi-gpio out","z":"57881832.e77f68","name":"Pump High","pin":"11","set":false,"level":"0","freq":"","out":"out","x":330,"y":20,"wires":},{"id":"3bbaec19.9895c4","type":"tail","z":"57881832.e77f68","name":"WatchPumpHighFile","filetype":"text","split":"{0,1}","filename":"PumpHigh","x":150,"y":20,"wires":[["ae0ea4be.948f98","52c016c7.4f9348"]]},{"id":"7aa12f6d.99c92","type":"file","z":"57881832.e77f68","name":"OzonatorFileWrite","filename":"Ozonator","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"none","x":870,"y":1020,"wires":[]},{"id":"81980796.cb7f98","type":"tail","z":"57881832.e77f68","name":"WatchPumpLowFile","filetype":"text","split":"{0,1}","filename":"PumpLow","x":510,"y":20,"wires":[["2b034b1f.4c86d4","12a5b628.698ffa"]]},{"id":"5df4b51d.445f5c","type":"tail","z":"57881832.e77f68","name":"WatchHeaterFile","filetype":"text","split":"{0,1}","filename":"Heater","x":860,"y":20,"wires":[["a970e356.b94ce","4098e7d7.6019e8"]]},{"id":"dfa39fbe.30907","type":"tail","z":"57881832.e77f68","name":"WatchOzonatorFile","filetype":"text","split":"{0,1}","filename":"Ozonator","x":1210,"y":20,"wires":[["2294db76.a9ca74","5830f874.d03e08"]]},{"id":"c3b4619d.f7e58","type":"file","z":"57881832.e77f68","name":"PumpLowFileWrite","filename":"PumpLow","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"none","x":870,"y":980,"wires":[]},{"id":"e5b16edb.6bc94","type":"file","z":"57881832.e77f68","name":"PumpHeaterFileWrite","filename":"Heater","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"none","x":780,"y":1120,"wires":[]},{"id":"29397ead.8908f2","type":"file","z":"57881832.e77f68","name":"PumpHighFileWrite","filename":"PumpHigh","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"none","x":870,"y":940,"wires":[]},{"id":"68b9869c.7fb898","type":"change","z":"57881832.e77f68","name":"Turn Off - 0","rules":[{"t":"change","p":"payload","pt":"msg","from":"1","fromt":"num","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":690,"y":940,"wires":[["29397ead.8908f2"]]},{"id":"ba61e16b.3d3b9","type":"delay","z":"57881832.e77f68","name":"1 sec delay","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":750,"y":1360,"wires":[["628a34f8.e1bc8c"]]},{"id":"7493ccc4.ef2e44","type":"inject","z":"57881832.e77f68","name":"simbutton","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":100,"y":1020,"wires":[["857f6939.98e918"]]},{"id":"1f2d3b9d.12b614","type":"inject","z":"57881832.e77f68","name":"simbutton","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":100,"y":1440,"wires":[["56150b65.511a14"]]},{"id":"628a34f8.e1bc8c","type":"file","z":"57881832.e77f68","name":"PumpHighFileWrite","filename":"PumpHigh","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"none","x":950,"y":1340,"wires":[]},{"id":"2dc5d36c.96e70c","type":"file","z":"57881832.e77f68","name":"PumpLowFileWrite","filename":"PumpLow","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"none","x":950,"y":1300,"wires":[]},{"id":"5ce377ee.b86138","type":"change","z":"57881832.e77f68","name":"Turn Off - 0","rules":[{"t":"change","p":"payload","pt":"msg","from":"1","fromt":"num","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":1320,"wires":[["2dc5d36c.96e70c"]]},{"id":"428bd858.254d88","type":"switch","z":"57881832.e77f68","name":"On Off","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":530,"y":1380,"wires":[["5ce377ee.b86138","ba61e16b.3d3b9"],["e5b7de60.cbd54","988c7778.5e2248"]]},{"id":"988c7778.5e2248","type":"delay","z":"57881832.e77f68","name":"1 sec delay","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":750,"y":1400,"wires":[["5a031c7b.216de4"]]},{"id":"e5b7de60.cbd54","type":"file","z":"57881832.e77f68","name":"PumpHighFileWrite","filename":"PumpHigh","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"none","x":950,"y":1380,"wires":[]},{"id":"38aca638.37448a","type":"file","z":"57881832.e77f68","name":"PumpLowFileWrite","filename":"PumpLow","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"none","x":950,"y":1420,"wires":[]},{"id":"5a031c7b.216de4","type":"change","z":"57881832.e77f68","name":"Turn On - 1","rules":[{"t":"change","p":"payload","pt":"msg","from":"0","fromt":"num","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":1440,"wires":[["38aca638.37448a","edb3a61e.cf15c8"]]},{"id":"f3ec59cb.e79c78","type":"sensor-ds18b20","z":"57881832.e77f68","name":"HottubTemp","topic":"","sensorid":"28-030897797267","timer":"1","repeat":false,"x":570,"y":320,"wires":[["5f2d7f5a.50b76"]]},{"id":"3ea84b7b.2490f4","type":"rpi-gpio in","z":"57881832.e77f68","name":"Temp Down","pin":"37","intype":"down","debounce":"75","read":false,"x":110,"y":560,"wires":[["f287ccab.1c7bc"]]},{"id":"290a6752.e3b9f8","type":"change","z":"57881832.e77f68","name":"change string to number","rules":[{"t":"set","p":"payload","pt":"msg","to":"$number(payload)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":560,"wires":[["16acdd77.f96b23"]]},{"id":"3bb5cfd4.9ee41","type":"file","z":"57881832.e77f68","name":"TempSetPoint","filename":"TempSetPoint","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"utf8","x":1000,"y":560,"wires":[["7a89c2f1.b7bd0c","884edb4b.0dd0d8"]]},{"id":"f287ccab.1c7bc","type":"ui_button","z":"57881832.e77f68","name":"Temp Down","group":"b0305158.796a4","order":7,"width":6,"height":1,"passthru":true,"label":"Decrease Temp","tooltip":"","color":"","bgcolor":"","icon":"","payload":"1","payloadType":"num","topic":"","x":270,"y":560,"wires":[["74a0d4a.6ade22c"]]},{"id":"d9062420.8f81c8","type":"inject","z":"57881832.e77f68","name":"simbutton","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":100,"y":620,"wires":[["f287ccab.1c7bc"]]},{"id":"16acdd77.f96b23","type":"function","z":"57881832.e77f68","name":"sub","func":"var temp = msg.payload\nmsg.payload = temp - 1\nreturn msg;","outputs":1,"noerr":0,"x":850,"y":560,"wires":[["3bb5cfd4.9ee41","ace7e1cd.17e89"]]},{"id":"74a0d4a.6ade22c","type":"file in","z":"57881832.e77f68","name":"ReadTempSetPoint","filename":"TempSetPoint","format":"utf8","chunk":false,"sendError":false,"encoding":"none","x":450,"y":560,"wires":[["290a6752.e3b9f8"]]},{"id":"1d790bae.7c9564","type":"file in","z":"57881832.e77f68","name":"ReadTempSetPoint","filename":"TempSetPoint","format":"utf8","chunk":false,"sendError":false,"encoding":"none","x":410,"y":460,"wires":[["732ee10.af2d02"]]},{"id":"732ee10.af2d02","type":"change","z":"57881832.e77f68","name":"change string to number","rules":[{"t":"set","p":"payload","pt":"msg","to":"$number(payload)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":630,"y":460,"wires":[["5eb123a0.d2cefc"]]},{"id":"c8a4539b.88ed5","type":"file","z":"57881832.e77f68","name":"TempSetPoint","filename":"TempSetPoint","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"utf8","x":960,"y":460,"wires":[["7a89c2f1.b7bd0c","884edb4b.0dd0d8"]]},{"id":"e05cec5f.b40f7","type":"rpi-gpio in","z":"57881832.e77f68","name":"Temp Up","pin":"35","intype":"down","debounce":"25","read":false,"x":100,"y":460,"wires":[["8bd14c48.d0ed1"]]},{"id":"4fa3a8cf.6662e8","type":"inject","z":"57881832.e77f68","name":"simbutton","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":100,"y":520,"wires":[["8bd14c48.d0ed1"]]},{"id":"8bd14c48.d0ed1","type":"ui_button","z":"57881832.e77f68","name":"Temp UP","group":"b0305158.796a4","order":8,"width":0,"height":0,"passthru":true,"label":"Increase Temp","tooltip":"","color":"","bgcolor":"","icon":"","payload":"1","payloadType":"num","topic":"","x":240,"y":460,"wires":[["1d790bae.7c9564"]]},{"id":"5eb123a0.d2cefc","type":"function","z":"57881832.e77f68","name":"sub","func":"var temp = msg.payload\nmsg.payload = temp + 1\nreturn msg;","outputs":1,"noerr":0,"x":810,"y":460,"wires":[["c8a4539b.88ed5","ace7e1cd.17e89"]]},{"id":"d34f671f.637ba8","type":"debug","z":"57881832.e77f68","name":"CurrentTemp","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1070,"y":280,"wires":},{"id":"6866bf52.def17","type":"trigger","z":"57881832.e77f68","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"-3","extend":false,"units":"s","reset":"","bytopic":"all","name":"","x":400,"y":320,"wires":[["f3ec59cb.e79c78"]]},{"id":"1e7dd96d.3895b7","type":"file","z":"57881832.e77f68","name":"","filename":"CurrentTemp","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"utf8","x":910,"y":320,"wires":[["d34f671f.637ba8","2b4342d3.c93f9e"]]},{"id":"5f2d7f5a.50b76","type":"unit-converter","z":"57881832.e77f68","category":"temperature","inputUnit":"C","outputUnit":"F","inputField":"payload","outputField":"payload","inputFieldType":"msg","outputFieldType":"msg","name":"","x":740,"y":320,"wires":[["1e7dd96d.3895b7","a1062d46.832bc"]]},{"id":"9da25b6e.89eb38","type":"switch","z":"57881832.e77f68","name":"","property":"payload","propertyType":"msg","rules":[{"t":"lt","v":"set_point","vt":"flow"},{"t":"gte","v":"set_point","vt":"flow"}],"checkall":"true","repair":false,"outputs":2,"x":1370,"y":720,"wires":[["f0df7c2f.d898f"],["d6bfe11b.d0042"]]},{"id":"942aca08.16df88","type":"change","z":"57881832.e77f68","name":"Setflow_set_point","rules":[{"t":"set","p":"set_point","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1390,"y":800,"wires":[]},{"id":"a8c79bf4.1ece68","type":"file in","z":"57881832.e77f68","name":"CurrentTemp","filename":"CurrentTemp","format":"utf8","chunk":false,"sendError":false,"encoding":"none","x":950,"y":720,"wires":[["72821bae.0a0ca4"]]},{"id":"c11bd053.137aa","type":"trigger","z":"57881832.e77f68","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"-5","extend":false,"units":"s","reset":"","bytopic":"all","name":"","x":760,"y":760,"wires":[["a8c79bf4.1ece68","e55dc571.cf0ef8"]]},{"id":"e55dc571.cf0ef8","type":"file in","z":"57881832.e77f68","name":"TempSetPoint","filename":"TempSetPoint","format":"utf8","chunk":false,"sendError":false,"encoding":"utf8","x":960,"y":800,"wires":[["efd3ccea.309d3"]]},{"id":"ca0c9235.8e199","type":"file","z":"57881832.e77f68","name":"","filename":"TempSetPoint","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"none","x":700,"y":400,"wires":[["884edb4b.0dd0d8"]]},{"id":"22d2a0f7.d92d8","type":"change","z":"57881832.e77f68","name":"SetTempSetPoint","rules":[{"t":"set","p":"payload","pt":"msg","to":"75","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":400,"wires":[["ca0c9235.8e199"]]},{"id":"72821bae.0a0ca4","type":"change","z":"57881832.e77f68","name":"change string to number","rules":[{"t":"set","p":"payload","pt":"msg","to":"$number(payload)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1170,"y":720,"wires":[["9da25b6e.89eb38"]]},{"id":"efd3ccea.309d3","type":"change","z":"57881832.e77f68","name":"change string to number","rules":[{"t":"set","p":"payload","pt":"msg","to":"$number(payload)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1170,"y":800,"wires":[["942aca08.16df88"]]},{"id":"d6bfe11b.d0042","type":"change","z":"57881832.e77f68","name":"Turn Off - 0","rules":[{"t":"set","p":"payload","pt":"msg","to":"0","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1590,"y":740,"wires":[["376f8716.d643c8"]]},{"id":"f0df7c2f.d898f","type":"change","z":"57881832.e77f68","name":"Turn On - 1","rules":[{"t":"set","p":"payload","pt":"msg","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":1590,"y":700,"wires":[["376f8716.d643c8"]]},{"id":"d38cab08.dcc678","type":"debug","z":"57881832.e77f68","name":"Tempsetpoint","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1670,"y":500,"wires":},{"id":"376f8716.d643c8","type":"file","z":"57881832.e77f68","name":"PumpHeaterFileWrite","filename":"Heater","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"none","x":1820,"y":720,"wires":[]},{"id":"51667db5.1c3f04","type":"file","z":"57881832.e77f68","name":"PumpHeaterFileWrite","filename":"Heater","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"none","x":600,"y":140,"wires":[]},{"id":"cc8f3cf5.91f96","type":"change","z":"57881832.e77f68","name":"Turn Off - 0","rules":[{"t":"change","p":"payload","pt":"msg","from":"","fromt":"str","to":"0","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":200,"wires":[["51667db5.1c3f04","382dade0.cc94f2","5ff0a89.1598058","74657e5.726968"]]},{"id":"81bd11c8.b9e08","type":"tail","z":"57881832.e77f68","name":"WatchPumpHighFile","filetype":"text","split":"{0,1}","filename":"PumpHigh","x":110,"y":740,"wires":[["3764791e.1fa7e6"]]},{"id":"4b4f4ec1.3324b","type":"tail","z":"57881832.e77f68","name":"WatchPumpLowFile","filetype":"text","split":"{0,1}","filename":"PumpLow","x":110,"y":800,"wires":[["139adbee.871a14"]]},{"id":"3a9d407.2c403c","type":"change","z":"57881832.e77f68","name":"Setflow_set_point","rules":[{"t":"set","p":"set_point","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1450,"y":500,"wires":[["d38cab08.dcc678"]]},{"id":"7a89c2f1.b7bd0c","type":"change","z":"57881832.e77f68","name":"change string to number","rules":[{"t":"set","p":"payload","pt":"msg","to":"$number(payload)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1230,"y":500,"wires":[["3a9d407.2c403c"]]},{"id":"3764791e.1fa7e6","type":"change","z":"57881832.e77f68","name":"change string to number","rules":[{"t":"set","p":"payload","pt":"msg","to":"$number(payload)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":330,"y":740,"wires":[["392a2618.bda0da"]]},{"id":"139adbee.871a14","type":"change","z":"57881832.e77f68","name":"change string to number","rules":[{"t":"set","p":"payload","pt":"msg","to":"$number(payload)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":330,"y":800,"wires":[["62a34c46.20e0b4"]]},{"id":"392a2618.bda0da","type":"switch","z":"57881832.e77f68","name":"CheckONorOff","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":560,"y":740,"wires":[["c11bd053.137aa"],]},{"id":"62a34c46.20e0b4","type":"switch","z":"57881832.e77f68","name":"CheckONorOff","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":560,"y":800,"wires":[["c11bd053.137aa"],]},{"id":"884edb4b.0dd0d8","type":"ui_text","z":"57881832.e77f68","group":"b0305158.796a4","order":9,"width":3,"height":1,"name":"Temp Set Point","label":"Temp Set Point","format":"{{msg.payload}}","layout":"row-spread","x":1340,"y":400,"wires":},{"id":"2b4342d3.c93f9e","type":"ui_text","z":"57881832.e77f68","group":"b0305158.796a4","order":10,"width":3,"height":1,"name":"Water Temp","label":"Water Temp","format":"{{msg.payload}}","layout":"row-spread","x":1070,"y":320,"wires":},{"id":"ace7e1cd.17e89","type":"ui_slider","z":"57881832.e77f68","name":"","label":"Temp Set","tooltip":"","group":"b0305158.796a4","order":11,"width":0,"height":0,"passthru":true,"outs":"all","topic":"","min":"80","max":"108","step":1,"x":940,"y":500,"wires":[["c8a4539b.88ed5"]]},{"id":"a1062d46.832bc","type":"ui_gauge","z":"57881832.e77f68","name":"Temp Guage","group":"b0305158.796a4","order":12,"width":0,"height":0,"gtype":"gage","title":"Water Temp","label":"units","format":"{{value}}","min":"80","max":"120","colors":["#00b500","#e6e600","#ca3838"],"seg1":"105","seg2":"107","x":910,"y":280,"wires":},{"id":"4d973d1b.dc5e44","type":"ui_led","z":"57881832.e77f68","group":"b0305158.796a4","order":6,"width":3,"height":1,"label":"Low Pump","labelPlacement":"left","labelAlignment":"left","colorForValue":[{"color":"red","value":"false","valueType":"bool"},{"color":"green","value":"true","valueType":"bool"}],"allowColorForValueInMessage":false,"name":"","x":670,"y":80,"wires":},{"id":"12a5b628.698ffa","type":"change","z":"57881832.e77f68","name":"Convert to TF","rules":[{"t":"change","p":"payload","pt":"msg","from":"1","fromt":"num","to":"true","tot":"bool"},{"t":"change","p":"payload","pt":"msg","from":"0","fromt":"num","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":80,"wires":[["4d973d1b.dc5e44"]]},{"id":"fcadb172.de51b","type":"ui_led","z":"57881832.e77f68","group":"b0305158.796a4","order":5,"width":3,"height":1,"label":"Heater","labelPlacement":"left","labelAlignment":"left","colorForValue":[{"color":"red","value":"false","valueType":"bool"},{"color":"green","value":"true","valueType":"bool"}],"allowColorForValueInMessage":false,"name":"","x":1030,"y":80,"wires":},{"id":"4098e7d7.6019e8","type":"change","z":"57881832.e77f68","name":"Convert to TF","rules":[{"t":"change","p":"payload","pt":"msg","from":"1","fromt":"num","to":"true","tot":"bool"},{"t":"change","p":"payload","pt":"msg","from":"0","fromt":"num","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":80,"wires":[["fcadb172.de51b"]]},{"id":"22bc193d.ef6706","type":"ui_led","z":"57881832.e77f68","group":"b0305158.796a4","order":2,"width":2,"height":1,"label":"","labelPlacement":"left","labelAlignment":"left","colorForValue":[{"color":"red","value":"false","valueType":"bool"},{"color":"green","value":"true","valueType":"bool"}],"allowColorForValueInMessage":false,"name":"","x":1370,"y":80,"wires":},{"id":"5830f874.d03e08","type":"change","z":"57881832.e77f68","name":"Convert to TF","rules":[{"t":"change","p":"payload","pt":"msg","from":"1","fromt":"num","to":"true","tot":"bool"},{"t":"change","p":"payload","pt":"msg","from":"0","fromt":"num","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1200,"y":80,"wires":[["22bc193d.ef6706"]]},{"id":"e0b084d3.628608","type":"ui_led","z":"57881832.e77f68","group":"b0305158.796a4","order":4,"width":2,"height":1,"label":"","labelPlacement":"left","labelAlignment":"left","colorForValue":[{"color":"red","value":"false","valueType":"bool"},{"color":"green","value":"true","valueType":"bool"}],"allowColorForValueInMessage":false,"name":"","x":310,"y":80,"wires":},{"id":"52c016c7.4f9348","type":"change","z":"57881832.e77f68","name":"Convert to TF","rules":[{"t":"change","p":"payload","pt":"msg","from":"1","fromt":"num","to":"true","tot":"bool"},{"t":"change","p":"payload","pt":"msg","from":"0","fromt":"num","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":140,"y":80,"wires":[["e0b084d3.628608"]]},{"id":"382dade0.cc94f2","type":"file","z":"57881832.e77f68","name":"PumpHighFileWrite","filename":"PumpHigh","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"none","x":590,"y":180,"wires":[]},{"id":"3e17c742.29dcd8","type":"inject","z":"57881832.e77f68","name":"Start with All OFF","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":true,"onceDelay":"1","x":170,"y":200,"wires":[["cc8f3cf5.91f96","22d2a0f7.d92d8","6866bf52.def17","b68d9d53.31c8","f014a16a.b8d0a","e280fe9e.d89d"]]},{"id":"5ff0a89.1598058","type":"file","z":"57881832.e77f68","name":"PumpLowFileWrite","filename":"PumpLow","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"none","x":590,"y":220,"wires":[]},{"id":"74657e5.726968","type":"file","z":"57881832.e77f68","name":"OzonatorFileWrite","filename":"Ozonator","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"none","x":590,"y":260,"wires":[]},{"id":"edb3a61e.cf15c8","type":"file","z":"57881832.e77f68","name":"OzonatorFileWrite","filename":"Ozonator","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"none","x":950,"y":1460,"wires":[]},{"id":"4827b52.b716a4c","type":"comment","z":"57881832.e77f68","name":"Heater Control","info":"","x":100,"y":680,"wires":},{"id":"1f0e584c.9b3468","type":"comment","z":"57881832.e77f68","name":"Start With All Devices OFF after power up and starts temp reading","info":"","x":230,"y":140,"wires":},{"id":"857f6939.98e918","type":"function","z":"57881832.e77f68","name":"flip","func":"// initialise the counter to 0 if it doesn't exist already\nvar count = context.get('count')||1;\ncount += 1;\n\n// store the value back\ncontext.set('count',count);\n\n// make it part of the outgoing msg object\nmsg.count = count;\n\n//define function isOdd 1 === isOdd\nfunction isOdd(num) { return num % 2;}\n\n/*if count is odd send 1,\nelse send 0 */\nif(isOdd((count+1)/2) ===1){\nmsg.payload = 1;\nreturn msg;\n} else if (isOdd((count+1)/2) ===0){\nmsg.payload = 0;\nreturn msg;\n}","outputs":1,"noerr":0,"x":190,"y":960,"wires":[["b68d9d53.31c8"]]},{"id":"9cfcab5d.1aa7c8","type":"switch","z":"57881832.e77f68","name":"On Off","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":450,"y":960,"wires":[["68b9869c.7fb898","77bbe2db.5cd73c"],["c4124fe2.e433f","e5b16edb.6bc94"]]},{"id":"b68d9d53.31c8","type":"ui_switch","z":"57881832.e77f68","name":"Power","label":"Power","tooltip":"","group":"b0305158.796a4","order":1,"width":4,"height":1,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"1","onvalueType":"num","onicon":"","oncolor":"","offvalue":"0","offvalueType":"num","officon":"","offcolor":"","x":310,"y":960,"wires":[["9cfcab5d.1aa7c8"]]},{"id":"71b67bc8.796594","type":"file","z":"57881832.e77f68","name":"PumpHighFileWrite","filename":"PumpHigh","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"none","x":1010,"y":1140,"wires":[]},{"id":"e71c95f2.61a1e8","type":"file","z":"57881832.e77f68","name":"PumpLowFileWrite","filename":"PumpLow","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"none","x":1010,"y":1180,"wires":[]},{"id":"e647b0e1.f3e3c","type":"file","z":"57881832.e77f68","name":"OzonatorFileWrite","filename":"Ozonator","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"none","x":1010,"y":1220,"wires":[]},{"id":"5a491885.9f3f88","type":"comment","z":"57881832.e77f68","name":"Power ON","info":"","x":480,"y":900,"wires":},{"id":"68381415.4fd7ec","type":"comment","z":"57881832.e77f68","name":"Power OFF","info":"","x":490,"y":1020,"wires":},{"id":"8b5289e1.c2c508","type":"comment","z":"57881832.e77f68","name":"Reset Temp Set Point","info":"","x":280,"y":400,"wires":},{"id":"591f7fce.9914d","type":"comment","z":"57881832.e77f68","name":"Temp Control","info":"","x":70,"y":420,"wires":},{"id":"3fd69e37.ce2f62","type":"comment","z":"57881832.e77f68","name":"Master Power","info":"","x":90,"y":900,"wires":},{"id":"17fc9433.4a8b9c","type":"comment","z":"57881832.e77f68","name":"Jet Control","info":"","x":100,"y":1320,"wires":},{"id":"56150b65.511a14","type":"function","z":"57881832.e77f68","name":"flip","func":"// initialise the counter to 0 if it doesn't exist already\nvar count = context.get('count')||1;\ncount += 1;\n\n// store the value back\ncontext.set('count',count);\n\n// make it part of the outgoing msg object\nmsg.count = count;\n\n//define function isOdd 1 === isOdd\nfunction isOdd(num) { return num % 2;}\n\n/*if count is odd send 1,\nelse send 0 */\nif(isOdd((count+1)/2) ===1){\nmsg.payload = 1;\nreturn msg;\n} else if (isOdd((count+1)/2) ===0){\nmsg.payload = 0;\nreturn msg;\n}","outputs":1,"noerr":0,"x":250,"y":1380,"wires":[["f014a16a.b8d0a"]]},{"id":"f014a16a.b8d0a","type":"ui_switch","z":"57881832.e77f68","name":"Jets","label":"Jets","tooltip":"","group":"b0305158.796a4","order":3,"width":4,"height":1,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"1","onvalueType":"num","onicon":"","oncolor":"","offvalue":"0","offvalueType":"num","officon":"","offcolor":"","x":390,"y":1380,"wires":[["428bd858.254d88"]]},{"id":"77bbe2db.5cd73c","type":"delay","z":"57881832.e77f68","name":"1sec delay","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":670,"y":980,"wires":[["c3b4619d.f7e58","7aa12f6d.99c92"]]},{"id":"85c9e965.c96b48","type":"rpi-gpio in","z":"57881832.e77f68","name":"Lights On/Off","pin":"22","intype":"up","debounce":"150","read":true,"x":910,"y":140,"wires":[["fc83db13.fc4e58"]]},{"id":"e280fe9e.d89d","type":"ui_switch","z":"57881832.e77f68","name":"Lights","label":"Lights","tooltip":"","group":"b0305158.796a4","order":12,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"1","onvalueType":"num","onicon":"","oncolor":"","offvalue":"0","offvalueType":"num","officon":"","offcolor":"","x":1170,"y":140,"wires":[["6050f336.97190c"]]},{"id":"6050f336.97190c","type":"rpi-gpio out","z":"57881832.e77f68","name":"Light","pin":"32","set":"","level":"0","freq":"","out":"out","x":1290,"y":140,"wires":},{"id":"af47817a.ac11d","type":"inject","z":"57881832.e77f68","name":"simbutton","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":900,"y":200,"wires":[["fc83db13.fc4e58"]]},{"id":"fc83db13.fc4e58","type":"function","z":"57881832.e77f68","name":"flip","func":"// initialise the counter to 0 if it doesn't exist already\nvar count = context.get('count')||1;\ncount += 1;\n\n// store the value back\ncontext.set('count',count);\n\n// make it part of the outgoing msg object\nmsg.count = count;\n\n//define function isOdd 1 === isOdd\nfunction isOdd(num) { return num % 2;}\n\n/*if count is odd send 1,\nelse send 0 */\nif(isOdd((count+1)/2) ===1){\nmsg.payload = 1;\nreturn msg;\n} else if (isOdd((count+1)/2) ===0){\nmsg.payload = 0;\nreturn msg;\n}","outputs":1,"noerr":0,"x":1050,"y":140,"wires":[["e280fe9e.d89d"]]},{"id":"41126145.2939","type":"comment","z":"57881832.e77f68","name":"Tub Light","info":"","x":1080,"y":200,"wires":},{"id":"d9f76d70.417c6","type":"comment","z":"57881832.e77f68","name":"initialize temp reading","info":"","x":160,"y":320,"wires":},{"id":"b0305158.796a4","type":"ui_group","z":"","name":"Default","tab":"cd1268db.6a7398","disp":true,"width":6,"collapse":false},{"id":"cd1268db.6a7398","type":"ui_tab","z":"","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]