Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [{"id":"9b4dbc77.3dc54","type":"tab","label":"Brewfather","disabled":false,"info":""},{"id":"3b1a376d.f3e658","type":"tab","label":"Dørlåser","disabled":false,"info":""},{"id":"88bbcf05.96d65","type":"tab","label":"Ventilasjon","disabled":false,"info":""},{"id":"bfb81e59.ff7c6","type":"tab","label":"Garasje","disabled":false,"info":""},{"id":"97d46aa8.590d48","type":"tab","label":"whois","disabled":false,"info":""},{"id":"6dc4c6ac.83d2b8","type":"tab","label":"BC","disabled":false,"info":""},{"id":"1649e3f6.45d0ec","type":"subflow","name":"Process Simulation","info":"","in":[{"x":37,"y":103,"wires":[{"id":"48afb9b1.cc79c8"}]}],"out":[{"x":728.5,"y":294,"wires":[{"id":"192e13d6.0a382c","port":0}]}]},{"id":"673d2f6.8407cd","type":"subflow","name":"Subflow 1","info":"","in":[],"out":[{"x":340,"y":80,"wires":[{"id":"10dfe4c4.d0508b","port":0}]}]},{"id":"eb1127af.550128","type":"key-value-store","z":"","filepath":"store1.json","namespace":"","name":""},{"id":"a12977.e4f5b688","type":"mqtt-broker","z":"","name":"","broker":"192.168.88.38","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeRetain":"false","closePayload":"","willTopic":"","willQos":"0","willRetain":"false","willPayload":""},{"id":"f0ab3a53.fdd7a8","type":"ui_base","z":"","theme":{"name":"theme-light","lightTheme":{"default":"#0094CE","baseColor":"#0094CE","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":true,"reset":false},"darkTheme":{"default":"#097479","baseColor":"#097479","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":false},"customTheme":{"name":"Untitled Theme 1","default":"#4B7930","baseColor":"#4B7930","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"},"themeState":{"base-color":{"default":"#0094CE","value":"#0094CE","edited":false},"page-titlebar-backgroundColor":{"value":"#0094CE","edited":false},"page-backgroundColor":{"value":"#fafafa","edited":false},"page-sidebar-backgroundColor":{"value":"#ffffff","edited":false},"group-textColor":{"value":"#1bbfff","edited":false},"group-borderColor":{"value":"#ffffff","edited":false},"group-backgroundColor":{"value":"#ffffff","edited":false},"widget-textColor":{"value":"#111111","edited":false},"widget-backgroundColor":{"value":"#0094ce","edited":false},"widget-borderColor":{"value":"#ffffff","edited":false},"base-font":{"value":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"}},"angularTheme":{"primary":"indigo","accents":"blue","warn":"red","background":"grey"}},"site":{"name":"Node-RED Dashboard","hideToolbar":"false","allowSwipe":"false","lockMenu":"false","allowTempTheme":"true","dateFormat":"DD/MM/YYYY","sizes":{"sx":48,"sy":48,"gx":6,"gy":6,"cx":6,"cy":6,"px":0,"py":0}}},{"id":"efa09baa.c93168","type":"ui_tab","z":"","name":"Home","icon":"dashboard","disabled":false,"hidden":true},{"id":"6b19cfc5.22db6","type":"modbus-client","z":"","name":"bryggeri","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":true,"tcpHost":"192.168.88.43","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":"","commandDelay":"1","clientTimeout":"2000","reconnectOnTimeout":true,"reconnectTimeout":"5000","parallelUnitIdsAllowed":true},{"id":"445c05cf.41736c","type":"blynk-ws-client","z":"","name":"Roomtemp","path":"ws://blynk-cloud.com/websockets","key":"d-6jb2u_ohwit0qU0PxxwN0npAYwa0KT","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":"ff12ede2.fff3b","type":"influxdb","z":"","hostname":"192.168.88.232","port":"8086","protocol":"http","database":"brewery","name":"","usetls":false,"tls":"","influxdbVersion":"1.x"},{"id":"b4f0b821.9556a","type":"tibber-api-endpoint","z":"","feedUrl":"wss://api.tibber.com/v1-beta/gql/subscriptions","queryUrl":"https://api.tibber.com/v1-beta/gql","name":""},{"id":"8b11c11a.85e2a","type":"brewfather-config","z":"","name":"Credentials 1"},{"id":"46ccfe10.13ec3","type":"modbus-client","z":"","name":"ventilasjon","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":false,"tcpHost":"192.168.88.69","tcpPort":"503","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":"","commandDelay":"1","clientTimeout":"1000","reconnectOnTimeout":true,"reconnectTimeout":"2000","parallelUnitIdsAllowed":true},{"id":"e54e7367.6f767","type":"http in","z":"9b4dbc77.3dc54","name":"","url":"/brewfather","method":"post","upload":false,"swaggerDoc":"","x":80,"y":120,"wires":[["4f5df3fb.e58f6c","50c06659.71b498","4ac47708.2b8e38","460946f3.dcf408"]]},{"id":"733a50b8.48292","type":"function","z":"9b4dbc77.3dc54","name":"BF to BC","func":"//flow.set('recipe' , msg.payload.recipe.fermentation)\n//flow.set('fbeername' , msg.payload.recipe.name)\n\nfunction numberDes(a,b) {\n return b-a;\n }\n \nfunction stringsort(b,a) {\n return (Number(a.match(/(\\d+)/g)[0]) - Number((b.match(/(\\d+)/g)[0])));\n}\n \nfunction time_convert(num)\n { \n var hours = Math.floor(num / 60); \n var minutes = num % 60;\n return + hours + \":\" + minutes + \":00\"; \n}\nvar hopstandhoptime=[];\nvar hopstandhopname=[];\nvar hopstandhopamount=[];\nvar hopstand\nvar hopstandtemp\nif (msg.payload.recipe.hops.length > 0){\n if (msg.payload.recipe.hopStandMinutes > 0) {\n hopstand = true\n hopstandtemp = msg.payload.recipe.avgWeightedHopstandTemp\n for(var x=0; x<msg.payload.recipe.hops.length; x++){\n if (msg.payload.recipe.hops[x].use == \"Aroma\") {\n hopstandhoptime.push(msg.payload.recipe.hops[x].time)\n hopstandhopname.push(msg.payload.recipe.hops[x].name)\n hopstandhopamount.push(msg.payload.recipe.hops[x].amount)\n }\n }\n \n }\n else {\n hopstandtemp = 0\n hopstand = false\n }\n}\n\nconst {\n dupstand\n} = hopstandhoptime.reduce(\n (acc, curr) => {\n acc.items[curr] = acc.items[curr] ? acc.items[curr] += 1 : 1\n if (acc.items[curr] === 2) acc.dupstand.push(curr)\n return acc\n }, {\n items: {},\n dupstand: []\n }\n)\n\nfor (x= 0; x<hopstandhoptime.length;x++){\n hopstandhopname[x] = hopstandhopamount[x]+\"g \"+hopstandhopname[x]\n}\n\n\nif (dupstand.length > 0) {\nfor (var i = 0; i<dupstand.length; i++) {\n for (x = (hopstandhoptime.indexOf(dupstand[i])); x < hopstandhoptime.lastIndexOf(dupstand[i]); x++) {\n hopstandhopname[hopstandhoptime.indexOf(dupstand[i])] += \" and \"+ hopstandhopname[x+1] \n delete hopstandhopname[x+1]\n delete hopstandhoptime[x+1]\n }\n} \n \n}\n\nfor (i=0; i<hopstandhoptime.length; i++) {\n if (hopstandhoptime[i] == null) {\n hopstandhoptime.splice(i,1);\n hopstandhopname.splice(i,1);\n i -= 1;\n }\n}\nfor (i=0; i<hopstandhoptime.length; i++) {\n hopstandhopname[i] = hopstandhoptime[i]+\"min \"+ hopstandhopname[i]\n}\n\nhopstandhoptime.sort(numberDes);\nhopstandhopname.sort(stringsort);\n\n\nhopstandhoptime.push(0,0,0,0,0,0,0,0,0,0)\nhopstandhoptime.length = 5\nhopstandhopname.push(\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\")\nhopstandhopname.length = 5\n\nvar firstwort\nvar firstworthopname=[];\nvar firstworthopamount=[];\nif (msg.payload.recipe.hops.length > 0){\n if (msg.payload.recipe.hops[0].use == \"First Wort\") {\n firstwort = true\n for( x=0; x<msg.payload.recipe.hops.length; x++){\n if (msg.payload.recipe.hops[x].use == \"First Wort\") {\n firstworthopname.push(msg.payload.recipe.hops[x].name)\n firstworthopamount.push(msg.payload.recipe.hops[x].amount)\n }\n }\n for (x= 0; x<firstworthopname.length;x++){\n firstworthopname[x] = firstworthopamount[x]+\"g \"+firstworthopname[x]\n } \n if (firstworthopname.length > 1) {\n for (x = 1; x <firstworthopname.length; x++) {\n firstworthopname[0] += \" and \"+ firstworthopname[x] \n //delete firstworthopname[x+1]\n }\n //for (i=0; i<firstworthopname.length; i++) {\n // if (firstworthopname[i] === null) {\n // firstworthopname.splice(i,1);\n // i -= 1;\n // } \n //}\n \n }\n }\n else {\n firstwort = false\n}\n //else {\n //firstwort = false\n }\n\n\nvar boilhoptime=[];\nvar boilhopname=[];\nvar boilhopamount=[];\nif (msg.payload.recipe.hops.length > 0){\nfor( x=0;x<msg.payload.recipe.hops.length;x++){\n if (msg.payload.recipe.hops[x].use == \"Boil\") {\n boilhoptime.push(msg.payload.recipe.hops[x].time);\n boilhopname.push(msg.payload.recipe.hops[x].name);\n boilhopamount.push(msg.payload.recipe.hops[x].amount);\n }\n} \n}\nif (msg.payload.batchMiscs.length > 0) {\n for ( x=0;x<msg.payload.batchMiscs.length;x++){\n if (msg.payload.batchMiscs[x].use == \"Boil\") {\n boilhoptime.push(msg.payload.batchMiscs[x].time)\n boilhopname.push(msg.payload.batchMiscs[x].name)\n boilhopamount.push(msg.payload.batchMiscs[x].amount)\n }\n }\n}\n\nconst {\n dup\n} = boilhoptime.reduce(\n (acc, curr) => {\n acc.items[curr] = acc.items[curr] ? acc.items[curr] += 1 : 1\n if (acc.items[curr] === 2) acc.dup.push(curr)\n return acc\n }, {\n items: {},\n dup: []\n }\n)\n\nfor (x= 0; x<boilhoptime.length;x++){\n boilhopname[x] = boilhopamount[x]+\"g \"+boilhopname[x]\n}\n\nif (dup.length > 0) {\nfor (var i = 0; i<dup.length; i++) {\n for (x = (boilhoptime.indexOf(dup[i])); x < boilhoptime.lastIndexOf(dup[i]); x++) {\n boilhopname[boilhoptime.indexOf(dup[i])] += \" and \"+ boilhopname[x+1] \n delete boilhopname[x+1]\n delete boilhoptime[x+1]\n }\n} \n}\n\nfor (i=0; i<boilhoptime.length; i++) {\n if (boilhoptime[i] == null) {\n boilhoptime.splice(i,1);\n boilhopname.splice(i,1);\n i -= 1;\n }\n}\nfor (i=0; i<boilhoptime.length; i++) {\n boilhopname[i] = boilhoptime[i]+\"min \"+ boilhopname[i]\n}\n\nboilhoptime.sort(numberDes);\nboilhopname.sort(stringsort);\n\n\nboilhoptime.push(0,0,0,0,0,0,0,0,0,0)\nboilhoptime.length = 10\nboilhopname.push(\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\")\nboilhopname.length = 10\n\nvar mashtime=[];\nfor(var y=0;y<msg.payload.mashStepsCount;y++){\n mashtime[y]= msg.payload.recipe.mash.steps[y].stepTime;\n }\nmashtime.push(0,0,0,0,0);\nmashtime.length = 5\n\nvar mashsteps = msg.payload.mashStepsCount - 1;\nvar mashtemp=[];\nfor(var z=0;z<msg.payload.mashStepsCount;z++){\n mashtemp[z]= msg.payload.recipe.mash.steps[z].stepTemp;\n }\nmashtemp.push(mashtemp[mashsteps], mashtemp[mashsteps], mashtemp[mashsteps], mashtemp[mashsteps], mashtemp[mashsteps], mashtemp[mashsteps])\nmashtemp.length = 6\n\nmsg.payload = [ \n\n{ \"Name\": \"Preboil volume\", \"Value\": msg.payload.recipe.boilSize } , \n{ \"Name\": \"HLT fillvolume\" , \"Value\": msg.payload.recipe.data.hltWaterAmount } , \n{ \"Name\": \"Sparge volume\" , \"Value\": msg.payload.recipe.data.spargeWaterAmount } , \n{ \"Name\": \"Strike temp\" , \"Value\": msg.payload.recipe.data.strikeTemp } , \n{ \"Name\": \"Mash volume\" , \"Value\": msg.payload.recipe.data.mashWaterAmount } , \n{ \"Name\": \"Mash temp1\" , \"Value\": mashtemp[0] } ,\n{ \"Name\": \"Mash temp2\" , \"Value\": mashtemp[1] } , \n{ \"Name\": \"Mash temp3\" , \"Value\": mashtemp[2] } ,\n{ \"Name\": \"Mash temp4\" , \"Value\": mashtemp[3] } ,\n{ \"Name\": \"Mash temp5\" , \"Value\": mashtemp[4] } ,\n{ \"Name\": \"Mash temp6\" , \"Value\": mashtemp[5] } ,\n{ \"Name\": \"Mash time1\" , \"Value\": time_convert(mashtime[0]) } ,\n{ \"Name\": \"Mash time2\" , \"Value\": time_convert(mashtime[1]) } ,\n{ \"Name\": \"Mash time3\" , \"Value\": time_convert(mashtime[2]) } ,\n{ \"Name\": \"Mash time4\" , \"Value\": time_convert(mashtime[3]) } ,\n{ \"Name\": \"Mash time5\" , \"Value\": time_convert(mashtime[4]) } ,\n{ \"Name\": \"Hop time0\" , \"Value\": time_convert(boilhoptime[0]) } ,\n{ \"Name\": \"Hop time1\" , \"Value\": time_convert(boilhoptime[1]) } ,\n{ \"Name\": \"Hop time2\" , \"Value\": time_convert(boilhoptime[2]) } ,\n{ \"Name\": \"Hop time3\" , \"Value\": time_convert(boilhoptime[3]) } ,\n{ \"Name\": \"Hop time4\" , \"Value\": time_convert(boilhoptime[4]) } ,\n{ \"Name\": \"Hop time5\" , \"Value\": time_convert(boilhoptime[5]) } ,\n{ \"Name\": \"Hop time6\" , \"Value\": time_convert(boilhoptime[6]) } ,\n{ \"Name\": \"Hop time7\" , \"Value\": time_convert(boilhoptime[7]) } ,\n{ \"Name\": \"Hop time8\" , \"Value\": time_convert(boilhoptime[8]) } ,\n{ \"Name\": \"Hop time9\" , \"Value\": time_convert(boilhoptime[9]) } ,\n{ \"Name\": \"Boilhopname0\" , \"Value\": boilhopname[0] } ,\n{ \"Name\": \"Boilhopname1\" , \"Value\": boilhopname[1] } ,\n{ \"Name\": \"Boilhopname2\" , \"Value\": boilhopname[2] } ,\n{ \"Name\": \"Boilhopname3\" , \"Value\": boilhopname[3] } ,\n{ \"Name\": \"Boilhopname4\" , \"Value\": boilhopname[4] } ,\n{ \"Name\": \"Boilhopname5\" , \"Value\": boilhopname[5] } ,\n{ \"Name\": \"Boilhopname6\" , \"Value\": boilhopname[6] } ,\n{ \"Name\": \"Boilhopname7\" , \"Value\": boilhopname[7] } ,\n{ \"Name\": \"Boilhopname8\" , \"Value\": boilhopname[8] } ,\n{ \"Name\": \"Boilhopname9\" , \"Value\": boilhopname[9] } ,\n{ \"Name\": \"Boilsteps\" , \"Value\": msg.payload.boilSteps.length } ,\n{ \"Name\": \"Hopstandtime0\" , \"Value\": time_convert(hopstandhoptime[0])},\n//{ \"Name\": \"Hopstandtime1\" , \"Value\": time_convert(hopstandhoptime[1])},\n//{ \"Name\": \"Hopstandtime2\" , \"Value\": time_convert(hopstandhoptime[2])},\n//{ \"Name\": \"Hopstandtime3\" , \"Value\": time_convert(hopstandhoptime[3])},\n//{ \"Name\": \"Hopstandtime4\" , \"Value\": time_convert(hopstandhoptime[4])},\n{ \"Name\": \"Hopstandhopname0\" , \"Value\": hopstandhopname[0]},//String(hopstandhopamount[0]) +\"g\" +\" \" +String(hopstandhopname[0]) } ,\n//{ \"Name\": \"Hopstandhopname2\" , \"Value\": hopstandhopname[1]},//String(hopstandhopamount[1]) +\"g\" +\" \" +String(hopstandhopname[1]) } ,\n//{ \"Name\": \"Hopstandhopname3\" , \"Value\": hopstandhopname[2]},//String(hopstandhopamount[2]) +\"g\" +\" \" +String(hopstandhopname[2]) } ,\n//{ \"Name\": \"Hopstandhopname4\" , \"Value\": hopstandhopname[3]},//String(hopstandhopamount[3]) +\"g\" +\" \" +String(hopstandhopname[3]) } ,\n//{ \"Name\": \"Hopstandhopname5\" , \"Value\": hopstandhopname[4]},//String(hopstandhopamount[4]) +\"g\" +\" \" +String(hopstandhopname[4]) } ,\n{ \"Name\": \"Hopstand\" , \"Value\": hopstand } ,\n{ \"Name\": \"Boil time\" , \"Value\": time_convert(msg. payload.recipe.boilTime) } ,\n{ \"Name\": \"Hopstand temp\" , \"Value\": hopstandtemp } ,\n{ \"Name\": \"First wort\" , \"Value\": firstwort } ,\n{ \"Name\": \"Firstwortname\" , \"Value\": firstworthopname[0] } ,\n{ \"Name\": \"Status\" , \"Value\": new Date().toDateString()+\" \"+new Date().getHours()+\":\"+new Date().getMinutes()+\" \" +\"#\"+msg.topic+\" \"+msg.payload.recipe.name }\n\n];\n\nreturn msg;\n","outputs":1,"noerr":0,"x":660,"y":60,"wires":[["c1fd8caf.51cb2","50299b6d.aeb604"]]},{"id":"c1fd8caf.51cb2","type":"http request","z":"9b4dbc77.3dc54","name":"","method":"PUT","ret":"txt","paytoqs":false,"url":"http://192.168.88.51:8000/globals","tls":"","persist":false,"proxy":"","authType":"","x":870,"y":60,"wires":[[]]},{"id":"4f5df3fb.e58f6c","type":"http response","z":"9b4dbc77.3dc54","name":"","statusCode":"200","headers":{},"x":300,"y":140,"wires":[]},{"id":"33fc917b.85563e","type":"key-value-write","z":"9b4dbc77.3dc54","store":"eb1127af.550128","action":"set","key":"","keyvalue":"","name":"","x":510,"y":60,"wires":[["733a50b8.48292"]]},{"id":"50c06659.71b498","type":"change","z":"9b4dbc77.3dc54","name":"set batchnumber","rules":[{"t":"set","p":"topic","pt":"msg","to":"$string(payload.batchNo)\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":330,"y":60,"wires":[["33fc917b.85563e"]]},{"id":"4ac47708.2b8e38","type":"debug","z":"9b4dbc77.3dc54","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":310,"y":220,"wires":[]},{"id":"460946f3.dcf408","type":"http request","z":"9b4dbc77.3dc54","name":"","method":"POST","ret":"txt","paytoqs":false,"url":"http://192.168.88.38:1880/brewfather","tls":"","persist":false,"proxy":"","authType":"","x":310,"y":180,"wires":[[]]},{"id":"50299b6d.aeb604","type":"debug","z":"9b4dbc77.3dc54","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":870,"y":120,"wires":[]},{"id":"24a79051.bcdc9","type":"function","z":"1649e3f6.45d0ec","name":"30 sec RC + 20","func":"// Applies a simple RC low pass filter to incoming payload values\nvar tc = 30*1000; // time constant in milliseconds\n\nvar lastValue = context.get('lastValue');\nif (typeof lastValue == \"undefined\") lastValue = msg.payload;\nvar lastTime = context.get('lastTime') || null;\nvar now = new Date();\nvar currentValue = msg.payload;\nif (lastTime === null) {\n // first time through\n newValue = currentValue;\n} else {\n var dt = now - lastTime;\n var newValue;\n \n if (dt > 0) {\n var dtotc = dt / tc;\n newValue = lastValue * (1 - dtotc) + currentValue * dtotc;\n } else {\n // no time has elapsed leave output the same as last time\n newValue = lastValue;\n }\n}\ncontext.set('lastValue', newValue);\ncontext.set('lastTime', now);\n\nmsg.payload = newValue + 20;\nreturn msg;","outputs":1,"noerr":0,"x":626.5,"y":207,"wires":[["192e13d6.0a382c"]]},{"id":"396a9a21.d8af36","type":"inject","z":"1649e3f6.45d0ec","name":"Inject -0.2 at start","topic":"","payload":"-0.2","payloadType":"num","repeat":"","crontab":"","once":true,"x":134.5,"y":30,"wires":[["48afb9b1.cc79c8"]]},{"id":"a94fff69.5ca7e","type":"function","z":"1649e3f6.45d0ec","name":"10 sec RC","func":"// Applies a simple RC low pass filter to incoming payload values\nvar tc = 10*1000; // time constant in milliseconds\n\nvar lastValue = context.get('lastValue');\nif (typeof lastValue == \"undefined\") lastValue = msg.payload;\nvar lastTime = context.get('lastTime') || null;\nvar now = new Date();\nvar currentValue = msg.payload;\nif (lastTime === null) {\n // first time through\n newValue = currentValue;\n} else {\n var dt = now - lastTime;\n var newValue;\n \n if (dt > 0) {\n var dtotc = dt / tc;\n newValue = lastValue * (1 - dtotc) + currentValue * dtotc;\n } else {\n // no time has elapsed leave output the same as last time\n newValue = lastValue;\n }\n}\ncontext.set('lastValue', newValue);\ncontext.set('lastTime', now);\n\nmsg.payload = newValue;\nreturn msg;","outputs":1,"noerr":0,"x":451,"y":207,"wires":[["24a79051.bcdc9"]]},{"id":"48afb9b1.cc79c8","type":"delay","z":"1649e3f6.45d0ec","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":268,"y":104,"wires":[["470fdbcb.1ce384"]]},{"id":"bb1060b6.259cb","type":"function","z":"1649e3f6.45d0ec","name":"2 msg transport delay","func":"// stores messages in a fifo until the specified number have been received, \n// then releases them as new messages are received.\n// during the filling phase the earliest message is passed on each time \n// a message is received, but it is also left in the fifo\nvar fifoMaxLength = 2;\nvar fifo = context.get('fifo') || [];\n// push the new message onto the top of the array, messages are shifted down and\n// drop off the front\nvar length = fifo.push(msg); // returns new length\nif (length > fifoMaxLength) {\n newMsg = fifo.shift();\n} else {\n // not full yet, make a copy of the msg and pass it on\n var newMsg = JSON.parse(JSON.stringify(fifo[0]));\n}\ncontext.set('fifo', fifo);\nreturn newMsg;","outputs":1,"noerr":0,"x":258,"y":208,"wires":[["a94fff69.5ca7e"]]},{"id":"192e13d6.0a382c","type":"function","z":"1649e3f6.45d0ec","name":"Clear all except payload","func":"msg2 = {payload: msg.payload};\nreturn msg2;","outputs":1,"noerr":0,"x":545,"y":293,"wires":[[]]},{"id":"470fdbcb.1ce384","type":"range","z":"1649e3f6.45d0ec","minin":"0","maxin":"1","minout":"0","maxout":"100","action":"scale","round":false,"name":"","x":87,"y":208,"wires":[["bb1060b6.259cb"]]},{"id":"10dfe4c4.d0508b","type":"mqtt in","z":"673d2f6.8407cd","name":"fridge status","topic":"shellies/F3/relay/+","qos":"2","datatype":"auto","broker":"a12977.e4f5b688","x":190,"y":80,"wires":[[]]},{"id":"1855c00f.80d9e","type":"json","z":"97d46aa8.590d48","name":"","x":2050,"y":340,"wires":[["8e0522ae.106e38"]]},{"id":"8e0522ae.106e38","type":"file","z":"97d46aa8.590d48","name":"writeFile","filename":"","appendNewline":false,"overwriteFile":true,"x":2178.0001220703125,"y":340,"wires":[[]]},{"id":"8d3ad658.9e0058","type":"file in","z":"97d46aa8.590d48","name":"readFile","filename":"","format":"utf8","x":603.2505073547363,"y":313.0000762939453,"wires":[["c170604f.bbdaa"]]},{"id":"a6529dac.a17928","type":"inject","z":"97d46aa8.590d48","name":"","topic":"filename","payload":"rs69","payloadType":"str","repeat":"240","crontab":"","once":true,"onceDelay":"","x":160,"y":380,"wires":[["b699983f.6129e8"]]},{"id":"b699983f.6129e8","type":"change","z":"97d46aa8.590d48","name":"filename","action":"replace","property":"filename","from":"","to":"msg.payload","reg":false,"x":179.00015258789062,"y":318.99964141845703,"wires":[["4c22dd3a.8ffb6c"]]},{"id":"30ccf4e.318cc0c","type":"change","z":"97d46aa8.590d48","name":"myPublicIp.json","action":"replace","property":"filename","from":"","to":"myPublicIp.json","reg":false,"x":447.0001678466797,"y":352.9998245239258,"wires":[["8d3ad658.9e0058"]]},{"id":"4c22dd3a.8ffb6c","type":"switch","z":"97d46aa8.590d48","name":"","property":"filename.length","rules":[{"t":"gt","v":0,"v2":0},{"t":"else"}],"checkall":"false","outputs":2,"x":302.0001678466797,"y":319.9996109008789,"wires":[["8d3ad658.9e0058"],["30ccf4e.318cc0c"]]},{"id":"c170604f.bbdaa","type":"switch","z":"97d46aa8.590d48","name":"","property":"payload.length","rules":[{"t":"gt","v":0,"v2":0},{"t":"else"}],"checkall":"true","outputs":2,"x":724.0001525878906,"y":312.99976348876953,"wires":[["bb58560a.a69138"],["e1d46089.0c4e2"]]},{"id":"629f442.b044dbc","type":"change","z":"97d46aa8.590d48","name":"last ip from file","action":"replace","property":"lastip","from":"","to":"msg.payload","reg":false,"x":1009.0001831054688,"y":279.99964141845703,"wires":[["5294426b.6081fc"]]},{"id":"6acc0be8.7f5754","type":"debug","z":"97d46aa8.590d48","name":"Stable IP","active":false,"console":"false","complete":"false","x":1940,"y":280,"wires":[]},{"id":"1ba01446.2b255c","type":"function","z":"97d46aa8.590d48","name":"Compare IP","func":"var lastip = msg.lastip.ip;\nvar currentip = msg.payload.ip;\nmsg.currentip = currentip;\nmsg.topic = \"stable\";\nif (lastip !== currentip) {\nmsg.payload.ip = currentip;\nmsg.topic = \"new\";\n}\n\nreturn msg;\n","outputs":"1","noerr":0,"x":1430,"y":440,"wires":[["d8a7f329.2f955","b7b4e50.c01bd98"]]},{"id":"bb58560a.a69138","type":"json","z":"97d46aa8.590d48","name":"","x":866.0001983642578,"y":279.99964141845703,"wires":[["629f442.b044dbc"]]},{"id":"d8a7f329.2f955","type":"template","z":"97d46aa8.590d48","name":"Description","field":"payload","fieldType":"msg","syntax":"mustache","template":"Your {{topic}} Public IP: http://{{payload.ip}}","x":1630,"y":300,"wires":[["19717e68.89302a"]]},{"id":"19717e68.89302a","type":"switch","z":"97d46aa8.590d48","name":"","property":"topic","rules":[{"t":"eq","v":"stable"},{"t":"else"}],"checkall":"false","outputs":2,"x":1771.0000610351562,"y":336.9996032714844,"wires":[["6acc0be8.7f5754"],["b4e6d397.28aa18","706307c1.fece5"]]},{"id":"b4e6d397.28aa18","type":"function","z":"97d46aa8.590d48","name":"prepare","func":"var newFile = {};\nnewFile.filename = msg.filename;\nnewFile.payload = {ip: msg.currentip};\n\nreturn newFile;","outputs":"1","x":1929.000244140625,"y":340.9996032714844,"wires":[["1855c00f.80d9e"]]},{"id":"e1d46089.0c4e2","type":"change","z":"97d46aa8.590d48","name":"null","action":"replace","property":"lastip","from":"","to":"null","reg":false,"x":868.0002059936523,"y":341.24964904785156,"wires":[["5294426b.6081fc"]]},{"id":"706307c1.fece5","type":"debug","z":"97d46aa8.590d48","name":"New IP","active":true,"console":"false","complete":"false","x":1920,"y":380,"wires":[]},{"id":"5294426b.6081fc","type":"http request","z":"97d46aa8.590d48","name":"Server","method":"GET","url":"http://ipecho.net/plain","x":1190.0001831054688,"y":339.99964141845703,"wires":[["4227092b.cd95d8"]]},{"id":"4227092b.cd95d8","type":"function","z":"97d46aa8.590d48","name":"payload.ip","func":"var regObj = new RegExp(\"(?:(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9]).){3}(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\");\nvar str = msg.payload;\nvar myIp = {};\nmyIp = str.match(regObj);\nmsg.payload = {ip : myIp[0]};\nreturn msg;","outputs":1,"noerr":0,"x":1330,"y":340,"wires":[["1ba01446.2b255c"]]},{"id":"aa88ab39.414a2","type":"comment","z":"97d46aa8.590d48","name":"Filename","info":"use the \"payload\" property to define a custom file name to hold\nthe public Ip address.\nThis flow uses the json format and will create a file when\nit is not found or when the public ip address changes.","x":58.27288055419922,"y":268.2723617553711,"wires":[]},{"id":"91d1d111.28e81","type":"comment","z":"97d46aa8.590d48","name":"Is there a filename defined?","info":"If it is blank, inject the default file name into the flow.","x":360.77296447753906,"y":278.2723922729492,"wires":[]},{"id":"42a28d47.bc7604","type":"comment","z":"97d46aa8.590d48","name":"Valid file?","info":"By checking the length of the payload we can determine if\nthe file exists or not.","x":722.0229072570801,"y":268.27235317230225,"wires":[]},{"id":"46d4b380.85036c","type":"comment","z":"97d46aa8.590d48","name":"New file check","info":"If the file does not exist, set the lastip property\nto something that will not match when we check a service for\nour public ip.","x":882.0229072570801,"y":385.7723560333252,"wires":[]},{"id":"bcc46803.2a6528","type":"comment","z":"97d46aa8.590d48","name":"good file","info":"convert the string to json and move it to the\nmsg.lastip property","x":865.7729110717773,"y":234.52235317230225,"wires":[]},{"id":"a6b81bf8.f15cc","type":"comment","z":"97d46aa8.590d48","name":"Check IP","info":"Use a web service to check your ip address.\nThen use a function to extract the ip from the result.\nTested with these Services:\nhttp://checkip.dyndns.org/\nhttp://echoip.com/\nhttp://ipecho.net/plain\nhttp://bot.whatismyipaddress.com/\n","x":1202.022850036621,"y":289.0223617553711,"wires":[]},{"id":"77d394c.90d166c","type":"comment","z":"97d46aa8.590d48","name":"Compare","info":"compare the results from the WEB with file","x":1494.5229110717773,"y":387.0223617553711,"wires":[]},{"id":"6c5da0ab.67b8d","type":"comment","z":"97d46aa8.590d48","name":"Text Description","info":"Add some words around the result to tell you whats going on.","x":1620,"y":160,"wires":[]},{"id":"5f3b0214.fd53bc","type":"comment","z":"97d46aa8.590d48","name":"Results","info":"The results will flow out the top if they are unchanged\nor flow out the bottom when they have changed.\nwe also write that to our file for next time.\nThis would be the ideal place to email or tweet on change.","x":1768.2728691101074,"y":387.0223627090454,"wires":[]},{"id":"a7827a39.8403e","type":"comment","z":"97d46aa8.590d48","name":"No?","info":"Then use the default defined here.","x":433.2728805541992,"y":394.5223388671875,"wires":[]},{"id":"47849ab.88549e4","type":"comment","z":"97d46aa8.590d48","name":"Save if different","info":"This ensures we remember the ip thru power cycles ;-)","x":2145.7728729248047,"y":395.7723627090454,"wires":[]},{"id":"4b839521.176adc","type":"blynk-ws-out-notify","z":"97d46aa8.590d48","name":"","client":"445c05cf.41736c","queue":false,"rate":5,"x":2150,"y":540,"wires":[]},{"id":"b020842f.9afc68","type":"ipwhois","z":"97d46aa8.590d48","name":"","x":1840,"y":540,"wires":[["857d45c0.8c1158"]]},{"id":"857d45c0.8c1158","type":"function","z":"97d46aa8.590d48","name":"ISP","func":"msg.payload = \"ISP: \" +msg.payload.descr\nreturn msg;","outputs":1,"noerr":0,"x":1990,"y":540,"wires":[["4b839521.176adc","c1d86cff.e67c2"]]},{"id":"bf341134.86aff8","type":"change","z":"97d46aa8.590d48","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.ip","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1660,"y":540,"wires":[["b020842f.9afc68","592972e2.abef34"]]},{"id":"b7b4e50.c01bd98","type":"switch","z":"97d46aa8.590d48","name":"","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"new","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1490,"y":540,"wires":[["bf341134.86aff8"]]},{"id":"c1d86cff.e67c2","type":"blynk-ws-out-write","z":"97d46aa8.590d48","name":"isp","pin":"8","pinmode":0,"client":"445c05cf.41736c","x":2150,"y":600,"wires":[]},{"id":"592972e2.abef34","type":"blynk-ws-out-write","z":"97d46aa8.590d48","name":"ip","pin":"9","pinmode":0,"client":"445c05cf.41736c","x":1830,"y":480,"wires":[]},{"id":"60b278c6.b6e098","type":"mqtt in","z":"bfb81e59.ff7c6","name":"","topic":"shellies/#","qos":"2","datatype":"auto","broker":"a12977.e4f5b688","x":80,"y":40,"wires":[["ce0efd22.525fa"]]},{"id":"ce0efd22.525fa","type":"debug","z":"bfb81e59.ff7c6","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":270,"y":40,"wires":[]},{"id":"b3538198.767e3","type":"mqtt in","z":"bfb81e59.ff7c6","name":"garage closed","topic":"shellies/shellyuni-483FDA82C328/input/1","qos":"2","datatype":"auto","broker":"a12977.e4f5b688","x":90,"y":100,"wires":[["cdfcb02a.22f6f"]]},{"id":"910cccb5.38d94","type":"mqtt in","z":"bfb81e59.ff7c6","name":"garage open","topic":"shellies/shellyuni-483FDA82C328/input/0","qos":"2","datatype":"auto","broker":"a12977.e4f5b688","x":90,"y":160,"wires":[["718a74bb.f6710c"]]},{"id":"49bc7c32.889304","type":"mqtt out","z":"bfb81e59.ff7c6","name":"open","topic":"shellies/shellyuni-483FDA6F317E/relay/0/command","qos":"","retain":"","broker":"a12977.e4f5b688","x":510,"y":620,"wires":[]},{"id":"d7fad0e1.d4a84","type":"mqtt out","z":"bfb81e59.ff7c6","name":"close","topic":"shellies/shellyuni-483FDA6F317E/relay/1/command","qos":"","retain":"","broker":"a12977.e4f5b688","x":510,"y":680,"wires":[]},{"id":"f8964a5d.6eb948","type":"inject","z":"bfb81e59.ff7c6","name":"open","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":620,"wires":[["81c46e20.51a87"]]},{"id":"81c46e20.51a87","type":"trigger","z":"bfb81e59.ff7c6","op1":"on","op2":"off","op1type":"str","op2type":"str","duration":"500","extend":false,"units":"ms","reset":"","bytopic":"all","name":"","x":300,"y":620,"wires":[["49bc7c32.889304"]]},{"id":"16a4b443.11001c","type":"trigger","z":"bfb81e59.ff7c6","op1":"on","op2":"off","op1type":"str","op2type":"str","duration":"500","extend":false,"units":"ms","reset":"","bytopic":"all","name":"","x":300,"y":680,"wires":[["d7fad0e1.d4a84"]]},{"id":"f6f753f1.e2316","type":"inject","z":"bfb81e59.ff7c6","name":"close","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":680,"wires":[["16a4b443.11001c"]]},{"id":"f833fcd8.93e3","type":"inject","z":"bfb81e59.ff7c6","name":"","topic":"","payload":"","payloadType":"date","repeat":"1","crontab":"","once":true,"onceDelay":0.1,"x":90,"y":380,"wires":[["84d58917.e824b8","6cc4005e.31f1f8"]]},{"id":"cdfcb02a.22f6f","type":"change","z":"bfb81e59.ff7c6","name":"closed","rules":[{"t":"change","p":"payload","pt":"msg","from":"1","fromt":"str","to":"true","tot":"bool"},{"t":"change","p":"payload","pt":"msg","from":"0","fromt":"str","to":"false","tot":"bool"},{"t":"set","p":"garageclosed","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":250,"y":100,"wires":[[]]},{"id":"718a74bb.f6710c","type":"change","z":"bfb81e59.ff7c6","name":"open","rules":[{"t":"change","p":"payload","pt":"msg","from":"1","fromt":"str","to":"true","tot":"bool"},{"t":"change","p":"payload","pt":"msg","from":"0","fromt":"str","to":"false","tot":"bool"},{"t":"set","p":"garageopen","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":250,"y":160,"wires":[[]]},{"id":"84d58917.e824b8","type":"function","z":"bfb81e59.ff7c6","name":"limitswitch","func":"var open = flow.get(\"garageopen\")\nvar closed = flow.get(\"garageclosed\")\n\nif (open === true) {\nmsg.payload = \"open\"\nflow.set(\"lastpos\", \"open\")\nnode.send(msg)\n}\n\nif (closed === true) {\nmsg.payload = \"closed\"\nflow.set(\"lastpos\", \"closed\")\nnode.send(msg)\n}\n","outputs":1,"noerr":0,"x":270,"y":380,"wires":[["fe5c12ab.76ec4"]]},{"id":"fe5c12ab.76ec4","type":"timeouttrigger","z":"bfb81e59.ff7c6","ontimeouttype":"str","ontimeoutval":"stuck","duration":"60","units":"s","name":"","x":410,"y":380,"wires":[["b9e1c24d.f956e"]]},{"id":"5637f495.d03fec","type":"switch","z":"bfb81e59.ff7c6","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"stuck","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":710,"y":420,"wires":[["5518287e.9324b"]]},{"id":"b9e1c24d.f956e","type":"rbe","z":"bfb81e59.ff7c6","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":550,"y":380,"wires":[["5637f495.d03fec","5f47bb89.6a343c"]]},{"id":"6cc4005e.31f1f8","type":"function","z":"bfb81e59.ff7c6","name":"moving","func":"var open = flow.get(\"garageopen\")\nvar closed = flow.get(\"garageclosed\")\n\nif (open !== true && closed !== true) {\n//msg.payload = \"moving from \" + flow.get(\"lastpos\")\n\nif (flow.get(\"lastpos\") == \"closed\") {\n msg.payload = \"opening\"\n}\nif (flow.get(\"lastpos\") == \"open\") {\n msg.payload = \"closing\"\n}\nnode.send(msg)\n}\n","outputs":1,"noerr":0,"x":260,"y":340,"wires":[["16534a54.37eb56"]]},{"id":"16534a54.37eb56","type":"rbe","z":"bfb81e59.ff7c6","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":550,"y":340,"wires":[["1780a68f.d5ff01"]]},{"id":"fe5e9def.6e611","type":"blynk-ws-in-write","z":"bfb81e59.ff7c6","name":"open","pin":"10","pin_all":0,"client":"445c05cf.41736c","x":90,"y":500,"wires":[["81c46e20.51a87"]]},{"id":"c3ff5ba0.f5661","type":"blynk-ws-in-write","z":"bfb81e59.ff7c6","name":"close","pin":"11","pin_all":0,"client":"445c05cf.41736c","x":90,"y":560,"wires":[["16a4b443.11001c"]]},{"id":"1780a68f.d5ff01","type":"blynk-ws-out-write","z":"bfb81e59.ff7c6","name":"status","pin":"12","pinmode":0,"client":"445c05cf.41736c","x":930,"y":340,"wires":[]},{"id":"69152922.662ee","type":"blynk-ws-out-notify","z":"bfb81e59.ff7c6","name":"","client":"445c05cf.41736c","queue":false,"rate":5,"x":1010,"y":420,"wires":[]},{"id":"5518287e.9324b","type":"change","z":"bfb81e59.ff7c6","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"garasjeporten er stuck","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":420,"wires":[["69152922.662ee"]]},{"id":"5f47bb89.6a343c","type":"function","z":"bfb81e59.ff7c6","name":"","func":"if (msg.payload == \"stuck\") {\nmsg.payload = msg.payload + \" from \" + flow.get(\"lastpos\")\n}\nelse {\n msg.payload = msg.payload\n}\n\n\nreturn msg;","outputs":1,"noerr":0,"x":690,"y":360,"wires":[["1780a68f.d5ff01"]]},{"id":"ee907d.30e8bf8","type":"function","z":"6dc4c6ac.83d2b8","name":"heat/cool","func":"\n/* A function designed to be used with node-red-contrib-pid in applications where both\n * heating and cooling are available to control the system.\n * The node is given a power value in msg.payload in the range 0 to 1, such as is produced by \n * node-red-contrib-pid and splits this into a heat power (o/p 1) and cool power (o/p 2) where\n * each is in the range 0 to 1. These can then be fed directly into an output device, if this\n * is continuously variable, or they may be passed to node-red-contrib-timeprop nodes to generate\n * time proportioned on/off outputs.\n * There are two particular issues to be dealt with in a heat/cool application. Firstly is the fact\n * that the cooling device may be more or less powerful than the heating device. It is necessary\n * therefore to be able to adjust the gain of the system separately for heating and cooling. Secondly\n * is the highly non-linear response of some devices, notably refrigerant systems, that can have a\n * large effect initially, then this tails off. To compensate for this it is useful to have an \n * overlap range where both heat and cool are slightly on.\n *\n * To allow for these requirements two variables can be set below. The value of the power input value\n * where the heating starts to come on is determined by the variable heatMin. Above this value the\n * heating will rise till it is fully on with an input of 1.\n * The cooling is fully on when value of the power input is 0, and falls till the cooling is fully\n * off at an input of coolMin.\n *\n * If the heating and cooling systems are of similar power then set heatMin and coolMin both to 0.5\n * in which case input values of 0.5 to 1.0 will map to heating outputs of 0.0 to 1.0,\n * and 0.5 down to 0.0 will map to cooling 0.0 to 1.0.\n * If, for example, the cooling system is more powerful than heating then they can both be set\n * to something like 0.7 which increases the gain in the heating region and reduces it\n * in the cooling region, to compensate for the different powers in the heating/cooling systems.\n * If some overlap is desired (so that both heat and cool are on slightly near the crossover\n * point) then overlap the two settings so that, for example, heatMin might be 0.45 and coolMin\n * might be 0.55\n */\n\nflow.set(String(msg.topic), Math. round(msg.payload*100))\n \n// set these as described above\nvar heatMin = 0.5; // the value of input corresponding to 0 heat o/p\nvar coolMin = 0.5; // the value of input corresponding to 0 cool o/p\n \nvar power = msg.payload;\nvar heat = (power - heatMin)/(1 - heatMin);\n// limit to range 0 to 1\nheat = Math.min(Math.max(heat, 0), 1);\nvar cool = (coolMin - power) / coolMin;\n// limit to range 0 to 1\ncool = Math.min(Math.max(cool, 0), 1);\n\nmsg.payload = [{payload: heat}, {payload: cool}];\nreturn msg;\n","outputs":2,"noerr":0,"x":2460,"y":40,"wires":[[],[]]},{"id":"c64ede7c.d3a6a","type":"link in","z":"6dc4c6ac.83d2b8","name":"","links":["54c14458.59eedc"],"x":1195,"y":60,"wires":[["f3cf8f49.ca6148"]]},{"id":"f3cf8f49.ca6148","type":"switch","z":"6dc4c6ac.83d2b8","name":"","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"201","vt":"str"},{"t":"eq","v":"400","vt":"str"},{"t":"eq","v":"403","vt":"str"},{"t":"eq","v":"401","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":1290,"y":60,"wires":[[],["5f910074.b2cd5"],["c40106fe.e9f4f8"],["f693c4ca.614538"]]},{"id":"9ea49dd0.d8d0f","type":"modbus-flex-write","z":"6dc4c6ac.83d2b8","name":"Digtal Out","showStatusActivities":false,"showErrors":false,"server":"6b19cfc5.22db6","emptyMsgOnFail":false,"keepMsgProperties":false,"x":420,"y":100,"wires":[[],["19d7aed0.bf3471"]]},{"id":"19d7aed0.bf3471","type":"modbus-response","z":"6dc4c6ac.83d2b8","name":"","registerShowMax":20,"x":610,"y":160,"wires":[]},{"id":"3252e5ba.b8baaa","type":"function","z":"6dc4c6ac.83d2b8","name":"Send DO","func":"\nvar outp =[];\nvar portrange = 500\nvar totaloutputs = 16\n\nfor (var i = 0; i < totaloutputs; i++) {\n if (flow.get(String(i+portrange)+\"output\")=== 1) {\n outp.push(true)\n }\n else {\n outp.push(false)\n }\n}\n\n\nmsg.payload = {value: outp,\n'fc': 15, 'unitid': 5, 'address':0, 'quantity':totaloutputs}\n\nreturn msg;","outputs":1,"noerr":0,"x":280,"y":100,"wires":[[]]},{"id":"8b0d17c5.4c89e8","type":"inject","z":"6dc4c6ac.83d2b8","name":"","topic":"","payload":"","payloadType":"date","repeat":"1800","crontab":"","once":true,"onceDelay":0.1,"x":110,"y":100,"wires":[["3252e5ba.b8baaa"]]},{"id":"d1577588.219748","type":"modbus-read","z":"6dc4c6ac.83d2b8","name":"Analog in 200","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"unitid":"2","dataType":"HoldingRegister","adr":"0","quantity":"8","rate":"750","rateUnit":"ms","delayOnStart":false,"startDelayTime":"","server":"6b19cfc5.22db6","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":110,"y":420,"wires":[["c7df38bb.734a58"],["94c5e696.973048"]]},{"id":"94c5e696.973048","type":"modbus-response","z":"6dc4c6ac.83d2b8","name":"","registerShowMax":20,"x":310,"y":460,"wires":[]},{"id":"c7df38bb.734a58","type":"function","z":"6dc4c6ac.83d2b8","name":"Split input","func":"var inp = msg.payload\nvar portrange = 200\n\nfor (i = 0; i < inp.length; i++) {\n msg.payload = inp[i]\n msg.topic = i + portrange\n node.send(msg)\n}\n","outputs":1,"noerr":0,"x":280,"y":420,"wires":[["d4b673dd.9ea8f"]]},{"id":"1576aecb.071c91","type":"modbus-read","z":"6dc4c6ac.83d2b8","name":"PT100 400","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"unitid":"4","dataType":"HoldingRegister","adr":"32","quantity":"8","rate":"600","rateUnit":"ms","delayOnStart":true,"startDelayTime":"2","server":"6b19cfc5.22db6","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":100,"y":340,"wires":[["5b45ed60.785ca4"],["d39ee7c3.e24438"]]},{"id":"d39ee7c3.e24438","type":"modbus-response","z":"6dc4c6ac.83d2b8","name":"","registerShowMax":20,"x":310,"y":360,"wires":[]},{"id":"5b45ed60.785ca4","type":"function","z":"6dc4c6ac.83d2b8","name":"Split input","func":"var inp = msg.payload\nvar portrange = 400\n\nfor (i = 0; i < inp.length; i++) {\n msg.payload = inp[i]\n msg.topic = i + portrange\n node.send(msg)\n}\n","outputs":1,"noerr":0,"x":280,"y":320,"wires":[["aca07636.8cbe28"]]},{"id":"d8d01682.693928","type":"link out","z":"6dc4c6ac.83d2b8","name":"","links":["cc96708e.f3e01"],"x":515,"y":420,"wires":[]},{"id":"aca07636.8cbe28","type":"link out","z":"6dc4c6ac.83d2b8","name":"","links":["cc96708e.f3e01"],"x":395,"y":320,"wires":[]},{"id":"e7f85caf.89fd3","type":"modbus-read","z":"6dc4c6ac.83d2b8","name":"Analog out 300","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"unitid":"3","dataType":"HoldingRegister","adr":"48","quantity":"8","rate":"1000","rateUnit":"ms","delayOnStart":false,"startDelayTime":"","server":"6b19cfc5.22db6","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":100,"y":180,"wires":[["63e8643.e2cbe9c"],["3024065a.219fea"]]},{"id":"3024065a.219fea","type":"modbus-response","z":"6dc4c6ac.83d2b8","name":"","registerShowMax":20,"x":310,"y":220,"wires":[]},{"id":"87e63099.e5e5f","type":"inject","z":"6dc4c6ac.83d2b8","name":"","topic":"","payload":"","payloadType":"date","repeat":"0.8","crontab":"","once":true,"onceDelay":0.1,"x":110,"y":260,"wires":[["66f9125d.86c96c"]]},{"id":"fd22355f.c4de68","type":"modbus-flex-write","z":"6dc4c6ac.83d2b8","name":"Analog output","showStatusActivities":false,"showErrors":false,"server":"6b19cfc5.22db6","emptyMsgOnFail":false,"keepMsgProperties":false,"x":440,"y":280,"wires":[[],["bf86632f.4356b"]]},{"id":"bf86632f.4356b","type":"modbus-response","z":"6dc4c6ac.83d2b8","name":"","registerShowMax":20,"x":630,"y":280,"wires":[]},{"id":"63e8643.e2cbe9c","type":"function","z":"6dc4c6ac.83d2b8","name":"Split input","func":"var inp = msg.payload\nvar portrange = 300\n\nfor (i = 0; i < inp.length; i++) {\n msg.payload = inp[i]\n msg.payload = (msg.payload / 4095) * 255\n msg.payload = Math.round(msg.payload)\n msg.topic = i + portrange\n //flow.set(String(msg.topic), msg.payload) //måtte fjerne for den overskrev med gammel verdi\n node.send(msg)\n}\n","outputs":1,"noerr":0,"x":280,"y":180,"wires":[[]]},{"id":"66f9125d.86c96c","type":"function","z":"6dc4c6ac.83d2b8","name":"Send AO","func":"\nvar outp =[];\nvar portrange = 300\nvar totaloutputs = 8\n\nfor (var i = 0; i < totaloutputs; i++) {\n if (isNaN(flow.get(String(i+portrange)+\"output\")) === false) {\n var a = (flow.get(String(i+portrange)+\"output\")/255)*4095\n a= Math.round(a)\n outp.push(a)\n }\n else {\n outp.push(0)\n }\n}\n\n\nmsg.payload = {value: outp,\n'fc': 16, 'unitid': 3, 'address':48, 'quantity':totaloutputs}\n\nreturn msg;","outputs":1,"noerr":0,"x":280,"y":280,"wires":[["fd22355f.c4de68"]]},{"id":"c6839720.edfc38","type":"function","z":"6dc4c6ac.83d2b8","name":"parse","func":"node.status({fill:\"green\",shape:\"dot\",text:\"connected\"});\n\nvar inp = msg.payload\nvar s =[];\nvar u = [];\nvar r = [];\nvar d = [];\nvar out = {};\n\nconst numberSorter = (([a, b], [c, d]) => a - c || d - b);\n\nif (inp.indexOf('!') != -1 || inp.indexOf('?') != -1 || inp.indexOf('/') != -1 ) {\n inp = inp.split(/(?=[?!;/])/g)\n\n for (var i = 0; i < inp.length; i++) {\n if (inp[i].indexOf('!') != -1) {\n inp[i] = inp[i].slice(inp[i].indexOf('!')+1)\n u.push (inp[i])\n }\n if (inp[i].indexOf('?') != -1) {\n inp[i] = inp[i].slice(inp[i].indexOf('?')+1)\n s.push (inp[i])\n }\n if (inp[i].indexOf('/') != -1) {\n inp[i] = inp[i].slice(inp[i].indexOf('/')+1)\n r.push (inp[i]+\",\"+\"99\")\n d.push (inp[i])\n }\n } \n\n for (i = 0; i < u.length; i++) {\n u[i] = u[i].split(\",\").map(Number);\n }\n for (i = 0; i < r.length; i++) {\n r[i] = r[i].split(\",\").map(Number);\n \n }\n for (i = 0; i < s.length; i++) {\n s[i] = s[i].split(\",\").map(Number);\n }\nu.sort(numberSorter)\n if (u.length > 0 ) {\n node.send([{payload:u}, null])\n }\nr.sort(numberSorter)\n if (r.length > 0 ) {\n //for (i = 0; i < r.length; i++) {\n \n out = r\n node.send([{payload:out}, null])\n }\ns.sort(numberSorter)\nsetTimeout(reply, 200);\n\n} else {\n if (inp.indexOf('*') != -1) {\n out = \"*;\"\n node.send([null, {payload: out}])\n }\n}\n\nfunction reply() {\n for (i = 0; i < s.length; i++) {\n if (isNaN(flow.get(String(s[i]))) === false) {\n s[i] = \"?\" + s[i] + \"=\" + flow.get(String(s[i]))\n }\n else {\n s[i] = \"?\" + s[i]\n }\n }\n\n for ( i = 0; i < u.length; i++) {\n u[i] = \"!\" + u[i]\n }\n for ( i = 0; i < d.length; i++) {\n d[i] = \"/\" + d[i]\n }\n\n u = u.join('')\n s = s.join('')\n out = s+u+d+\";\"\n node.send([null, {payload: out}])\n}\n\n\nmsg.topic = \"tick\"\nmsg.payload = Date.now()\nreturn [ msg, null];\n \n \n\n","outputs":2,"noerr":0,"x":210,"y":760,"wires":[["197116ed.5a3f49"],["bea6c539.232428","cb4b7c5e.7a3fe"]]},{"id":"197116ed.5a3f49","type":"function","z":"6dc4c6ac.83d2b8","name":"config","func":"\nvar u = msg.payload || []\nvar dcpins = flow.get(\"dcpins\") || []\nvar deadTime = 400; // number of milliseconds the valve (or whatever) takes to actuate, 30 seconds\nvar invert = false; \n\ndcpins = Array.from(new Set(dcpins))\ndcpins.sort(function(a, b){return a-b});\n\nfor (var i = 0; i < u.length; i++) {\n var config = u[i][1]\n var pin = u[i][0]\n \n if (config === 1) { //digital out\n flow.set(String(pin)+\"config\", config)\n msg.topic = pin\n msg.payload = u[i][2]\n flow.set(String(msg.topic), msg.payload) //store digital input to pick it up by modbus\n node.send(msg);\n }\n\n if (config === 4) { //dutycycle\n flow.set(String(pin)+\"config\", config)\n flow.set(String(pin)+\"dcpower\", u[i][2]/100)\n flow.set(String(pin)+\"dctime\", u[i][3])\n dcpins.push(u[i][0]);\n }\n \n if (config === 5) { //hysteresis\n flow.set(String(pin)+\"config\", config)\n flow.set(String(u[i][2])+\"config\", config)\n flow.set(String(pin)+\"pin\", u[i][2])\n flow.set(String(pin)+\"setpoint\", u[i][3])\n flow.set(String(pin)+\"setpoint2\", u[i][4])\n flow.set(String(u[i][2])+\"pin\", pin)\n var cooling\n if (u[i][3] < u[i][4]) {\n cooling = true\n } else {\n cooling = false\n }\n flow.set(String(pin)+\"cooling\", cooling)\n flow.set(String(pin)+\"delay\", u[i][5]*1000)\n }\n\n if (config == 6 ) { //PID\n flow.set(String(pin)+\"config\", config)\n flow.set(String(u[i][2])+\"config\", config)\n flow.set(String(u[i][2])+\"pin\", pin)\n flow.set(String(pin)+\"pin\", u[i][2])\n flow.set(String(pin)+\"pid\", u[i][2])\n flow.set(String(pin)+\"setpoint\", u[i][3])\n flow.set(String(pin)+\"prop_band\", u[i][4])// /100) //deler ikke på 100 siden temp ikke deles på 100\n flow.set(String(pin)+\"t_integral\", u[i][5]/100) //deler ikke på 100 siden temp ikke deles på 100\n flow.set(String(pin)+\"t_derivative\", u[i][6]/100) //deler ikke på 100 siden temp ikke deles på 100\n flow.set(String(pin)+\"direction\", u[i][7])\n flow.set(String(pin)+\"calctime\", u[i][8]*1000)\n flow.set(String(pin)+\"outtime\", u[i][9])\n flow.set(String(pin)+\"maxout\", u[i][11])\n msg.payload = [u[i][0],u[i][1],u[i][2],u[i][3],u[i][4],u[i][5],u[i][6],u[i][7],u[i][8],u[i][9],u[i][10],u[i][11]]//flow.get(String(u[i][2]))\n msg.topic = u[i][0]\n msg.enable = 1\n node.send(msg)\n }\n \n if (config === 7) { //pwm\n flow.set(String(pin)+\"config\", config)\n flow.set(String(pin), u[i][2])\n msg.topic = pin\n //msg.payload = flow.get(String(pin))\n msg.payload = u[i][2]\n flow.set(String(msg.topic)+\"output\", msg.payload)\n //flow.set(String(msg.topic), msg.payload)\n node.send(msg);\n }\n if (config === 8) { //analoginput\n flow.set(String(pin)+\"pollrate\", u[i][2])\n flow.set(String(pin)+\"awgweight\", u[i][3])\n msg.topic = pin\n msg.payload = [pin, 8, u[i][2], u[i][3]]\n node.send(msg);\n }\n if (config === 99) { //disabled\n previousconfig = flow.get(String(pin)+\"config\") || 0\n flow.set(String(pin)+\"config\", config)\n \n if (previousconfig === 1) {\n msg.topic = pin\n msg.payload = 0\n flow.set(String(msg.topic)+\"output\", msg.payload)\n node.send(msg)\n }\n if (previousconfig === 4) {\n for (i = 0; i < flow.get(\"dcpins\").length; i++) {\n \n if (pin === dcpins[i]) {\n dcpins.splice([i], 1)\n flow.set(String(pin)+\"dcdisabled\", true)\n msg.topic = pin\n msg.payload = 0\n node.send(msg)\n }\n }\n flow.set(String(pin)+\"config\", 99)\n flow.set(String(pin)+\"dcpower\", 0)\n flow.set(String(pin)+\"dctime\", 0)\n }\n \n if (previousconfig === 5) { //hysteresis\n flow.set(String(pin)+\"config\", config)\n //flow.set(String(pin)+\"pin\", 0)\n flow.set(String(pin)+\"setpoint\", 0)\n flow.set(String(pin)+\"setpoint2\", 0)\n flow.set(String(pin)+\"ondelay\", 0)\n msg.topic = pin\n msg.payload = 0\n node.send(msg);\n }\n \n \n if (previousconfig === 6) {\n flow.set(String(pin)+\"config\", 99)\n flow.set(String(u[i][2])+\"config\", 0)\n flow.set(String(u[i][2])+\"pin\", 0)\n flow.set(String(pin)+\"pin\", 0)\n flow.set(String(pin)+\"pid\", 0)\n flow.set(String(pin)+\"setpoint\", 0)\n flow.set(String(pin)+\"prop_band\", 0)\n flow.set(String(pin)+\"t_integral\", 0)\n flow.set(String(pin)+\"t_derivative\",0)\n flow.set(String(pin)+\"direction\", 0)\n flow.set(String(pin)+\"calctime\", 0)\n flow.set(String(pin)+\"outtime\", 0)\n flow.set(String(pin)+\"maxout\", 0)\n msg.topic = pin\n msg.enable = 0\n msg.payload = [msg.payload[0][0], msg.payload[0][1]]\n node.send(msg)\n }\n if (previousconfig === 7) { //pwm\n flow.set(String(pin)+\"config\", 99)\n flow.set(String(pin)+\"output\", 0)\n msg.topic = pin\n msg.payload = flow.get(String(pin))\n node.send(msg);\n }\n if (previousconfig === 8) { //analoginput\n flow.set(String(pin)+\"pollrate\", 0)\n flow.set(String(pin)+\"awgweight\", 0)\n }\n }\n}\n\ndcpins = Array.from(new Set(dcpins))\ndcpins.sort(function(a, b){return a-b});\n\nif (dcpins !== flow.get(\"dcpins\")) {\n flow.set(\"dcpins\", dcpins)\n}\n\nif (msg.topic === \"tick\") {\n for (i = 0; i < dcpins.length; i++) {\n msg.topic = dcpins[i]\n var power = flow.get(String(dcpins[i])+\"dcpower\");\n var dctime = flow.get(String(dcpins[i])+\"dctime\");\n var inn = msg.payload\n // yes, payload is timestamp, calc current wave value between 0 and 1\n var wave = inn % dctime/dctime; // fraction of way through cycle\n var direction;\n // determine direction of travel and convert to triangular wave\n if (wave < 0.5) {\n direction = 1; // on the way up\n wave = wave*2;\n } else {\n direction = -1; // on the way down\n wave = (1 - wave)*2;\n }\n var requestedPower = power || 0;\n // if a dead_time has been supplied for this o/p then adjust power accordingly\n if (deadTime > 0 && requestedPower > 0.0 && requestedPower < 1.0) {\n var dtop = deadTime/dctime;\n power = (1.0-2.0*dtop)*requestedPower + dtop;\n } else {\n power = requestedPower;\n }\n // cope with end cases in case values outside 0..1\n var opState;\n if (power <= 0.0) {\n opState = 0; // no heat\n } else if (power >= 1.0) {\n opState = 1; // full heat\n } else {\n // only allow power to come on on the way down and off on the way up, to reduce short pulses\n if (power >= wave && direction === -1) {\n opState = 1;\n } else if (power <= wave && direction === 1) {\n opState = 0;\n } else {\n // otherwise leave it as it is\n opState = flow.get(String(dcpins[i])+'opState') || 0;\n } \n }\n flow.set(String(dcpins[i])+'opState', opState);\n \n var out = invert ? (1-opState) : opState;\n if ((out !== flow.get(String(dcpins[i])+\"previousout\")) || (flow.get(String(dcpins[i])+\"dcdisabled\") === true)) {\n flow.set(String(dcpins[i])+\"previousout\", out)\n flow.set(String(dcpins[i])+\"dcdisabled\", false)\n flow.set(String(dcpins[i]), out)\n msg.payload = out\n msg.topic = dcpins[i]\n node.send(msg)\n }\n}\n}\n\n \n\n\n\n\n\n","outputs":1,"noerr":0,"x":350,"y":740,"wires":[["71ed0fc1.2674d","a3f3e16d.d4a51"]]},{"id":"3ba727c9.6fecc8","type":"tcp in","z":"6dc4c6ac.83d2b8","name":"","server":"server","host":"","port":"5000","datamode":"stream","datatype":"utf8","newline":"","topic":"","base64":false,"x":80,"y":760,"wires":[["c6839720.edfc38","537db619.85be48"]]},{"id":"bea6c539.232428","type":"tcp out","z":"6dc4c6ac.83d2b8","host":"","port":"","beserver":"reply","base64":false,"end":false,"name":"","x":350,"y":780,"wires":[]},{"id":"60db6701.40c848","type":"switch","z":"6dc4c6ac.83d2b8","name":"out","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"2","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":550,"y":660,"wires":[["5f2d18d0.00d1e8","c472faef.a96148"],["757e1e02.3305","c472faef.a96148"]]},{"id":"645492c.c0dd96c","type":"function","z":"6dc4c6ac.83d2b8","name":"input","func":"if (typeof(msg.payload) !== \"undefined\") {\n\n var pin = msg.topic;\n var value = msg.payload;\n flow.set(String(pin),value)\n\n if (flow.get(String(pin)+\"config\") === 5 && pin >= 100 ){ //hysteresis\n var outpin = flow.get(String(pin)+\"pin\") || 0\n var setpoint = flow.get(String(outpin)+\"setpoint\") || 0\n var setpoint2 = flow.get(String(outpin)+\"setpoint2\") || 0\n var config = flow.get(String(outpin)+\"config\") || 99\n var cooling = flow.get(String(outpin)+\"cooling\") || false\n var delay = flow.get(String(outpin)+\"delay\")\n var out = flow.get(String(outpin)+\"out\")\n \n \n if (value < setpoint) {\n if (cooling === true) {\n out = false\n } else {\n out = true\n }\n }\n if (value > setpoint2) {\n if (cooling === true) {\n out = true\n } else {\n out = false\n }\n }\n \n if (value === -12700) {\n out = false\n }\n \n if (config == 99) {\n out = false\n }\n if (out !== flow.get(String(outpin)+\"out\")) {\n flow.set(String(outpin)+\"out\", out)\n if (out === false) {\n context.set(String(outpin)+\"status\", Number(out))\n msg.topic = outpin\n msg.payload = Number(flow.get(String(outpin)+\"out\"))\n node.send(msg);\n }\n \n if (out === true && config !== 99 && value !== -12700) {\n setTimeout(start, delay)\n }\n }\n setTimeout(mismatch, 2000)\n}\n//PID\n if (flow.get(String(pin)+\"config\") === 6) {\n outpin = flow.get(String(pin)+\"pin\") || 0\n //var config = flow.get(String(outpin)+\"config\") || 99\n var pidsetpoint = flow.get(String(outpin)+\"setpoint\");\n var prop_band = flow.get(String(outpin)+\"prop_band\");\n var t_integral = flow.get(String(outpin)+\"t_integral\");\n var t_derivative = flow.get(String(outpin)+\"t_derivative\");\n \n if (flow.get(String(outpin)+\"config\") === 99 || flow.get(String(pin)) === -12700) {\n msg.topic = pin\n var maxout = flow.get(String(pin)+\"maxout\");\n flow.set(String(pin)+\"oldmaxout\", maxout)\n flow.set(String(pin)+\"maxout\", 0)\n msg.enable = 0\n msg.disabled_op = 0\n node.send(msg)\n }\n \n else {\n var oldmaxout = flow.get(String(pin)+\"oldmaxout\");\n flow.set(String(pin)+\"maxout\", oldmaxout)\n msg.enable = 1\n msg.topic = pin\n msg.payload = flow.get(String(pin))\n msg.setpoint = pidsetpoint\n msg.prop_band = prop_band\n msg.t_integral = t_integral\n msg.t_derivative = t_derivative\n node.send(msg)\n }\n }\n}\n\nfunction start() {\n if (config !== 99 && value !== -12700) {\n context.set(String(outpin)+\"status\", Number(flow.get(String(outpin)+\"out\")))\n msg.topic = outpin\n msg.payload = Number(flow.get(String(outpin)+\"out\"))\n node.send(msg);\n }\n \n}\n\nfunction mismatch() {\n if (context.get(String(outpin)+\"status\") !== flow.get(String(outpin)) ) {\n context.set(String(outpin)+\"status\", Number(flow.get(String(outpin)+\"out\")))\n if (Number(flow.get(String(outpin)+\"out\")) === 1 && config !== 99 && value !== -12700) {\n setTimeout(start, delay)\n }\n if (Number(flow.get(String(outpin)+\"out\")) === 0) {\n msg.payload = Number(flow.get(String(outpin)+\"out\"))\n msg.topic = outpin\n node.send(msg)\n }\n }\n}","outputs":1,"noerr":0,"x":350,"y":700,"wires":[["54c14458.59eedc"]]},{"id":"54c14458.59eedc","type":"link out","z":"6dc4c6ac.83d2b8","name":"input","links":["89ef5759.fc2d28","c64ede7c.d3a6a"],"x":455,"y":700,"wires":[]},{"id":"71ed0fc1.2674d","type":"link out","z":"6dc4c6ac.83d2b8","name":"config","links":["89ef5759.fc2d28"],"x":455,"y":740,"wires":[]},{"id":"89ef5759.fc2d28","type":"link in","z":"6dc4c6ac.83d2b8","name":"outputs","links":["71ed0fc1.2674d","54c14458.59eedc","58d6778.cbf3088","bdc1e45b.bcdfc8"],"x":455,"y":660,"wires":[["60db6701.40c848"]]},{"id":"cc96708e.f3e01","type":"link in","z":"6dc4c6ac.83d2b8","name":"","links":["aca07636.8cbe28","d8d01682.693928"],"x":255,"y":700,"wires":[["645492c.c0dd96c"]]},{"id":"d4b673dd.9ea8f","type":"smooth","z":"6dc4c6ac.83d2b8","name":"","property":"payload","action":"mean","count":"3","round":"0","mult":"multi","reduce":false,"x":420,"y":420,"wires":[["d8d01682.693928"]]},{"id":"7df076f4.d43e18","type":"mqtt out","z":"6dc4c6ac.83d2b8","name":"pump","topic":"shellies/shelly1pm-F26E20/relay/0/command","qos":"0","retain":"false","broker":"a12977.e4f5b688","x":850,"y":640,"wires":[]},{"id":"5f2d18d0.00d1e8","type":"change","z":"6dc4c6ac.83d2b8","name":"pump","rules":[{"t":"set","p":"1","pt":"flow","to":"payload","tot":"msg"},{"t":"change","p":"payload","pt":"msg","from":"1","fromt":"num","to":"on","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"0","fromt":"num","to":"off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":640,"wires":[["7df076f4.d43e18"]]},{"id":"5e629a15.dda714","type":"modbus-read","z":"6dc4c6ac.83d2b8","name":"","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"unitid":"3","dataType":"HoldingRegister","adr":"73","quantity":"8","rate":"12","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"6b19cfc5.22db6","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":110,"y":480,"wires":[[],["6cfc1ef5.0de64"]]},{"id":"6cfc1ef5.0de64","type":"modbus-response","z":"6dc4c6ac.83d2b8","name":"","registerShowMax":20,"x":310,"y":520,"wires":[]},{"id":"5f910074.b2cd5","type":"PID","z":"6dc4c6ac.83d2b8","name":"HLT PID","setpoint":21,"pb":"30","ti":9999,"td":0,"integral_default":0.5,"smooth_factor":3,"max_interval":600,"enable":1,"disabled_op":"1","x":1440,"y":40,"wires":[["1149662c.a7120a","16848bdc.516d04"]]},{"id":"1149662c.a7120a","type":"range","z":"6dc4c6ac.83d2b8","minin":"0","maxin":"1","minout":"0","maxout":"255","action":"clamp","round":true,"property":"payload","name":"","x":1600,"y":40,"wires":[["c61a32dd.74e8f"]]},{"id":"5f05482b.317fe8","type":"change","z":"6dc4c6ac.83d2b8","name":"HLT","rules":[{"t":"set","p":"topic","pt":"msg","to":"900","tot":"str"},{"t":"set","p":"900","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1950,"y":40,"wires":[["50910f0c.d87e2"]]},{"id":"50910f0c.d87e2","type":"debug","z":"6dc4c6ac.83d2b8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":2110,"y":40,"wires":[]},{"id":"c40106fe.e9f4f8","type":"PID","z":"6dc4c6ac.83d2b8","name":"HEX PID","setpoint":21,"pb":"30","ti":9999,"td":0,"integral_default":0.5,"smooth_factor":3,"max_interval":600,"enable":1,"disabled_op":"1","x":1440,"y":100,"wires":[["4d3e166d.94f338"]]},{"id":"4d3e166d.94f338","type":"range","z":"6dc4c6ac.83d2b8","minin":"0","maxin":"1","minout":"80","maxout":"255","action":"clamp","round":true,"property":"payload","name":"","x":1600,"y":120,"wires":[["e01e72d2.622f2"]]},{"id":"e01e72d2.622f2","type":"change","z":"6dc4c6ac.83d2b8","name":"HEX","rules":[{"t":"set","p":"topic","pt":"msg","to":"903","tot":"str"},{"t":"set","p":"903","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1770,"y":120,"wires":[["d89c98aa.3839b8"]]},{"id":"d89c98aa.3839b8","type":"debug","z":"6dc4c6ac.83d2b8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":2090,"y":120,"wires":[]},{"id":"9bacad6a.05f94","type":"tibber-feed","z":"6dc4c6ac.83d2b8","name":"","active":true,"apiEndpointRef":"b4f0b821.9556a","homeId":"990d8d6c-38d9-4cf5-970c-98f1c241685c","timestamp":"1","power":"1","lastMeterConsumption":"1","accumulatedConsumption":"1","accumulatedProduction":"1","accumulatedCost":"1","accumulatedReward":"1","currency":"1","minPower":"1","averagePower":"1","maxPower":"1","powerProduction":"1","minPowerProduction":"1","maxPowerProduction":"1","lastMeterProduction":"1","powerFactor":"1","voltagePhase1":"1","voltagePhase2":"1","voltagePhase3":"1","currentL1":"1","currentL2":"1","currentL3":"1","signalStrength":"1","x":1340,"y":320,"wires":[["5a01bb46.a8492c","b0af1da6.9339f"]]},{"id":"5a01bb46.a8492c","type":"debug","z":"6dc4c6ac.83d2b8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1530,"y":240,"wires":[]},{"id":"411423a9.bcbcfc","type":"modbus-read","z":"6dc4c6ac.83d2b8","name":"HLT pwr","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"unitid":"6","dataType":"HoldingRegister","adr":"0","quantity":"7","rate":"3100","rateUnit":"ms","delayOnStart":false,"startDelayTime":"","server":"6b19cfc5.22db6","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":1300,"y":480,"wires":[["7195be0f.67783"],["dcf9e8c3.3572d8"]]},{"id":"dcf9e8c3.3572d8","type":"modbus-response","z":"6dc4c6ac.83d2b8","name":"","registerShowMax":20,"x":1510,"y":520,"wires":[]},{"id":"e6bd1472.5cdf18","type":"modbus-response","z":"6dc4c6ac.83d2b8","name":"","registerShowMax":20,"x":1510,"y":620,"wires":[]},{"id":"1a0c95d7.23173a","type":"modbus-read","z":"6dc4c6ac.83d2b8","name":"BKL pwr","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"unitid":"7","dataType":"HoldingRegister","adr":"0","quantity":"7","rate":"4000","rateUnit":"ms","delayOnStart":false,"startDelayTime":"","server":"6b19cfc5.22db6","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":1300,"y":560,"wires":[["c6abc6b6.0660a8"],["e6bd1472.5cdf18"]]},{"id":"f693c4ca.614538","type":"PID","z":"6dc4c6ac.83d2b8","name":"BKL PID","setpoint":21,"pb":"30","ti":9999,"td":0,"integral_default":0.5,"smooth_factor":3,"max_interval":600,"enable":1,"disabled_op":"1","x":1440,"y":160,"wires":[["beed8af.3ef1578","5f54025e.93f64c"]]},{"id":"beed8af.3ef1578","type":"range","z":"6dc4c6ac.83d2b8","minin":"0","maxin":"1","minout":"0","maxout":"255","action":"clamp","round":true,"property":"payload","name":"","x":1600,"y":160,"wires":[["6b3ccf44.6622c"]]},{"id":"14d2b00.609a25","type":"change","z":"6dc4c6ac.83d2b8","name":"BKL","rules":[{"t":"set","p":"topic","pt":"msg","to":"902","tot":"str"},{"t":"set","p":"902","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1950,"y":160,"wires":[["8c0682f.d83318"]]},{"id":"8c0682f.d83318","type":"debug","z":"6dc4c6ac.83d2b8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":2090,"y":160,"wires":[]},{"id":"5f54025e.93f64c","type":"change","z":"6dc4c6ac.83d2b8","name":"BKL heater","rules":[{"t":"set","p":"payload","pt":"msg","to":"305","tot":"flow"},{"t":"set","p":"topic","pt":"msg","to":"305","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1610,"y":200,"wires":[["a9847231.8d22e"]]},{"id":"ea406102.9bd7b","type":"debug","z":"6dc4c6ac.83d2b8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":2290,"y":200,"wires":[]},{"id":"db709550.290338","type":"inject","z":"6dc4c6ac.83d2b8","name":"","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1750,"y":660,"wires":[["a69176f2.053fd8","51b8b91c.faa9b8"]]},{"id":"a69176f2.053fd8","type":"modbus-write","z":"6dc4c6ac.83d2b8","name":"start HLT","showStatusActivities":false,"showErrors":false,"unitid":"6","dataType":"HoldingRegister","adr":"50","quantity":"1","server":"6b19cfc5.22db6","emptyMsgOnFail":false,"keepMsgProperties":false,"x":1940,"y":660,"wires":[[],["9554f39f.4a2a6"]]},{"id":"9554f39f.4a2a6","type":"modbus-response","z":"6dc4c6ac.83d2b8","name":"","registerShowMax":20,"x":2110,"y":680,"wires":[]},{"id":"54643960.d6a648","type":"modbus-write","z":"6dc4c6ac.83d2b8","name":"","showStatusActivities":false,"showErrors":false,"unitid":"6","dataType":"HoldingRegister","adr":"17","quantity":"1","server":"6b19cfc5.22db6","emptyMsgOnFail":false,"keepMsgProperties":false,"x":1880,"y":320,"wires":[[],["c3b3396a.47f1b8"]]},{"id":"c3b3396a.47f1b8","type":"modbus-response","z":"6dc4c6ac.83d2b8","name":"","registerShowMax":20,"x":2090,"y":320,"wires":[]},{"id":"16848bdc.516d04","type":"change","z":"6dc4c6ac.83d2b8","name":"HLT heater","rules":[{"t":"set","p":"payload","pt":"msg","to":"304","tot":"flow"},{"t":"set","p":"topic","pt":"msg","to":"304","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1610,"y":80,"wires":[["c76db491.a14df8"]]},{"id":"2a3fb412.eced7c","type":"modbus-write","z":"6dc4c6ac.83d2b8","name":"HLT heater","showStatusActivities":false,"showErrors":false,"unitid":"6","dataType":"HoldingRegister","adr":"11","quantity":"1","server":"6b19cfc5.22db6","emptyMsgOnFail":false,"keepMsgProperties":false,"x":2110,"y":80,"wires":[["6a42af8f.b06b6"],[]]},{"id":"20b123de.89e38c","type":"modbus-write","z":"6dc4c6ac.83d2b8","name":"BKL heater","showStatusActivities":false,"showErrors":false,"unitid":"7","dataType":"HoldingRegister","adr":"11","quantity":"1","server":"6b19cfc5.22db6","emptyMsgOnFail":false,"keepMsgProperties":false,"x":2110,"y":200,"wires":[["ea406102.9bd7b"],[]]},{"id":"6a42af8f.b06b6","type":"debug","z":"6dc4c6ac.83d2b8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":2290,"y":60,"wires":[]},{"id":"a9847231.8d22e","type":"range","z":"6dc4c6ac.83d2b8","minin":"0","maxin":"255","minout":"0","maxout":"1000","action":"clamp","round":true,"property":"payload","name":"","x":1780,"y":200,"wires":[["bb2afcc0.98bf4"]]},{"id":"c76db491.a14df8","type":"range","z":"6dc4c6ac.83d2b8","minin":"0","maxin":"255","minout":"0","maxout":"1000","action":"clamp","round":true,"property":"payload","name":"","x":1780,"y":80,"wires":[["1cf9463a.dec0aa"]]},{"id":"b0af1da6.9339f","type":"function","z":"6dc4c6ac.83d2b8","name":"power","func":"var consumption = msg.payload.power\nvar BKLceiling\nvar HLTelementsize = 6000\nvar BKLelementsize = 4800\nvar maxlimit = 14000\nvar HLTelementusage = (flow.get(\"HLTpower\")/1000)*HLTelementsize\n//var BKLelementusage = (flow.get(\"BKLpower\")/1000)*BKLelementsize\nvar maxusage = consumption + HLTelementsize //+ BKLelementsize\n\nceiling = 100 - (((maxusage - maxlimit - HLTelementusage)/(HLTelementsize))*100)\nceiling\n\nif (ceiling > 100) {\n ceiling = 100\n}\n\nif (ceiling < 0) {\n BKLceiling = Math.round((ceiling*4.5/6) + 100)\n ceiling = 0\n}\nelse {\n BKLceiling = 100\n}\n\nmsg.payload = Math.round(ceiling)\nflow.set(\"HLTceiling\", msg.payload)\nflow.set(\"BKLceiling\", BKLceiling)\nnode.send([null,msg,{payload: BKLceiling}])","outputs":3,"noerr":0,"x":1470,"y":380,"wires":[[],["dc446cea.3d423"],["47bc4111.46caf"]]},{"id":"bb2afcc0.98bf4","type":"rbe","z":"6dc4c6ac.83d2b8","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":1930,"y":200,"wires":[["20b123de.89e38c"]]},{"id":"1cf9463a.dec0aa","type":"rbe","z":"6dc4c6ac.83d2b8","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":1950,"y":80,"wires":[["2a3fb412.eced7c"]]},{"id":"c8d7a6d4.d41208","type":"debug","z":"6dc4c6ac.83d2b8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1870,"y":400,"wires":[]},{"id":"7195be0f.67783","type":"function","z":"6dc4c6ac.83d2b8","name":"Store input","func":"flow.set(\"HLTpower\" , msg.payload[1])\n","outputs":1,"noerr":0,"x":1490,"y":480,"wires":[[]]},{"id":"c61a32dd.74e8f","type":"function","z":"6dc4c6ac.83d2b8","name":"","func":"var output = Math.round((msg.payload/255)*100)\n\nif (output > flow.get(\"HLTceiling\")) {\n msg.payload = Math.round((flow.get(\"HLTceiling\")/100)*255) \n}\nreturn msg;","outputs":1,"noerr":0,"x":1770,"y":40,"wires":[["5f05482b.317fe8"]]},{"id":"dc446cea.3d423","type":"delay","z":"6dc4c6ac.83d2b8","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"2","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":1660,"y":320,"wires":[["54643960.d6a648","52931797.854de8"]]},{"id":"51b8b91c.faa9b8","type":"modbus-write","z":"6dc4c6ac.83d2b8","name":"start BKL","showStatusActivities":false,"showErrors":false,"unitid":"7","dataType":"HoldingRegister","adr":"50","quantity":"1","server":"6b19cfc5.22db6","emptyMsgOnFail":false,"keepMsgProperties":false,"x":1940,"y":720,"wires":[[],["69a7b8c4.1c1418"]]},{"id":"5e5d7b18.bbe0a4","type":"inject","z":"6dc4c6ac.83d2b8","name":"","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1750,"y":720,"wires":[["a69176f2.053fd8","51b8b91c.faa9b8"]]},{"id":"69a7b8c4.1c1418","type":"modbus-response","z":"6dc4c6ac.83d2b8","name":"","registerShowMax":20,"x":2110,"y":740,"wires":[]},{"id":"47bc4111.46caf","type":"delay","z":"6dc4c6ac.83d2b8","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"2","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":1660,"y":360,"wires":[["379abe16.082212","c8d7a6d4.d41208"]]},{"id":"379abe16.082212","type":"modbus-write","z":"6dc4c6ac.83d2b8","name":"","showStatusActivities":false,"showErrors":false,"unitid":"7","dataType":"HoldingRegister","adr":"17","quantity":"1","server":"6b19cfc5.22db6","emptyMsgOnFail":false,"keepMsgProperties":false,"x":1880,"y":360,"wires":[[],["67432bee.510e04"]]},{"id":"c6abc6b6.0660a8","type":"function","z":"6dc4c6ac.83d2b8","name":"Store input","func":"flow.set(\"BKLpower\" , msg.payload[1])\n","outputs":1,"noerr":0,"x":1490,"y":580,"wires":[[]]},{"id":"6b3ccf44.6622c","type":"function","z":"6dc4c6ac.83d2b8","name":"","func":"var output = Math.round((msg.payload/255)*100)\n\nif (output > flow.get(\"BKLceiling\")) {\n msg.payload = Math.round((flow.get(\"BKLceiling\")/100)*255) \n}\nreturn msg;","outputs":1,"noerr":0,"x":1770,"y":160,"wires":[["14d2b00.609a25"]]},{"id":"52931797.854de8","type":"debug","z":"6dc4c6ac.83d2b8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1870,"y":280,"wires":[]},{"id":"67432bee.510e04","type":"modbus-response","z":"6dc4c6ac.83d2b8","name":"","registerShowMax":20,"x":2090,"y":380,"wires":[]},{"id":"a3f3e16d.d4a51","type":"debug","z":"6dc4c6ac.83d2b8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":510,"y":800,"wires":[]},{"id":"cb4b7c5e.7a3fe","type":"debug","z":"6dc4c6ac.83d2b8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":470,"y":860,"wires":[]},{"id":"537db619.85be48","type":"debug","z":"6dc4c6ac.83d2b8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":210,"y":920,"wires":[]},{"id":"c472faef.a96148","type":"debug","z":"6dc4c6ac.83d2b8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":790,"y":820,"wires":[]},{"id":"6d0a5311.749b7c","type":"delay","z":"6dc4c6ac.83d2b8","name":"","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":800,"y":700,"wires":[["2a4b2761.626b68"]]},{"id":"757e1e02.3305","type":"switch","z":"6dc4c6ac.83d2b8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":670,"y":680,"wires":[["6d0a5311.749b7c"]]},{"id":"2a4b2761.626b68","type":"change","z":"6dc4c6ac.83d2b8","name":"","rules":[{"t":"set","p":"2","pt":"flow","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":940,"y":700,"wires":[[]]},{"id":"6112931c.edc41c","type":"modbus-read","z":"88bbcf05.96d65","name":"","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"unitid":"1","dataType":"InputRegister","adr":"12101","quantity":"1","rate":"10000","rateUnit":"ms","delayOnStart":false,"startDelayTime":"","server":"46ccfe10.13ec3","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":130,"y":100,"wires":[["b4c151d3.fb0ad"],["4c111b32.6e6544"]]},{"id":"4c111b32.6e6544","type":"modbus-response","z":"88bbcf05.96d65","name":"","registerShowMax":20,"x":470,"y":160,"wires":[]},{"id":"11078278.f731fe","type":"blynk-ws-out-write","z":"88bbcf05.96d65","name":"Utetemperatur","pin":"13","pinmode":0,"client":"445c05cf.41736c","x":680,"y":80,"wires":[]},{"id":"b4c151d3.fb0ad","type":"change","z":"88bbcf05.96d65","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.0","tot":"msg"},{"t":"set","p":"payload","pt":"msg","to":"msg.payload/10","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":80,"wires":[["73a77557.6b856c"]]},{"id":"d9ed88f8.7c25a8","type":"modbus-read","z":"88bbcf05.96d65","name":"Extract temperature","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"unitid":"1","dataType":"InputRegister","adr":"12543","quantity":"1","rate":"20000","rateUnit":"ms","delayOnStart":false,"startDelayTime":"","server":"46ccfe10.13ec3","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":150,"y":240,"wires":[[],["9dbf53e1.89b98"]]},{"id":"9dbf53e1.89b98","type":"modbus-response","z":"88bbcf05.96d65","name":"","registerShowMax":20,"x":370,"y":260,"wires":[]},{"id":"e61ea344.b296","type":"modbus-read","z":"88bbcf05.96d65","name":"Extract Humidity","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"unitid":"1","dataType":"InputRegister","adr":"12135","quantity":"1","rate":"10","rateUnit":"m","delayOnStart":false,"startDelayTime":"","server":"46ccfe10.13ec3","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":140,"y":360,"wires":[[],["6ecb2c2b.66f794"]]},{"id":"6ecb2c2b.66f794","type":"modbus-response","z":"88bbcf05.96d65","name":"","registerShowMax":20,"x":350,"y":380,"wires":[]},{"id":"bc4b1269.8167d","type":"modbus-read","z":"88bbcf05.96d65","name":"Supply temperature","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"unitid":"1","dataType":"InputRegister","adr":"12102","quantity":"1","rate":"60","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"46ccfe10.13ec3","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":150,"y":300,"wires":[[],["f0490645.a259c8"]]},{"id":"f0490645.a259c8","type":"modbus-response","z":"88bbcf05.96d65","name":"","registerShowMax":20,"x":370,"y":320,"wires":[]},{"id":"1bb01eb0.48a951","type":"modbus-read","z":"88bbcf05.96d65","name":"Mode","topic":"","showStatusActivities":false,"logIOActivities":false,"showErrors":false,"unitid":"1","dataType":"InputRegister","adr":"1160","quantity":"1","rate":"60","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"46ccfe10.13ec3","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"x":110,"y":420,"wires":[[],["7716573a.675df8"]]},{"id":"7716573a.675df8","type":"modbus-response","z":"88bbcf05.96d65","name":"","registerShowMax":20,"x":350,"y":440,"wires":[]},{"id":"b0c815b9.2c0ca8","type":"modbus-write","z":"88bbcf05.96d65","name":"","showStatusActivities":false,"showErrors":false,"unitid":"1","dataType":"HoldingRegister","adr":"1161","quantity":"1","server":"46ccfe10.13ec3","emptyMsgOnFail":false,"keepMsgProperties":false,"x":300,"y":540,"wires":[[],["6f1ee505.562b5c"]]},{"id":"5db42335.7650bc","type":"inject","z":"88bbcf05.96d65","name":"Refresh 4","topic":"","payload":"4","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":100,"y":560,"wires":[["b0c815b9.2c0ca8"]]},{"id":"6f1ee505.562b5c","type":"modbus-response","z":"88bbcf05.96d65","name":"","registerShowMax":20,"x":510,"y":560,"wires":[]},{"id":"a1297b27.661f38","type":"inject","z":"88bbcf05.96d65","name":"Crowded 3","topic":"","payload":"3","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":100,"y":520,"wires":[["b0c815b9.2c0ca8"]]},{"id":"46f81312.58dbec","type":"inject","z":"88bbcf05.96d65","name":"Normal 2","topic":"","payload":"2","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":100,"y":480,"wires":[["b0c815b9.2c0ca8"]]},{"id":"e858241f.2a2778","type":"inject","z":"88bbcf05.96d65","name":"Away 6","topic":"","payload":"6","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":600,"wires":[["b0c815b9.2c0ca8"]]},{"id":"4c218f89.bd536","type":"inject","z":"88bbcf05.96d65","name":"Holiday 7","topic":"","payload":"7","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":100,"y":640,"wires":[["b0c815b9.2c0ca8"]]},{"id":"c43406d2.277a98","type":"mqtt out","z":"3b1a376d.f3e658","name":"Door relock","topic":"zwave2mqtt/2/112/1/5/set","qos":"0","retain":"false","broker":"a12977.e4f5b688","x":390,"y":240,"wires":[]},{"id":"aaa57a9e.24a098","type":"inject","z":"3b1a376d.f3e658","name":"door relock off","topic":"","payload":"Disabled","payloadType":"str","repeat":"","crontab":"02 07 * * *","once":false,"onceDelay":0.1,"x":140,"y":240,"wires":[["c43406d2.277a98"]]},{"id":"bab7dba8.926928","type":"mqtt out","z":"3b1a376d.f3e658","name":"lock/unlock","topic":"zwave2mqtt/2/98/1/0/set","qos":"0","retain":"false","broker":"a12977.e4f5b688","x":390,"y":300,"wires":[]},{"id":"a8f4a572.232418","type":"inject","z":"3b1a376d.f3e658","name":"lock","topic":"","payload":"LOCK","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":360,"wires":[["bab7dba8.926928"]]},{"id":"9e4a4b18.742f48","type":"inject","z":"3b1a376d.f3e658","name":"unlock","topic":"","payload":"UNLOCK","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":400,"wires":[["bab7dba8.926928"]]},{"id":"7dbac896.8ac038","type":"inject","z":"3b1a376d.f3e658","name":"door relock on","topic":"","payload":"Enabled","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":280,"wires":[["c43406d2.277a98"]]},{"id":"d933f075.acd04","type":"mqtt out","z":"3b1a376d.f3e658","name":"Door lock mode","topic":"zwave2mqtt/2/112/1/1/set","qos":"0","retain":"false","broker":"a12977.e4f5b688","x":400,"y":420,"wires":[]},{"id":"8494f5a.7802408","type":"inject","z":"3b1a376d.f3e658","name":"","topic":"","payload":"Auto lock, Away on","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":440,"wires":[["d933f075.acd04"]]},{"id":"6899bd74.5e3c04","type":"inject","z":"3b1a376d.f3e658","name":"","topic":"","payload":"Auto lock, Away off","payloadType":"str","repeat":"","crontab":"01 23 * * *","once":false,"onceDelay":0.1,"x":160,"y":480,"wires":[["d933f075.acd04"]]},{"id":"ff0acdf.30ec53","type":"inject","z":"3b1a376d.f3e658","name":"Manual lock, Away off","topic":"","payload":"Manual lock, Away off","payloadType":"str","repeat":"","crontab":"59 05 * * *","once":false,"onceDelay":0.1,"x":160,"y":520,"wires":[["d933f075.acd04"]]},{"id":"c9e1755d.46cd08","type":"inject","z":"3b1a376d.f3e658","name":"","topic":"","payload":"Manual lock, Away on","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":560,"wires":[["d933f075.acd04"]]},{"id":"114903af.a0291c","type":"mqtt in","z":"3b1a376d.f3e658","name":"","topic":"zwave2mqtt/2/98/1/0","qos":"0","datatype":"json","broker":"a12977.e4f5b688","x":140,"y":180,"wires":[["e43a3c79.40137"]]},{"id":"e43a3c79.40137","type":"switch","z":"3b1a376d.f3e658","name":"","property":"payload.value","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":310,"y":180,"wires":[["4c1138ea.110768"],["739a288.88d76d8"]]},{"id":"989188dc.2d0988","type":"inject","z":"3b1a376d.f3e658","name":"lock at night","topic":"","payload":"LOCK","payloadType":"str","repeat":"","crontab":"00 23 * * *","once":false,"onceDelay":0.1,"x":130,"y":320,"wires":[["bab7dba8.926928"]]},{"id":"129f24dd.56bceb","type":"inject","z":"3b1a376d.f3e658","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":720,"wires":[["fb8cb1dc.29e71"]]},{"id":"accaf02.79bf51","type":"inject","z":"3b1a376d.f3e658","name":"true","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":640,"wires":[["c4ec07b9.ba1488"]]},{"id":"c4ec07b9.ba1488","type":"change","z":"3b1a376d.f3e658","name":"","rules":[{"t":"set","p":"test","pt":"flow","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":290,"y":640,"wires":[[]]},{"id":"68802f4d.d9417","type":"inject","z":"3b1a376d.f3e658","name":"false","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":680,"wires":[["7d1e2da3.6788c4"]]},{"id":"7d1e2da3.6788c4","type":"change","z":"3b1a376d.f3e658","name":"","rules":[{"t":"set","p":"test","pt":"flow","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":290,"y":680,"wires":[[]]},{"id":"fb8cb1dc.29e71","type":"switch","z":"3b1a376d.f3e658","name":"","property":"test","propertyType":"flow","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":270,"y":720,"wires":[["7adae1f9.15a3"],["7e2a6fff.7ad46"]]},{"id":"7adae1f9.15a3","type":"debug","z":"3b1a376d.f3e658","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":470,"y":720,"wires":[]},{"id":"7e2a6fff.7ad46","type":"debug","z":"3b1a376d.f3e658","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":470,"y":760,"wires":[]},{"id":"305f186a.2ec8f8","type":"debug","z":"3b1a376d.f3e658","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":510,"y":40,"wires":[]},{"id":"8e0b08e.22df9f8","type":"mqtt in","z":"3b1a376d.f3e658","name":"","topic":"zwave2mqtt/2/#","qos":"0","datatype":"auto","broker":"a12977.e4f5b688","x":120,"y":100,"wires":[["305f186a.2ec8f8"]]},{"id":"4c1138ea.110768","type":"debug","z":"3b1a376d.f3e658","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":510,"y":140,"wires":[]},{"id":"739a288.88d76d8","type":"debug","z":"3b1a376d.f3e658","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":510,"y":180,"wires":[]},{"id":"991271a4.dc8a4","type":"mqtt in","z":"3b1a376d.f3e658","name":"","topic":"zw2mqtt-kjeller/#","qos":"0","datatype":"json","broker":"a12977.e4f5b688","x":120,"y":140,"wires":[["35bd2681.b88afa"]]},{"id":"ea3710e8.4ee2e","type":"mqtt in","z":"3b1a376d.f3e658","name":"","topic":"zwave2mqtt/3/#","qos":"0","datatype":"json","broker":"a12977.e4f5b688","x":120,"y":60,"wires":[["305f186a.2ec8f8"]]},{"id":"35bd2681.b88afa","type":"debug","z":"3b1a376d.f3e658","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":510,"y":80,"wires":[]},{"id":"73a77557.6b856c","type":"smooth","z":"88bbcf05.96d65","name":"","property":"payload","action":"mean","count":"25","round":"","mult":"single","reduce":false,"x":520,"y":80,"wires":[["11078278.f731fe"]]}]
Add Comment
Please, Sign In to add comment