How to find max & min value from received values and shows it like this

IMG_20200714_122208

see this thread for an identical question... sounds like homework time again...

1 Like

Thank You..:blush::blush:

Thank You..:blush::blush:

Plz explain more...I can't get which I want....

Show us what you have tried so far and what there does not work.

I have to show max and min values..at bottom of gauge ..like in pic..which i uploaded..

The question is: where do you get your data from. How do you want help if we dont know what you are working with.

I made random data generating fuction and connected it with gauge on it I have to show current value & max value and min value...

Please post your flow.

HVAC&RemoteEnergyMonitoring_DevSoni.json (10.8 KB)

You could do it like this. Note that you cannot dynamically set the range values of the gauge, so i used to text fields.

You will have to set an initial minimum and maximum to compare against (see the function node).

[{"id":"1d161e35.b8c412","type":"ui_gauge","z":"532ca152.47d2e","name":"","group":"a0643bc4.6e36a","order":1,"width":"6","height":"6","gtype":"wave","title":"Current","label":"A","format":"{{value}}","min":0,"max":"40","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":300,"y":432,"wires":[]},{"id":"7fe2344e.83684c","type":"ui_chart","z":"532ca152.47d2e","name":"","group":"a0643bc4.6e36a","order":4,"width":"6","height":"10","label":"Current","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"00","ymax":"50","removeOlder":"1","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":300,"y":492,"wires":[[]]},{"id":"6fe4fb05.b6de34","type":"inject","z":"532ca152.47d2e","name":"","repeat":"5","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":166,"y":336,"wires":[["673ed388.d4f7bc"]]},{"id":"673ed388.d4f7bc","type":"function","z":"532ca152.47d2e","name":"rnd","func":"msg.payload = Math.round(Math.random()*40);\nreturn msg;\n","outputs":1,"noerr":0,"x":314,"y":336,"wires":[["b5027d4.53d72"]]},{"id":"b5027d4.53d72","type":"mqtt out","z":"532ca152.47d2e","name":"pubcur","topic":"Plant1/cur","qos":"2","retain":"","broker":"425e991b.63e368","x":444,"y":336,"wires":[]},{"id":"34380b4b.8083dc","type":"mqtt in","z":"532ca152.47d2e","name":"subcur","topic":"Plant1/cur","qos":"2","datatype":"auto","broker":"425e991b.63e368","x":122,"y":456,"wires":[["1d161e35.b8c412","7fe2344e.83684c","7509e58e.22ac7c"]]},{"id":"d0f8b40b.3a728","type":"ui_text","z":"532ca152.47d2e","group":"a0643bc4.6e36a","order":2,"width":0,"height":0,"name":"min","label":"min","format":"{{msg.payload.min}}","layout":"row-spread","x":482,"y":528,"wires":[]},{"id":"ad2beaf5.6d646","type":"ui_text","z":"532ca152.47d2e","group":"a0643bc4.6e36a","order":3,"width":0,"height":0,"name":"","label":"max","format":"{{msg.payload.max}}","layout":"row-spread","x":482,"y":576,"wires":[]},{"id":"7509e58e.22ac7c","type":"function","z":"532ca152.47d2e","name":"","func":"m = parseFloat(msg.payload)\n\nmin = flow.get(\"min\") || 6 // minimum value \nmax = flow.get(\"max\") || 7 // maximum value \n\nif(m<min && m <=max){\n    flow.set(\"min\",m)\n    min = flow.get(\"min\")\n}\nif(m>max){\n   \n        flow.set(\"max\",m)\n        max = flow.get(\"max\")\n    \n}\n\n\nreturn {payload:{min:min,max:max}};","outputs":1,"noerr":0,"initialize":"","finalize":"","x":300,"y":552,"wires":[["d0f8b40b.3a728","ad2beaf5.6d646","cf55b950.b053c"]]},{"id":"cf55b950.b053c","type":"debug","z":"532ca152.47d2e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":502,"y":624,"wires":[]},{"id":"a0643bc4.6e36a","type":"ui_group","z":"","name":"Currrent(Ampere)","tab":"2590396a.bb5e46","order":5,"disp":true,"width":"6","collapse":false},{"id":"425e991b.63e368","type":"mqtt-broker","z":"","name":"","broker":"broker.hivemq.com","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","willTopic":"","willQos":"0","willRetain":"false","willPayload":""},{"id":"2590396a.bb5e46","type":"ui_tab","z":"","name":"Plant-1","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

Perfect Brother.... :smiling_face_with_three_hearts:

Thanx a lot....

I don't know if you've found what you're looking for. If it is useful, I already had the same question and developed the following flow to record these values.

See that the buttons are responsible for resetting the system, inserting very high reference values ​​in relation to the input values. In addition, there is a time stamp of the readings.

You have to adapt, but it may be useful.

[{"id":"ef356694.2d2f48","type":"change","z":"cfbb6e4f.6526a","name":"","rules":[{"t":"set","p":"max","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1150,"y":4160,"wires":[["60f61f3b.8c15a"]]},{"id":"55c269fe.b25fd8","type":"ui_button","z":"cfbb6e4f.6526a","name":"","group":"cf817aa5.c91f38","order":3,"width":8,"height":1,"passthru":true,"label":"Reset - max","tooltip":"","color":"","bgcolor":"","icon":"","payload":"-10000","payloadType":"num","topic":"","x":910,"y":4160,"wires":[["ef356694.2d2f48"]]},{"id":"1233d78.a7bba29","type":"ui_text","z":"cfbb6e4f.6526a","group":"cf817aa5.c91f38","order":1,"width":3,"height":1,"name":"value max","label":"","format":"{{msg.payload}}","layout":"row-left","x":1450,"y":4180,"wires":[]},{"id":"fca3d950.88ab78","type":"switch","z":"cfbb6e4f.6526a","name":"","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"max","vt":"flow"},{"t":"lt","v":"min","vt":"flow"}],"checkall":"true","repair":false,"outputs":2,"x":1010,"y":4200,"wires":[["ef356694.2d2f48"],["8edcf000.641ec"]]},{"id":"60f61f3b.8c15a","type":"function","z":"cfbb6e4f.6526a","name":"","func":"if(msg.payload == -10000)\n{\n msg.payload = \"-\"\n}else\n{\n msg.payload = msg.payload + \" cm \"\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1310,"y":4160,"wires":[["1233d78.a7bba29","7435ffd1.4cb91"]]},{"id":"7435ffd1.4cb91","type":"simpletime","z":"cfbb6e4f.6526a","name":" date / time ","x":1450,"y":4140,"wires":[["4d6502b4.006b3c"]]},{"id":"4d6502b4.006b3c","type":"function","z":"cfbb6e4f.6526a","name":" date / time composition","func":"var a = \"(\"+msg.mydom+\"/\"+msg.mymonthn+\"/\"+msg.myyear+ \" - \" +msg.mytimes+\")\";\nmsg.payload = a;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1650,"y":4140,"wires":[["3c40a80a.e452f8"]]},{"id":"3c40a80a.e452f8","type":"ui_text","z":"cfbb6e4f.6526a","group":"cf817aa5.c91f38","order":2,"width":5,"height":1,"name":"date / time","label":"","format":"{{msg.payload}}","layout":"row-left","x":1630,"y":4180,"wires":[]},{"id":"8edcf000.641ec","type":"change","z":"cfbb6e4f.6526a","name":"","rules":[{"t":"set","p":"min","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1150,"y":4240,"wires":[["e41a3ac4.7ff478"]]},{"id":"8f49175.c82b3e8","type":"ui_button","z":"cfbb6e4f.6526a","name":"","group":"fb78e249.cda99","order":3,"width":8,"height":1,"passthru":true,"label":"Reset - min","tooltip":"","color":"","bgcolor":"","icon":"","payload":"10000","payloadType":"num","topic":"","x":910,"y":4240,"wires":[["8edcf000.641ec"]]},{"id":"e41a3ac4.7ff478","type":"function","z":"cfbb6e4f.6526a","name":"","func":"if(msg.payload == 10000)\n{\n msg.payload = \"-\"\n}else\n{\n msg.payload = msg.payload + \" cm \"\n}\nreturn msg;","outputs":1,"noerr":0,"x":1310,"y":4240,"wires":[["3e85ada5.985b02","8cc0b0ad.31d46"]]},{"id":"3e85ada5.985b02","type":"ui_text","z":"cfbb6e4f.6526a","group":"fb78e249.cda99","order":1,"width":3,"height":1,"name":"value min","label":"","format":"{{msg.payload}}","layout":"row-left","x":1440,"y":4260,"wires":[]},{"id":"8cc0b0ad.31d46","type":"simpletime","z":"cfbb6e4f.6526a","name":" date / time ","x":1450,"y":4220,"wires":[["e815eab4.b94788"]]},{"id":"e815eab4.b94788","type":"function","z":"cfbb6e4f.6526a","name":" date / time composition","func":"var a = \"(\"+msg.mydom+\"/\"+msg.mymonthn+\"/\"+msg.myyear+ \" - \" +msg.mytimes+\")\";\nmsg.payload = a;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1650,"y":4220,"wires":[["e69f6304.ad773"]]},{"id":"e69f6304.ad773","type":"ui_text","z":"cfbb6e4f.6526a","group":"fb78e249.cda99","order":2,"width":5,"height":1,"name":"date / time","label":"","format":"{{msg.payload}}","layout":"row-left","x":1630,"y":4260,"wires":[]},{"id":"3aa77469.214dcc","type":"function","z":"cfbb6e4f.6526a","name":" purchase value (sensor)","func":"\nmsg.payload = Number(msg.payload);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":830,"y":4200,"wires":[["fca3d950.88ab78"]]},{"id":"cf817aa5.c91f38","type":"ui_group","z":"","name":"Valor máximo ","tab":"afeb27be.73ba48","order":5,"disp":true,"width":"8","collapse":false},{"id":"fb78e249.cda99","type":"ui_group","z":"","name":"Valor mínimo","tab":"afeb27be.73ba48","order":6,"disp":true,"width":"8","collapse":false},{"id":"afeb27be.73ba48","type":"ui_tab","z":"","name":"HC-SR04 - Distância","icon":"settings_input_antenna","order":3,"disabled":false,"hidden":false}]

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