• 1
    Step 1

    Use node read.

    Import:

    [{"id":"3b4f4164.ff2986","type":"http in","z":"ecdc725b.4275e","name":"Get temp","url":"/temp","method":"get","swaggerDoc":"","x":104.5,"y":175.33331298828125,"wires":[["809da49f.ba0078"]]},{"id":"809da49f.ba0078","type":"rpi-ds18b20","z":"ecdc725b.4275e","topic":"","array":false,"name":"","x":326.5,"y":174.33331298828125,"wires":[["92362f3f.c5cff","93c6a90f.82fd38"]]},{"id":"92362f3f.c5cff","type":"http response","z":"ecdc725b.4275e","name":"","x":767.5,"y":113.33331298828125,"wires":[]},{"id":"89974cda.223888","type":"debug","z":"ecdc725b.4275e","name":"","active":true,"console":"false","complete":"false","x":777,"y":583,"wires":[]},{"id":"6c210231.367b24","type":"function","z":"ecdc725b.4275e","name":"Togglr 0/1 gpio 28 pin 20","func":"context.state = context.state || 0;\n(context.state == 0) ? context.state =1 : context.state = 0;\nmsg.payload = context.state;\nreturn msg;","outputs":1,"noerr":0,"x":426,"y":633,"wires":[["6f713f51.8333d8","89974cda.223888","6df95fa.bab6c2"]]},{"id":"6f713f51.8333d8","type":"rpi-gpio out","z":"ecdc725b.4275e","name":"","pin":"38","set":"","level":"0","out":"out","x":767,"y":630,"wires":[]},{"id":"aba97c7d.ae3e18","type":"inject","z":"ecdc725b.4275e","name":"Right 240V control ","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":125,"y":580,"wires":[["6c210231.367b24"]]},{"id":"f1b82736.7307a","type":"http in","z":"ecdc725b.4275e","name":"WS for right power socket","url":"/right","method":"get","swaggerDoc":"","x":132,"y":632,"wires":[["6c210231.367b24"]]},{"id":"6df95fa.bab6c2","type":"http response","z":"ecdc725b.4275e","name":"Responce","x":768,"y":513,"wires":[]},{"id":"899eb687.b65dc8","type":"inject","z":"ecdc725b.4275e","name":"Left 240V control","topic":"","payload":"","payloadType":"date","repeat":"3600","crontab":"","once":false,"x":125,"y":735,"wires":[["96572c17.9ee768"]]},{"id":"96572c17.9ee768","type":"function","z":"ecdc725b.4275e","name":"Set On Left 240V  pin GPIO 4 pin 23","func":"context.state = context.state || 0;\n(context.state == 0) ? context.state =1 : context.state = 1;\nmsg.payload = context.state;\nreturn msg;","outputs":1,"noerr":0,"x":442,"y":735,"wires":[["cf0be4f1.e91598","4ff82331.12ede4","37d1e1e4.08a816"]]},{"id":"cf0be4f1.e91598","type":"debug","z":"ecdc725b.4275e","name":"","active":true,"console":"false","complete":"false","x":797,"y":736,"wires":[]},{"id":"4ff82331.12ede4","type":"rpi-gpio out","z":"ecdc725b.4275e","name":"","pin":"16","set":"","level":"0","out":"out","x":957,"y":834,"wires":[]},{"id":"93c6a90f.82fd38","type":"file","z":"ecdc725b.4275e","name":"","filename":"/home/pi/temp.txt","appendNewline":true,"createDir":true,"overwriteFile":"false","x":807,"y":175,"wires":[]},{"id":"dcb452b3.e8d9c8","type":"http in","z":"ecdc725b.4275e","name":"Get tempt record","url":"/temprecord","method":"get","swaggerDoc":"","x":112,"y":312,"wires":[["54b2ef36.56ba2"]]},{"id":"54b2ef36.56ba2","type":"file in","z":"ecdc725b.4275e","name":"Get temp from file","filename":"/home/pi/temp.txt","format":"utf8","x":395,"y":235,"wires":[["85bb0af1.707e28","b078ce82.04c588"]]},{"id":"85bb0af1.707e28","type":"http response","z":"ecdc725b.4275e","name":"","x":779,"y":234,"wires":[]},{"id":"9d54f373.c41948","type":"inject","z":"ecdc725b.4275e","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":118,"y":235,"wires":[["54b2ef36.56ba2"]]},{"id":"b078ce82.04c588","type":"debug","z":"ecdc725b.4275e","name":"","active":true,"console":"false","complete":"false","x":973,"y":267,"wires":[]},{"id":"37d1e1e4.08a816","type":"function","z":"ecdc725b.4275e","name":"Set Turn off Signal","func":"context.state = 0\nmsg.payload = context.state;\n\nreturn msg;","outputs":1,"noerr":0,"x":372,"y":839,"wires":[["6bf937da.c6b308"]]},{"id":"6bf937da.c6b308","type":"delay","z":"ecdc725b.4275e","name":"Wait 15 mins","pauseType":"delay","timeout":"10","timeoutUnits":"minutes","rate":"1","nbRateUnits":"","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":592,"y":838,"wires":[["4ff82331.12ede4"]]},{"id":"fd9d6362.8365b","type":"function","z":"ecdc725b.4275e","name":"Set turn off signal","func":"context.state = 0\nmsg.payload = context.state;\n\nreturn msg;","outputs":1,"noerr":0,"x":598,"y":908,"wires":[["4ff82331.12ede4"]]},{"id":"ed509dfe.25318","type":"inject","z":"ecdc725b.4275e","name":"Turn OFF Emergancy Override","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":280,"y":909,"wires":[["fd9d6362.8365b"]]},{"id":"39a4d979.fbe67e","type":"exec","z":"ecdc725b.4275e","command":"python","addpay":true,"append":"","useSpawn":"","timer":"10","name":"Get PH","x":261,"y":1149.5,"wires":[["dfca2f38.554cb","65804f7e.70ff38"],[],[]]},{"id":"50a4e037.ffc39","type":"http in","z":"ecdc725b.4275e","name":"Get PH ","url":"/ph","method":"get","swaggerDoc":"","x":64,"y":1349,"wires":[["a63a814b.e3bfa8"]]},{"id":"a63a814b.e3bfa8","type":"function","z":"ecdc725b.4275e","name":"Set Python ","func":"msg.payload = \" /home/pi/.node-red/pythonScripts/p4.py\"\n// Return the message so it can be sent on\nreturn msg;","outputs":1,"noerr":0,"x":255,"y":1349,"wires":[["39a4d979.fbe67e"]]},{"id":"b70e1d48.64b2d","type":"http response","z":"ecdc725b.4275e","name":"WS PH","x":1197,"y":1268,"wires":[]},{"id":"dfca2f38.554cb","type":"function","z":"ecdc725b.4275e","name":"Calibration Formula","func":"var newvalue = parseFloat(msg.payload);\n\n\n//The Linear  is 0.95X + 1.7643\n//Tested on Cal water\n//4 = 5.6\n//7 = 8.4\n//10 = 11.3\nnewvalue = (newvalue - 1.7643) / 0.95;\n\n//msg.payload = newvalue.toFixed(2);\n\nnewMsg = { payload: \"The PH of my tank is: \"+newvalue.toFixed(2)+\"ph\" };\n\n\nreturn newMsg;","outputs":1,"noerr":0,"x":634,"y":1158,"wires":[["b70e1d48.64b2d","d5438da1.153cd8"]]},{"id":"730e492f.2e9488","type":"debug","z":"ecdc725b.4275e","name":"","active":true,"console":"false","complete":"false","x":1209,"y":1040,"wires":[]},{"id":"65804f7e.70ff38","type":"rpi-ds18b20","z":"ecdc725b.4275e","topic":"","array":false,"name":"","x":556,"y":1067,"wires":[["edb5cbc6.cce7d8"]]},{"id":"2cf820c5.4e3b","type":"twitter out","z":"ecdc725b.4275e","twitter":"","name":"Tweet","x":1192,"y":1151,"wires":[]},{"id":"d5438da1.153cd8","type":"join","z":"ecdc725b.4275e","name":"","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","timeout":"","count":"2","x":967,"y":1117,"wires":[["730e492f.2e9488","2cf820c5.4e3b"]]},{"id":"edb5cbc6.cce7d8","type":"function","z":"ecdc725b.4275e","name":"Temp Text","func":"newMsg = { payload: \" The temperature of my tank is: \"+msg.payload+\" C and the fish have been Auto fed\" };\n\nreturn newMsg;","outputs":1,"noerr":0,"x":714,"y":1067,"wires":[["d5438da1.153cd8"]]},{"id":"b581565.aee7ca8","type":"function","z":"ecdc725b.4275e","name":"Turn on Wireless One","func":"msg.payload = \" /home/pi/.node-red/pythonScripts/WirelessOnOne.py\"\n// Return the message so it can be sent on\nreturn msg;","outputs":1,"noerr":0,"x":430,"y":1791,"wires":[["954c86f3.8e0958"]]},{"id":"5d253ed6.243708","type":"delay","z":"ecdc725b.4275e","name":"Wait 15 mins","pauseType":"delay","timeout":"15","timeoutUnits":"minutes","rate":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":826,"y":1792,"wires":[["94641694.eea78"]]},{"id":"2c586836.16f8d","type":"function","z":"ecdc725b.4275e","name":"Set turn off signal","func":"msg.payload = \" /home/pi/.node-red/pythonScripts/WirelessOffOne.py\"\n// Return the message so it can be sent on\nreturn msg;","outputs":1,"noerr":0,"x":443,"y":1875,"wires":[["bb65f157.da576"]]},{"id":"a7f496f5.3bb48","type":"inject","z":"ecdc725b.4275e","name":"Turn OFF Emergancy Override","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":177,"y":1875,"wires":[["2c586836.16f8d"]]},{"id":"94641694.eea78","type":"function","z":"ecdc725b.4275e","name":"Turn OFF Wireless one","func":"msg.payload = \" /home/pi/.node-red/pythonScripts/WirelessOffOne.py\"\n// Return the message so it can be sent on\nreturn msg;","outputs":1,"noerr":0,"x":1052,"y":1792,"wires":[["ba7f6d02.954dc"]]},{"id":"954c86f3.8e0958","type":"exec","z":"ecdc725b.4275e","command":"python","addpay":true,"append":"","useSpawn":"","timer":"","name":"","x":611,"y":1791.5,"wires":[["5d253ed6.243708"],[],[]]},{"id":"ba7f6d02.954dc","type":"exec","z":"ecdc725b.4275e","command":"python","addpay":true,"append":"","useSpawn":"","timer":"","name":"","x":1261,"y":1791.5,"wires":[["838828b1.74a068"],["838828b1.74a068"],["838828b1.74a068"]]},{"id":"bb65f157.da576","type":"exec","z":"ecdc725b.4275e","command":"python","addpay":true,"append":"","useSpawn":"","timer":"","name":"","x":616,"y":1875.5,"wires":[["838828b1.74a068"],[],[]]},{"id":"838828b1.74a068","type":"debug","z":"ecdc725b.4275e","name":"","active":true,"console":"false","complete":"false","x":1012,"y":1899,"wires":[]},{"id":"da8fc6a.dcf2138","type":"inject","z":"ecdc725b.4275e","name":"","topic":"","payload":"","payloadType":"date","repeat":"57600","crontab":"","once":false,"x":119,"y":1256,"wires":[["a63a814b.e3bfa8","78ed6667.f68898"]]},{"id":"15f2f2f3.9701f5","type":"inject","z":"ecdc725b.4275e","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":147,"y":1455,"wires":[["78ed6667.f68898"]]},{"id