Zigbee2mqtt Aquara triple Sensors WSDCGQ11LM (temp, humidity, pressure) - 2 sensor test-flow

interesting small zigbee sensor from Aquara. Easy to install and run in a smart home.
Includes calculation of relative pressure depending on the hight above sea-level.

[{"id":"9469147d85cf6677","type":"tab","label":"AQARA thp sensor","disabled":false,"info":"","env":[]},{"id":"ad033dade2c29e0d","type":"debug","z":"9469147d85cf6677","name":"debug EG","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":440,"y":580,"wires":[]},{"id":"729919e14cd5d733","type":"change","z":"9469147d85cf6677","name":"humidity","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.humidity","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"hum_EG %","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":700,"wires":[["edea58a87596d4fa","e0d9897067903b74"]]},{"id":"edea58a87596d4fa","type":"debug","z":"9469147d85cf6677","name":"debug 70","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":600,"y":700,"wires":[]},{"id":"6b8648821e359c0e","type":"change","z":"9469147d85cf6677","name":"pressure","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.pressure","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":760,"wires":[["29bad4967706c36b","d28a8e6a50999b11"]]},{"id":"29bad4967706c36b","type":"debug","z":"9469147d85cf6677","name":"debug 71","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":600,"y":760,"wires":[]},{"id":"63799ce727ee9b9a","type":"change","z":"9469147d85cf6677","name":"temperature","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.temperature","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"temp_EG ┬░C","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":820,"wires":[["7ce17faea574bf07","5b9eee080d2ceadf"]]},{"id":"7ce17faea574bf07","type":"debug","z":"9469147d85cf6677","name":"debug 72","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":600,"y":820,"wires":[]},{"id":"d28a8e6a50999b11","type":"function","z":"9469147d85cf6677","name":"relative pressure @ 482m","func":"let P = msg.payload;\nlet x = 1 - (482/ 44330);    // 482 = hight[m] above sealevel\nlet y = 5.255;\nlet P_relativ = P / Math.pow(x, y);\nflow.set('current_pressure', P_relativ);\n\nnode.status({ fill: \"grey\", shape: \"dot\", text: P_relativ.toFixed(1) });\n\nreturn {payload : parseFloat(P_relativ.toFixed(1)), topic : \"pressure_EG hpa\"};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":830,"y":760,"wires":[["1639c3429e39a280"]]},{"id":"3fe7087b2b858d8c","type":"mqtt in","z":"9469147d85cf6677","name":"Sensor EG","topic":"zigbee2mqtt/Aqara-thp-sensor-1","qos":"0","datatype":"auto-detect","broker":"67e7ccc7233608f6","nl":false,"rap":true,"rh":0,"inputs":0,"x":120,"y":760,"wires":[["ad033dade2c29e0d","729919e14cd5d733","6b8648821e359c0e","63799ce727ee9b9a","bdf87a6da0957f9a","f103627375f8500c","3a4ae7136b86a4bd"]]},{"id":"2e19cd9a30c0eb8a","type":"mqtt in","z":"9469147d85cf6677","name":"Sensor DG","topic":"zigbee2mqtt/Aqara-thp-sensor-2","qos":"0","datatype":"auto-detect","broker":"67e7ccc7233608f6","nl":false,"rap":true,"rh":0,"inputs":0,"x":120,"y":260,"wires":[["f6914b3ba76dc8ca","daa61cd7f1d2765e","332d63ad2b5dbf88","342a13308710a2be","2816b01f481fea81","9d8491cdd4b10cfb","32b5bab5e0845f3c"]]},{"id":"bdf87a6da0957f9a","type":"change","z":"9469147d85cf6677","name":"voltage","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.voltage","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":880,"wires":[["b4e5913b26b06e4c"]]},{"id":"0542ab7ba0ec9856","type":"debug","z":"9469147d85cf6677","name":"debug 75","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":780,"y":880,"wires":[]},{"id":"f103627375f8500c","type":"change","z":"9469147d85cf6677","name":"linkquality","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.linkquality","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":940,"wires":[["33e366013bec0bb3","2dec9b9d274c61ce"]]},{"id":"625ce79004889c71","type":"debug","z":"9469147d85cf6677","name":"debug 76","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":900,"y":940,"wires":[]},{"id":"b4e5913b26b06e4c","type":"function","z":"9469147d85cf6677","name":"function 1","func":"node.status({ fill: \"grey\", shape: \"dot\", text: (msg.payload + \" mVolt\") });\nmsg.payload = msg.payload/1000;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":600,"y":880,"wires":[["0542ab7ba0ec9856"]]},{"id":"33e366013bec0bb3","type":"range","z":"9469147d85cf6677","minin":"0","maxin":"255","minout":"0","maxout":"100","action":"scale","round":true,"property":"payload","name":"","x":740,"y":940,"wires":[["625ce79004889c71"]]},{"id":"175db285e89a2f94","type":"debug","z":"9469147d85cf6677","name":"debug 77","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":700,"y":140,"wires":[]},{"id":"f6914b3ba76dc8ca","type":"change","z":"9469147d85cf6677","name":"humidity","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.humidity","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"hum_DG %","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":200,"wires":[["ae9cc011e6669a5c","dc86c5bcf1a87e95"]]},{"id":"ae9cc011e6669a5c","type":"debug","z":"9469147d85cf6677","name":"debug 78","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":600,"y":200,"wires":[]},{"id":"daa61cd7f1d2765e","type":"change","z":"9469147d85cf6677","name":"pressure","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.pressure","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":260,"wires":[["9ee6814913682954","e991d66646a38162"]]},{"id":"9ee6814913682954","type":"debug","z":"9469147d85cf6677","name":"debug 79","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":600,"y":260,"wires":[]},{"id":"332d63ad2b5dbf88","type":"change","z":"9469147d85cf6677","name":"temperature","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.temperature","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"temp_DG ┬░C","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":320,"wires":[["33deed4c0638242b","70cec064a08c4d28"]]},{"id":"33deed4c0638242b","type":"debug","z":"9469147d85cf6677","name":"debug 80","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":600,"y":320,"wires":[]},{"id":"e991d66646a38162","type":"function","z":"9469147d85cf6677","name":"relative pressure @ 482m","func":"let P = msg.payload;\nlet x = 1 - (482/ 44330);    // 482 = hight[m] above sealevel\nlet y = 5.255;\nlet P_relativ = P / Math.pow(x, y);\nflow.set('current_pressure', P_relativ);\n\nnode.status({ fill: \"grey\", shape: \"dot\", text: P_relativ.toFixed(1) });\n\nreturn {payload : parseFloat(P_relativ.toFixed(1)), topic : \"pressure_DG hpa\"};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":830,"y":260,"wires":[["1c8850add7c6caeb"]]},{"id":"342a13308710a2be","type":"change","z":"9469147d85cf6677","name":"voltage","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.voltage","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":380,"wires":[["a2f944c7ae234459"]]},{"id":"ec26abe4d6d384bd","type":"debug","z":"9469147d85cf6677","name":"debug 82","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":780,"y":380,"wires":[]},{"id":"2816b01f481fea81","type":"change","z":"9469147d85cf6677","name":"linkquality","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.linkquality","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":440,"wires":[["fdb57c018a7f2013","5ed69056f16f9b80"]]},{"id":"957e04b309cde45f","type":"debug","z":"9469147d85cf6677","name":"debug 83","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":900,"y":440,"wires":[]},{"id":"a2f944c7ae234459","type":"function","z":"9469147d85cf6677","name":"function 2","func":"node.status({ fill: \"grey\", shape: \"dot\", text: (msg.payload + \" mVolt\")});\nmsg.payload = msg.payload/1000;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":600,"y":380,"wires":[["ec26abe4d6d384bd"]]},{"id":"fdb57c018a7f2013","type":"range","z":"9469147d85cf6677","minin":"0","maxin":"255","minout":"0","maxout":"100","action":"scale","round":true,"property":"payload","name":"","x":740,"y":440,"wires":[["957e04b309cde45f"]]},{"id":"3a4ae7136b86a4bd","type":"change","z":"9469147d85cf6677","name":"HH:mm:ss DD-MM-YYYY","rules":[{"t":"set","p":"payload","pt":"msg","to":"$moment().tz(\"Europe/Berlin\").format(\"HH:mm:ss DD-MM-YYYY\")","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":640,"wires":[["e5bf31cb4556cd55","4a544b9e0b779fda"]]},{"id":"e5bf31cb4556cd55","type":"debug","z":"9469147d85cf6677","name":"debug 84","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":700,"y":640,"wires":[]},{"id":"9d8491cdd4b10cfb","type":"change","z":"9469147d85cf6677","name":"HH:mm:ss DD-MM-YYYY","rules":[{"t":"set","p":"payload","pt":"msg","to":"$moment().tz(\"Europe/Berlin\").format(\"HH:mm:ss DD-MM-YYYY\")","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":140,"wires":[["175db285e89a2f94","9bee9325206cf13b"]]},{"id":"32b5bab5e0845f3c","type":"debug","z":"9469147d85cf6677","name":"debug DG","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":450,"y":80,"wires":[]},{"id":"5ed69056f16f9b80","type":"debug","z":"9469147d85cf6677","name":" ","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":590,"y":440,"wires":[]},{"id":"2dec9b9d274c61ce","type":"debug","z":"9469147d85cf6677","name":" ","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":590,"y":940,"wires":[]},{"id":"112e8ed227cc02ba","type":"function","z":"9469147d85cf6677","name":"init chart temp","func":"return null;","outputs":1,"noerr":0,"initialize":"// Der Code hier wird ausgef├╝hrt,\n// wenn der Node gestartet wird\n\nnode.send({ payload: [] });\n\nnode.send({ payload: null, topic: \"temp_DG ┬░C\" });\nnode.send({ payload: null, topic: \"temp_EG ┬░C\" });\n","finalize":"","libs":[],"x":380,"y":1140,"wires":[["01f9e06f44cf57e1"]]},{"id":"01f9e06f44cf57e1","type":"ui_chart","z":"9469147d85cf6677","name":"Chart temp","group":"e25da20c3f5e7e14","order":1,"width":0,"height":0,"label":"","chartType":"line","legend":"true","xformat":"HH:mm","interpolate":"linear","nodata":"","dot":true,"ymin":"","ymax":"","removeOlder":"7","removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#f91f06","#fda308","#ff7f0e","#04a5f6","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"className":"","x":590,"y":1140,"wires":[[]]},{"id":"161901fb99b9f39c","type":"link in","z":"9469147d85cf6677","name":"temp_EG_in","links":["70cec064a08c4d28"],"x":445,"y":1100,"wires":[["01f9e06f44cf57e1","45d4333138dae825"]]},{"id":"69c3f5dcc8a95854","type":"link in","z":"9469147d85cf6677","name":"hum_EG_in","links":["dc86c5bcf1a87e95"],"x":445,"y":1260,"wires":[["f881e4cc9c61c847","712aa9f75a6c7344"]]},{"id":"5b9eee080d2ceadf","type":"link out","z":"9469147d85cf6677","name":"link out 1","mode":"link","links":["bf9f1c4191638b51","3421be6170a64191"],"x":735,"y":820,"wires":[]},{"id":"70cec064a08c4d28","type":"link out","z":"9469147d85cf6677","name":"link out 2","mode":"link","links":["ccab11256bc7a26c","161901fb99b9f39c"],"x":735,"y":320,"wires":[]},{"id":"dc86c5bcf1a87e95","type":"link out","z":"9469147d85cf6677","name":"link out 3","mode":"link","links":["4516784da5e822c3","69c3f5dcc8a95854"],"x":735,"y":200,"wires":[]},{"id":"e0d9897067903b74","type":"link out","z":"9469147d85cf6677","name":"link out 4","mode":"link","links":["436e2a689fb09445","87808920f4c7dcfa"],"x":735,"y":700,"wires":[]},{"id":"3421be6170a64191","type":"link in","z":"9469147d85cf6677","name":"temp_DG_in","links":["5b9eee080d2ceadf"],"x":445,"y":1180,"wires":[["01f9e06f44cf57e1","a71d1eafc3148778"]]},{"id":"87808920f4c7dcfa","type":"link in","z":"9469147d85cf6677","name":"hum_DG_in","links":["e0d9897067903b74"],"x":445,"y":1340,"wires":[["f881e4cc9c61c847","940759d7c168dd45"]]},{"id":"0505655c54c1508f","type":"ui_chart","z":"9469147d85cf6677","name":"Chart pressure","group":"e25da20c3f5e7e14","order":7,"width":0,"height":0,"label":"","chartType":"line","legend":"true","xformat":"HH:mm","interpolate":"linear","nodata":"","dot":true,"ymin":"","ymax":"","removeOlder":"7","removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#137000","#02f79a","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"className":"","x":600,"y":1460,"wires":[[]]},{"id":"5f3f865faaf2ee72","type":"function","z":"9469147d85cf6677","name":"init chart pressure","func":"return null;","outputs":1,"noerr":0,"initialize":"// Der Code hier wird ausgef├╝hrt,\n// wenn der Node gestartet wird\n\nnode.send({ payload: [] });\n\nnode.send({ payload: null, topic: \"pressure_DG hpa\" });\nnode.send({ payload: null, topic: \"pressure_EG hpa\" });\n","finalize":"","libs":[],"x":370,"y":1460,"wires":[["0505655c54c1508f"]]},{"id":"48c3553c7f9d3372","type":"link in","z":"9469147d85cf6677","name":"pressure_EG_in","links":["1c8850add7c6caeb"],"x":445,"y":1420,"wires":[["0505655c54c1508f","c46b991c1fa34524"]]},{"id":"381e855dc851d50a","type":"link in","z":"9469147d85cf6677","name":"pressure_DG_in","links":["1639c3429e39a280"],"x":445,"y":1500,"wires":[["0505655c54c1508f","b8e2c68a2126c8d8"]]},{"id":"1639c3429e39a280","type":"link out","z":"9469147d85cf6677","name":"link out 5","mode":"link","links":["292fdf519fe8a54f","381e855dc851d50a"],"x":1015,"y":760,"wires":[]},{"id":"1c8850add7c6caeb","type":"link out","z":"9469147d85cf6677","name":"link out 6","mode":"link","links":["dba9ffdd34532c2b","48c3553c7f9d3372"],"x":1025,"y":260,"wires":[]},{"id":"4a544b9e0b779fda","type":"ui_text","z":"9469147d85cf6677","group":"e25da20c3f5e7e14","order":11,"width":11,"height":1,"name":"","label":"update EG","format":"{{msg.payload}}","layout":"row-center","className":"","style":false,"font":"","fontSize":16,"color":"#000000","x":870,"y":640,"wires":[]},{"id":"9bee9325206cf13b","type":"ui_text","z":"9469147d85cf6677","group":"e25da20c3f5e7e14","order":10,"width":11,"height":1,"name":"","label":"update DG","format":"{{msg.payload}}","layout":"row-center","className":"","style":false,"font":"","fontSize":16,"color":"#000000","x":870,"y":140,"wires":[]},{"id":"52698ea0c28cfa18","type":"function","z":"9469147d85cf6677","name":"init EG","func":"return null;","outputs":1,"noerr":0,"initialize":"// Der Code hier wird ausgef├╝hrt,\n// wenn der Node gestartet wird\n\nnode.send({ payload: \" \" });\n","finalize":"","libs":[],"x":690,"y":580,"wires":[["4a544b9e0b779fda"]]},{"id":"f36fc0a45c7880fe","type":"function","z":"9469147d85cf6677","name":"init DG","func":"return null;","outputs":1,"noerr":0,"initialize":"// Der Code hier wird ausgef├╝hrt,\n// wenn der Node gestartet wird\n\nnode.send({ payload: \" \" });\n","finalize":"","libs":[],"x":710,"y":80,"wires":[["9bee9325206cf13b"]]},{"id":"860dde1c1b3d4d2b","type":"function","z":"9469147d85cf6677","name":"init chart hum","func":"return null;","outputs":1,"noerr":0,"initialize":"// Der Code hier wird ausgef├╝hrt,\n// wenn der Node gestartet wird\n\nnode.send({ payload: [] });\n\nnode.send({ payload: null, topic: \"hum_DG %\" });\nnode.send({ payload: null, topic: \"hum_EG %\" });\n","finalize":"","libs":[],"x":380,"y":1300,"wires":[["f881e4cc9c61c847"]]},{"id":"f881e4cc9c61c847","type":"ui_chart","z":"9469147d85cf6677","name":"Chart hum","group":"e25da20c3f5e7e14","order":4,"width":0,"height":0,"label":"","chartType":"line","legend":"true","xformat":"HH:mm","interpolate":"linear","nodata":"","dot":true,"ymin":"","ymax":"","removeOlder":"7","removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#009afa","#c905ff","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"className":"","x":590,"y":1300,"wires":[[]]},{"id":"ece0ca3c13272297","type":"ui_text","z":"9469147d85cf6677","group":"e25da20c3f5e7e14","order":6,"width":11,"height":1,"name":"Tendenz EG hum","label":"","format":"{{msg.payload}}","layout":"row-center","className":"","style":true,"font":"","fontSize":16,"color":"#c905fa","x":790,"y":1340,"wires":[]},{"id":"acf1c7535b9056df","type":"ui_text","z":"9469147d85cf6677","group":"e25da20c3f5e7e14","order":5,"width":11,"height":1,"name":"Tendenz DG hum","label":"","format":"{{msg.payload}}","layout":"row-center","className":"","style":true,"font":"","fontSize":16,"color":"#009afa","x":790,"y":1260,"wires":[]},{"id":"618e5dc9dd362adf","type":"ui_text","z":"9469147d85cf6677","group":"e25da20c3f5e7e14","order":3,"width":11,"height":1,"name":"Tendenz EG temp","label":"","format":"{{msg.payload}}","layout":"row-center","className":"","style":true,"font":"","fontSize":16,"color":"#fda308","x":790,"y":1180,"wires":[]},{"id":"a1ee4e75123efc29","type":"ui_text","z":"9469147d85cf6677","group":"e25da20c3f5e7e14","order":2,"width":11,"height":1,"name":"Tendenz DG temp","label":"","format":"{{msg.payload}}","layout":"row-center","className":"","style":true,"font":"","fontSize":16,"color":"#f91f06","x":790,"y":1100,"wires":[]},{"id":"7136c769628a1a32","type":"ui_text","z":"9469147d85cf6677","group":"e25da20c3f5e7e14","order":9,"width":11,"height":1,"name":"Tendenz EG pressure","label":"","format":"{{msg.payload}}","layout":"row-center","className":"","style":true,"font":"","fontSize":16,"color":"#02f79a","x":800,"y":1500,"wires":[]},{"id":"c46b991c1fa34524","type":"function","z":"9469147d85cf6677","name":"Tendenz 5","func":"let p = msg.payload;\nif (context.get('last_value') === 0) {\n    msg.payload = date_time_string() + '&nbsp' + p;\n}\nelse if (msg.payload < context.get('last_value')) {\n    msg.payload = date_time_string() + '&nbsp' + p + '&nbsp' + '<i class=\"fa fa-arrow-circle-down fa-1x\" aria-hidden=\"true\"></i>';\n}\nelse if (msg.payload === context.get('last_value')) {\n    msg.payload = date_time_string() + '&nbsp' + p + '&nbsp' + '<i class=\"fa fa-arrow-circle-right fa-1x\" aria-hidden=\"true\"></i>';\n}\nelse if (msg.payload > context.get('last_value')) {\n    msg.payload = date_time_string() + '&nbsp' + p + '&nbsp' + '<i class=\"fa fa-arrow-circle-up fa-1x\" aria-hidden=\"true\"></i>';\n}\ncontext.set('last_value', p);\nreturn msg;\n\nfunction date_time_string() {\n    const date = new Date(Date.now());\n    //const year = date.getFullYear();\n    //const month = (\"0\" + (date.getMonth() + 1)).slice(-2);\n    //const day = (\"0\" + date.getDate()).slice(-2);\n    const hours = (\"0\" + date.getHours()).slice(-2);\n    const minutes = (\"0\" + date.getMinutes()).slice(-2);\n    const seconds = (\"0\" + date.getSeconds()).slice(-2);\n//    let datetimestring = day + \"-\" + month + \"-\" + year + \" \" + hours + ':' + minutes + ':' + seconds;\n    let datetimestring = hours + ':' + minutes + ':' + seconds;    \n    return datetimestring;\n}","outputs":1,"noerr":0,"initialize":"// Code added here will be run once\n// whenever the node is started.\nnode.send({ payload: \" \" });\ncontext.set('last_value', 0);\n","finalize":"","libs":[],"x":590,"y":1420,"wires":[["f5c97f0b030c0002"]]},{"id":"f5c97f0b030c0002","type":"ui_text","z":"9469147d85cf6677","group":"e25da20c3f5e7e14","order":8,"width":11,"height":1,"name":"Tendenz DG pressure","label":"","format":"{{msg.payload}}","layout":"row-center","className":"","style":true,"font":"","fontSize":16,"color":"#137000","x":800,"y":1420,"wires":[]},{"id":"b8e2c68a2126c8d8","type":"function","z":"9469147d85cf6677","name":"Tendenz 6","func":"let p = msg.payload;\nif (context.get('last_value') === 0) {\n    msg.payload = date_time_string() + '&nbsp' + p;\n}\nelse if (msg.payload < context.get('last_value')) {\n    msg.payload = date_time_string() + '&nbsp' + p + '&nbsp' + '<i class=\"fa fa-arrow-circle-down fa-1x\" aria-hidden=\"true\"></i>';\n}\nelse if (msg.payload === context.get('last_value')) {\n    msg.payload = date_time_string() + '&nbsp' + p + '&nbsp' + '<i class=\"fa fa-arrow-circle-right fa-1x\" aria-hidden=\"true\"></i>';\n}\nelse if (msg.payload > context.get('last_value')) {\n    msg.payload = date_time_string() + '&nbsp' + p + '&nbsp' + '<i class=\"fa fa-arrow-circle-up fa-1x\" aria-hidden=\"true\"></i>';\n}\ncontext.set('last_value', p);\nreturn msg;\n\nfunction date_time_string() {\n    const date = new Date(Date.now());\n    //const year = date.getFullYear();\n    //const month = (\"0\" + (date.getMonth() + 1)).slice(-2);\n    //const day = (\"0\" + date.getDate()).slice(-2);\n    const hours = (\"0\" + date.getHours()).slice(-2);\n    const minutes = (\"0\" + date.getMinutes()).slice(-2);\n    const seconds = (\"0\" + date.getSeconds()).slice(-2);\n//    let datetimestring = day + \"-\" + month + \"-\" + year + \" \" + hours + ':' + minutes + ':' + seconds;\n    let datetimestring = hours + ':' + minutes + ':' + seconds;    \n    return datetimestring;\n}","outputs":1,"noerr":0,"initialize":"// Code added here will be run once\n// whenever the node is started.\nnode.send({ payload: \" \" });\ncontext.set('last_value', 0);\n","finalize":"","libs":[],"x":590,"y":1500,"wires":[["7136c769628a1a32"]]},{"id":"940759d7c168dd45","type":"function","z":"9469147d85cf6677","name":"Tendenz 4","func":"let p = msg.payload;\nif (context.get('last_value') === 0) {\n    msg.payload = date_time_string() + '&nbsp' + p;\n}\nelse if (msg.payload < context.get('last_value')) {\n    msg.payload = date_time_string() + '&nbsp' + p + '&nbsp' + '<i class=\"fa fa-arrow-circle-down fa-1x\" aria-hidden=\"true\"></i>';\n}\nelse if (msg.payload === context.get('last_value')) {\n    msg.payload = date_time_string() + '&nbsp' + p + '&nbsp' + '<i class=\"fa fa-arrow-circle-right fa-1x\" aria-hidden=\"true\"></i>';\n}\nelse if (msg.payload > context.get('last_value')) {\n    msg.payload = date_time_string() + '&nbsp' + p + '&nbsp' + '<i class=\"fa fa-arrow-circle-up fa-1x\" aria-hidden=\"true\"></i>';\n}\ncontext.set('last_value', p);\nreturn msg;\n\nfunction date_time_string() {\n    const date = new Date(Date.now());\n    //const year = date.getFullYear();\n    //const month = (\"0\" + (date.getMonth() + 1)).slice(-2);\n    //const day = (\"0\" + date.getDate()).slice(-2);\n    const hours = (\"0\" + date.getHours()).slice(-2);\n    const minutes = (\"0\" + date.getMinutes()).slice(-2);\n    const seconds = (\"0\" + date.getSeconds()).slice(-2);\n//    let datetimestring = day + \"-\" + month + \"-\" + year + \" \" + hours + ':' + minutes + ':' + seconds;\n    let datetimestring = hours + ':' + minutes + ':' + seconds;    \n    return datetimestring;\n}","outputs":1,"noerr":0,"initialize":"// Code added here will be run once\n// whenever the node is started.\nnode.send({ payload: \" \" });\ncontext.set('last_value', 0);\n","finalize":"","libs":[],"x":590,"y":1340,"wires":[["ece0ca3c13272297"]]},{"id":"712aa9f75a6c7344","type":"function","z":"9469147d85cf6677","name":"Tendenz 3","func":"let p = msg.payload;\nif (context.get('last_value') === 0) {\n    msg.payload = date_time_string() + '&nbsp' + p;\n}\nelse if (msg.payload < context.get('last_value')) {\n    msg.payload = date_time_string() + '&nbsp' + p + '&nbsp' + '<i class=\"fa fa-arrow-circle-down fa-1x\" aria-hidden=\"true\"></i>';\n}\nelse if (msg.payload === context.get('last_value')) {\n    msg.payload = date_time_string() + '&nbsp' + p + '&nbsp' + '<i class=\"fa fa-arrow-circle-right fa-1x\" aria-hidden=\"true\"></i>';\n}\nelse if (msg.payload > context.get('last_value')) {\n    msg.payload = date_time_string() + '&nbsp' + p + '&nbsp' + '<i class=\"fa fa-arrow-circle-up fa-1x\" aria-hidden=\"true\"></i>';\n}\ncontext.set('last_value', p);\nreturn msg;\n\nfunction date_time_string() {\n    const date = new Date(Date.now());\n    //const year = date.getFullYear();\n    //const month = (\"0\" + (date.getMonth() + 1)).slice(-2);\n    //const day = (\"0\" + date.getDate()).slice(-2);\n    const hours = (\"0\" + date.getHours()).slice(-2);\n    const minutes = (\"0\" + date.getMinutes()).slice(-2);\n    const seconds = (\"0\" + date.getSeconds()).slice(-2);\n//    let datetimestring = day + \"-\" + month + \"-\" + year + \" \" + hours + ':' + minutes + ':' + seconds;\n    let datetimestring = hours + ':' + minutes + ':' + seconds;    \n    return datetimestring;\n}","outputs":1,"noerr":0,"initialize":"// Code added here will be run once\n// whenever the node is started.\nnode.send({ payload: \" \" });\ncontext.set('last_value', 0);\n","finalize":"","libs":[],"x":590,"y":1260,"wires":[["acf1c7535b9056df"]]},{"id":"a71d1eafc3148778","type":"function","z":"9469147d85cf6677","name":"Tendenz 2","func":"let p = msg.payload;\nif (context.get('last_value') === 0) {\n    msg.payload = date_time_string() + '&nbsp' + p;\n}\nelse if (msg.payload < context.get('last_value')) {\n    msg.payload = date_time_string() + '&nbsp' + p + '&nbsp' + '<i class=\"fa fa-arrow-circle-down fa-1x\" aria-hidden=\"true\"></i>';\n}\nelse if (msg.payload === context.get('last_value')) {\n    msg.payload = date_time_string() + '&nbsp' + p + '&nbsp' + '<i class=\"fa fa-arrow-circle-right fa-1x\" aria-hidden=\"true\"></i>';\n}\nelse if (msg.payload > context.get('last_value')) {\n    msg.payload = date_time_string() + '&nbsp' + p + '&nbsp' + '<i class=\"fa fa-arrow-circle-up fa-1x\" aria-hidden=\"true\"></i>';\n}\ncontext.set('last_value', p);\nreturn msg;\n\nfunction date_time_string() {\n    const date = new Date(Date.now());\n    //const year = date.getFullYear();\n    //const month = (\"0\" + (date.getMonth() + 1)).slice(-2);\n    //const day = (\"0\" + date.getDate()).slice(-2);\n    const hours = (\"0\" + date.getHours()).slice(-2);\n    const minutes = (\"0\" + date.getMinutes()).slice(-2);\n    const seconds = (\"0\" + date.getSeconds()).slice(-2);\n//    let datetimestring = day + \"-\" + month + \"-\" + year + \" \" + hours + ':' + minutes + ':' + seconds;\n    let datetimestring = hours + ':' + minutes + ':' + seconds;    \n    return datetimestring;\n}","outputs":1,"noerr":0,"initialize":"// Code added here will be run once\n// whenever the node is started.\nnode.send({ payload: \" \" });\ncontext.set('last_value', 0);\n","finalize":"","libs":[],"x":590,"y":1180,"wires":[["618e5dc9dd362adf"]]},{"id":"45d4333138dae825","type":"function","z":"9469147d85cf6677","name":"Tendenz 1","func":"let p = msg.payload;\nif (context.get('last_value') === 0) {\n    msg.payload = date_time_string() + '&nbsp' + p;\n}\nelse if (msg.payload < context.get('last_value')) {\n    msg.payload = date_time_string() + '&nbsp' + p + '&nbsp' + '<i class=\"fa fa-arrow-circle-down fa-1x\" aria-hidden=\"true\"></i>';\n}\nelse if (msg.payload === context.get('last_value')) {\n    msg.payload = date_time_string() + '&nbsp' + p + '&nbsp' + '<i class=\"fa fa-arrow-circle-right fa-1x\" aria-hidden=\"true\"></i>';\n}\nelse if (msg.payload > context.get('last_value')) {\n    msg.payload = date_time_string() + '&nbsp' + p + '&nbsp' + '<i class=\"fa fa-arrow-circle-up fa-1x\" aria-hidden=\"true\"></i>';\n}\ncontext.set('last_value', p);\nreturn msg;\n\nfunction date_time_string() {\n    const date = new Date(Date.now());\n    //const year = date.getFullYear();\n    //const month = (\"0\" + (date.getMonth() + 1)).slice(-2);\n    //const day = (\"0\" + date.getDate()).slice(-2);\n    const hours = (\"0\" + date.getHours()).slice(-2);\n    const minutes = (\"0\" + date.getMinutes()).slice(-2);\n    const seconds = (\"0\" + date.getSeconds()).slice(-2);\n//    let datetimestring = day + \"-\" + month + \"-\" + year + \" \" + hours + ':' + minutes + ':' + seconds;\n    let datetimestring = hours + ':' + minutes + ':' + seconds;    \n    return datetimestring;\n}","outputs":1,"noerr":0,"initialize":"// Code added here will be run once\n// whenever the node is started.\nnode.send({ payload: \" \" });\ncontext.set('last_value', 0);\n","finalize":"","libs":[],"x":590,"y":1100,"wires":[["a1ee4e75123efc29"]]},{"id":"67e7ccc7233608f6","type":"mqtt-broker","name":"mqtt-broker","broker":"10.0.0.43:1883","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""},{"id":"e25da20c3f5e7e14","type":"ui_group","name":"Aquara Sensors WSDCGQ11LM","tab":"f107620a99de236b","order":1,"disp":true,"width":"22","collapse":false,"className":""},{"id":"f107620a99de236b","type":"ui_tab","name":"Sensors","icon":"dashboard","order":5,"disabled":false,"hidden":false}]

3 Likes

I have added min-max values to the flow which is very usefull in sensor use cases.
Reset of min max is set to occur on midnight. Can be changed to week etc.



Zigbee-27.01.2024.txt (146.6 KB)

Flow updated 27.01.2024 at 15:34 (added gauges for Voltage and Linlquality)