[{"id":"5aee24b0dc09f867","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"4ddcb7b43fc65a98","type":"inject","z":"5aee24b0dc09f867","name":"8:00 Uhr 20 soll","props":[{"p":"payload"}],"repeat":"","crontab":"00 08 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"25.00","payloadType":"str","x":250,"y":820,"wires":[["108822392f65c0b7"]]},{"id":"fa366c2603c523fc","type":"inject","z":"5aee24b0dc09f867","name":"9:00 Uhr 15 soll","props":[{"p":"payload"}],"repeat":"","crontab":"00 09 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"15.00","payloadType":"str","x":250,"y":860,"wires":[["108822392f65c0b7"]]},{"id":"d0214d6bc2f36054","type":"ui_chart","z":"5aee24b0dc09f867","name":"soll-ist-aussen chart","group":"8d760e8097c25308","order":1,"width":21,"height":12,"label":"EGWZ - Room Manager & Thermostat","chartType":"line","legend":"true","xformat":"HH:mm","interpolate":"linear","nodata":"waiting for data","dot":false,"ymin":"","ymax":"","removeOlder":"24","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#ffeb0f","#f21f07","#0fcfff","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"className":"","x":1460,"y":720,"wires":[[]]},{"id":"8f4cebabf63447e2","type":"function","z":"5aee24b0dc09f867","name":"one node room manager","func":"// Version 1.0.1, 02.04.2022, e-mail johannes@untiedt.net\n//\nconst messages = new Array(node.outputCount);\nlet data = msg.payload;\nlet datasource = {\"device\":data.device, \"devicetech\":data.devicetech,\"devicetype\":data.devicetype, \"devicefunction\":data.devicefunction, \"devicevalue\":data.devicevalue};\nnode_send(datasource,context.get('out_datasource'));\n//debug(\"debugtext\");\nswitch (data.device){\n case \"system\":\n //node_send({\"datadevice\":data.device},context.get('out_debug'));\n switch(data.devicetech){\n case \"init\":\n //node_send({\"data.devicetech\":data.devicetech},context.get('out_debug'));\n node_send({\"payload\":\"Heizung aus\"},context.get('out_regler_status'));\n node_send({\"payload\":runtime_str(0)},context.get('out_heater_totalruntimestring')); \n reset_runtime();\n switch(data.devicetype){\n case \"chart\":\n //node_send({\"data.devicefunction\":data.devicefunction},context.get('out_debug')); \n switch(data.devicefunction){\n case \"soll_ist_aussen\":\n context.set('soll', 0.00);\n node_send({\"topic\":\"soll\",\"payload\":0.0},context.get('out_soll_ist_aussen_chart'));\n node_send({\"topic\":\"soll\",\"payload\":0.0},context.get('out_soll')); \n node_send({\"topic\":\"ist\",\"payload\":0.0},context.get('out_soll_ist_aussen_chart'));\n context.set('ist',0.00);\n context.set('aussen',0.00);\n node_send({\"topic\":\"aussen\",\"payload\":0.0},context.get('out_soll_ist_aussen_chart'));\n node_send({\"topic\":\"aussen\",\"payload\":0.0},context.get('out_aussen'));\n node_send({\"topic\":\"aussen\",\"payload\":0.0},context.get('out_delta')); \n break;\n case \"humidity_ist\":\n context.set('humidity',0.00);\n node_send({\"topic\":\"hum\",\"payload\":0.0},context.get('out_humidity')); \n //node_send({\"topic\":\"ist\",\"payload\":0.0},context.get('out_debug'));\n break; \n default:\n return null;\n }\n break;\n default:\n return null;\n }\n break;\n case \"reset\":\n //node_send({\"data.devicetech\":data.devicetech},context.get('out_debug'));\n switch(data.devicetype){\n case \"chart\":\n //node_send({\"data.devicefunction\":data.devicefunction},context.get('out_debug')); \n switch(data.devicefunction){\n case \"soll_ist_aussen\":\n node_send({\"payload\":[]},context.get('out_soll_ist_aussen_chart'));\n node_send({\"payload\":\"0.0\"},context.get('out_soll_gauge')); \n node_send({\"payload\":\"0.0\"},context.get('out_ist_gauge'));\n node_send({\"payload\":\"0.0\"},context.get('out_aussen_gauge')); \n break;\n case \"humidity_ist\":\n node_send({\"topic\":\"hum\"},context.get('out_debug')); \n node_send({\"topic\":\"ist\"},context.get('out_debug'));\n break; \n default:\n return null;\n }\n break;\n default:\n return null;\n }\n break; \n case \"set\":\n //node_send({\"data.devicetech\":data.devicetech},context.get('out_debug'));\n switch(data.devicetype){\n case \"soll\":\n context.set(\"location\", data.location);\n if (context.get('soll') === 0.0){\n context.set(\"ist\", data.devicevalue);\n node_send({\"topic\":\"ist\",\"payload\":\"0.0\"},context.get('out_soll_ist_aussen_chart'));\n node_send({\"topic\":\"ist\",\"payload\":context.get('ist')},context.get('out_soll_ist_aussen_chart')); \n node_send({\"topic\":\"ist\",\"payload\":context.get('ist')},context.get('out_ist'));\n node_send({\"topic\":\"ist\",\"payload\":context.get('ist')},context.get('out_ist_gauge'));\n }\n context.set(\"soll\", data.devicevalue);\n context.set(\"soll_time\",data.devicetimestring);\n node_send({\"payload\":data.location},context.get('out_location'));\n node_send({\"payload\":data.devicevalue},context.get('out_soll'));\n node_send({\"payload\":data.devicemin},context.get('out_soll_min'));\n node_send({\"payload\":data.devicemax},context.get('out_soll_max')); \n node_send({\"payload\":data.devicevalue},context.get('out_soll_gauge'));\n node_send({\"topic\":\"ist\",\"payload\":context.get('ist')},context.get('out_soll_ist_aussen_chart')); \n node_send({\"topic\":data.devicetype,\"payload\":context.get('soll_previous')},context.get('out_soll_ist_aussen_chart'));\n node_send({\"topic\":data.devicetype,\"payload\":data.devicevalue},context.get('out_soll_ist_aussen_chart'));\n context.set('soll_previous',data.devicevalue);\n node_send({\"topic\":\"ist\",\"payload\":context.get('ist')},context.get('out_soll_ist_aussen_chart'));\n //node_send({\"topic\":\"ist\",\"payload\":context.get('ist')},context.get('out_ist_gauge')); \n node_send({\"topic\":\"aussen\",\"payload\":context.get('aussen')},context.get('out_soll_ist_aussen_chart'));\n node_send({\"payload\":Number.parseFloat(context.get('ist')-context.get('soll')).toFixed(2)},context.get('out_delta')); \n node_send({\"payload\":Number.parseFloat(context.get('ist')-context.get('soll')).toFixed(2)},context.get('out_delta_gauge')); \n node_send({\"payload\":data.devicetimestring},context.get('out_soll_time'));\n regler();\n break; \n case \"hys\":\n context.set('hys_on',data.devicevalue.hys_on);\n context.set('hys_off',data.devicevalue.hys_off); \n break; \n default:\n return null \n }\n break;\n default:\n return null;\n }\n break;\n default:\n return null;\n \n case \"sensor\":\n switch (data.devicefunction){\n case \"aussen\": \n context.set(\"location\", data.location);\n context.set(\"aussen\", data.devicevalue);\n context.set(\"aussen_time\",data.sensortimestring) \n node_send({\"payload\":data.location},context.get('out_location'));\n node_send({\"payload\":data.devicevalue},context.get('out_aussen'));\n node_send({\"payload\":data.devicemin},context.get('out_aussen_min'));\n node_send({\"payload\":data.devicemax},context.get('out_aussen_max'));\n node_send({\"payload\":data.devicemax},context.get('out_aussen_time')); \n node_send({\"payload\":data.devicevalue},context.get('out_aussen_gauge'));\n node_send({\"topic\":\"ist\",\"payload\":context.get('ist')},context.get('out_soll_ist_aussen_chart')); \n node_send({\"topic\":\"soll\",\"payload\":context.get('soll')},context.get('out_soll_ist_aussen_chart')); \n node_send({\"topic\":data.devicefunction,\"payload\":data.devicevalue},context.get('out_soll_ist_aussen_chart'));\n node_send({\"payload\":data.devicetimestring},context.get('out_aussen_time')); \n break; \n case \"ist\": \n context.set(\"location\", data.location);\n context.set(\"ist\", data.devicevalue);\n context.set(\"ist_time\",data.sensortimestring) \n node_send({\"payload\":data.location},context.get('out_location'));\n node_send({\"payload\":data.devicevalue},context.get('out_ist'));\n node_send({\"payload\":data.devicemin},context.get('out_ist_min'));\n node_send({\"payload\":data.devicemax},context.get('out_ist_max')); \n node_send({\"payload\":data.devicevalue},context.get('out_ist_gauge'));\n node_send({\"topic\":\"soll\",\"payload\":context.get('soll')},context.get('out_soll_ist_aussen_chart')); \n node_send({\"topic\":data.devicefunction,\"payload\":data.devicevalue},context.get('out_soll_ist_aussen_chart'));\n node_send({\"topic\":\"aussen\",\"payload\":context.get('aussen')},context.get('out_soll_ist_aussen_chart'));\n node_send({\"payload\":data.devicetimestring},context.get('out_ist_time')); \n let delta = Number.parseFloat(context.get('ist')-context.get('soll')).toFixed(2);\n node_send({\"payload\":delta},context.get('out_delta'));\n node_send({\"payload\":delta},context.get('out_delta_gauge')); \n delta = minmax(delta);\n //node_send({\"payload\":minmax(delta)},context.get('out_debug')); \n node_send({\"payload\":delta.deltamin},context.get('out_delta_min'));\n node_send({\"payload\":delta.deltamax},context.get('out_delta_max'));\n node_send({\"payload\":date_time_string(\"hm\",Date.now())},context.get('out_delta_time'));\n regler();\n break;\n case \"humidity\": \n context.set(\"location\", data.location);\n context.set(\"humidity\", data.devicevalue);\n context.set(\"humidity_time\",data.sensortimestring) \n node_send({\"payload\":data.location},context.get('out_location'));\n node_send({\"payload\":data.devicevalue},context.get('out_humidity'));\n node_send({\"payload\":data.devicemin},context.get('out_humidity_min'));\n node_send({\"payload\":data.devicemax},context.get('out_humidity_max')); \n node_send({\"payload\":data.devicevalue},context.get('out_humidity_gauge'));\n node_send({\"topic\":\"ist\",\"payload\":context.get('ist')},context.get('out_aussen_humidity_chart')); \n node_send({\"payload\":data.devicetimestring},context.get('out_humidity_time')); \n break;\n case \"pressure\": \n context.set(\"location\", data.location);\n context.set(\"pressure\", data.devicevalue);\n context.set(\"pressure_time\",data.sensortimestring) \n node_send({\"payload\":data.location},context.get('out_location'));\n node_send({\"payload\":data.devicevalue},context.get('out_pressure'));\n node_send({\"payload\":data.devicemin},context.get('out_pressure_min'));\n node_send({\"payload\":data.devicemax},context.get('out_pressure_max')); \n node_send({\"payload\":data.devicevalue},context.get('out_pressure_gauge'));\n node_send({\"topic\":\"ist\",\"payload\":context.get('ist')},context.get('out_pressure_chart')); \n node_send({\"payload\":data.devicetimestring},context.get('out_pressure_time')); \n break;\n case \"co2\": \n context.set(\"location\", data.location);\n context.set(\"co2\", data.devicevalue);\n context.set(\"co2_time\",data.sensortimestring) \n node_send({\"payload\":data.location},context.get('out_location'));\n node_send({\"payload\":data.devicevalue},context.get('out_co2'));\n node_send({\"payload\":data.devicemin},context.get('out_co2_min'));\n node_send({\"payload\":data.devicemax},context.get('out_co2_max')); \n node_send({\"payload\":data.devicevalue},context.get('out_co2_gauge'));\n node_send({\"topic\":\"ist\",\"payload\":context.get('ist')},context.get('out_co2_chart')); \n node_send({\"payload\":data.devicetimestring},context.get('out_co2_time')); \n break; \n default:\n return null;\n }\n break;\n case \"switch\":\n switch (data.devicetech){\n case \"auxiliaryheater\":\n context.set(\"location\", data.location);\n node_send({\"payload\":data.devicevalue},context.get('out_auxiliaryheater'));\n if (data.devicevalue === \"on\"){\n node_send({\"payload\":date_time_string(\"dayhm\", data.devicetimestamp)},context.get('out_auxiliaryheater_ontimestring')); \n }\n else if (data.devicevalue === \"off\"){\n node_send({\"payload\":date_time_string(\"dayhm\", data.devicetimestamp)},context.get('out_auxiliaryheater_offtimestring')); \n } \n break; \n case \"window\":\n context.set(\"location\", data.location); \n node_send({\"payload\":data.devicevalue},context.get('out_window'));\n if (data.devicevalue === \"open\"){\n node_send({\"payload\":date_time_string(\"dayhm\", data.devicetimestamp)},context.get('out_window_opentimestring')); \n }\n else if (data.devicevalue === \"closed\"){\n node_send({\"payload\":date_time_string(\"dayhm\", data.devicetimestamp)},context.get('out_window_closetimestring')); \n } \n break;\n default:\n return null;\n }\n break; \n} \nreturn null;\n\nfunction regler(){\n let rtime = Date.now();\n if (context.get('ist') >= (context.get('soll') + context.get('hys_on'))){\n let t = date_time_string(\"dayhm\", rtime) + \" | \" + \"off \" + \" | \" + context.get('soll') + \" | \" + context.get('ist').toFixed(2);\n node.status({fill:\"blue\",shape:\"ring\",text:t});\n node_send({\"payload\":{\"location\":context.get('location'),\"switch\":\"off\"}},context.get('out_thermostat'));\n timefilter(\"off\");\n }\n else if (context.get('ist') <= (context.get('soll')-context.get('hys_on'))){\n let t = date_time_string(\"dayhm\", rtime) + \" | \" + \"on \" + \" | \" + context.get('soll') + \" | \" + context.get('ist').toFixed(2);\n node.status({fill:\"red\",shape:\"ring\",text:t});\n node_send({\"payload\":{\"location\":context.get('location'),\"switch\":\"on\"}},context.get('out_thermostat'));\n timefilter(\"on\");\n }\n else {\n node_send({\"location\":context.get('location'),\"switch\":\"Regler NoOp\"},context.get('out_thermostat')); \n }\n}\nreturn null;\n\n//-------------------------------------\n\nfunction debug(message){\n node_send(message,context.get('out-debug')); \n}\n\n//-------------------------------------\n\nfunction node_send(value, port){\n messages[port] = value;\n node.send(messages);\n messages[port] = null; \n}\n\n//-------------------------------------------\n\nfunction date_time_string(type,time){\n let date =new Date(time);\n let year = date.getFullYear();\n let month = (\"0\" + (date.getMonth() + 1)).slice(-2);\n let day = (\"0\" + date.getDate()).slice(-2);\n let hours = (\"0\" + date.getHours()).slice(-2);\n let minutes = (\"0\" + date.getMinutes()).slice(-2);\n let seconds = (\"0\" + date.getSeconds()).slice(-2);\n let datetimestring = \"\";\n switch(type) {\n case \"full\":\n datetimestring = day + \"-\" + month + \"-\" + year + \" \" + hours + ':' + minutes + ':' + seconds; \n break\n case \"dayhm\":\n datetimestring = day + \"-\" + month + \" @ \" + hours + ':' + minutes; \n break \n case \"hm\": \n datetimestring = hours + ':' + minutes; \n break\n case \"hms\":\n datetimestring = hours + ':' + minutes + ':' + seconds; \n break;\n default:\n datetimestring = null; \n }\n return datetimestring;\n} \n\n//-------------------------------------------\n\nfunction minmax(value){\n let x = parseFloat(value);\n let min = context.get('min');\n let max = context.get('max');\n\n if ((min === 0) && (max === 0)){\n min = x;\n context.set('min',x);\n max = x;\n context.set('max',x);\n }\n else {\n if (x < min){\n min = x;\n context.set('min',x);\n }\n if (x > max){\n max = x;\n context.set('max',x);\n }\n }\n return {'deltamin':min,'deltamax':max};\n}\n\n//-------------------------------------------\n\nfunction timefilter(status){\n //node_send({\"payload\":\"timefilter\"},context.get('out_debug')); \n if ((context.get(\"statusfilter\") === \"off\") && (status === \"off\")){\n return null;\n }\n else if ((context.get(\"statusfilter\") === \"on\") && (status === \"on\")){\n return null;\n }\n else if ((context.get(\"statusfilter\") === \"on\") && (status === \"off\")){\n context.set(\"endtime\",Date.now());\n node_send({\"payload\":date_time_string(\"dayhm\", Date.now())},context.get('out_thermostat_offtime')); \n context.set(\"statusfilter\",\"off\");\n runtime();\n } \n else if ((context.get(\"statusfilter\") === \"off\") && (status === \"on\")){\n context.set(\"starttime\",Date.now());\n node_send({\"payload\":date_time_string(\"dayhm\", Date.now())},context.get('out_thermostat_offtime'));\n context.set(\"statusfilter\",\"on\"); \n }\n}\n\n//-------------------------------------------\n\nfunction runtime(){\n if(context.get('starttime')=== 0){\n return;\n }\n let rt = context.get('endtime') - context.get('starttime');\n node_send({\"payload\":rt},context.get('out_heaterruntime'));\n node_send({\"payload\":runtime_str(rt)},context.get('out_heaterruntimestring')); \n context.set('runtime',rt);\n node_send({\"payload\":rt},context.get('out_runtime'));\n let trt = context.get('totalruntime');\n trt = trt + rt;\n context.set('totalruntime',trt);\n node_send({\"payload\":trt},context.get('out_runtimetotal'));\n node_send({\"payload\":runtime_str(trt)},context.get('out_heater_totalruntimestring')); \n}\n \n// HH:MM:SS --------------------------------\n\nfunction runtime_str(ms){\n let t = ms / 1000;\n let h = (Math.floor(t / 3600)).toString();\n let m = (Math.floor(t%3600 / 60)).toString();\n let s = (Math.floor(t%3600 % 60)).toString();\n let r = h + \":\" + (\"0\" + m).slice(-2) + \":\" + (\"0\" + s).slice(-2);\n return r; \n}\n\n//-------------------------------------------\n\nfunction reset_runtime(){\n context.set(\"starttime\",0);\n context.set(\"endtime\",0);\n context.set(\"runtime\",0);\n context.set(\"totalruntime\",0);\n} \n\n//-------------------------------------------","outputs":54,"noerr":0,"initialize":"// Code added here will be run once\n// whenever the node is started.\n//\n// port definition:\ncontext.set('out_location',0);\ncontext.set('out_aussen',1);\ncontext.set('out_aussen_min',2);\ncontext.set('out_aussen_max',3);\ncontext.set('out_aussen_time',4);\ncontext.set('out_aussen_gauge',5);\ncontext.set('out_soll',6);\ncontext.set('out_soll_min',7);\ncontext.set('out_soll_max',8);\ncontext.set('out_soll_time',9);\ncontext.set('out_soll_gauge',10);\ncontext.set('out_ist',11);\ncontext.set('out_ist_min',12);\ncontext.set('out_ist_max',13);\ncontext.set('out_ist_time',14);\ncontext.set('out_ist_gauge',15);\ncontext.set('out_soll_ist_aussen_chart',16);\ncontext.set('out_delta',17);\ncontext.set('out_delta_min',18);\ncontext.set('out_delta_max',19);\ncontext.set('out_delta_time',20)\ncontext.set('out_delta_gauge',21);\ncontext.set('out_thermostat',22);\ncontext.set('out_thermostat_ontime',23);\ncontext.set('out_thermostat_offtime',24);\ncontext.set('out_heater_runtime',25);\ncontext.set('out_heater_runtimestring',26);\ncontext.set('out_heater_totalruntimestring',27);\ncontext.set('out_auxiliaryheater',28);\ncontext.set('out_auxiliaryheater_ontimestring',29);\ncontext.set('out_auxiliaryheater_offtimestring',30);\ncontext.set('out_window',31);\ncontext.set('out_window_opentimestring',32);\ncontext.set('out_window_closetimestring',33);\ncontext.set('out_humidity',34);\ncontext.set('out_humidity_min',35);\ncontext.set('out_humidity_max',36);\ncontext.set('out_humidity_time',37);\ncontext.set('out_humidity_gauge',38);\ncontext.set('out_humidity_ist_chart',39);\ncontext.set('out_pressure',40);\ncontext.set('out_pressure_min',41);\ncontext.set('out_pressure_max',42);\ncontext.set('out_pressure_time',43);\ncontext.set('out_pressure_gauge',44);\ncontext.set('out_pressure_chart',45);\ncontext.set('out_co2',46);\ncontext.set('out_co2_min',47);\ncontext.set('out_co2_max',48);\ncontext.set('out_co2_time',49);\ncontext.set('out_co2_gauge',50);\ncontext.set('out_co2_chart',51);\ncontext.set('out_datasource',52);\ncontext.set('out_debug',53);\n\n//-----------------------------\n\ncontext.set(\"soll_previous\",0.0);\ncontext.set(\"soll\",0.0);\ncontext.set(\"ist\",0.0);\ncontext.set(\"aussen\",0.0);\ncontext.set('pressure',0.0);\ncontext.set('co2',0.0);\n\n//-----------------------------\n\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}\n\n//-----------------------------\n\ncontext.set(\"statusfilter\",\"off\"); \ncontext.set(\"starttime\",0);\ncontext.set(\"endtime\",0);\ncontext.set(\"runtime\",0);\ncontext.set(\"totalruntime\",0);\n\n//-----------------------------\n","finalize":"","libs":[],"x":1030,"y":1120,"wires":[["2a0c1dabda522795"],["b451a57f7ec382fe"],["ae1af1b5f85f4a1e"],["68ed4ac87b8fc201"],["5ecfcec66a0bc190"],["ef209501af0c6194"],["95c5ec5c60379978"],["99bd2991f934bb1b"],["07231bbc9b90edce"],["8dbb22a6946fbd37"],["3d59338fd25c7f83"],["c7aa5d87a56dd860"],["69a17e979d2d0ce8"],["57d8d237396b75e7"],["a78a25bef97d8f02"],["e51f56d47f516027"],["d0214d6bc2f36054"],["65847bf96b933824"],["019a03d59f2a0240"],["b0239909121b379d"],["099e23a72aef1043"],["27f4b1dd4a22bb55"],["83d5de0417e71850"],["9792bb9e1ad4f32b"],["dcc38100b33b82f8"],["f0552bac8063a37a"],["6f1ea433dd311e1a"],["ff262e2d5d2d9d28"],["dcd1c931fc062e65"],["73f39992ba580d31"],["752a72a534dd4133"],["729db3df5f4960f9"],["cd2a79f9bf0f0d2c"],["bdfe4711b8c31872"],["f5293007cef97533"],["b6667d7520b93246"],["5636fa0926e0ec9e"],["07cd0c6cf3cb6720"],["3a658b69353a06b0"],["70b1c7d70b0adaed"],["f889a7deaad2b475"],["5b9b30815bb1e7d2"],["d4bf60033a8ec7af"],["a948787518968916"],["a4555e054f47aebe"],["0f45dc5b25a413ab"],["1828f86e4c87d27f"],["2dd8cf7bf7abf670"],["dad2871fa4f1259f"],["5b2975cddc9738c1"],["7590e929a852132d"],["9f097c8081f4c995"],["f168a461b577fa07"],["92b97666693639a8"]],"inputLabels":["data"],"outputLabels":["location","aussen","aussen-min","aussen_max","aussen_time","aussen_gauge","soll","soll_min","soll_max","soll_time","soll_gauge","ist","ist_min","ist_max","ist_time","ist_gauge","soll_ist_aussen_chart","delta","delta_min","delta_max","delta_time","delta_gauge","thermostat","thermostat_ontime","thermostat_offtime","heater_runtime","heater_runtimestring","heater_totalruntimestring","auxiliaryheater","auxiliaryheater_ontimestring","auxiliaryheater_offtimestring","window","window_ontimestring","window_offtimestring","humidity","humidity_min","humidity_max","humidity_time","humidity_gauge","humidity_chart","pressure","pressure_min","pressure_max","pressure_time","pressure_gauge","pressure_chart","co2","co2_min","co2_max","co2_time","co2_gauge","co2_chart","datasource","debug"]},{"id":"2a0c1dabda522795","type":"debug","z":"5aee24b0dc09f867","name":"location","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1420,"y":80,"wires":[]},{"id":"f168a461b577fa07","type":"debug","z":"5aee24b0dc09f867","name":"datasource","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1430,"y":2160,"wires":[]},{"id":"70b1c7d70b0adaed","type":"debug","z":"5aee24b0dc09f867","name":"humidity chart","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1440,"y":1640,"wires":[]},{"id":"729db3df5f4960f9","type":"debug","z":"5aee24b0dc09f867","name":"window","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1420,"y":1320,"wires":[]},{"id":"f0552bac8063a37a","type":"debug","z":"5aee24b0dc09f867","name":"heater runtime","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1440,"y":1080,"wires":[]},{"id":"92b97666693639a8","type":"debug","z":"5aee24b0dc09f867","name":"debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1410,"y":2200,"wires":[]},{"id":"eaa4911cb7e98277","type":"function","z":"5aee24b0dc09f867","name":"init-soll-ist-aussen-chart","func":"if ('reset' in msg){\n context.set('min',0.0);\n context.set('max',0.0);\n return null;\n}\n\n//-------------------------------------------\n\nlet time = Date.now();\n// the next 5 lines to be edited per sensor\nlet timestring = date_time_string(\"hm\",time); // Format full, dayhm, hm, hms\nlet location = \"EGWZ\";\nlet device = \"system\";\nlet devicetech = \"init\";\nlet devicetype = \"chart\"\nlet devicefunction = \"soll_ist_aussen\";\n\n//let sensoroffset = flow.get('sensoroffset_DGWZ');\nlet deviceoffset = 0.0;\n//\nlet devicerawvalue = parseFloat(msg.payload);\nlet devicevalue = devicerawvalue + deviceoffset;\nlet deviceobject = {\"location\":location,\n \"device\":device,\n \"devicetech\":devicetech,\n \"devicetype\":devicetype,\n \"devicefunction\":devicefunction,\n \"devicetimestamp\":time,\n \"devicetimestring\":timestring,\n \"devicerawvalue\":null,\n \"deviceoffset\":null,\n \"devicevalue\":null}; \nmsg.payload = deviceobject;\nreturn msg;\n\n//-------------------------------------------\n\nfunction date_time_string(type,time){\n let date =new Date(time);\n let year = date.getFullYear();\n let month = (\"0\" + (date.getMonth() + 1)).slice(-2);\n let day = (\"0\" + date.getDate()).slice(-2);\n let hours = (\"0\" + date.getHours()).slice(-2);\n let minutes = (\"0\" + date.getMinutes()).slice(-2);\n let seconds = (\"0\" + date.getSeconds()).slice(-2);\n let datetimestring = \"\";\n switch(type) {\n case \"full\":\n datetimestring = day + \"-\" + month + \"-\" + year + \" \" + hours + ':' + minutes + ':' + seconds; \n break\n case \"dayhm\":\n datetimestring = day + \"-\" + month + \" @ \" + hours + ':' + minutes; \n break \n case \"hm\": \n datetimestring = hours + ':' + minutes; \n break\n case \"hms\":\n datetimestring = hours + ':' + minutes + ':' + seconds; \n break;\n default:\n datetimestring = null; \n }\n return datetimestring;\n} \n//-------------------------------------------\n","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":550,"y":640,"wires":[["019cfc66544b90f2"]]},{"id":"dcd1c931fc062e65","type":"debug","z":"5aee24b0dc09f867","name":"auxiliary heater","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1440,"y":1200,"wires":[]},{"id":"c36664c8bad3ac7b","type":"function","z":"5aee24b0dc09f867","name":"init-humidity-ist-chart","func":"if ('reset' in msg){\n context.set('min',0.0);\n context.set('max',0.0);\n return null;\n}\n\n//-------------------------------------------\n\nlet time = Date.now();\n// the next 5 lines to be edited per sensor\nlet timestring = date_time_string(\"hm\",time); // Format full, dayhm, hm, hms\nlet location = \"EGWZ\";\nlet device = \"system\";\nlet devicetech = \"init\";\nlet devicetype = \"chart\"\nlet devicefunction = \"humidity_ist\";\n\n//let sensoroffset = flow.get('sensoroffset_DGWZ');\nlet deviceoffset = 0.0;\n//\nlet devicerawvalue = parseFloat(msg.payload);\nlet devicevalue = devicerawvalue + deviceoffset;\nlet deviceobject = {\"location\":location,\n \"device\":device,\n \"devicetech\":devicetech,\n \"devicetype\":devicetype,\n \"devicefunction\":devicefunction,\n \"devicetimestamp\":time,\n \"devicetimestring\":timestring};\n \nmsg.payload = deviceobject;\nreturn msg;\n\n//-------------------------------------------\n\nfunction date_time_string(type,time){\n let date =new Date(time);\n let year = date.getFullYear();\n let month = (\"0\" + (date.getMonth() + 1)).slice(-2);\n let day = (\"0\" + date.getDate()).slice(-2);\n let hours = (\"0\" + date.getHours()).slice(-2);\n let minutes = (\"0\" + date.getMinutes()).slice(-2);\n let seconds = (\"0\" + date.getSeconds()).slice(-2);\n let datetimestring = \"\";\n switch(type) {\n case \"full\":\n datetimestring = day + \"-\" + month + \"-\" + year + \" \" + hours + ':' + minutes + ':' + seconds; \n break\n case \"dayhm\":\n datetimestring = day + \"-\" + month + \" @ \" + hours + ':' + minutes; \n break \n case \"hm\": \n datetimestring = hours + ':' + minutes; \n break\n case \"hms\":\n datetimestring = hours + ':' + minutes + ':' + seconds; \n break;\n default:\n datetimestring = null; \n }\n return datetimestring;\n} \n//-------------------------------------------\n","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":560,"y":680,"wires":[["019cfc66544b90f2"]]},{"id":"108822392f65c0b7","type":"function","z":"5aee24b0dc09f867","name":"systemobject-set-soll","func":"if ('reset' in msg){\n context.set('min',0.0);\n context.set('max',0.0);\n return null;\n}\n\n//-------------------------------------------\n\nlet time = Date.now();\n// the next 5 lines to be edited per sensor\nlet timestring = date_time_string(\"hm\",time); // Format full, dayhm, hm, hms\nlet location = \"EGWZ\";\nlet device = \"system\";\nlet devicetech = \"set\";\nlet devicetype = \"soll\"\nlet devicefunction = \"soll\";\n\n//let sensoroffset = flow.get('sensoroffset_DGWZ');\nlet deviceoffset = 0.0;\n//\nlet devicerawvalue = Number.parseFloat(msg.payload).toFixed(2);\nlet devicevalue = Number(devicerawvalue + deviceoffset);\nlet deviceobject = {\"location\":location,\n \"device\":device,\n \"devicetech\":devicetech,\n \"devicetype\":devicetype,\n \"devicefunction\":devicefunction,\n \"devicetimestamp\":time,\n \"devicetimestring\":timestring,\n \"devicevalue\":devicevalue}; \nminmaxobject = minmax(devicevalue);\nmsg.payload = Object.assign(deviceobject, minmaxobject);\nlet t = date_time_string(\"dayhm\",time) + \" | \" + \"ist \" + devicevalue;\nnode.status({fill:\"red\",shape:\"ring\",text:t});\nreturn msg;\n\n//-------------------------------------------\n\nfunction minmax(value){\n let x = parseFloat(value);\n let min = context.get('min');\n let max = context.get('max');\n\n if ((min === 0) && (max === 0)){\n min = x;\n context.set('min',x);\n max = x;\n context.set('max',x);\n }\n else {\n if (x < min){\n min = x;\n context.set('min',x);\n }\n if (x > max){\n max = x;\n context.set('max',x);\n }\n }\n return {'devicemin':min,'devicemax':max};\n}\n\n//-------------------------------------------\n//-------------------------------------------\n\nfunction date_time_string(type,time){\n let date =new Date(time);\n let year = date.getFullYear();\n let month = (\"0\" + (date.getMonth() + 1)).slice(-2);\n let day = (\"0\" + date.getDate()).slice(-2);\n let hours = (\"0\" + date.getHours()).slice(-2);\n let minutes = (\"0\" + date.getMinutes()).slice(-2);\n let seconds = (\"0\" + date.getSeconds()).slice(-2);\n let datetimestring = \"\";\n switch(type) {\n case \"full\":\n datetimestring = day + \"-\" + month + \"-\" + year + \" \" + hours + ':' + minutes + ':' + seconds; \n break\n case \"dayhm\":\n datetimestring = day + \"-\" + month + \" @ \" + hours + ':' + minutes; \n break \n case \"hm\": \n datetimestring = hours + ':' + minutes; \n break\n case \"hms\":\n datetimestring = hours + ':' + minutes + ':' + seconds; \n break;\n default:\n datetimestring = null; \n }\n return datetimestring;\n} \n//-------------------------------------------\n","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":560,"y":840,"wires":[["019cfc66544b90f2","8e18ba1e0f05fe60"]]},{"id":"019cfc66544b90f2","type":"switch","z":"5aee24b0dc09f867","name":"","property":"payload.location","propertyType":"msg","rules":[{"t":"eq","v":"EGWZ","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":830,"y":1120,"wires":[["8f4cebabf63447e2"]]},{"id":"14673c6c59737c7f","type":"function","z":"5aee24b0dc09f867","name":"systemobject-set-hysterisis","func":"\nlet time = Date.now();\n// the next 5 lines to be edited per sensor\nlet timestring = date_time_string(\"hm\",time); // Format full, dayhm, hm, hms\nlet location = \"EGWZ\";\nlet device = \"system\";\nlet devicetech = \"set\";\nlet devicetype = \"hys\"\nlet devicefunction = \"\";\nlet devicevalue = {\"hys_off\":0.1,\"hys_on\":-0.1};\n\n//let sensoroffset = flow.get('sensoroffset_DGWZ');\n\nlet deviceobject = {\"location\":location,\n \"device\":device,\n \"devicetech\":devicetech,\n \"devicetype\":devicetype,\n \"devicefunction\":devicefunction,\n \"devicetimestamp\":time,\n \"devicetimestring\":timestring,\n \"devicevalue\":devicevalue};\nmsg.payload = deviceobject;\nreturn msg;\n\n//-------------------------------------------\n\nfunction date_time_string(type,time){\n let date =new Date(time);\n let year = date.getFullYear();\n let month = (\"0\" + (date.getMonth() + 1)).slice(-2);\n let day = (\"0\" + date.getDate()).slice(-2);\n let hours = (\"0\" + date.getHours()).slice(-2);\n let minutes = (\"0\" + date.getMinutes()).slice(-2);\n let seconds = (\"0\" + date.getSeconds()).slice(-2);\n let datetimestring = \"\";\n switch(type) {\n case \"full\":\n datetimestring = day + \"-\" + month + \"-\" + year + \" \" + hours + ':' + minutes + ':' + seconds; \n break\n case \"dayhm\":\n datetimestring = day + \"-\" + month + \" @ \" + hours + ':' + minutes; \n break \n case \"hm\": \n datetimestring = hours + ':' + minutes; \n break\n case \"hms\":\n datetimestring = hours + ':' + minutes + ':' + seconds; \n break;\n default:\n datetimestring = null; \n }\n return datetimestring;\n} \n//-------------------------------------------\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":720,"wires":[["019cfc66544b90f2"]]},{"id":"60b02851.5272d8","type":"mqtt in","z":"5aee24b0dc09f867","name":"","topic":"enocean/Aussen-HT/Temperature","qos":"0","datatype":"auto","broker":"99603ece.52e2a","nl":false,"rap":true,"rh":0,"inputs":0,"x":210,"y":960,"wires":[["7b3d38bffafd73e1"]]},{"id":"7b3d38bffafd73e1","type":"function","z":"5aee24b0dc09f867","name":"sensorobject-aussen","func":"if ('reset' in msg){\n context.set('min',0.0);\n context.set('max',0.0);\n return null;\n}\n\n//-------------------------------------------\n\nlet time = Date.now();\n// the next 5 lines to be edited per sensor\nlet timestring = date_time_string(\"hm\",time); // Format full, dayhm, hm, hms\nlet location = \"EGWZ\";\nlet device = \"sensor\";\nlet devicetech = \"enocean\";\nlet devicetype = \"temp-hum\"\nlet devicefunction = \"aussen\";\n\n//let sensoroffset = flow.get('sensoroffset_DGWZ');\nlet deviceoffset = 0.0;\n//\nlet devicerawvalue = Number.parseFloat(msg.payload).toFixed(2);\nlet devicevalue = Number(devicerawvalue + deviceoffset);\nlet deviceobject = {\"location\":location,\n \"device\":device,\n \"devicetech\":devicetech,\n \"devicetype\":devicetype,\n \"devicefunction\":devicefunction,\n \"devicetimestamp\":time,\n \"devicetimestring\":timestring,\n \"devicerawvalue\":devicerawvalue,\n \"deviceoffset\":deviceoffset,\n \"devicevalue\":devicevalue};\nminmaxobject = minmax(devicevalue);\nmsg.payload = Object.assign(deviceobject, minmaxobject);\nlet t = date_time_string(\"dayhm\",time) + \" | \" + \"ist \" + devicevalue;\nnode.status({fill:\"red\",shape:\"ring\",text:t});\nreturn msg;\n\n//-------------------------------------------\n\nfunction minmax(value){\n let x = parseFloat(value);\n let min = context.get('min');\n let max = context.get('max');\n\n if ((min === 0) && (max === 0)){\n min = x;\n context.set('min',x);\n max = x;\n context.set('max',x);\n }\n else {\n if (x < min){\n min = x;\n context.set('min',x);\n }\n if (x > max){\n max = x;\n context.set('max',x);\n }\n }\n return {'devicemin':min,'devicemax':max};\n}\n\n//-------------------------------------------\n\nfunction date_time_string(type,time){\n let date =new Date(time);\n let year = date.getFullYear();\n let month = (\"0\" + (date.getMonth() + 1)).slice(-2);\n let day = (\"0\" + date.getDate()).slice(-2);\n let hours = (\"0\" + date.getHours()).slice(-2);\n let minutes = (\"0\" + date.getMinutes()).slice(-2);\n let seconds = (\"0\" + date.getSeconds()).slice(-2);\n let datetimestring = \"\";\n switch(type) {\n case \"full\":\n datetimestring = day + \"-\" + month + \"-\" + year + \" \" + hours + ':' + minutes + ':' + seconds; \n break\n case \"dayhm\":\n datetimestring = day + \"-\" + month + \" @ \" + hours + ':' + minutes; \n break \n case \"hm\": \n datetimestring = hours + ':' + minutes; \n break\n case \"hms\":\n datetimestring = hours + ':' + minutes + ':' + seconds; \n break;\n default:\n datetimestring = null; \n }\n return datetimestring;\n} \n//-------------------------------------------\n","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":560,"y":960,"wires":[["019cfc66544b90f2"]]},{"id":"b685d7964e599242","type":"inject","z":"5aee24b0dc09f867","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"20.55","payloadType":"num","x":290,"y":920,"wires":[["7b3d38bffafd73e1"]]},{"id":"8e18ba1e0f05fe60","type":"debug","z":"5aee24b0dc09f867","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":610,"y":800,"wires":[]},{"id":"a5f9f1e2148c626f","type":"function","z":"5aee24b0dc09f867","name":"reset-soll-ist-aussen-chart","func":"if ('reset' in msg){\n context.set('min',0.0);\n context.set('max',0.0);\n return null;\n}\n\n//-------------------------------------------\n\nlet time = Date.now();\n// the next 5 lines to be edited per sensor\nlet timestring = date_time_string(\"hm\",time); // Format full, dayhm, hm, hms\nlet location = \"EGWZ\";\nlet device = \"system\";\nlet devicetech = \"reset\";\nlet devicetype = \"chart\"\nlet devicefunction = \"soll_ist_aussen\";\n\n//let sensoroffset = flow.get('sensoroffset_DGWZ');\nlet deviceoffset = 0.0;\n//\nlet devicerawvalue = parseFloat(msg.payload);\nlet devicevalue = devicerawvalue + deviceoffset;\nlet deviceobject = {\"location\":location,\n \"device\":device,\n \"devicetech\":devicetech,\n \"devicetype\":devicetype,\n \"devicefunction\":devicefunction,\n \"devicetimestamp\":time,\n \"devicetimestring\":timestring,\n \"devicerawvalue\":null,\n \"deviceoffset\":null,\n \"devicevalue\":null}; \nmsg.payload = deviceobject;\nreturn msg;\n\n//-------------------------------------------\n\nfunction date_time_string(type,time){\n let date =new Date(time);\n let year = date.getFullYear();\n let month = (\"0\" + (date.getMonth() + 1)).slice(-2);\n let day = (\"0\" + date.getDate()).slice(-2);\n let hours = (\"0\" + date.getHours()).slice(-2);\n let minutes = (\"0\" + date.getMinutes()).slice(-2);\n let seconds = (\"0\" + date.getSeconds()).slice(-2);\n let datetimestring = \"\";\n switch(type) {\n case \"full\":\n datetimestring = day + \"-\" + month + \"-\" + year + \" \" + hours + ':' + minutes + ':' + seconds; \n break\n case \"dayhm\":\n datetimestring = day + \"-\" + month + \" @ \" + hours + ':' + minutes; \n break \n case \"hm\": \n datetimestring = hours + ':' + minutes; \n break\n case \"hms\":\n datetimestring = hours + ':' + minutes + ':' + seconds; \n break;\n default:\n datetimestring = null; \n }\n return datetimestring;\n} \n//-------------------------------------------\n","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":550,"y":580,"wires":[["019cfc66544b90f2"]]},{"id":"8b4d2bf4e3cb60c4","type":"inject","z":"5aee24b0dc09f867","name":"reset","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":150,"y":560,"wires":[["a5f9f1e2148c626f"]]},{"id":"b451a57f7ec382fe","type":"ui_text","z":"5aee24b0dc09f867","group":"8d760e8097c25308","order":8,"width":3,"height":1,"name":"aussen","label":"aussen:","format":"{{msg.payload}} °C","layout":"row-center","className":"","x":1420,"y":120,"wires":[]},{"id":"95c5ec5c60379978","type":"ui_text","z":"5aee24b0dc09f867","group":"8d760e8097c25308","order":9,"width":3,"height":1,"name":"soll","label":"soll:","format":"{{msg.payload}} °C","layout":"row-center","className":"","x":1410,"y":320,"wires":[]},{"id":"c7aa5d87a56dd860","type":"ui_text","z":"5aee24b0dc09f867","group":"8d760e8097c25308","order":10,"width":3,"height":1,"name":"ist","label":"ist:","format":"{{msg.payload}} °C","layout":"row-center","className":"","x":1410,"y":520,"wires":[]},{"id":"65847bf96b933824","type":"ui_text","z":"5aee24b0dc09f867","group":"8d760e8097c25308","order":11,"width":3,"height":1,"name":"delta","label":"delta:","format":"{{msg.payload}} °C","layout":"row-center","className":"","x":1410,"y":760,"wires":[]},{"id":"ef209501af0c6194","type":"ui_gauge","z":"5aee24b0dc09f867","name":"aussen_gauge","group":"8d760e8097c25308","order":2,"width":2,"height":2,"gtype":"gage","title":"aussen","label":"°C","format":"{{value}}","min":"-10","max":"30","colors":["#0df9fd","#0fe600","#ca3838"],"seg1":"16","seg2":"21","className":"","x":1440,"y":280,"wires":[]},{"id":"3d59338fd25c7f83","type":"ui_gauge","z":"5aee24b0dc09f867","name":"soll_gauge","group":"8d760e8097c25308","order":3,"width":2,"height":2,"gtype":"gage","title":"soll","label":"°C","format":"{{value}}","min":"-10","max":"30","colors":["#0df9fd","#0fe600","#ca3838"],"seg1":"16","seg2":"21","className":"","x":1430,"y":480,"wires":[]},{"id":"e51f56d47f516027","type":"ui_gauge","z":"5aee24b0dc09f867","name":"ist_gauge","group":"8d760e8097c25308","order":4,"width":2,"height":2,"gtype":"gage","title":"ist","label":"°C","format":"{{value}}","min":"-10","max":"30","colors":["#0df9fd","#0fe600","#ca3838"],"seg1":"16","seg2":"21","className":"","x":1420,"y":680,"wires":[]},{"id":"463d7ebc009e807f","type":"inject","z":"5aee24b0dc09f867","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":600,"wires":[["a5f9f1e2148c626f","7a8856d98b79d09c"]]},{"id":"7a8856d98b79d09c","type":"delay","z":"5aee24b0dc09f867","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":140,"y":660,"wires":[["eaa4911cb7e98277","c36664c8bad3ac7b","14673c6c59737c7f","13e6064923562371"]]},{"id":"13e6064923562371","type":"delay","z":"5aee24b0dc09f867","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":120,"y":780,"wires":[["684d806e8421303c"]]},{"id":"684d806e8421303c","type":"function","z":"5aee24b0dc09f867","name":"init soll 20.00","func":"msg.payload = \"20.00\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":270,"y":780,"wires":[["108822392f65c0b7"]]},{"id":"27f4b1dd4a22bb55","type":"ui_gauge","z":"5aee24b0dc09f867","name":"delta_gauge","group":"8d760e8097c25308","order":5,"width":2,"height":2,"gtype":"gage","title":"delta","label":"°C","format":"{{value}}","min":"-10","max":10,"colors":["#0af5e5","#26e600","#ca3838"],"seg1":"-1","seg2":"+1","className":"","x":1430,"y":920,"wires":[]},{"id":"f5293007cef97533","type":"ui_text","z":"5aee24b0dc09f867","group":"8d760e8097c25308","order":12,"width":3,"height":1,"name":"humidity","label":"humidity","format":"{{msg.payload}} %","layout":"row-center","className":"","x":1420,"y":1440,"wires":[]},{"id":"39fdc7b9.b0fd88","type":"mqtt in","z":"5aee24b0dc09f867","name":"","topic":"enocean/EGWZ-HT/Temperature","qos":"0","datatype":"auto","broker":"2df13204.e2465e","nl":false,"rap":false,"inputs":0,"x":210,"y":1120,"wires":[["1b4b396eefe4aa6f"]]},{"id":"1b4b396eefe4aa6f","type":"function","z":"5aee24b0dc09f867","name":"sensorobject-ist-EGWZ","func":"if ('reset' in msg){\n context.set('min',0.0);\n context.set('max',0.0);\n return null;\n}\n\n//-------------------------------------------\n\nlet time = Date.now();\n// the next 5 lines to be edited per sensor\nlet timestring = date_time_string(\"hm\",time); // Format full, dayhm, hm, hms\nlet location = \"EGWZ\";\nlet device = \"sensor\";\nlet devicetech = \"enocean\";\nlet devicetype = \"temp-hum\"\nlet devicefunction = \"ist\";\n\n//let sensoroffset = flow.get('sensoroffset_DGWZ');\nlet deviceoffset = 0.0;\n//\nlet devicerawvalue = Number(parseFloat(msg.payload).toFixed(2));\nlet devicevalue = Number(devicerawvalue + deviceoffset);\nlet deviceobject = {\"location\":location,\n \"device\":device,\n \"devicetech\":devicetech,\n \"devicetype\":devicetype,\n \"devicefunction\":devicefunction,\n \"devicetimestamp\":time,\n \"devicetimestring\":timestring,\n \"devicerawvalue\":devicerawvalue,\n \"deviceoffset\":deviceoffset,\n \"devicevalue\":devicevalue};\nminmaxobject = minmax(devicevalue);\nmsg.payload = Object.assign(deviceobject, minmaxobject);\nlet t = date_time_string(\"dayhm\",time) + \" | \" + \"ist \" + devicevalue;\nnode.status({fill:\"red\",shape:\"ring\",text:t});\nreturn msg;\n\n//-------------------------------------------\n\nfunction minmax(value){\n let x = parseFloat(value);\n let min = context.get('min');\n let max = context.get('max');\n\n if ((min === 0) && (max === 0)){\n min = x;\n context.set('min',x);\n max = x;\n context.set('max',x);\n }\n else {\n if (x < min){\n min = x;\n context.set('min',x);\n }\n if (x > max){\n max = x;\n context.set('max',x);\n }\n }\n return {'devicemin':min,'devicemax':max};\n}\n\n//-------------------------------------------\n\nfunction date_time_string(type,time){\n let date =new Date(time);\n let year = date.getFullYear();\n let month = (\"0\" + (date.getMonth() + 1)).slice(-2);\n let day = (\"0\" + date.getDate()).slice(-2);\n let hours = (\"0\" + date.getHours()).slice(-2);\n let minutes = (\"0\" + date.getMinutes()).slice(-2);\n let seconds = (\"0\" + date.getSeconds()).slice(-2);\n let datetimestring = \"\";\n switch(type) {\n case \"full\":\n datetimestring = day + \"-\" + month + \"-\" + year + \" \" + hours + ':' + minutes + ':' + seconds; \n break\n case \"dayhm\":\n datetimestring = day + \"-\" + month + \" @ \" + hours + ':' + minutes; \n break \n case \"hm\": \n datetimestring = hours + ':' + minutes; \n break\n case \"hms\":\n datetimestring = hours + ':' + minutes + ':' + seconds; \n break;\n default:\n datetimestring = null; \n }\n return datetimestring;\n} \n//-------------------------------------------\n","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":550,"y":1120,"wires":[["019cfc66544b90f2"]]},{"id":"87bd05c219e16654","type":"inject","z":"5aee24b0dc09f867","name":"reset min max","props":[{"p":"reset","v":"","vt":"str"}],"repeat":"","crontab":"00 00 * * *","once":false,"onceDelay":0.1,"topic":"","x":260,"y":1060,"wires":[["1b4b396eefe4aa6f","d7f824f0f55bd010","28536ec3a14ce64c","abce24eee698f605","7b3d38bffafd73e1"]]},{"id":"78ac948afa9316eb","type":"mqtt in","z":"5aee24b0dc09f867","name":"","topic":"enocean/EGWZ-HT/Humidity","qos":"0","datatype":"auto","broker":"2df13204.e2465e","nl":false,"rap":false,"inputs":0,"x":220,"y":1180,"wires":[["d7f824f0f55bd010"]]},{"id":"d7f824f0f55bd010","type":"function","z":"5aee24b0dc09f867","name":"sensorobject-humidity-EGWZ","func":"if ('reset' in msg){\n context.set('min',0.0);\n context.set('max',0.0);\n return null;\n}\n\n//-------------------------------------------\n\nlet time = Date.now();\n// the next 5 lines to be edited per sensor\nlet timestring = date_time_string(\"hm\",time); // Format full, dayhm, hm, hms\nlet location = \"EGWZ\";\nlet device = \"sensor\";\nlet devicetech = \"enocean\";\nlet devicetype = \"temp-hum\"\nlet devicefunction = \"humidity\";\n\n//let sensoroffset = flow.get('sensoroffset_DGWZ');\nlet deviceoffset = 0.0;\n//\nlet devicerawvalue = Number(parseFloat(msg.payload).toFixed(2));\nlet devicevalue = Number(devicerawvalue + deviceoffset);\nlet deviceobject = {\"location\":location,\n \"device\":device,\n \"devicetech\":devicetech,\n \"devicetype\":devicetype,\n \"devicefunction\":devicefunction,\n \"devicetimestamp\":time,\n \"devicetimestring\":timestring,\n \"devicerawvalue\":devicerawvalue,\n \"deviceoffset\":deviceoffset,\n \"devicevalue\":devicevalue};\nminmaxobject = minmax(devicevalue);\nmsg.payload = Object.assign(deviceobject, minmaxobject);\nlet t = date_time_string(\"dayhm\",time) + \" | \" + \"ist \" + devicevalue;\nnode.status({fill:\"red\",shape:\"ring\",text:t});\nreturn msg;\n\n//-------------------------------------------\n\nfunction minmax(value){\n let x = parseFloat(value);\n let min = context.get('min');\n let max = context.get('max');\n\n if ((min === 0) && (max === 0)){\n min = x;\n context.set('min',x);\n max = x;\n context.set('max',x);\n }\n else {\n if (x < min){\n min = x;\n context.set('min',x);\n }\n if (x > max){\n max = x;\n context.set('max',x);\n }\n }\n return {'devicemin':min,'devicemax':max};\n}\n\n//-------------------------------------------\n\nfunction date_time_string(type,time){\n let date =new Date(time);\n let year = date.getFullYear();\n let month = (\"0\" + (date.getMonth() + 1)).slice(-2);\n let day = (\"0\" + date.getDate()).slice(-2);\n let hours = (\"0\" + date.getHours()).slice(-2);\n let minutes = (\"0\" + date.getMinutes()).slice(-2);\n let seconds = (\"0\" + date.getSeconds()).slice(-2);\n let datetimestring = \"\";\n switch(type) {\n case \"full\":\n datetimestring = day + \"-\" + month + \"-\" + year + \" \" + hours + ':' + minutes + ':' + seconds; \n break\n case \"dayhm\":\n datetimestring = day + \"-\" + month + \" @ \" + hours + ':' + minutes; \n break \n case \"hm\": \n datetimestring = hours + ':' + minutes; \n break\n case \"hms\":\n datetimestring = hours + ':' + minutes + ':' + seconds; \n break;\n default:\n datetimestring = null; \n }\n return datetimestring;\n} \n//-------------------------------------------\n","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":540,"y":1180,"wires":[["019cfc66544b90f2"]]},{"id":"ae1af1b5f85f4a1e","type":"ui_text","z":"5aee24b0dc09f867","group":"8d760e8097c25308","order":16,"width":3,"height":1,"name":"aussen min","label":"min:","format":"{{msg.payload}} °C","layout":"row-center","className":"","x":1430,"y":160,"wires":[]},{"id":"68ed4ac87b8fc201","type":"ui_text","z":"5aee24b0dc09f867","group":"8d760e8097c25308","order":23,"width":3,"height":1,"name":"aussen max","label":"max:","format":"{{msg.payload}} °C","layout":"row-center","className":"","x":1430,"y":200,"wires":[]},{"id":"5ecfcec66a0bc190","type":"ui_text","z":"5aee24b0dc09f867","group":"8d760e8097c25308","order":31,"width":3,"height":1,"name":"aussen time","label":"time:","format":"{{msg.payload}}","layout":"row-center","className":"","x":1430,"y":240,"wires":[]},{"id":"69a17e979d2d0ce8","type":"ui_text","z":"5aee24b0dc09f867","group":"8d760e8097c25308","order":18,"width":3,"height":1,"name":"ist min","label":"min:","format":"{{msg.payload}} °C","layout":"row-center","className":"","x":1410,"y":560,"wires":[]},{"id":"57d8d237396b75e7","type":"ui_text","z":"5aee24b0dc09f867","group":"8d760e8097c25308","order":25,"width":3,"height":1,"name":"ist max","label":"max:","format":"{{msg.payload}} °C","layout":"row-center","className":"","x":1420,"y":600,"wires":[]},{"id":"a78a25bef97d8f02","type":"ui_text","z":"5aee24b0dc09f867","group":"8d760e8097c25308","order":33,"width":3,"height":1,"name":"ist time","label":"time:","format":"{{msg.payload}}","layout":"row-center","className":"","x":1420,"y":640,"wires":[]},{"id":"3a658b69353a06b0","type":"ui_gauge","z":"5aee24b0dc09f867","name":"humidity_gauge","group":"8d760e8097c25308","order":6,"width":2,"height":2,"gtype":"gage","title":"Humidity","label":"%","format":"{{value}}","min":"0","max":"100","colors":["#ff3300","#26e600","#ff0000"],"seg1":"35","seg2":"65","className":"","x":1440,"y":1600,"wires":[]},{"id":"019a03d59f2a0240","type":"ui_text","z":"5aee24b0dc09f867","group":"8d760e8097c25308","order":19,"width":3,"height":1,"name":"delta_min","label":"min:","format":"{{msg.payload}} °C","layout":"row-center","className":"","x":1420,"y":800,"wires":[]},{"id":"b0239909121b379d","type":"ui_text","z":"5aee24b0dc09f867","group":"8d760e8097c25308","order":26,"width":3,"height":1,"name":"delta_max","label":"max:","format":"{{msg.payload}} °C","layout":"row-center","className":"","x":1430,"y":840,"wires":[]},{"id":"b6667d7520b93246","type":"ui_text","z":"5aee24b0dc09f867","group":"8d760e8097c25308","order":20,"width":3,"height":1,"name":"humidity_min","label":"min:","format":"{{msg.payload}} %","layout":"row-center","className":"","x":1430,"y":1480,"wires":[]},{"id":"5636fa0926e0ec9e","type":"ui_text","z":"5aee24b0dc09f867","group":"8d760e8097c25308","order":27,"width":3,"height":1,"name":"humidity_max","label":"max:","format":"{{msg.payload}} %","layout":"row-center","className":"","x":1440,"y":1520,"wires":[]},{"id":"07cd0c6cf3cb6720","type":"ui_text","z":"5aee24b0dc09f867","group":"8d760e8097c25308","order":35,"width":3,"height":1,"name":"humidity time","label":"time:","format":"{{msg.payload}}","layout":"row-center","className":"","x":1430,"y":1560,"wires":[]},{"id":"0f45dc5b25a413ab","type":"debug","z":"5aee24b0dc09f867","name":"pressure chart","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1440,"y":1880,"wires":[]},{"id":"f889a7deaad2b475","type":"ui_text","z":"5aee24b0dc09f867","group":"8d760e8097c25308","order":13,"width":3,"height":1,"name":"pressure","label":"pressure","format":"{{msg.payload}} hpa","layout":"row-center","className":"","x":1420,"y":1680,"wires":[]},{"id":"a4555e054f47aebe","type":"ui_gauge","z":"5aee24b0dc09f867","name":"pressure_gauge","group":"8d760e8097c25308","order":7,"width":2,"height":2,"gtype":"gage","title":"Pressure","label":"hpa","format":"{{value}}","min":"600","max":"1500","colors":["#ff3300","#f9d41a","#04ff00"],"seg1":"800","seg2":"1000","className":"","x":1440,"y":1840,"wires":[]},{"id":"5b9b30815bb1e7d2","type":"ui_text","z":"5aee24b0dc09f867","group":"8d760e8097c25308","order":21,"width":3,"height":1,"name":"pressure_min","label":"min:","format":"{{msg.payload}} hpa","layout":"row-center","className":"","x":1440,"y":1720,"wires":[]},{"id":"d4bf60033a8ec7af","type":"ui_text","z":"5aee24b0dc09f867","group":"8d760e8097c25308","order":28,"width":3,"height":1,"name":"pressure_max","label":"max:","format":"{{msg.payload}} hpa","layout":"row-center","className":"","x":1440,"y":1760,"wires":[]},{"id":"a948787518968916","type":"ui_text","z":"5aee24b0dc09f867","group":"8d760e8097c25308","order":36,"width":3,"height":1,"name":"pressure time","label":"time:","format":"{{msg.payload}}","layout":"row-center","className":"","x":1440,"y":1800,"wires":[]},{"id":"9f097c8081f4c995","type":"debug","z":"5aee24b0dc09f867","name":"co2 chart","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1420,"y":2120,"wires":[]},{"id":"1828f86e4c87d27f","type":"ui_text","z":"5aee24b0dc09f867","group":"8d760e8097c25308","order":14,"width":3,"height":1,"name":"co2","label":"co2","format":"{{msg.payload}} ppm","layout":"row-center","className":"","x":1410,"y":1920,"wires":[]},{"id":"7590e929a852132d","type":"ui_gauge","z":"5aee24b0dc09f867","name":"co2_gauge","group":"8d760e8097c25308","order":15,"width":2,"height":2,"gtype":"gage","title":"co2","label":"ppm","format":"{{value}}","min":"0","max":"1500","colors":["#11ff00","#fbcd28","#ff0000"],"seg1":"750","seg2":"1100","className":"","x":1430,"y":2080,"wires":[]},{"id":"2dd8cf7bf7abf670","type":"ui_text","z":"5aee24b0dc09f867","group":"8d760e8097c25308","order":22,"width":3,"height":1,"name":"co2_min","label":"min:","format":"{{msg.payload}} ppm","layout":"row-center","className":"","x":1420,"y":1960,"wires":[]},{"id":"dad2871fa4f1259f","type":"ui_text","z":"5aee24b0dc09f867","group":"8d760e8097c25308","order":29,"width":3,"height":1,"name":"co2_max","label":"max:","format":"{{msg.payload}} ppm","layout":"row-center","className":"","x":1420,"y":2000,"wires":[]},{"id":"5b2975cddc9738c1","type":"ui_text","z":"5aee24b0dc09f867","group":"8d760e8097c25308","order":37,"width":3,"height":1,"name":"co2 time","label":"time:","format":"{{msg.payload}}","layout":"row-center","className":"","x":1420,"y":2040,"wires":[]},{"id":"5850a0abd29eef78","type":"mqtt in","z":"5aee24b0dc09f867","name":"","topic":"Net_Atmo_record/#","qos":"0","datatype":"auto","broker":"99603ece.52e2a","nl":false,"rap":false,"inputs":0,"x":150,"y":1260,"wires":[["418a47a497d34ec4"]]},{"id":"418a47a497d34ec4","type":"json","z":"5aee24b0dc09f867","name":"","property":"payload","action":"","pretty":false,"x":130,"y":1320,"wires":[["4cc27164b688b249"]]},{"id":"4cc27164b688b249","type":"function","z":"5aee24b0dc09f867","name":"filter","func":"return[\n {payload:msg.payload.compact.pressure},\n {payload:msg.payload.compact.co2} \n]\n","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":250,"y":1320,"wires":[["28536ec3a14ce64c"],["abce24eee698f605"]]},{"id":"28536ec3a14ce64c","type":"function","z":"5aee24b0dc09f867","name":"sensorobject-pressure-EGWZ","func":"if ('reset' in msg){\n context.set('min',0.0);\n context.set('max',0.0);\n return null;\n}\n\n//-------------------------------------------\n\nlet time = Date.now();\n// the next 5 lines to be edited per sensor\nlet timestring = date_time_string(\"hm\",time); // Format full, dayhm, hm, hms\nlet location = \"EGWZ\";\nlet device = \"sensor\";\nlet devicetech = \"netatmo\";\nlet devicetype = \"netatmo\"\nlet devicefunction = \"pressure\";\n\n//let sensoroffset = flow.get('sensoroffset_DGWZ');\nlet deviceoffset = 0.0;\n//\nlet devicerawvalue = Number(parseFloat(msg.payload).toFixed(2));\nlet devicevalue = Number(devicerawvalue + deviceoffset);\nlet deviceobject = {\"location\":location,\n \"device\":device,\n \"devicetech\":devicetech,\n \"devicetype\":devicetype,\n \"devicefunction\":devicefunction,\n \"devicetimestamp\":time,\n \"devicetimestring\":timestring,\n \"devicerawvalue\":devicerawvalue,\n \"deviceoffset\":deviceoffset,\n \"devicevalue\":devicevalue};\nminmaxobject = minmax(devicevalue);\nmsg.payload = Object.assign(deviceobject, minmaxobject);\nlet t = date_time_string(\"dayhm\",time) + \" | \" + \"ist \" + devicevalue;\nnode.status({fill:\"red\",shape:\"ring\",text:t});\nreturn msg;\n\n//-------------------------------------------\n\nfunction minmax(value){\n let x = parseFloat(value);\n let min = context.get('min');\n let max = context.get('max');\n\n if ((min === 0) && (max === 0)){\n min = x;\n context.set('min',x);\n max = x;\n context.set('max',x);\n }\n else {\n if (x < min){\n min = x;\n context.set('min',x);\n }\n if (x > max){\n max = x;\n context.set('max',x);\n }\n }\n return {'devicemin':min,'devicemax':max};\n}\n\n//-------------------------------------------\n\nfunction date_time_string(type,time){\n let date =new Date(time);\n let year = date.getFullYear();\n let month = (\"0\" + (date.getMonth() + 1)).slice(-2);\n let day = (\"0\" + date.getDate()).slice(-2);\n let hours = (\"0\" + date.getHours()).slice(-2);\n let minutes = (\"0\" + date.getMinutes()).slice(-2);\n let seconds = (\"0\" + date.getSeconds()).slice(-2);\n let datetimestring = \"\";\n switch(type) {\n case \"full\":\n datetimestring = day + \"-\" + month + \"-\" + year + \" \" + hours + ':' + minutes + ':' + seconds; \n break\n case \"dayhm\":\n datetimestring = day + \"-\" + month + \" @ \" + hours + ':' + minutes; \n break \n case \"hm\": \n datetimestring = hours + ':' + minutes; \n break\n case \"hms\":\n datetimestring = hours + ':' + minutes + ':' + seconds; \n break;\n default:\n datetimestring = null; \n }\n return datetimestring;\n} \n//-------------------------------------------\n","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":530,"y":1300,"wires":[["019cfc66544b90f2"]]},{"id":"abce24eee698f605","type":"function","z":"5aee24b0dc09f867","name":"sensorobject-co2-EGWZ","func":"if ('reset' in msg){\n context.set('min',0.0);\n context.set('max',0.0);\n return null;\n}\n\n//-------------------------------------------\n\nlet time = Date.now();\n// the next 5 lines to be edited per sensor\nlet timestring = date_time_string(\"hm\",time); // Format full, dayhm, hm, hms\nlet location = \"EGWZ\";\nlet device = \"sensor\";\nlet devicetech = \"netatmo\";\nlet devicetype = \"netatmo\"\nlet devicefunction = \"co2\";\n\n//let sensoroffset = flow.get('sensoroffset_DGWZ');\nlet deviceoffset = 0.0;\n//\nlet devicerawvalue = Number(parseFloat(msg.payload).toFixed(2));\nlet devicevalue = Number(devicerawvalue + deviceoffset);\nlet deviceobject = {\"location\":location,\n \"device\":device,\n \"devicetech\":devicetech,\n \"devicetype\":devicetype,\n \"devicefunction\":devicefunction,\n \"devicetimestamp\":time,\n \"devicetimestring\":timestring,\n \"devicerawvalue\":devicerawvalue,\n \"deviceoffset\":deviceoffset,\n \"devicevalue\":devicevalue};\nminmaxobject = minmax(devicevalue);\nmsg.payload = Object.assign(deviceobject, minmaxobject);\nlet t = date_time_string(\"dayhm\",time) + \" | \" + \"ist \" + devicevalue;\nnode.status({fill:\"red\",shape:\"ring\",text:t});\nreturn msg;\n\n//-------------------------------------------\n\nfunction minmax(value){\n let x = parseFloat(value);\n let min = context.get('min');\n let max = context.get('max');\n\n if ((min === 0) && (max === 0)){\n min = x;\n context.set('min',x);\n max = x;\n context.set('max',x);\n }\n else {\n if (x < min){\n min = x;\n context.set('min',x);\n }\n if (x > max){\n max = x;\n context.set('max',x);\n }\n }\n return {'devicemin':min,'devicemax':max};\n}\n\n//-------------------------------------------\n\nfunction date_time_string(type,time){\n let date =new Date(time);\n let year = date.getFullYear();\n let month = (\"0\" + (date.getMonth() + 1)).slice(-2);\n let day = (\"0\" + date.getDate()).slice(-2);\n let hours = (\"0\" + date.getHours()).slice(-2);\n let minutes = (\"0\" + date.getMinutes()).slice(-2);\n let seconds = (\"0\" + date.getSeconds()).slice(-2);\n let datetimestring = \"\";\n switch(type) {\n case \"full\":\n datetimestring = day + \"-\" + month + \"-\" + year + \" \" + hours + ':' + minutes + ':' + seconds; \n break\n case \"dayhm\":\n datetimestring = day + \"-\" + month + \" @ \" + hours + ':' + minutes; \n break \n case \"hm\": \n datetimestring = hours + ':' + minutes; \n break\n case \"hms\":\n datetimestring = hours + ':' + minutes + ':' + seconds; \n break;\n default:\n datetimestring = null; \n }\n return datetimestring;\n} \n//-------------------------------------------\n","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":550,"y":1360,"wires":[["019cfc66544b90f2"]]},{"id":"c72862d52da2bea7","type":"comment","z":"5aee24b0dc09f867","name":"on/off for heater or valve","info":"","x":1890,"y":940,"wires":[]},{"id":"671fca3b4f76e8b3","type":"ui_template","z":"5aee24b0dc09f867","group":"8d760e8097c25308","name":"dot red or grey","order":30,"width":2,"height":1,"format":"
\n \n   Heater \n \n \n \n \n
\n","storeOutMessages":false,"fwdInMessages":false,"resendOnRefresh":true,"templateScope":"local","className":"","x":1680,"y":940,"wires":[[]]},{"id":"83d5de0417e71850","type":"function","z":"5aee24b0dc09f867","name":"thermostat-status","func":"msg1 = {};\nmsg2 = {};\nmsg1.payload = (msg.payload.switch === \"on\") ? \"red\" : \"grey\"; \nmsg2.payload = msg.payload.switch;\nreturn[msg1,msg2];","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1450,"y":960,"wires":[["671fca3b4f76e8b3"],["40b339a3fb9f76b4"]]},{"id":"99bd2991f934bb1b","type":"ui_text","z":"5aee24b0dc09f867","group":"8d760e8097c25308","order":17,"width":3,"height":1,"name":"soll min","label":"min:","format":"{{msg.payload}} °C","layout":"row-center","className":"","x":1420,"y":360,"wires":[]},{"id":"07231bbc9b90edce","type":"ui_text","z":"5aee24b0dc09f867","group":"8d760e8097c25308","order":24,"width":3,"height":1,"name":"soll max","label":"max:","format":"{{msg.payload}} °C","layout":"row-center","className":"","x":1420,"y":400,"wires":[]},{"id":"8dbb22a6946fbd37","type":"ui_text","z":"5aee24b0dc09f867","group":"8d760e8097c25308","order":32,"width":3,"height":1,"name":"soll time","label":"time:","format":"{{msg.payload}}","layout":"row-center","className":"","x":1420,"y":440,"wires":[]},{"id":"099e23a72aef1043","type":"ui_text","z":"5aee24b0dc09f867","group":"8d760e8097c25308","order":34,"width":3,"height":1,"name":"delta_time","label":"time:","format":"{{msg.payload}}","layout":"row-center","className":"","x":1430,"y":880,"wires":[]},{"id":"ff262e2d5d2d9d28","type":"ui_text","z":"5aee24b0dc09f867","group":"8d760e8097c25308","order":38,"width":2,"height":1,"name":"heater totalrunstring","label":"{{msg.payload}}","format":"","layout":"row-center","className":"","x":1460,"y":1160,"wires":[]},{"id":"ddf2ee02aba397bf","type":"function","z":"5aee24b0dc09f867","name":"switchobject-auxiliary heater-EGWZ","func":"//-------------------------------------------\n\nlet time = Date.now();\n// the next 4 lines to be edited per sensor\nlet timestring = date_time_string(\"hm\",time); // Format full, dayhm, hm, hms\nlet location = \"EGWZ\";\nlet device = \"switch\";\nlet devicetech = \"auxiliaryheater\";\n//\nlet devicevalue = msg.payload;\nlet deviceobject = {\"location\":location,\n \"device\":device,\n \"devicetech\":devicetech, \n \"devicetimestamp\":time,\n \"devicetimestring\":timestring,\n \"devicevalue\":devicevalue};\nmsg.payload = Object.assign(deviceobject);\n\nlet t = date_time_string(\"dayhm\",time) + \" | \" + \"Zusatzheizung \" + devicevalue;\nnode.status({fill:\"red\",shape:\"ring\",text:t});\nreturn msg;\n\n//-------------------------------------------\n\nfunction date_time_string(type,time){\n let date =new Date(time);\n let year = date.getFullYear();\n let month = (\"0\" + (date.getMonth() + 1)).slice(-2);\n let day = (\"0\" + date.getDate()).slice(-2);\n let hours = (\"0\" + date.getHours()).slice(-2);\n let minutes = (\"0\" + date.getMinutes()).slice(-2);\n let seconds = (\"0\" + date.getSeconds()).slice(-2);\n let datetimestring = \"\";\n switch(type) {\n case \"full\":\n datetimestring = day + \"-\" + month + \"-\" + year + \" \" + hours + ':' + minutes + ':' + seconds; \n break\n case \"dayhm\":\n datetimestring = day + \"-\" + month + \" @ \" + hours + ':' + minutes; \n break \n case \"hm\": \n datetimestring = hours + ':' + minutes; \n break\n case \"hms\":\n datetimestring = hours + ':' + minutes + ':' + seconds; \n break;\n default:\n datetimestring = null; \n }\n return datetimestring;\n} \n//-------------------------------------------\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":520,"y":1440,"wires":[["019cfc66544b90f2"]]},{"id":"8183e645ddbba8be","type":"inject","z":"5aee24b0dc09f867","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"on","payloadType":"str","x":230,"y":1420,"wires":[["ddf2ee02aba397bf"]]},{"id":"4a8939eacb3522b0","type":"inject","z":"5aee24b0dc09f867","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"off","payloadType":"str","x":230,"y":1460,"wires":[["ddf2ee02aba397bf"]]},{"id":"553225417355933d","type":"function","z":"5aee24b0dc09f867","name":"switchobject-window-EGWZ","func":"//-------------------------------------------\n\nlet time = Date.now();\n// the next 4 lines to be edited per sensor\nlet timestring = date_time_string(\"hm\",time); // Format full, dayhm, hm, hms\nlet location = \"EGWZ\";\nlet device = \"switch\";\nlet devicetech = \"window\";\n//\nlet devicevalue = msg.payload;\nlet deviceobject = {\"location\":location,\n \"device\":device,\n \"devicetech\":devicetech,\n \"devicetimestamp\":time,\n \"devicetimestring\":timestring,\n \"devicevalue\":devicevalue};\nmsg.payload = Object.assign(deviceobject);\n\nlet t = date_time_string(\"dayhm\",time) + \" | \" + \"Zusatzheizung \" + devicevalue;\nnode.status({fill:\"red\",shape:\"ring\",text:t});\nreturn msg;\n\n//-------------------------------------------\n\nfunction date_time_string(type,time){\n let date =new Date(time);\n let year = date.getFullYear();\n let month = (\"0\" + (date.getMonth() + 1)).slice(-2);\n let day = (\"0\" + date.getDate()).slice(-2);\n let hours = (\"0\" + date.getHours()).slice(-2);\n let minutes = (\"0\" + date.getMinutes()).slice(-2);\n let seconds = (\"0\" + date.getSeconds()).slice(-2);\n let datetimestring = \"\";\n switch(type) {\n case \"full\":\n datetimestring = day + \"-\" + month + \"-\" + year + \" \" + hours + ':' + minutes + ':' + seconds; \n break\n case \"dayhm\":\n datetimestring = day + \"-\" + month + \" @ \" + hours + ':' + minutes; \n break \n case \"hm\": \n datetimestring = hours + ':' + minutes; \n break\n case \"hms\":\n datetimestring = hours + ':' + minutes + ':' + seconds; \n break;\n default:\n datetimestring = null; \n }\n return datetimestring;\n} \n//-------------------------------------------\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":1540,"wires":[["019cfc66544b90f2"]]},{"id":"f230070a9581d03c","type":"inject","z":"5aee24b0dc09f867","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"closed","payloadType":"str","x":230,"y":1560,"wires":[["553225417355933d"]]},{"id":"31b85458dca88c58","type":"inject","z":"5aee24b0dc09f867","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"open","payloadType":"str","x":230,"y":1520,"wires":[["553225417355933d"]]},{"id":"40b339a3fb9f76b4","type":"debug","z":"5aee24b0dc09f867","name":"","active":false,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1670,"y":980,"wires":[]},{"id":"9792bb9e1ad4f32b","type":"debug","z":"5aee24b0dc09f867","name":"thermostat ontime","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1450,"y":1000,"wires":[]},{"id":"dcc38100b33b82f8","type":"debug","z":"5aee24b0dc09f867","name":"thermostat offtime","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1450,"y":1040,"wires":[]},{"id":"6f1ea433dd311e1a","type":"debug","z":"5aee24b0dc09f867","name":"heater runtimestring","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1460,"y":1120,"wires":[]},{"id":"73f39992ba580d31","type":"debug","z":"5aee24b0dc09f867","name":"auxiliaryheater_ontimestring","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1480,"y":1240,"wires":[]},{"id":"752a72a534dd4133","type":"debug","z":"5aee24b0dc09f867","name":"auxiliaryheater_offtimestring","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1480,"y":1280,"wires":[]},{"id":"bdfe4711b8c31872","type":"debug","z":"5aee24b0dc09f867","name":"window_offtimestring","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1460,"y":1400,"wires":[]},{"id":"cd2a79f9bf0f0d2c","type":"debug","z":"5aee24b0dc09f867","name":"window_ontimestring","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1460,"y":1360,"wires":[]},{"id":"8d760e8097c25308","type":"ui_group","name":"Temperatur","tab":"a3cd133b39a365a4","order":1,"disp":false,"width":"23","collapse":false,"className":""},{"id":"99603ece.52e2a","type":"mqtt-broker","broker":"10.0.0.43","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":4,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"2df13204.e2465e","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":""},{"id":"a3cd133b39a365a4","type":"ui_tab","name":"24 h DGSZ Temp","icon":"dashboard","order":1,"disabled":false,"hidden":false}]