smort

nrblynkferment

Oct 6th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.43 KB | None | 0 0
  1. [{"id":"56a96e1e.fe6478","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"a80e2c24.28dd8","type":"http in","z":"56a96e1e.fe6478","name":"","url":"/test","method":"post","upload":false,"swaggerDoc":"","x":240,"y":300,"wires":[["e17e5d2f.46a5a","2223a072.e32ff"]]},{"id":"e17e5d2f.46a5a","type":"http response","z":"56a96e1e.fe6478","name":"","statusCode":"","headers":{},"x":390,"y":260,"wires":[]},{"id":"d1720c34.0700d","type":"key-value-write","z":"56a96e1e.fe6478","store":"29912703.c1a3b8","action":"set","key":"","keyvalue":"","name":"","x":590,"y":300,"wires":[[]]},{"id":"1d76ba60.7ac306","type":"key-value-read","z":"56a96e1e.fe6478","store":"29912703.c1a3b8","key":"","name":"","x":590,"y":340,"wires":[["7f72404e.082c9"]]},{"id":"2223a072.e32ff","type":"change","z":"56a96e1e.fe6478","name":"set batchnumber","rules":[{"t":"set","p":"topic","pt":"msg","to":"$string(payload.batchNo)\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":300,"wires":[["d1720c34.0700d"]]},{"id":"745e02dd.bb36fc","type":"change","z":"56a96e1e.fe6478","name":"set batchnumber","rules":[{"t":"set","p":"topic","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":340,"wires":[["1d76ba60.7ac306"]]},{"id":"39ab513d.2a131e","type":"blynk-ws-in-write","z":"56a96e1e.fe6478","name":"Batchno","pin":"8","pin_all":0,"client":"5ed34a67.0e4ae4","x":240,"y":340,"wires":[["745e02dd.bb36fc"]]},{"id":"ee3e5af4.1ce638","type":"blynk-ws-in-write","z":"56a96e1e.fe6478","name":"Button","pin":"9","pin_all":0,"client":"5ed34a67.0e4ae4","x":590,"y":240,"wires":[["f1f61bc3.de0408"]]},{"id":"f1f61bc3.de0408","type":"rising-edge","z":"56a96e1e.fe6478","name":"","threshold":"0.1","x":770,"y":300,"wires":[["7f85ff13.63c7f","f785192c.cef858"]]},{"id":"6d898217.555ecc","type":"inject","z":"56a96e1e.fe6478","name":"start","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":"1","x":890,"y":120,"wires":[["7f85ff13.63c7f","7d097b33.451d64","b2ba9c9b.0bebb"]]},{"id":"7f72404e.082c9","type":"change","z":"56a96e1e.fe6478","name":"store","rules":[{"t":"set","p":"fermentationStartDate","pt":"flow","to":"payload.fermentationStartDate","tot":"jsonata"},{"t":"set","p":"stepTemp","pt":"flow","to":"payload.recipe.fermentation.steps.stepTemp\t","tot":"jsonata"},{"t":"set","p":"stepTime","pt":"flow","to":"payload.recipe.fermentation.steps.stepTime","tot":"jsonata"},{"t":"set","p":"steps","pt":"flow","to":"$count(msg.payload.recipe.fermentation.steps)\t","tot":"jsonata"},{"t":"set","p":"finished","pt":"flow","to":"$sum(payload.recipe.fermentation.steps.stepTime)\t\t","tot":"jsonata"},{"t":"set","p":"ramp","pt":"flow","to":"payload.recipe.fermentation.steps.ramp","tot":"jsonata"},{"t":"set","p":"pressure","pt":"flow","to":"payload.recipe.fermentation.steps.pressure","tot":"jsonata"},{"t":"set","p":"type","pt":"flow","to":"payload.recipe.fermentation.steps.type","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":340,"wires":[["f785192c.cef858","8f86d347.827d7"]]},{"id":"3cf75636.3cb35a","type":"inject","z":"56a96e1e.fe6478","name":"now","topic":"","payload":"","payloadType":"date","repeat":"3","crontab":"","once":true,"onceDelay":"5","x":910,"y":420,"wires":[["59b7325f.1f584c"]]},{"id":"59b7325f.1f584c","type":"function","z":"56a96e1e.fe6478","name":"Calc&store SP","func":"var now = msg.payload / 1000 /3600 / 24\nvar start = flow.get('fermentationStartDate') / 1000 /3600 /24\nvar steps = flow.get('steps') - 1\nvar stepTemp = flow.get('stepTemp')\nvar stepTime = flow.get('stepTime')\nvar stepcounter = 0\nvar nextsteptime = start+stepTime[0]\nvar elapsed = now - start\nflow.set('elapsed', elapsed)\n\nfor (var i=1;i<=steps;i++) {\n if (now > nextsteptime) {\n stepcounter += 1;\n nextsteptime += stepTime[i];\n }\n}\n \n\nvar target = stepTemp[stepcounter]\nflow.set('target', target)\n\n\nmsg.payload = {\n \"stepcounter\": stepcounter,\n \"target\": target,\n \"start\": start,\n \"nextsteptime\": nextsteptime,\n \"now\": now\n}\nmsg.pick = stepcounter\nreturn msg; \n","outputs":1,"noerr":0,"x":1080,"y":420,"wires":[["7825720d.d267fc","3a506a69.39c176"]]},{"id":"7f85ff13.63c7f","type":"blynk-ws-out-sync","z":"56a96e1e.fe6478","name":"","pin":"8","pinmode":0,"client":"5ed34a67.0e4ae4","x":1320,"y":180,"wires":[]},{"id":"218f5d55.1d3512","type":"function","z":"56a96e1e.fe6478","name":"thermostat","func":"var temp = flow.get('temp')||20\nvar target = flow.get('target')\nvar hyst = 0.5\nvar ambient = flow.get('ambient')||20\nvar heat = flow.get('heat')||\"off\"\nvar cool = flow.get('cool')||\"off\"\n\n\n//heat\nif (temp < target - hyst) {//&& (ambient < target)) {\n heat = \"on\"\n flow.set('heat', heat)\n }\nif (temp > target) {\n heat = \"off\"\n flow.set('heat', heat)\n}\n \n//cool\nif (temp > (target + hyst)) {\n cool = \"on\"\n flow.set('cool', cool)\n }\n\nif (temp < target) {\n cool = \"off\" \n flow.set('cool', cool)\n }\n \nif (flow.get('heatingstopped') === true) {\n heat = \"off\"\n flow.set('heat', heat)\n}\nif (flow.get('coolingstopped') === true) {\n cool = \"off\" \n flow.set('cool', cool)\n}\n \nmsg.payload = {\"target\": target, \"heat\": heat, \"cool\": cool}\n \nreturn msg;","outputs":1,"noerr":0,"x":910,"y":460,"wires":[["94bdee41.58404"]]},{"id":"9772bb1.c90e148","type":"inject","z":"56a96e1e.fe6478","name":"","topic":"","payload":"24.49","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":390,"y":560,"wires":[["82774c11.f03db"]]},{"id":"1f9eaccb.7513f3","type":"inject","z":"56a96e1e.fe6478","name":"","topic":"","payload":"24.51","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":390,"y":520,"wires":[["82774c11.f03db"]]},{"id":"a83a38bd.8bb8e8","type":"inject","z":"56a96e1e.fe6478","name":"","topic":"","payload":"23.99","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":390,"y":600,"wires":[["82774c11.f03db"]]},{"id":"f45e5f6a.be458","type":"inject","z":"56a96e1e.fe6478","name":"","topic":"","payload":"23.49","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":390,"y":640,"wires":[["82774c11.f03db"]]},{"id":"7825720d.d267fc","type":"blynk-ws-out-table","z":"56a96e1e.fe6478","name":"Table","pin":"5","client":"5ed34a67.0e4ae4","x":1290,"y":420,"wires":[]},{"id":"f785192c.cef858","type":"change","z":"56a96e1e.fe6478","name":"clear table","rules":[{"t":"set","p":"clear","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1070,"y":300,"wires":[["7825720d.d267fc"]]},{"id":"49a774af.8c875c","type":"function","z":"56a96e1e.fe6478","name":"update table","func":"\nvar loadtable = [];\n\nfor (var i = 0; i < msg.payload.recipe.fermentation.steps.length; i++) {\n loadtable.push(\n [msg.payload.recipe.fermentation.steps[i].type+ \" for \"+ msg.payload.recipe.fermentation.steps[i].stepTime + \" days\", \n msg.payload.recipe.fermentation.steps[i].stepTemp]\n )\n}\nmsg.loadtable = loadtable\nreturn msg;","outputs":1,"noerr":0,"x":1070,"y":340,"wires":[["7825720d.d267fc"]]},{"id":"8f86d347.827d7","type":"delay","z":"56a96e1e.fe6478","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":900,"y":340,"wires":[["49a774af.8c875c","64473961.ccd4c8"]]},{"id":"a4c52a75.9531f8","type":"blynk-ws-out-write","z":"56a96e1e.fe6478","name":"beername","pin":"4","pinmode":0,"client":"5ed34a67.0e4ae4","x":1300,"y":380,"wires":[]},{"id":"64473961.ccd4c8","type":"function","z":"56a96e1e.fe6478","name":"set beername","func":"var elapsed = Math.floor(flow.get('elapsed'))\n\nbeername = \"#\"+msg.payload.batchNo + \" \" + msg.payload.recipe.name + \" @ day \" + elapsed\nmsg.payload = beername\nreturn msg;","outputs":1,"noerr":0,"x":1080,"y":380,"wires":[["a4c52a75.9531f8"]]},{"id":"1c2db562.f29f1b","type":"blynk-ws-in-write","z":"56a96e1e.fe6478","name":"Heating off","pin":"0","pin_all":0,"client":"5ed34a67.0e4ae4","x":700,"y":560,"wires":[["e9918e5e.44655","218f5d55.1d3512"]]},{"id":"1aa72084.bdbf0f","type":"change","z":"56a96e1e.fe6478","name":"stop","rules":[{"t":"set","p":"coolingstopped","pt":"flow","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1050,"y":620,"wires":[[]]},{"id":"102bd633.6f5cfa","type":"switch","z":"56a96e1e.fe6478","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":890,"y":640,"wires":[["1aa72084.bdbf0f"],["c5d0c523.a055d8"]]},{"id":"c5d0c523.a055d8","type":"change","z":"56a96e1e.fe6478","name":"start","rules":[{"t":"set","p":"coolingstopped","pt":"flow","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1050,"y":660,"wires":[[]]},{"id":"7d097b33.451d64","type":"blynk-ws-out-sync","z":"56a96e1e.fe6478","name":"","pin":"0","pinmode":0,"client":"5ed34a67.0e4ae4","x":1320,"y":120,"wires":[]},{"id":"34818929.1c69e6","type":"blynk-ws-in-write","z":"56a96e1e.fe6478","name":"Cooling off","pin":"1","pin_all":0,"client":"5ed34a67.0e4ae4","x":700,"y":640,"wires":[["102bd633.6f5cfa","218f5d55.1d3512"]]},{"id":"e9918e5e.44655","type":"switch","z":"56a96e1e.fe6478","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":890,"y":560,"wires":[["7524ba62.51f924"],["ef0934f3.9c8d08"]]},{"id":"7524ba62.51f924","type":"change","z":"56a96e1e.fe6478","name":"stop","rules":[{"t":"set","p":"heatingstopped","pt":"flow","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1050,"y":540,"wires":[[]]},{"id":"ef0934f3.9c8d08","type":"change","z":"56a96e1e.fe6478","name":"start","rules":[{"t":"set","p":"heatingstopped","pt":"flow","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1050,"y":580,"wires":[[]]},{"id":"b2ba9c9b.0bebb","type":"blynk-ws-out-sync","z":"56a96e1e.fe6478","name":"","pin":"1","pinmode":0,"client":"5ed34a67.0e4ae4","x":1320,"y":240,"wires":[]},{"id":"24fccac8.8efea6","type":"mqtt in","z":"56a96e1e.fe6478","name":"","topic":"/test","qos":"2","datatype":"auto","broker":"ef35eeea.ebedf","x":390,"y":460,"wires":[["82774c11.f03db"]]},{"id":"82774c11.f03db","type":"change","z":"56a96e1e.fe6478","name":"temp","rules":[{"t":"set","p":"temp","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":690,"y":460,"wires":[["218f5d55.1d3512","51f63360.1a821c"]]},{"id":"94bdee41.58404","type":"function","z":"56a96e1e.fe6478","name":"set status","func":"\n\nvar status = \"Waiting\"\n\nif (msg.payload.heat == \"on\") {\n status = \"Heating\"\n}\n\nif (msg.payload.cool == \"on\") {\n status = \"Cooling\"\n}\n\nif (msg.payload.cool == \"off\" && msg.payload.heat == \"off\") {\n status = \"Idle\"\n}\n\nmsg.payload = status\nreturn msg;","outputs":1,"noerr":0,"x":1060,"y":460,"wires":[["4e210fa5.97938"]]},{"id":"4e210fa5.97938","type":"blynk-ws-out-write","z":"56a96e1e.fe6478","name":"status","pin":"2","pinmode":0,"client":"5ed34a67.0e4ae4","x":1290,"y":460,"wires":[]},{"id":"3a506a69.39c176","type":"debug","z":"56a96e1e.fe6478","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1260,"y":580,"wires":[]},{"id":"51f63360.1a821c","type":"blynk-ws-out-write","z":"56a96e1e.fe6478","name":"temp","pin":"6","pinmode":0,"client":"5ed34a67.0e4ae4","x":890,"y":520,"wires":[]},{"id":"29912703.c1a3b8","type":"key-value-store","z":"","filepath":"store.json","namespace":"","name":""},{"id":"5ed34a67.0e4ae4","type":"blynk-ws-client","z":"","name":"NRferment","path":"ws://blynk-cloud.com/websockets","key":"iX3OA1ihf97LFIo3m2U_Fs-2-javnVZU","dbg_all":false,"dbg_read":false,"dbg_write":false,"dbg_notify":false,"dbg_mail":false,"dbg_prop":false,"dbg_sync":false,"dbg_bridge":false,"dbg_low":false,"dbg_pins":"","multi_cmd":false,"proxy_type":"no","proxy_url":"","enabled":true},{"id":"ef35eeea.ebedf","type":"mqtt-broker","z":"","name":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
Advertisement
Add Comment
Please, Sign In to add comment