3 temperature Output calculate AVG

Hello
i have this script

[{"id":"88e25ccc.26438","type":"inject","z":"3ddc05.29f503fc","name":"20min","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":1380,"wires":[["6e9bd378.23487c","6b1bf86a.7f7d68","1c54e009.db931"]]},{"id":"6e9bd378.23487c","type":"http request","z":"3ddc05.29f503fc","name":"station=WYN","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://app-prod-ws.meteoswiss-app.ch/v1/stationOverview?station=WYN","tls":"","persist":false,"proxy":"","authType":"","x":350,"y":1320,"wires":[["9cc540f5.dcb39"]]},{"id":"9cc540f5.dcb39","type":"change","z":"3ddc05.29f503fc","name":"","rules":[{"t":"move","p":"payload.WYN","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":1320,"wires":[["cc0cee7c.d7fcf"]]},{"id":"cc0cee7c.d7fcf","type":"function","z":"3ddc05.29f503fc","name":"","func":"msg.payload = {\nTemperatur: msg.payload.temperature\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":840,"y":1320,"wires":[["84c8f28.bc2491"]]},{"id":"84c8f28.bc2491","type":"debug","z":"3ddc05.29f503fc","name":"","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1020,"y":1320,"wires":[]},{"id":"6b1bf86a.7f7d68","type":"http request","z":"3ddc05.29f503fc","name":"station=GOE","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://app-prod-ws.meteoswiss-app.ch/v1/stationOverview?station=GOE","tls":"","persist":false,"proxy":"","authType":"","x":350,"y":1460,"wires":[["625b3202.b68ebc"]]},{"id":"625b3202.b68ebc","type":"change","z":"3ddc05.29f503fc","name":"","rules":[{"t":"move","p":"payload.GOE","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":1460,"wires":[["4eba41c.51e9ec"]]},{"id":"4eba41c.51e9ec","type":"function","z":"3ddc05.29f503fc","name":"","func":"msg.payload = {\nTemperatur: msg.payload.temperature\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":840,"y":1460,"wires":[["8174003a.08764"]]},{"id":"8174003a.08764","type":"debug","z":"3ddc05.29f503fc","name":"","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1020,"y":1460,"wires":[]},{"id":"1c54e009.db931","type":"http request","z":"3ddc05.29f503fc","name":"station=EGO","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://app-prod-ws.meteoswiss-app.ch/v1/stationOverview?station=EGO","tls":"","persist":false,"proxy":"","authType":"","x":350,"y":1600,"wires":[["6411ddf2.fed4c4"]]},{"id":"6411ddf2.fed4c4","type":"change","z":"3ddc05.29f503fc","name":"","rules":[{"t":"move","p":"payload.EGO","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":1600,"wires":[["33488a96.e7ce16"]]},{"id":"33488a96.e7ce16","type":"function","z":"3ddc05.29f503fc","name":"","func":"msg.payload = {\nTemperatur: msg.payload.temperature\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":840,"y":1600,"wires":[["b1e7633b.51ceb"]]},{"id":"b1e7633b.51ceb","type":"debug","z":"3ddc05.29f503fc","name":"","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1020,"y":1600,"wires":[]}]

at the end i wish to have a AVG of this 3 Temperature is there a node for?

have a nice day
vinc

this would put out the pure number

[{"id":"88e25ccc.26438","type":"inject","z":"3ddc05.29f503fc","name":"20min","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":1380,"wires":[["6e9bd378.23487c","6b1bf86a.7f7d68","1c54e009.db931"]]},{"id":"6e9bd378.23487c","type":"http request","z":"3ddc05.29f503fc","name":"station=WYN","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://app-prod-ws.meteoswiss-app.ch/v1/stationOverview?station=WYN","tls":"","persist":false,"proxy":"","authType":"","x":350,"y":1320,"wires":[["9cc540f5.dcb39"]]},{"id":"9cc540f5.dcb39","type":"change","z":"3ddc05.29f503fc","name":"","rules":[{"t":"move","p":"payload.WYN","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":1320,"wires":[["35fe931b.1e9f4c"]]},{"id":"84c8f28.bc2491","type":"debug","z":"3ddc05.29f503fc","name":"","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1140,"y":1320,"wires":[]},{"id":"6b1bf86a.7f7d68","type":"http request","z":"3ddc05.29f503fc","name":"station=GOE","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://app-prod-ws.meteoswiss-app.ch/v1/stationOverview?station=GOE","tls":"","persist":false,"proxy":"","authType":"","x":350,"y":1460,"wires":[["625b3202.b68ebc"]]},{"id":"625b3202.b68ebc","type":"change","z":"3ddc05.29f503fc","name":"","rules":[{"t":"move","p":"payload.GOE","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":1460,"wires":[["2c6cd741.c58848"]]},{"id":"8174003a.08764","type":"debug","z":"3ddc05.29f503fc","name":"","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1160,"y":1460,"wires":[]},{"id":"1c54e009.db931","type":"http request","z":"3ddc05.29f503fc","name":"station=EGO","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://app-prod-ws.meteoswiss-app.ch/v1/stationOverview?station=EGO","tls":"","persist":false,"proxy":"","authType":"","x":350,"y":1600,"wires":[["6411ddf2.fed4c4"]]},{"id":"6411ddf2.fed4c4","type":"change","z":"3ddc05.29f503fc","name":"","rules":[{"t":"move","p":"payload.EGO","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":1600,"wires":[["a7fba2a9.073c6"]]},{"id":"b1e7633b.51ceb","type":"debug","z":"3ddc05.29f503fc","name":"","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1160,"y":1600,"wires":[]},{"id":"35fe931b.1e9f4c","type":"change","z":"3ddc05.29f503fc","name":"","rules":[{"t":"move","p":"payload.temperature","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":900,"y":1320,"wires":[["84c8f28.bc2491"]]},{"id":"2c6cd741.c58848","type":"change","z":"3ddc05.29f503fc","name":"","rules":[{"t":"move","p":"payload.temperature","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":900,"y":1460,"wires":[["8174003a.08764"]]},{"id":"a7fba2a9.073c6","type":"change","z":"3ddc05.29f503fc","name":"","rules":[{"t":"move","p":"payload.temperature","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":900,"y":1600,"wires":[["b1e7633b.51ceb"]]}]

Just join messages and calculate.
eg

[{"id":"d887e9ed.a49db","type":"inject","z":"8d22ae29.7df6d","name":"20min","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":270,"y":3120,"wires":[["53948fac.5dcf28","2e4dde11.fd7182","573d4135.dc548"]]},{"id":"53948fac.5dcf28","type":"http request","z":"8d22ae29.7df6d","name":"station=WYN","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://app-prod-ws.meteoswiss-app.ch/v1/stationOverview?station=WYN","tls":"","persist":false,"proxy":"","authType":"","x":290,"y":3040,"wires":[["b1b996b4.d5c79"]]},{"id":"2e4dde11.fd7182","type":"http request","z":"8d22ae29.7df6d","name":"station=GOE","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://app-prod-ws.meteoswiss-app.ch/v1/stationOverview?station=GOE","tls":"","persist":false,"proxy":"","authType":"","x":290,"y":3180,"wires":[["61d7e41.b07f81c"]]},{"id":"573d4135.dc548","type":"http request","z":"8d22ae29.7df6d","name":"station=EGO","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://app-prod-ws.meteoswiss-app.ch/v1/stationOverview?station=EGO","tls":"","persist":false,"proxy":"","authType":"","x":290,"y":3320,"wires":[["deb0f682.82ed18"]]},{"id":"b1b996b4.d5c79","type":"change","z":"8d22ae29.7df6d","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.WYN.temperature","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"WYN","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":300,"y":3080,"wires":[["ec4642fa.e3c88"]]},{"id":"61d7e41.b07f81c","type":"change","z":"8d22ae29.7df6d","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.GOE.temperature","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"GOE","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":300,"y":3220,"wires":[["ec4642fa.e3c88"]]},{"id":"deb0f682.82ed18","type":"change","z":"8d22ae29.7df6d","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.EGO.temperature","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"EGO","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":300,"y":3360,"wires":[["ec4642fa.e3c88"]]},{"id":"ec4642fa.e3c88","type":"join","z":"8d22ae29.7df6d","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"3","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":490,"y":3220,"wires":[["381e1787.e82f","f678b54a.3d1f9"]]},{"id":"381e1787.e82f","type":"function","z":"8d22ae29.7df6d","name":"","func":"msg.payload.average=Math.round((Object.values(msg.payload).reduce((pv, cv) => pv + cv, 0)/Object.keys(msg.payload).length)*100)/100;\nlet msg1={topic:\"WYM\",payload:{Temperatur:msg.payload.WYN,average:msg.payload.average}},\n    msg2={topic:\"EGO\",payload:{Temperatur:msg.payload.EGO,average:msg.payload.average}},\n    msg3={topic:\"GOE\",payload:{Temperatur:msg.payload.GOE,average:msg.payload.average}};\n\nreturn [msg1,msg2,msg3];","outputs":3,"noerr":0,"initialize":"","finalize":"","x":610,"y":3300,"wires":[["d74e5b2e.aa5e58"],["6a78b0e8.cef2d"],["547c4890.835b68"]]},{"id":"f678b54a.3d1f9","type":"debug","z":"8d22ae29.7df6d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":590,"y":3140,"wires":[]},{"id":"6a78b0e8.cef2d","type":"debug","z":"8d22ae29.7df6d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"msg","x":810,"y":3240,"wires":[]},{"id":"547c4890.835b68","type":"debug","z":"8d22ae29.7df6d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":810,"y":3320,"wires":[]},{"id":"d74e5b2e.aa5e58","type":"debug","z":"8d22ae29.7df6d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":810,"y":3160,"wires":[]}]

thanks a lot @E1cid
yes there is the needed average, i just try to modifie it to have just one output

[{"id":"5ec6038e.3eba4c","type":"http request","z":"8d22ae29.7df6d","name":"station=GOE","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://app-prod-ws.meteoswiss-app.ch/v1/stationOverview?station=GOE","tls":"","persist":false,"proxy":"","authType":"","x":110,"y":3140,"wires":[["93919ca1.6a47e8"]]},{"id":"7b2ec319.a6d86c","type":"inject","z":"8d22ae29.7df6d","name":"20min","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":90,"y":3080,"wires":[["4d22a18d.0aaac8","5ec6038e.3eba4c","d7a0c0d7.983398"]]},{"id":"93919ca1.6a47e8","type":"change","z":"8d22ae29.7df6d","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.GOE.temperature","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"GOE","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":120,"y":3180,"wires":[["ed766a7a.ccab78"]]},{"id":"4d22a18d.0aaac8","type":"http request","z":"8d22ae29.7df6d","name":"station=WYN","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://app-prod-ws.meteoswiss-app.ch/v1/stationOverview?station=WYN","tls":"","persist":false,"proxy":"","authType":"","x":110,"y":3000,"wires":[["3e139f4d.4fb7b8"]]},{"id":"d7a0c0d7.983398","type":"http request","z":"8d22ae29.7df6d","name":"station=EGO","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://app-prod-ws.meteoswiss-app.ch/v1/stationOverview?station=EGO","tls":"","persist":false,"proxy":"","authType":"","x":110,"y":3280,"wires":[["f077acd3.279a7"]]},{"id":"ed766a7a.ccab78","type":"join","z":"8d22ae29.7df6d","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"3","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":310,"y":3180,"wires":[["7dacb35.e6ca54c"]]},{"id":"3e139f4d.4fb7b8","type":"change","z":"8d22ae29.7df6d","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.WYN.temperature","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"WYN","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":120,"y":3040,"wires":[["ed766a7a.ccab78"]]},{"id":"f077acd3.279a7","type":"change","z":"8d22ae29.7df6d","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.EGO.temperature","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"EGO","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":120,"y":3320,"wires":[["ed766a7a.ccab78"]]},{"id":"7dacb35.e6ca54c","type":"change","z":"8d22ae29.7df6d","name":"","rules":[{"t":"set","p":"payload.average","pt":"msg","to":"$round($sum(payload.*)/$count($keys(payload)),2)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":3180,"wires":[["41b8718c.c4bf78"]]},{"id":"41b8718c.c4bf78","type":"debug","z":"8d22ae29.7df6d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":650,"y":3140,"wires":[]}]

all values are in msg.payload

have also done something, it works but will not get a price for it :wink:

[{"id":"88e25ccc.26438","type":"inject","z":"3ddc05.29f503fc","name":"20min","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":1380,"wires":[["6e9bd378.23487c","6b1bf86a.7f7d68","1c54e009.db931"]]},{"id":"6e9bd378.23487c","type":"http request","z":"3ddc05.29f503fc","name":"station=WYN","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://app-prod-ws.meteoswiss-app.ch/v1/stationOverview?station=WYN","tls":"","persist":false,"proxy":"","authType":"","x":350,"y":1320,"wires":[["9cc540f5.dcb39"]]},{"id":"9cc540f5.dcb39","type":"change","z":"3ddc05.29f503fc","name":"","rules":[{"t":"move","p":"payload.WYN.temperature","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":1320,"wires":[["84c8f28.bc2491","3255d1fa.3cf55e"]]},{"id":"84c8f28.bc2491","type":"debug","z":"3ddc05.29f503fc","name":"","active":false,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1140,"y":1320,"wires":[]},{"id":"6b1bf86a.7f7d68","type":"http request","z":"3ddc05.29f503fc","name":"station=GOE","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://app-prod-ws.meteoswiss-app.ch/v1/stationOverview?station=GOE","tls":"","persist":false,"proxy":"","authType":"","x":350,"y":1460,"wires":[["625b3202.b68ebc"]]},{"id":"625b3202.b68ebc","type":"change","z":"3ddc05.29f503fc","name":"","rules":[{"t":"move","p":"payload.GOE.temperature","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":1460,"wires":[["8174003a.08764","3255d1fa.3cf55e"]]},{"id":"8174003a.08764","type":"debug","z":"3ddc05.29f503fc","name":"","active":false,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1160,"y":1460,"wires":[]},{"id":"1c54e009.db931","type":"http request","z":"3ddc05.29f503fc","name":"station=EGO","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://app-prod-ws.meteoswiss-app.ch/v1/stationOverview?station=EGO","tls":"","persist":false,"proxy":"","authType":"","x":350,"y":1600,"wires":[["7b689079.80ce3"]]},{"id":"b1e7633b.51ceb","type":"debug","z":"3ddc05.29f503fc","name":"","active":false,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1160,"y":1600,"wires":[]},{"id":"3255d1fa.3cf55e","type":"join","z":"3ddc05.29f503fc","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"payload","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"3","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":930,"y":1400,"wires":[["cffd5dc2.cad0d"]]},{"id":"6c921b40.2a0964","type":"debug","z":"3ddc05.29f503fc","name":"","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1440,"y":1400,"wires":[]},{"id":"cffd5dc2.cad0d","type":"function","z":"3ddc05.29f503fc","name":"","func":"msg.payload.average=Math.round((Object.values(msg.payload).reduce((pv, cv) => pv + cv, 0)/Object.keys(msg.payload).length)*100)/100;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1080,"y":1400,"wires":[["daa29728.de9038"]]},{"id":"daa29728.de9038","type":"function","z":"3ddc05.29f503fc","name":"","func":"msg.payload = {\naverage: msg.payload.average\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1260,"y":1400,"wires":[["6c921b40.2a0964"]]},{"id":"7b689079.80ce3","type":"change","z":"3ddc05.29f503fc","name":"","rules":[{"t":"move","p":"payload.EGO.temperature","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":1600,"wires":[["b1e7633b.51ceb","8174003a.08764","3255d1fa.3cf55e"]]}]

i took 3 station around the area i live, because the mqtt input from 344MHz device on my balcon - don't go down enough because it is to much protected. so i got a idea what really is outside!
just freezing to read the output :wink:

and a next step will be get a Telegram Information to take care !

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.