[{"id":"f288e9f24817bca0","type":"group","z":"366d5b2cdeff6aae","name":"flow or room router","style":{"fill":"#e3f3d3","label":true},"nodes":["b49097ad7b90689a","25b99c24a038658c","70006a9f84044cc5","bb9f0ecf75bd9ddd"],"x":1494,"y":1439,"w":362,"h":122},{"id":"b49097ad7b90689a","type":"switch","z":"366d5b2cdeff6aae","g":"f288e9f24817bca0","name":"flow/room router","property":"payload.flow","propertyType":"msg","rules":[{"t":"eq","v":"flow1","vt":"str"},{"t":"eq","v":"flow2","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1660,"y":1500,"wires":[["70006a9f84044cc5"],["bb9f0ecf75bd9ddd"]]},{"id":"25b99c24a038658c","type":"link in","z":"366d5b2cdeff6aae","g":"f288e9f24817bca0","name":"flow_router_in","links":["b1fb0e92ce39e921","d7c9d7dbb2eeb0f2","56b7c4236bd3e5c5","e2e814f20accfd19"],"x":1535,"y":1500,"wires":[["b49097ad7b90689a"]]},{"id":"70006a9f84044cc5","type":"link out","z":"366d5b2cdeff6aae","g":"f288e9f24817bca0","name":"router out","mode":"link","links":["04ebd35e3b8e1db7"],"x":1815,"y":1480,"wires":[]},{"id":"bb9f0ecf75bd9ddd","type":"link out","z":"366d5b2cdeff6aae","g":"f288e9f24817bca0","name":"","links":["30d05c4b5f80a0c2"],"x":1815,"y":1520,"wires":[]},{"id":"fe61f69387dea439","type":"group","z":"366d5b2cdeff6aae","name":"flow1 / room 1","style":{"label":true,"color":"#7f7f7f","fill":"#bfdbef"},"nodes":["f4efdfcb2f7237d2","04ebd35e3b8e1db7","925809aca26485d4","004ef708de3b7b0a","5c83951a72586df4","3cdb9713b79b7b51","0517c83c08bd93a6","0c15948b8cd04989","17e8a3b2a2a1c39e","615a27fcbdbef909","515393634e04c5d8","2b659b97f928ae9b","683b6a2c3bcd0d09","ffeb87dacfb12f86","e7c419c07817ad26","31caf4a5060d5b98","b9171ea6675ba91b","5339a3f3e25c51e0","6c81d51075ae593c","5d06b73a4bed605c","79ebfde237f39a5c"],"x":374,"y":1799,"w":1032,"h":382},{"id":"f4efdfcb2f7237d2","type":"comment","z":"366d5b2cdeff6aae","g":"fe61f69387dea439","name":"each flow could be one room temp management","info":"","x":580,"y":2140,"wires":[]},{"id":"04ebd35e3b8e1db7","type":"link in","z":"366d5b2cdeff6aae","g":"fe61f69387dea439","name":"flow_1_in","links":["70006a9f84044cc5"],"x":415,"y":1980,"wires":[["79ebfde237f39a5c"]]},{"id":"925809aca26485d4","type":"debug","z":"366d5b2cdeff6aae","g":"fe61f69387dea439","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1170,"y":1880,"wires":[]},{"id":"004ef708de3b7b0a","type":"function","z":"366d5b2cdeff6aae","g":"fe61f69387dea439","name":"HZVL min temperature ","func":"return{payload:parseFloat(msg.payload.min.toFixed(2))};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":960,"y":1880,"wires":[["925809aca26485d4"]]},{"id":"5c83951a72586df4","type":"debug","z":"366d5b2cdeff6aae","g":"fe61f69387dea439","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1170,"y":1840,"wires":[]},{"id":"3cdb9713b79b7b51","type":"function","z":"366d5b2cdeff6aae","g":"fe61f69387dea439","name":"HZVL temperature","func":"return{payload:parseFloat(msg.payload.temp.toFixed(2))};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":950,"y":1840,"wires":[["5c83951a72586df4"]]},{"id":"0517c83c08bd93a6","type":"debug","z":"366d5b2cdeff6aae","g":"fe61f69387dea439","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1170,"y":1920,"wires":[]},{"id":"0c15948b8cd04989","type":"function","z":"366d5b2cdeff6aae","g":"fe61f69387dea439","name":"HZVL max temperature","func":"return{payload:parseFloat(msg.payload.max.toFixed(2))};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":970,"y":1920,"wires":[["0517c83c08bd93a6"]]},{"id":"17e8a3b2a2a1c39e","type":"debug","z":"366d5b2cdeff6aae","g":"fe61f69387dea439","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1290,"y":1960,"wires":[]},{"id":"615a27fcbdbef909","type":"function","z":"366d5b2cdeff6aae","g":"fe61f69387dea439","name":"HZVL timestamp","func":"return{payload:msg.payload.time};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":950,"y":1960,"wires":[["5d06b73a4bed605c"]]},{"id":"515393634e04c5d8","type":"debug","z":"366d5b2cdeff6aae","g":"fe61f69387dea439","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1170,"y":2060,"wires":[]},{"id":"2b659b97f928ae9b","type":"function","z":"366d5b2cdeff6aae","g":"fe61f69387dea439","name":"HZRL min temperature","func":"return{payload:parseFloat(msg.payload.min.toFixed(2))};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":960,"y":2060,"wires":[["515393634e04c5d8"]]},{"id":"683b6a2c3bcd0d09","type":"debug","z":"366d5b2cdeff6aae","g":"fe61f69387dea439","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1170,"y":2020,"wires":[]},{"id":"ffeb87dacfb12f86","type":"function","z":"366d5b2cdeff6aae","g":"fe61f69387dea439","name":"HZRL temperature","func":"return{payload:parseFloat(msg.payload.temp.toFixed(2))};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":950,"y":2020,"wires":[["683b6a2c3bcd0d09"]]},{"id":"e7c419c07817ad26","type":"debug","z":"366d5b2cdeff6aae","g":"fe61f69387dea439","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1170,"y":2100,"wires":[]},{"id":"31caf4a5060d5b98","type":"function","z":"366d5b2cdeff6aae","g":"fe61f69387dea439","name":"HZRL max temperature","func":"return{payload:parseFloat(msg.payload.max.toFixed(2))};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":970,"y":2100,"wires":[["e7c419c07817ad26"]]},{"id":"b9171ea6675ba91b","type":"debug","z":"366d5b2cdeff6aae","g":"fe61f69387dea439","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1290,"y":2140,"wires":[]},{"id":"5339a3f3e25c51e0","type":"function","z":"366d5b2cdeff6aae","g":"fe61f69387dea439","name":"HZRL timestamp","func":"return{payload:msg.payload.time};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":950,"y":2140,"wires":[["6c81d51075ae593c"]]},{"id":"6c81d51075ae593c","type":"moment","z":"366d5b2cdeff6aae","g":"fe61f69387dea439","name":"HH:mm:ss","topic":"","input":"","inputType":"msg","inTz":"Europe/Berlin","adjAmount":0,"adjType":"days","adjDir":"add","format":"HH:mm:ss","locale":"de-DE","output":"","outputType":"msg","outTz":"Europe/Berlin","x":1130,"y":2140,"wires":[["b9171ea6675ba91b"]]},{"id":"5d06b73a4bed605c","type":"moment","z":"366d5b2cdeff6aae","g":"fe61f69387dea439","name":"HH:mm:ss","topic":"","input":"","inputType":"msg","inTz":"Europe/Berlin","adjAmount":0,"adjType":"days","adjDir":"add","format":"HH:mm:ss","locale":"de-DE","output":"","outputType":"msg","outTz":"Europe/Berlin","x":1130,"y":1960,"wires":[["17e8a3b2a2a1c39e"]]},{"id":"79ebfde237f39a5c","type":"switch","z":"366d5b2cdeff6aae","g":"fe61f69387dea439","name":"type router of flow/room 1 ","property":"payload.type","propertyType":"msg","rules":[{"t":"eq","v":"HZVL","vt":"str"},{"t":"eq","v":"HZRL","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":570,"y":1980,"wires":[["3cdb9713b79b7b51","004ef708de3b7b0a","0c15948b8cd04989","615a27fcbdbef909"],["ffeb87dacfb12f86","2b659b97f928ae9b","31caf4a5060d5b98","5339a3f3e25c51e0"]]},{"id":"dd8c9722d9604950","type":"group","z":"366d5b2cdeff6aae","name":"init offsets","style":{"label":true,"color":"#3f3f3f","fill":"#dbcbe7"},"nodes":["9e37fc20403a4344","6a0803562c349453","bd81ee33ac2de25b"],"x":14,"y":1159,"w":432,"h":122},{"id":"9e37fc20403a4344","type":"inject","z":"366d5b2cdeff6aae","g":"dd8c9722d9604950","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payloadType":"date","x":130,"y":1220,"wires":[["6a0803562c349453","bd81ee33ac2de25b"]]},{"id":"6a0803562c349453","type":"change","z":"366d5b2cdeff6aae","g":"dd8c9722d9604950","name":"init offset flow 1","rules":[{"t":"set","p":"room_1","pt":"flow","to":"0.5","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":1200,"wires":[[]]},{"id":"bd81ee33ac2de25b","type":"change","z":"366d5b2cdeff6aae","g":"dd8c9722d9604950","name":"init offset flow 2","rules":[{"t":"set","p":"room_2","pt":"flow","to":"1.2","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":1240,"wires":[[]]},{"id":"84261139ea3212a5","type":"group","z":"366d5b2cdeff6aae","name":"central flow to read sensor input and create temperature object","style":{"fill":"#ffffbf","label":true,"color":"#3f3f3f"},"nodes":["2275c296b562d425","6c342237b64a444e","56b7c4236bd3e5c5","750106e13bb5c7d6","110b3373a3dcc5b9","f48397b85d1dc9c0","3acbdaeaac6955e3","07f587dadfe23ba5","e001e05b04091936","e2e814f20accfd19","3d5f92f395f8dd73","cab2401f0e2b9489","b23be9a020f252e8","6661ab77d2d6753f","dc0f6cf0d1eb21b1","5313f9cbe2172b2b","1ba790a6d2ba0313","ad2257c0fd463c1f","0f2431ce3095d9a8"],"x":14,"y":1319,"w":1402,"h":382},{"id":"2275c296b562d425","type":"mqtt in","z":"366d5b2cdeff6aae","g":"84261139ea3212a5","name":"Sensor 1 data","topic":"home/ug/Buero/unipi/1/temp/2892844D07000012","qos":"0","datatype":"auto","broker":"36a1d46c.15334c","nl":false,"rap":true,"rh":0,"inputs":0,"x":110,"y":1420,"wires":[["1ba790a6d2ba0313"]]},{"id":"6c342237b64a444e","type":"function","z":"366d5b2cdeff6aae","g":"84261139ea3212a5","name":"add sensor data min max to object","func":"if (msg.topic === 'reset'){\n context.set('min',0.0);\n context.set('max',0.0);\n return null;\n}\n\nlet time = Date.now();\nlet temp = parseFloat(msg.payload);\nlet min = context.get('min');\nlet max = context.get('max');\n\nif ((min === 0) && (max === 0)){\n min = temp;\n context.set('min',temp);\n max = temp;\n context.set('max',temp);\n}\nelse {\n if (temp < min){\n min = temp;\n context.set('min',temp);\n }\n if (temp > max){\n max = temp;\n context.set('max',temp);\n }\n}\n\nreturn {'time':time,'temp':temp,'min':min,'max':max};","outputs":1,"noerr":0,"initialize":"// Code added here will be run once\n// whenever the node is started.\nif (context.get(\"min\") === undefined) {\n context.set(\"min\", 0.0)\n}\n\nif (context.get(\"max\") === undefined) {\n context.set(\"max\", 0.0)\n}","finalize":"","libs":[],"x":880,"y":1420,"wires":[["750106e13bb5c7d6"]]},{"id":"56b7c4236bd3e5c5","type":"link out","z":"366d5b2cdeff6aae","g":"84261139ea3212a5","name":"","links":["25b99c24a038658c"],"x":1375,"y":1420,"wires":[]},{"id":"750106e13bb5c7d6","type":"function","z":"366d5b2cdeff6aae","g":"84261139ea3212a5","name":"add flow/room & type to object","func":"let input = msg;\nlet msg1 = {};\nlet msg2 = {};\n\nlet route1 = {'flow':'flow1','type':'HZVL'};\nmsg1.payload = Object.assign(route1, input);\nnode.send(msg1);\n\nlet route2 = {'flow':'flow2','type':'HZVL'};\nmsg2.payload = Object.assign(route2, input);\nnode.send(msg2);\n\n//return [msg1,msg2];\nreturn null;","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1170,"y":1420,"wires":[["56b7c4236bd3e5c5"],["56b7c4236bd3e5c5"]]},{"id":"110b3373a3dcc5b9","type":"trigger","z":"366d5b2cdeff6aae","g":"84261139ea3212a5","name":"time - filter","op1":"","op2":"","op1type":"pay","op2type":"nul","duration":"10","extend":false,"overrideDelay":false,"units":"s","reset":"msg.reset","bytopic":"all","topic":"topic","outputs":1,"x":330,"y":1400,"wires":[[]]},{"id":"f48397b85d1dc9c0","type":"rbe","z":"366d5b2cdeff6aae","g":"84261139ea3212a5","name":"% - filter","func":"deadbandEq","gap":"5","start":"","inout":"out","septopics":false,"property":"payload","topi":"topic","x":320,"y":1440,"wires":[[]]},{"id":"3acbdaeaac6955e3","type":"function","z":"366d5b2cdeff6aae","g":"84261139ea3212a5","name":"sensor offset","func":"let offset = flow.get('room_1');\nmsg.payload = parseFloat(msg.payload) + offset; \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":550,"y":1420,"wires":[["6c342237b64a444e"]]},{"id":"07f587dadfe23ba5","type":"mqtt in","z":"366d5b2cdeff6aae","g":"84261139ea3212a5","name":"Sensor 2 data","topic":"home/ug/Buero/unipi/1/temp/2892844D07000012","qos":"0","datatype":"auto","broker":"36a1d46c.15334c","nl":false,"rap":true,"rh":0,"inputs":0,"x":110,"y":1580,"wires":[["ad2257c0fd463c1f"]]},{"id":"e001e05b04091936","type":"function","z":"366d5b2cdeff6aae","g":"84261139ea3212a5","name":"add sensor data min max to object","func":"if (msg.topic === 'reset'){\n context.set('min',0.0);\n context.set('max',0.0);\n return null;\n}\n\nlet time = Date.now();\nlet temp = parseFloat(msg.payload) + flow.get('HZRL_temp_offset');\nlet min = context.get('min');\nlet max = context.get('max');\n\nif ((min === 0) && (max === 0)){\n min = temp;\n context.set('min',temp);\n max = temp;\n context.set('max',temp);\n}\nelse {\n if (temp < min){\n min = temp;\n context.set('min',temp);\n }\n if (temp > max){\n max = temp;\n context.set('max',temp);\n }\n}\n\nreturn {'time':time,'temp':temp,'min':min,'max':max};","outputs":1,"noerr":0,"initialize":"// Code added here will be run once\n// whenever the node is started.\nif (context.get(\"min\") === undefined) {\n context.set(\"min\", 0.0)\n}\n\nif (context.get(\"max\") === undefined) {\n context.set(\"max\", 0.0)\n}","finalize":"","libs":[],"x":880,"y":1580,"wires":[["3d5f92f395f8dd73"]]},{"id":"e2e814f20accfd19","type":"link out","z":"366d5b2cdeff6aae","g":"84261139ea3212a5","name":"","links":["25b99c24a038658c"],"x":1375,"y":1580,"wires":[]},{"id":"3d5f92f395f8dd73","type":"function","z":"366d5b2cdeff6aae","g":"84261139ea3212a5","name":"add flow/room & type to object","func":"let input = msg;\nlet msg1 = {};\nlet msg2 = {};\n\nlet route1 = {'flow':'flow1','type':'HZRL'};\nmsg1.payload = Object.assign(route1, input);\nnode.send(msg1);\n\nlet route2 = {'flow':'flow2','type':'HZRL'};\nmsg2.payload = Object.assign(route2, input);\nnode.send(msg2);\n\n//return [msg1,msg2];\nreturn null;","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1170,"y":1580,"wires":[["e2e814f20accfd19"],["e2e814f20accfd19"]]},{"id":"cab2401f0e2b9489","type":"trigger","z":"366d5b2cdeff6aae","g":"84261139ea3212a5","name":"time - filter","op1":"","op2":"","op1type":"pay","op2type":"nul","duration":"10","extend":false,"overrideDelay":false,"units":"s","reset":"msg.reset","bytopic":"all","topic":"topic","outputs":1,"x":330,"y":1580,"wires":[[]]},{"id":"b23be9a020f252e8","type":"rbe","z":"366d5b2cdeff6aae","g":"84261139ea3212a5","name":"% - filter","func":"deadbandEq","gap":"5","start":"","inout":"out","septopics":false,"property":"payload","topi":"topic","x":320,"y":1620,"wires":[[]]},{"id":"6661ab77d2d6753f","type":"function","z":"366d5b2cdeff6aae","g":"84261139ea3212a5","name":"sensor offset","func":"let offset = flow.get('room_2');\nmsg.payload = parseFloat(msg.payload) + offset; \nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":550,"y":1580,"wires":[["e001e05b04091936"]]},{"id":"dc0f6cf0d1eb21b1","type":"inject","z":"366d5b2cdeff6aae","g":"84261139ea3212a5","name":"reset at midnight","props":[{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 00 * * *","once":false,"onceDelay":0.1,"topic":"reset","x":590,"y":1500,"wires":[["e001e05b04091936","6c342237b64a444e"]]},{"id":"5313f9cbe2172b2b","type":"switch","z":"366d5b2cdeff6aae","g":"84261139ea3212a5","name":"!= previous value","property":"payload","propertyType":"msg","rules":[{"t":"neq","v":"","vt":"prev"}],"checkall":"true","repair":false,"outputs":1,"x":350,"y":1480,"wires":[[]]},{"id":"1ba790a6d2ba0313","type":"function","z":"366d5b2cdeff6aae","g":"84261139ea3212a5","name":"no filter","func":"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":320,"y":1360,"wires":[["3acbdaeaac6955e3"]]},{"id":"ad2257c0fd463c1f","type":"function","z":"366d5b2cdeff6aae","g":"84261139ea3212a5","name":"no filter","func":"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":320,"y":1540,"wires":[["6661ab77d2d6753f"]]},{"id":"0f2431ce3095d9a8","type":"switch","z":"366d5b2cdeff6aae","g":"84261139ea3212a5","name":"!= previous value","property":"payload","propertyType":"msg","rules":[{"t":"neq","v":"","vt":"prev"}],"checkall":"true","repair":false,"outputs":1,"x":350,"y":1660,"wires":[[]]},{"id":"36a1d46c.15334c","type":"mqtt-broker","broker":"10.0.0.43","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","willTopic":"","willQos":"0","willPayload":""}]