How to choose the highest temperature value in 8x8 array of amg8833 and display it on the dashboard?

Hi, i have a problem in writing the function to display only the highest value in the 8x8 array of AMG8833. below is my currently dashboard. but for the temperature reading value is not correct. I want to display on the temperature reading value the highest temperature that is display on the 8x8 array of thermal imaging.

here is my function for the temperature reading.

Please show us the data used to render the thermal image

Better still, use the "copy value" button on the debug to grab the actual values as text & share your flow.

the flow of my node

Unfortunately, I can not use pictures to re-create (or solve) your problem.

  • For a flow - Use the node-red export feature (CTRL+E)
  • for data in a debug message - use the "copy value" button on the debug message property

See this post for more details - How to share code or flow json

Try something like this

[{"id":"942c070f.f38758","type":"inject","z":"c791cbc0.84f648","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[[1,2,3,4],[5,6,7,8],[2,3,4,5],[3,4,5,6]]","payloadType":"json","x":200,"y":220,"wires":[["b6f5da19.9d47d8"]]},{"id":"b6f5da19.9d47d8","type":"change","z":"c791cbc0.84f648","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$$.payload.*^($)[-1]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":220,"wires":[["8a8158b3.d3d318","aa51af73.3bbed"]]},{"id":"8a8158b3.d3d318","type":"ui_gauge","z":"c791cbc0.84f648","name":"","group":"b9d366f18ff7ae74","order":22,"width":0,"height":0,"gtype":"gage","title":"gauge","label":"units","format":"{{value}}","min":0,"max":10,"colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","className":"","x":650,"y":220,"wires":[]},{"id":"aa51af73.3bbed","type":"debug","z":"c791cbc0.84f648","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":600,"y":360,"wires":[]},{"id":"b9d366f18ff7ae74","type":"ui_group","name":"test","tab":"ffba43d73860d25d","order":1,"disp":true,"width":12,"collapse":false},{"id":"ffba43d73860d25d","type":"ui_tab","name":"Level","icon":"dashboard","order":3,"disabled":false,"hidden":false}]

sorry.. here is my node flow

[{"id":"948243a3.6a4c2","type":"tab","label":"Thermal Image","disabled":false,"info":""},{"id":"c0f81119.2fa26","type":"mqtt in","z":"948243a3.6a4c2","name":"","topic":"/thermal/status","qos":"0","datatype":"auto","broker":"c11e7bc99adf471c","nl":false,"rap":false,"inputs":0,"x":120,"y":240,"wires":[["250280cb.2d764"]]},{"id":"6ca67c67.5158f4","type":"debug","z":"948243a3.6a4c2","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":570,"y":200,"wires":},{"id":"7f0330d.502b7d","type":"mqtt in","z":"948243a3.6a4c2","name":"","topic":"/thermal/thermal","qos":"0","datatype":"auto","broker":"c11e7bc99adf471c","nl":false,"rap":false,"inputs":0,"x":120,"y":400,"wires":[["5ff1fcf0.3046e4","cb9daecb.6bbc4","42f56a4e76409de7"]]},{"id":"5ff1fcf0.3046e4","type":"debug","z":"948243a3.6a4c2","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":750,"y":400,"wires":},{"id":"250280cb.2d764","type":"json","z":"948243a3.6a4c2","name":"","property":"payload","action":"","pretty":false,"x":330,"y":240,"wires":[["6ca67c67.5158f4","eed49414.163348","bc13ee80.e8f6a"]]},{"id":"cb9daecb.6bbc4","type":"function","z":"948243a3.6a4c2","name":"Render image","func":"let camColors = ["#0a00bb","#0b00ba","#0c00ba","#0d00b9","#0e00b8","#0f00b7","#1000b7","#1100b6","#1200b5","#1300b4","#1400b4","#1500b3","#1600b2","#1700b1","#1800b1","#1800b0","#1900af","#1a00ae","#1b00ae","#1c00ad","#1d00ac","#1e00ac","#1f00ab","#2000aa","#2100a9","#2200a9","#2300a8","#2400a7","#2500a6","#2600a6","#2700a5","#2800a4","#2900a3","#2a00a3","#2b00a2","#2c00a1","#2d00a0","#2e00a0","#2f009f","#30009e","#31009e","#32009d","#33009c","#33009b","#34009b","#35009a","#360099","#370098","#380098","#390097","#3a0096","#3b0095","#3c0095","#3d0094","#3e0093","#3f0093","#400092","#410091","#420090","#430090","#44008f","#45008e","#46008d","#47008d","#48008c","#49008b","#4a008a","#4b008a","#4c0089","#4d0088","#4e0087","#4e0087","#4f0086","#500085","#510085","#520084","#530083","#540082","#550082","#560081","#570080","#58007f","#59007f","#5a007e","#5b007d","#5c007c","#5d007c","#5e007b","#5f007a","#600079","#610079","#620078","#630077","#640077","#650076","#660075","#670074","#680074","#690073","#690072","#6a0071","#6b0071","#6c0070","#6d006f","#6e006e","#6f006e","#70006d","#71006c","#72006b","#73006b","#74006a","#750069","#760069","#770068","#780067","#790066","#7a0066","#7b0065","#7c0064","#7d0063","#7e0063","#7f0062","#800061","#810060","#820060","#83005f","#84005e","#85005e","#85005d","#86005c","#87005b","#88005b","#89005a","#8a0059","#8b0058","#8c0058","#8d0057","#8e0056","#8f0055","#900055","#910054","#920053","#930052","#940052","#950051","#960050","#970050","#98004f","#99004e","#9a004d","#9b004d","#9c004c","#9d004b","#9e004a","#9f004a","#a00049","#a00048","#a10047","#a20047","#a30046","#a40045","#a50044","#a60044","#a70043","#a80042","#a90042","#aa0041","#ab0040","#ac003f","#ad003f","#ae003e","#af003d","#b0003c","#b1003c","#b2003b","#b3003a","#b40039","#b50039","#b60038","#b70037","#b80036","#b90036","#ba0035","#bb0034","#bb0034","#bc0033","#bd0032","#be0031","#bf0031","#c00030","#c1002f","#c2002e","#c3002e","#c4002d","#c5002c","#c6002b","#c7002b","#c8002a","#c90029","#ca0028","#cb0028","#cc0027","#cd0026","#ce0026","#cf0025","#d00024","#d10023","#d20023","#d30022","#d40021","#d50020","#d60020","#d6001f","#d7001e","#d8001d","#d9001d","#da001c","#db001b","#dc001b","#dd001a","#de0019","#df0018","#e00018","#e10017","#e20016","#e30015","#e40015","#e50014","#e60013","#e70012","#e80012","#e90011","#ea0010","#eb000f","#ec000f","#ed000e","#ee000d","#ef000d","#f0000c","#f1000b","#f1000a","#f2000a","#f30009","#f40008","#f50007","#f60007","#f70006","#f80005","#f90004","#fa0004","#fb0003","#fc0002","#fd0001","#fe0001","#ff0000"];\nlet MINTEMP = 20.0;\nlet MAXTEMP = 32.0;\n\n\nlet html = "<table border=\"0\" padding=\"0\" spacing=\"0\">";\n\nlet image = msg.payload.split(",");\n\n// auto calculate min and max\nMINTEMP = 200.0;\nMAXTEMP = 0.0;\nfor (let k=0;k<64;k++) {\n let value = parseFloat(image[k]);\n if (value<MINTEMP) { MINTEMP = value; }\n if (value>MAXTEMP) { MAXTEMP = value; }\n}\nif (MAXTEMP-MINTEMP<10) { MAXTEMP = MINTEMP + 10.0; }\n\nfor (let i=0;i<8;i++) {\n html = html + ""\n for (let j=0;j<8;j++) {\n let mycolor = parseFloat(image[i*8+j]);\n let temp =parseFloat(image[(i8+j)])+5.0;\n if (mycolor<MINTEMP) { mycolor = MINTEMP; }\n if (mycolor>MAXTEMP) { mycolor = MAXTEMP; }\n mycolor = Math.floor(255(mycolor-MINTEMP)/(MAXTEMP-MINTEMP));\n //html = html + mycolor + ",";\n if (mycolor>253) { mycolor = 253; }\n mycolor = camColors[mycolor];\n html = html + "<td bgcolor=\""+mycolor+"\" width=\"40px\" height=\"40px\" align=\"center\" valign=\"middle\"><font size=\"2\" color= \"#CCCCCC\">"+temp+""\n }\n html = html + ""\n}\n\nhtml = html + ""\n\nmsg.payload = html;\n\nreturn [msg,{"payload":MINTEMP},{"payload":MAXTEMP}];","outputs":3,"noerr":0,"initialize":"","finalize":"","libs":,"x":400,"y":440,"wires":[["a3c4087e.bc2c28","ce18a3aa.bdd22"],,]},{"id":"a3c4087e.bc2c28","type":"debug","z":"948243a3.6a4c2","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":650,"y":460,"wires":},{"id":"ce18a3aa.bdd22","type":"ui_template","z":"948243a3.6a4c2","group":"38a41d52.5ca782","name":"","order":1,"width":"8","height":"10","format":"<div ng-bind-html="msg.payload">","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","x":640,"y":520,"wires":[]},{"id":"eed49414.163348","type":"ui_text","z":"948243a3.6a4c2","group":"edc77171.40e6d","order":0,"width":0,"height":0,"name":"","label":"RSSI","format":"{{msg.payload.rssi}}","layout":"row-spread","x":550,"y":240,"wires":},{"id":"bc13ee80.e8f6a","type":"ui_text","z":"948243a3.6a4c2","group":"edc77171.40e6d","order":0,"width":0,"height":0,"name":"","label":"Uptime [min]","format":"{{msg.payload.uptime}}","layout":"row-spread","x":570,"y":300,"wires":},{"id":"42f56a4e76409de7","type":"function","z":"948243a3.6a4c2","name":"","func":"\nlet image = msg.payload.split(",");\n// auto calculate min and max\n//MINTEMP = 200.0;\n//MAXTEMP = 32.0;\nfor (let k=0;k<=64;k++) {\n value = parseFloat(image[k-1])+5.0;\n \n}\nreturn [msg,{"payload":value}];\n\n\n","outputs":3,"noerr":0,"initialize":"","finalize":"","libs":,"x":380,"y":740,"wires":[,["6010fca4ae55b1d5"],]},{"id":"091e8cc89e14a149","type":"debug","z":"948243a3.6a4c2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":950,"y":640,"wires":},{"id":"fe10b2ec158fb17a","type":"ui_text","z":"948243a3.6a4c2","group":"2e00d8e7.308948","order":2,"width":0,"height":0,"name":"","label":"Temperature Reading","format":"{{msg.payload}}","layout":"row-spread","x":980,"y":700,"wires":},{"id":"5a149f8f41ade161","type":"switch","z":"948243a3.6a4c2","name":"","property":"payload","propertyType":"msg","rules":[{"t":"gte","v":"37.5","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":590,"y":880,"wires":[["0accfdcc99a7ae03","3c4250b8336f3ac7","aeefcd424d5ecb79"]]},{"id":"0accfdcc99a7ae03","type":"debug","z":"948243a3.6a4c2","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":750,"y":860,"wires":},{"id":"3c4250b8336f3ac7","type":"change","z":"948243a3.6a4c2","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":880,"y":900,"wires":[["4d9754416fede2fd"]]},{"id":"4d9754416fede2fd","type":"ui_switch","z":"948243a3.6a4c2","name":"","label":"Temperature > 37.5 ","tooltip":"","group":"2e00d8e7.308948","order":3,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":1090,"y":900,"wires":[["dfc0ec304cfacc60"]]},{"id":"6010fca4ae55b1d5","type":"delay","z":"948243a3.6a4c2","name":"","pauseType":"rate","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"5","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":660,"y":740,"wires":[["fe10b2ec158fb17a","a4d83157f77a1c59","091e8cc89e14a149","5e62cf89bf096559","5a149f8f41ade161"]]},{"id":"a4d83157f77a1c59","type":"ui_gauge","z":"948243a3.6a4c2","name":"","group":"2e00d8e7.308948","order":3,"width":0,"height":0,"gtype":"gage","title":"TEMPERATURE","label":"celcius","format":"{{value}}","min":0,"max":"100","colors":["#00b500","#e6c700","#ca3838"],"seg1":"","seg2":"","x":970,"y":760,"wires":},{"id":"13bbebf8df4d16e8","type":"mysql","z":"948243a3.6a4c2","mydb":"333d95a779e4070c","name":"thermal image","x":1340,"y":840,"wires":[]},{"id":"51ec4eb7cc866ee3","type":"inject","z":"948243a3.6a4c2","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":940,"y":420,"wires":[]},{"id":"5e62cf89bf096559","type":"function","z":"948243a3.6a4c2","name":"mysql temperature","func":"const temp = msg.payload;\nmsg.payload = [temp];\nmsg.topic = "INSERT INTO temperature(temperature) VALUES (?)";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":,"x":950,"y":820,"wires":[["8dac0e4c11314159","13bbebf8df4d16e8"]]},{"id":"8dac0e4c11314159","type":"debug","z":"948243a3.6a4c2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1210,"y":760,"wires":},{"id":"13ca8bb0941dc8bb","type":"ui_form","z":"948243a3.6a4c2","name":"","label":"","group":"2e00d8e7.308948","order":3,"width":0,"height":0,"options":[{"label":"ID","value":"id","type":"number","required":true,"rows":null},{"label":"Temperature","value":"temp","type":"number","required":true,"rows":null}],"formValue":{"id":"","temp":""},"payload":"","submit":"submit","cancel":"cancel","topic":"","x":90,"y":980,"wires":[["1b88ea0c9ba9f547","11f13721cf323d35"]]},{"id":"1b88ea0c9ba9f547","type":"debug","z":"948243a3.6a4c2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":390,"y":1100,"wires":},{"id":"11f13721cf323d35","type":"function","z":"948243a3.6a4c2","name":"mysql form","func":"const data = msg.payload;\nmsg.payload = [data.id,data.temp];\nmsg.topic = "INSERT INTO Recorded_temperature(MATRIC_NO, TEMPERATURE) VALUES (?,?)";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":,"x":410,"y":1000,"wires":[["a6281b5770ae6090","ca32eedc818e66f5","a3dd54e62a110bd0"]]},{"id":"dfc0ec304cfacc60","type":"debug","z":"948243a3.6a4c2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1290,"y":920,"wires":},{"id":"a6281b5770ae6090","type":"debug","z":"948243a3.6a4c2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":750,"y":1020,"wires":},{"id":"ca32eedc818e66f5","type":"mysql","z":"948243a3.6a4c2","mydb":"333d95a779e4070c","name":"","x":740,"y":1060,"wires":[]},{"id":"a3dd54e62a110bd0","type":"switch","z":"948243a3.6a4c2","name":"","property":"payload","propertyType":"msg","rules":[{"t":"gte","v":"3.75","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":630,"y":1140,"wires":[["8d3855ddde415822"]]},{"id":"8d3855ddde415822","type":"debug","z":"948243a3.6a4c2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":830,"y":1140,"wires":},{"id":"e119968e857acfb9","type":"remote-access","z":"948243a3.6a4c2","confignode":"42bfc4b2390226eb","name":"","verbose":0,"x":120,"y":820,"wires":[]},{"id":"f1f0da6adfe34e02","type":"remote-notification","z":"948243a3.6a4c2","confignode":"42bfc4b2390226eb","name":"","notificationTitle":"payload.title","notificationTitleType":"msg","notificationBody":"payload.body","notificationBodyType":"msg","notificationSound":"bikebell","notificationSoundComputed":"payload.sound","notificationSoundComputedType":"msg","output":1,"x":1110,"y":960,"wires":[]},{"id":"aeefcd424d5ecb79","type":"change","z":"948243a3.6a4c2","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{"title":"Temperature warning","body":"The temperature is greater than 37.5!"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":900,"y":960,"wires":[["f1f0da6adfe34e02"]]},{"id":"c11e7bc99adf471c","type":"mqtt-broker","name":"","broker":"broker.hivemq.com","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":"38a41d52.5ca782","type":"ui_group","name":"THERMAL IMAGE DISPLAY","tab":"dd1d391f.548498","order":1,"disp":true,"width":"8","collapse":false},{"id":"edc77171.40e6d","type":"ui_group","name":"Device Status","tab":"dd1d391f.548498","order":3,"disp":true,"width":"6","collapse":false},{"id":"2e00d8e7.308948","type":"ui_group","name":"TEMPERATURE MEASUREMENT","tab":"dd1d391f.548498","order":2,"disp":true,"width":"6","collapse":false},{"id":"333d95a779e4070c","type":"MySQLdatabase","name":"","host":"127.0.0.1","port":"3306","db":"dataset","tz":"","charset":"UTF8"},{"id":"42bfc4b2390226eb","type":"remote-config","name":"Node-RED UI","host":"localhost","protocol":"http","port":"1880","baseurl":"/ui","instancehash":"2lsl07kxokhomreyytes7vjv7d6g6a9xtxxfxe3gpmfx7396ra0xwyvibnnzizgc","server":"nodered02.remote-red.com","region":"de"},{"id":"dd1d391f.548498","type":"ui_tab","name":"Thermal Imaging","icon":"image","order":1,"disabled":false,"hidden":false}]

sorry im still new to this...

where should i put this?

where ever you wish. You feed the array into the change node, the change node outputs the highest value.

Ps your flow json is corrupt , you need to paste the code between backtickd
eg
```
paste code here
```

Please☝️read this - your posted flow is not valid/importable

In order to make code more readable and importable it is important to surround your code with three backticks
```
like this
```

You can edit and correct your post by clicking the pencil icon.

[{"id":"948243a3.6a4c2","type":"tab","label":"Thermal Image","disabled":false,"info":""},{"id":"c0f81119.2fa26","type":"mqtt in","z":"948243a3.6a4c2","name":"","topic":"/thermal/status","qos":"0","datatype":"auto","broker":"c11e7bc99adf471c","nl":false,"rap":false,"inputs":0,"x":120,"y":240,"wires":[["250280cb.2d764"]]},{"id":"6ca67c67.5158f4","type":"debug","z":"948243a3.6a4c2","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":570,"y":200,"wires":[]},{"id":"7f0330d.502b7d","type":"mqtt in","z":"948243a3.6a4c2","name":"","topic":"/thermal/thermal","qos":"0","datatype":"auto","broker":"c11e7bc99adf471c","nl":false,"rap":false,"inputs":0,"x":120,"y":400,"wires":[["5ff1fcf0.3046e4","cb9daecb.6bbc4","42f56a4e76409de7"]]},{"id":"5ff1fcf0.3046e4","type":"debug","z":"948243a3.6a4c2","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":750,"y":400,"wires":[]},{"id":"250280cb.2d764","type":"json","z":"948243a3.6a4c2","name":"","property":"payload","action":"","pretty":false,"x":330,"y":240,"wires":[["6ca67c67.5158f4","eed49414.163348","bc13ee80.e8f6a"]]},{"id":"cb9daecb.6bbc4","type":"function","z":"948243a3.6a4c2","name":"Render image","func":"let camColors = [\"#0a00bb\",\"#0b00ba\",\"#0c00ba\",\"#0d00b9\",\"#0e00b8\",\"#0f00b7\",\"#1000b7\",\"#1100b6\",\"#1200b5\",\"#1300b4\",\"#1400b4\",\"#1500b3\",\"#1600b2\",\"#1700b1\",\"#1800b1\",\"#1800b0\",\"#1900af\",\"#1a00ae\",\"#1b00ae\",\"#1c00ad\",\"#1d00ac\",\"#1e00ac\",\"#1f00ab\",\"#2000aa\",\"#2100a9\",\"#2200a9\",\"#2300a8\",\"#2400a7\",\"#2500a6\",\"#2600a6\",\"#2700a5\",\"#2800a4\",\"#2900a3\",\"#2a00a3\",\"#2b00a2\",\"#2c00a1\",\"#2d00a0\",\"#2e00a0\",\"#2f009f\",\"#30009e\",\"#31009e\",\"#32009d\",\"#33009c\",\"#33009b\",\"#34009b\",\"#35009a\",\"#360099\",\"#370098\",\"#380098\",\"#390097\",\"#3a0096\",\"#3b0095\",\"#3c0095\",\"#3d0094\",\"#3e0093\",\"#3f0093\",\"#400092\",\"#410091\",\"#420090\",\"#430090\",\"#44008f\",\"#45008e\",\"#46008d\",\"#47008d\",\"#48008c\",\"#49008b\",\"#4a008a\",\"#4b008a\",\"#4c0089\",\"#4d0088\",\"#4e0087\",\"#4e0087\",\"#4f0086\",\"#500085\",\"#510085\",\"#520084\",\"#530083\",\"#540082\",\"#550082\",\"#560081\",\"#570080\",\"#58007f\",\"#59007f\",\"#5a007e\",\"#5b007d\",\"#5c007c\",\"#5d007c\",\"#5e007b\",\"#5f007a\",\"#600079\",\"#610079\",\"#620078\",\"#630077\",\"#640077\",\"#650076\",\"#660075\",\"#670074\",\"#680074\",\"#690073\",\"#690072\",\"#6a0071\",\"#6b0071\",\"#6c0070\",\"#6d006f\",\"#6e006e\",\"#6f006e\",\"#70006d\",\"#71006c\",\"#72006b\",\"#73006b\",\"#74006a\",\"#750069\",\"#760069\",\"#770068\",\"#780067\",\"#790066\",\"#7a0066\",\"#7b0065\",\"#7c0064\",\"#7d0063\",\"#7e0063\",\"#7f0062\",\"#800061\",\"#810060\",\"#820060\",\"#83005f\",\"#84005e\",\"#85005e\",\"#85005d\",\"#86005c\",\"#87005b\",\"#88005b\",\"#89005a\",\"#8a0059\",\"#8b0058\",\"#8c0058\",\"#8d0057\",\"#8e0056\",\"#8f0055\",\"#900055\",\"#910054\",\"#920053\",\"#930052\",\"#940052\",\"#950051\",\"#960050\",\"#970050\",\"#98004f\",\"#99004e\",\"#9a004d\",\"#9b004d\",\"#9c004c\",\"#9d004b\",\"#9e004a\",\"#9f004a\",\"#a00049\",\"#a00048\",\"#a10047\",\"#a20047\",\"#a30046\",\"#a40045\",\"#a50044\",\"#a60044\",\"#a70043\",\"#a80042\",\"#a90042\",\"#aa0041\",\"#ab0040\",\"#ac003f\",\"#ad003f\",\"#ae003e\",\"#af003d\",\"#b0003c\",\"#b1003c\",\"#b2003b\",\"#b3003a\",\"#b40039\",\"#b50039\",\"#b60038\",\"#b70037\",\"#b80036\",\"#b90036\",\"#ba0035\",\"#bb0034\",\"#bb0034\",\"#bc0033\",\"#bd0032\",\"#be0031\",\"#bf0031\",\"#c00030\",\"#c1002f\",\"#c2002e\",\"#c3002e\",\"#c4002d\",\"#c5002c\",\"#c6002b\",\"#c7002b\",\"#c8002a\",\"#c90029\",\"#ca0028\",\"#cb0028\",\"#cc0027\",\"#cd0026\",\"#ce0026\",\"#cf0025\",\"#d00024\",\"#d10023\",\"#d20023\",\"#d30022\",\"#d40021\",\"#d50020\",\"#d60020\",\"#d6001f\",\"#d7001e\",\"#d8001d\",\"#d9001d\",\"#da001c\",\"#db001b\",\"#dc001b\",\"#dd001a\",\"#de0019\",\"#df0018\",\"#e00018\",\"#e10017\",\"#e20016\",\"#e30015\",\"#e40015\",\"#e50014\",\"#e60013\",\"#e70012\",\"#e80012\",\"#e90011\",\"#ea0010\",\"#eb000f\",\"#ec000f\",\"#ed000e\",\"#ee000d\",\"#ef000d\",\"#f0000c\",\"#f1000b\",\"#f1000a\",\"#f2000a\",\"#f30009\",\"#f40008\",\"#f50007\",\"#f60007\",\"#f70006\",\"#f80005\",\"#f90004\",\"#fa0004\",\"#fb0003\",\"#fc0002\",\"#fd0001\",\"#fe0001\",\"#ff0000\"];\nlet MINTEMP = 20.0;\nlet MAXTEMP = 32.0;\n\n\nlet html = \"<table border=\\\"0\\\" padding=\\\"0\\\" spacing=\\\"0\\\">\";\n\nlet image = msg.payload.split(\",\");\n\n// auto calculate min and max\nMINTEMP = 200.0;\nMAXTEMP = 0.0;\nfor (let k=0;k<64;k++) {\n    let value = parseFloat(image[k]);\n    if (value<MINTEMP) { MINTEMP = value; }\n    if (value>MAXTEMP) { MAXTEMP = value; }\n}\nif (MAXTEMP-MINTEMP<10) { MAXTEMP = MINTEMP + 10.0; }\n\nfor (let i=0;i<8;i++) {\n    html = html + \"<tr>\"\n    for (let j=0;j<8;j++) {\n        let mycolor = parseFloat(image[i*8+j]);\n        let temp =parseFloat(image[(i*8+j)])+5.0;\n        if (mycolor<MINTEMP) { mycolor = MINTEMP; }\n        if (mycolor>MAXTEMP) { mycolor = MAXTEMP; }\n        mycolor = Math.floor(255*(mycolor-MINTEMP)/(MAXTEMP-MINTEMP));\n        //html = html + mycolor + \",\";\n        if (mycolor>253) { mycolor = 253; }\n        mycolor = camColors[mycolor];\n        html = html + \"<td bgcolor=\\\"\"+mycolor+\"\\\" width=\\\"40px\\\" height=\\\"40px\\\" align=\\\"center\\\" valign=\\\"middle\\\"><font size=\\\"2\\\" color= \\\"#CCCCCC\\\">\"+temp+\"</font></td>\"\n    }\n    html = html + \"</tr>\"\n}\n\nhtml = html + \"</table>\"\n\nmsg.payload = html;\n\nreturn [msg,{\"payload\":MINTEMP},{\"payload\":MAXTEMP}];","outputs":3,"noerr":0,"initialize":"","finalize":"","libs":[],"x":400,"y":440,"wires":[["a3c4087e.bc2c28","ce18a3aa.bdd22"],[],[]]},{"id":"a3c4087e.bc2c28","type":"debug","z":"948243a3.6a4c2","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":650,"y":460,"wires":[]},{"id":"ce18a3aa.bdd22","type":"ui_template","z":"948243a3.6a4c2","group":"38a41d52.5ca782","name":"","order":1,"width":"8","height":"10","format":"<div ng-bind-html=\"msg.payload\"></div>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","x":640,"y":520,"wires":[[]]},{"id":"eed49414.163348","type":"ui_text","z":"948243a3.6a4c2","group":"edc77171.40e6d","order":0,"width":0,"height":0,"name":"","label":"RSSI","format":"{{msg.payload.rssi}}","layout":"row-spread","x":550,"y":240,"wires":[]},{"id":"bc13ee80.e8f6a","type":"ui_text","z":"948243a3.6a4c2","group":"edc77171.40e6d","order":0,"width":0,"height":0,"name":"","label":"Uptime [min]","format":"{{msg.payload.uptime}}","layout":"row-spread","x":570,"y":300,"wires":[]},{"id":"42f56a4e76409de7","type":"function","z":"948243a3.6a4c2","name":"","func":"\nlet image = msg.payload.split(\",\");\n// auto calculate min and max\n//MINTEMP = 200.0;\n//MAXTEMP = 32.0;\nfor (let k=0;k<=64;k++) {\n    value = parseFloat(image[k-1])+5.0;\n   \n}\nreturn [msg,{\"payload\":value}];\n\n\n","outputs":3,"noerr":0,"initialize":"","finalize":"","libs":[],"x":380,"y":740,"wires":[[],["6010fca4ae55b1d5"],[]]},{"id":"091e8cc89e14a149","type":"debug","z":"948243a3.6a4c2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":950,"y":640,"wires":[]},{"id":"fe10b2ec158fb17a","type":"ui_text","z":"948243a3.6a4c2","group":"2e00d8e7.308948","order":2,"width":0,"height":0,"name":"","label":"Temperature Reading","format":"{{msg.payload}}","layout":"row-spread","x":980,"y":700,"wires":[]},{"id":"5a149f8f41ade161","type":"switch","z":"948243a3.6a4c2","name":"","property":"payload","propertyType":"msg","rules":[{"t":"gte","v":"37.5","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":590,"y":880,"wires":[["0accfdcc99a7ae03","3c4250b8336f3ac7","aeefcd424d5ecb79"]]},{"id":"0accfdcc99a7ae03","type":"debug","z":"948243a3.6a4c2","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":750,"y":860,"wires":[]},{"id":"3c4250b8336f3ac7","type":"change","z":"948243a3.6a4c2","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":880,"y":900,"wires":[["4d9754416fede2fd"]]},{"id":"4d9754416fede2fd","type":"ui_switch","z":"948243a3.6a4c2","name":"","label":"Temperature > 37.5 ","tooltip":"","group":"2e00d8e7.308948","order":3,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":1090,"y":900,"wires":[["dfc0ec304cfacc60"]]},{"id":"6010fca4ae55b1d5","type":"delay","z":"948243a3.6a4c2","name":"","pauseType":"rate","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"5","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":660,"y":740,"wires":[["fe10b2ec158fb17a","a4d83157f77a1c59","091e8cc89e14a149","5e62cf89bf096559","5a149f8f41ade161"]]},{"id":"a4d83157f77a1c59","type":"ui_gauge","z":"948243a3.6a4c2","name":"","group":"2e00d8e7.308948","order":3,"width":0,"height":0,"gtype":"gage","title":"TEMPERATURE","label":"celcius","format":"{{value}}","min":0,"max":"100","colors":["#00b500","#e6c700","#ca3838"],"seg1":"","seg2":"","x":970,"y":760,"wires":[]},{"id":"13bbebf8df4d16e8","type":"mysql","z":"948243a3.6a4c2","mydb":"333d95a779e4070c","name":"thermal image","x":1340,"y":840,"wires":[[]]},{"id":"51ec4eb7cc866ee3","type":"inject","z":"948243a3.6a4c2","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":940,"y":420,"wires":[[]]},{"id":"5e62cf89bf096559","type":"function","z":"948243a3.6a4c2","name":"mysql temperature","func":"const temp = msg.payload;\nmsg.payload = [temp];\nmsg.topic = \"INSERT INTO temperature(temperature) VALUES (?)\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":950,"y":820,"wires":[["8dac0e4c11314159","13bbebf8df4d16e8"]]},{"id":"8dac0e4c11314159","type":"debug","z":"948243a3.6a4c2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1210,"y":760,"wires":[]},{"id":"13ca8bb0941dc8bb","type":"ui_form","z":"948243a3.6a4c2","name":"","label":"","group":"2e00d8e7.308948","order":3,"width":0,"height":0,"options":[{"label":"ID","value":"id","type":"number","required":true,"rows":null},{"label":"Temperature","value":"temp","type":"number","required":true,"rows":null}],"formValue":{"id":"","temp":""},"payload":"","submit":"submit","cancel":"cancel","topic":"","x":90,"y":980,"wires":[["1b88ea0c9ba9f547","11f13721cf323d35"]]},{"id":"1b88ea0c9ba9f547","type":"debug","z":"948243a3.6a4c2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":390,"y":1100,"wires":[]},{"id":"11f13721cf323d35","type":"function","z":"948243a3.6a4c2","name":"mysql form","func":"const data = msg.payload;\nmsg.payload = [data.id,data.temp];\nmsg.topic = \"INSERT INTO Recorded_temperature(MATRIC_NO, TEMPERATURE) VALUES (?,?)\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":410,"y":1000,"wires":[["a6281b5770ae6090","ca32eedc818e66f5","a3dd54e62a110bd0"]]},{"id":"dfc0ec304cfacc60","type":"debug","z":"948243a3.6a4c2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1290,"y":920,"wires":[]},{"id":"a6281b5770ae6090","type":"debug","z":"948243a3.6a4c2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":750,"y":1020,"wires":[]},{"id":"ca32eedc818e66f5","type":"mysql","z":"948243a3.6a4c2","mydb":"333d95a779e4070c","name":"","x":740,"y":1060,"wires":[[]]},{"id":"a3dd54e62a110bd0","type":"switch","z":"948243a3.6a4c2","name":"","property":"payload","propertyType":"msg","rules":[{"t":"gte","v":"3.75","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":630,"y":1140,"wires":[["8d3855ddde415822"]]},{"id":"8d3855ddde415822","type":"debug","z":"948243a3.6a4c2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":830,"y":1140,"wires":[]},{"id":"e119968e857acfb9","type":"remote-access","z":"948243a3.6a4c2","confignode":"42bfc4b2390226eb","name":"","verbose":0,"x":120,"y":820,"wires":[[]]},{"id":"f1f0da6adfe34e02","type":"remote-notification","z":"948243a3.6a4c2","confignode":"42bfc4b2390226eb","name":"","notificationTitle":"payload.title","notificationTitleType":"msg","notificationBody":"payload.body","notificationBodyType":"msg","notificationSound":"bikebell","notificationSoundComputed":"payload.sound","notificationSoundComputedType":"msg","output":1,"x":1110,"y":960,"wires":[[]]},{"id":"aeefcd424d5ecb79","type":"change","z":"948243a3.6a4c2","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"title\":\"Temperature warning\",\"body\":\"The temperature is greater than 37.5!\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":900,"y":960,"wires":[["f1f0da6adfe34e02"]]},{"id":"c11e7bc99adf471c","type":"mqtt-broker","name":"","broker":"broker.hivemq.com","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":"38a41d52.5ca782","type":"ui_group","name":"THERMAL IMAGE DISPLAY","tab":"dd1d391f.548498","order":1,"disp":true,"width":"8","collapse":false},{"id":"edc77171.40e6d","type":"ui_group","name":"Device Status","tab":"dd1d391f.548498","order":3,"disp":true,"width":"6","collapse":false},{"id":"2e00d8e7.308948","type":"ui_group","name":"TEMPERATURE MEASUREMENT","tab":"dd1d391f.548498","order":2,"disp":true,"width":"6","collapse":false},{"id":"333d95a779e4070c","type":"MySQLdatabase","name":"","host":"127.0.0.1","port":"3306","db":"dataset","tz":"","charset":"UTF8"},{"id":"42bfc4b2390226eb","type":"remote-config","name":"Node-RED UI","host":"localhost","protocol":"http","port":"1880","baseurl":"/ui","instancehash":"2lsl07kxokhomreyytes7vjv7d6g6a9xtxxfxe3gpmfx7396ra0xwyvibnnzizgc","server":"nodered02.remote-red.com","region":"de"},{"id":"dd1d391f.548498","type":"ui_tab","name":"Thermal Imaging","icon":"image","order":1,"disabled":false,"hidden":false}]

Hi, there was really no need to post your entire flow - a cut down demo would suffice. You also didn't provide sample data.

never mind.

Here is a demo I knocked up

[{"id":"b20b0bace1cb8757","type":"function","z":"23a4d2dd73b6359f","name":"min max","func":"\nconst image = msg.payload.split(\",\");\nconst data = image.map(e => parseFloat(e) + 5.0);\nconst min = Math.min(...data);\nconst max = Math.max(...data);\n\nmsg.payload = {\n    min: min,\n    max: max\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":640,"y":320,"wires":[["b1c2ac35c45cb973"]]},{"id":"7926e8b8790cd901","type":"function","z":"23a4d2dd73b6359f","name":"min and max separate","func":"\nconst image = msg.payload.split(\",\");\nconst data = image.map(e => parseFloat(e) + 5.0);\nconst min = Math.min(...data);\nconst max = Math.max(...data);\n\nreturn [{ payload: min }, { payload: max }];","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":680,"y":380,"wires":[["d2213c2210e09113"],["1b5e47b734bfecf6"]]},{"id":"26f4abce7d70d21c","type":"inject","z":"23a4d2dd73b6359f","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"30,20,40,33,44,26,27","payloadType":"str","x":440,"y":320,"wires":[["b20b0bace1cb8757","7926e8b8790cd901"]]},{"id":"b1c2ac35c45cb973","type":"debug","z":"23a4d2dd73b6359f","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":910,"y":320,"wires":[]},{"id":"d2213c2210e09113","type":"debug","z":"23a4d2dd73b6359f","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":910,"y":380,"wires":[]},{"id":"1b5e47b734bfecf6","type":"debug","z":"23a4d2dd73b6359f","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":910,"y":440,"wires":[]}]

NOTE: for anyone looking at the image and thinking 25 is not the min - the OP had a formula to add 5.0 to the value. I included this in the demo (remove that if not required)

This seems to be the function node that feeds your gauge:

let image = msg.payload.split(",");
// auto calculate min and max
//MINTEMP = 200.0;
//MAXTEMP = 32.0;
for (let k=0;k<=64;k++) {
    value = parseFloat(image[k-1])+5.0;  
}
return [msg,{"payload":value}];

I think you are trying to loop through all the values in the array, but you don't do anything with the measurements, so the value passed to the gauge comes from the last array element.

But your other function "Render image" does record MINTEMP and MAXTEMP. Why can't you send MAXTEMP to your gauge?

Edit - Looking at the picture you posted, I would expect the gauge to show 40.75 (35.75 + 5.0) so either I'm misunderstanding the code or else that picture is from an earlier attempt at the code.

And I suspect that

for (let k=0;k<=64;k++) {
    value = parseFloat(image[k-1])+5.0;  
}

would be better as

for (let k=0;k<64;k++) {
    value = parseFloat(image[k])+5.0;  
}

thank you.. i got it already

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