MaxMin Thermometer reset

Hi,
Been trying to set up a max-min thermometer using node red (ESP32/DHT22/MQTT/RPi3(please bear with me, I'm new at this)).
I need a reset button for the max and min gauges, so used a button to fire a function node setting msg.reset = 1 to reset the subsequent smooth node(s). the gauges (fed by the smooth nodes) reset to a value of 1 - fine for the max gauge which reset to current temp with next mqtt message, but min gauge will have to wait until temp falls below 1, presumably!
So, why does the smooth node pass '1' instead of reinitialising and waiting for the next mqtt input?What did I miss, or is there a better way, please? Thank you for your forebearance, I hope that all made sense...

Post your flow so we can see what happens.

In the message where you set msg.reset=1 what have you got the msg.payload set to?

If you read the smooth nodes input panel it states

If msg.reset is received (with any value), all the counters and intermediate values are reset to an initial state.

And the initial value is that set by the reset message.

This can be seen if you import the following flow and click on the injects from top to bottom
[{"id":"d56320da.a89e3","type":"inject","z":"50f1489e.628838","name":"","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":122.5,"y":64,"wires":[["9b6faaff.fd9ff8"]]},{"id":"9b6faaff.fd9ff8","type":"smooth","z":"50f1489e.628838","name":"","property":"payload","action":"mean","count":"10","round":"","mult":"single","x":534.5,"y":194,"wires":[["9929c95.b146d38"]]},{"id":"9929c95.b146d38","type":"debug","z":"50f1489e.628838","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":694.5,"y":188,"wires":[]},{"id":"51614c7d.4e8a4c","type":"inject","z":"50f1489e.628838","name":"","topic":"","payload":"1000","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":121.5,"y":202,"wires":[["e061bc3.4439d4"]]},{"id":"e061bc3.4439d4","type":"change","z":"50f1489e.628838","name":"","rules":[{"t":"set","p":"reset","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":260.5,"y":200,"wires":[["9b6faaff.fd9ff8"]]},{"id":"8e29932b.9edde","type":"inject","z":"50f1489e.628838","name":"","topic":"","payload":"10","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":122,"y":110,"wires":[["9b6faaff.fd9ff8"]]},{"id":"efec260.dd73d58","type":"inject","z":"50f1489e.628838","name":"","topic":"","payload":"5.5","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":122,"y":150,"wires":[["9b6faaff.fd9ff8"]]},{"id":"272dd657.66f13a","type":"inject","z":"50f1489e.628838","name":"","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":118,"y":261,"wires":[["9b6faaff.fd9ff8"]]},{"id":"8077b19f.307cc8","type":"inject","z":"50f1489e.628838","name":"","topic":"","payload":"10","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":118.5,"y":305,"wires":[["9b6faaff.fd9ff8"]]},{"id":"9122d633.be8c6","type":"inject","z":"50f1489e.628838","name":"","topic":"","payload":"2","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":118.5,"y":345,"wires":[["9b6faaff.fd9ff8"]]}]

Sorry, here's my flow.
ukmoose, I've not looked at yours yet - rushing about - but I understood the msg.reset function on smooth. However, the initial value doesn't seem to follow the value ascribed to msg.reset - I just tried it with msg.reset = 40; and the gauge returned 1.
I will look at your flow as soon as I can, meanwhile, here's mine.
Thank you much for your help...

[{"id":"f234654f.652a48","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"48bdc589.059a2c","type":"debug","z":"f234654f.652a48","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":970,"y":80,"wires":[]},{"id":"8389e5e8.a68428","type":"mqtt in","z":"f234654f.652a48","name":"Temperature","topic":"topic/temp1","qos":"2","datatype":"auto","broker":"91a70537.a84f08","x":290,"y":40,"wires":[["eef3a546.489468","b5e1f1b4.1b3c6","3f49bb03.3ff104","bba9cded.2fa2a"]]},{"id":"b0de5343.65e88","type":"mqtt in","z":"f234654f.652a48","name":"Humidity","topic":"topic/humid1","qos":"2","datatype":"auto","broker":"91a70537.a84f08","x":280,"y":100,"wires":[["d4f3ffbc.bc096","769696fb.5b7668","5f722a43.0e1d84","267a07f7.80e738"]]},{"id":"eef3a546.489468","type":"ui_chart","z":"f234654f.652a48","name":"Temperature","group":"3b204857.d75b68","order":1,"width":"13","height":"3","label":"Temperature","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":730,"y":40,"wires":[["48bdc589.059a2c"]]},{"id":"d4f3ffbc.bc096","type":"ui_chart","z":"f234654f.652a48","name":"Humidity","group":"3b204857.d75b68","order":3,"width":"13","height":"3","label":"Humidity","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":720,"y":100,"wires":[["48bdc589.059a2c"]]},{"id":"b5e1f1b4.1b3c6","type":"ui_gauge","z":"f234654f.652a48","name":"Temperature","group":"14bf30df.94ef3f","order":1,"width":"3","height":"3","gtype":"gage","title":"Current Temperature","label":"C","format":"{{value}}","min":"-15","max":"40","colors":["#00b500","#e6e600","#ca3838"],"seg1":"20","seg2":"25","x":730,"y":160,"wires":[]},{"id":"769696fb.5b7668","type":"ui_gauge","z":"f234654f.652a48","name":"Humidity","group":"14bf30df.94ef3f","order":6,"width":"3","height":"3","gtype":"wave","title":"Current Humidity","label":"%","format":"{{value}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":720,"y":220,"wires":[]},{"id":"3f49bb03.3ff104","type":"smooth","z":"f234654f.652a48","name":"MaxTemp","property":"payload","action":"max","count":"1000","round":"","mult":"single","x":520,"y":280,"wires":[["33c3d37d.7f032c"]]},{"id":"33c3d37d.7f032c","type":"ui_gauge","z":"f234654f.652a48","name":"Max Temp","group":"14bf30df.94ef3f","order":3,"width":"3","height":"3","gtype":"gage","title":"Max.","label":"C","format":"{{value}}","min":"-15","max":"40","colors":["#00b500","#e6e600","#ca3838"],"seg1":"20","seg2":"25","x":730,"y":280,"wires":[]},{"id":"bba9cded.2fa2a","type":"smooth","z":"f234654f.652a48","name":"MinTemp","property":"payload","action":"min","count":"1000","round":"","mult":"single","x":520,"y":340,"wires":[["5673286f.5d3508"]]},{"id":"5673286f.5d3508","type":"ui_gauge","z":"f234654f.652a48","name":"Min Temp","group":"14bf30df.94ef3f","order":2,"width":"3","height":"3","gtype":"gage","title":"Min.","label":"C","format":"{{value}}","min":"-15","max":"40","colors":["#00b500","#e6e600","#ca3838"],"seg1":"20","seg2":"25","x":720,"y":340,"wires":[]},{"id":"5f722a43.0e1d84","type":"smooth","z":"f234654f.652a48","name":"MaxHum","property":"payload","action":"max","count":"1000","round":"","mult":"single","x":520,"y":400,"wires":[["e4068ef.82b337"]]},{"id":"267a07f7.80e738","type":"smooth","z":"f234654f.652a48","name":"MinHum","property":"payload","action":"min","count":"1000","round":"","mult":"single","x":520,"y":460,"wires":[["6f216a5c.8e1894"]]},{"id":"e4068ef.82b337","type":"ui_gauge","z":"f234654f.652a48","name":"Max Humidity","group":"14bf30df.94ef3f","order":8,"width":"3","height":"3","gtype":"wave","title":"Max.","label":"%","format":"{{value}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":740,"y":400,"wires":[]},{"id":"6f216a5c.8e1894","type":"ui_gauge","z":"f234654f.652a48","name":"Min Humidity","group":"14bf30df.94ef3f","order":7,"width":"3","height":"3","gtype":"wave","title":"Min.","label":"%","format":"{{value}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":730,"y":460,"wires":[]},{"id":"7a78c77c.23ad78","type":"ui_button","z":"f234654f.652a48","name":"","group":"14bf30df.94ef3f","order":4,"width":0,"height":0,"passthru":false,"label":"button","tooltip":"","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":260,"y":260,"wires":[["8b8848d7.7e3e78"]]},{"id":"8b8848d7.7e3e78","type":"function","z":"f234654f.652a48","name":"msg.reset","func":"msg.reset = true;\nreturn msg;","outputs":1,"noerr":0,"x":310,"y":360,"wires":[["3f49bb03.3ff104","bba9cded.2fa2a"]]},{"id":"91a70537.a84f08","type":"mqtt-broker","z":"","name":"NodeRed","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"3b204857.d75b68","type":"ui_group","z":"","name":"Graphs","tab":"cd8f0bc5.bb8598","order":1,"disp":false,"width":"13","collapse":false},{"id":"14bf30df.94ef3f","type":"ui_group","z":"","name":"Gauges","tab":"cd8f0bc5.bb8598","order":2,"disp":false,"width":"9","collapse":false},{"id":"cd8f0bc5.bb8598","type":"ui_tab","z":"","name":"Greenhouse","icon":"fa-leaf","order":1,"disabled":false,"hidden":false}]```

msg.reset can be set to anything, it just has to be present to trigger a reset
the initial value is taken from msg.payload in the same message,

Nice! SO it turns out the "1" on the gauges was payload from the button output. I set the button output payload to "" and now when I push the button the gauges return 0 - not what I need, but progress...

You might need to put a Change node in between, which is configured to Delete msg.payload.

Yep, that did it Colin - Change node with rules to both delete payload, and set msg.reset. It still takes until the next mqtt input for the gauges to change, but I can live with that for now. Thank you.

[{"id":"8389e5e8.a68428","type":"mqtt in","z":"f234654f.652a48","name":"Temperature","topic":"topic/temp1","qos":"2","datatype":"auto","broker":"91a70537.a84f08","x":290,"y":260,"wires":[["eef3a546.489468","b5e1f1b4.1b3c6","3f49bb03.3ff104","bba9cded.2fa2a","35304ba9.791c44"]]},{"id":"eef3a546.489468","type":"ui_chart","z":"f234654f.652a48","name":"Temperature","group":"3b204857.d75b68","order":1,"width":"13","height":"3","label":"Temperature","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":650,"y":220,"wires":[[]]},{"id":"b5e1f1b4.1b3c6","type":"ui_gauge","z":"f234654f.652a48","name":"Temperature","group":"14bf30df.94ef3f","order":1,"width":"3","height":"3","gtype":"gage","title":"Current Temperature","label":"C","format":"{{value}}","min":"-15","max":"40","colors":["#093bf4","#e6e600","#ca3838"],"seg1":"","seg2":"","x":650,"y":280,"wires":[]},{"id":"3f49bb03.3ff104","type":"smooth","z":"f234654f.652a48","name":"MaxTemp","property":"payload","action":"max","count":"1000","round":"","mult":"single","x":860,"y":200,"wires":[["33c3d37d.7f032c"]]},{"id":"33c3d37d.7f032c","type":"ui_gauge","z":"f234654f.652a48","name":"Max Temp","group":"14bf30df.94ef3f","order":3,"width":"3","height":"3","gtype":"gage","title":"Max.","label":"C","format":"{{value}}","min":"-15","max":"40","colors":["#093bf4","#e6e600","#ca3838"],"seg1":"","seg2":"","x":1070,"y":200,"wires":[]},{"id":"bba9cded.2fa2a","type":"smooth","z":"f234654f.652a48","name":"MinTemp","property":"payload","action":"min","count":"1000","round":"","mult":"single","x":860,"y":260,"wires":[["5673286f.5d3508"]]},{"id":"5673286f.5d3508","type":"ui_gauge","z":"f234654f.652a48","name":"Min Temp","group":"14bf30df.94ef3f","order":2,"width":"3","height":"3","gtype":"gage","title":"Min.","label":"C","format":"{{value}}","min":"-15","max":"40","colors":["#093bf4","#e6e600","#ca3838"],"seg1":"","seg2":"","x":1060,"y":260,"wires":[]},{"id":"931affd8.7b7e","type":"ui_button","z":"f234654f.652a48","name":"","group":"14bf30df.94ef3f","order":4,"width":0,"height":0,"passthru":false,"label":"Temp. Reset","tooltip":"","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":450,"y":160,"wires":[["938aecb6.69984"]]},{"id":"938aecb6.69984","type":"change","z":"f234654f.652a48","name":"Reset MaxMin","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":160,"wires":[["3f49bb03.3ff104","bba9cded.2fa2a"]]},{"id":"91a70537.a84f08","type":"mqtt-broker","z":"","name":"NodeRed","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"3b204857.d75b68","type":"ui_group","z":"","name":"Graphs","tab":"cd8f0bc5.bb8598","order":1,"disp":false,"width":"13","collapse":false},{"id":"14bf30df.94ef3f","type":"ui_group","z":"","name":"Gauges","tab":"cd8f0bc5.bb8598","order":2,"disp":false,"width":"9","collapse":false},{"id":"cd8f0bc5.bb8598","type":"ui_tab","z":"","name":"Greenhouse","icon":"fa-leaf","order":1,"disabled":false,"hidden":false}]

They can't change immediately because they don't know what to change to till you give them a value.

yep, I get that. Now I need to work out a way to 'prime' either the Smooth nodes or the Gauges directly on the button-press. No hurry - I have other stuff to work out first. Thanks for your help.

If you know what you want to prime with then , in the Change node, instead of deleting msg.payload just set it to whatever you want.

Yeah - they need to show the latest measurement, and I'm only sampling once a minute. I need to record and refresh each sample so the Change node can inject it if the button is pressed - I'm sure it's trivial, but a)I'm a newbie toNodeRed, Java and JSON, and b) I haven't even looked at it yet. I'll get around to it...:rofl:

I'm having a similar issue, how do I reset the min,max at say 09:00 ?

You can use an inject node set for 09:00 to send the message, or you can use one of the timer nodes if you need a more complex schedule. Possibly one of the contrib nodes bigtimer, schedex or cron-plus.

Thanks for the suggestions, this is what I ended up with - messy but it works !. The top delay node goes off to email.

[{"id":"8035dab8.1c3408","type":"smooth","z":"271cda61.84a4a6","name":"min","property":"payload","action":"min","count":"8640","round":"","mult":"single","reduce":false,"x":287,"y":148,"wires":[["989efd8d.7ba26","14fc7aee.8549b5"]]},{"id":"c7f73cd0.1c98b","type":"link in","z":"271cda61.84a4a6","name":"","links":["4d72160c.803c58"],"x":113,"y":236,"wires":[["b7e9dd77.cb497","8035dab8.1c3408","89e2d246.e4df","dd053d2.57df4c"]]},{"id":"989efd8d.7ba26","type":"time-range-switch","z":"271cda61.84a4a6","name":"","lat":"","lon":"","startTime":"08:00","endTime":"08:01","startOffset":0,"endOffset":0,"x":156,"y":20,"wires":[["837dc606.1ce288"],[]]},{"id":"837dc606.1ce288","type":"delay","z":"271cda61.84a4a6","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"2","rateUnits":"minute","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":500,"y":20,"wires":[["2ece6789.2c6f78"]]},{"id":"8d6b94.e811447","type":"ui_chart","z":"271cda61.84a4a6","name":"","group":"8d1a9ea2.79fdb","order":1,"width":10,"height":6,"label":"temp","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"12","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#0080ff","#00ff00","#0000ff","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":606,"y":159,"wires":[[]]},{"id":"89e2d246.e4df","type":"function","z":"271cda61.84a4a6","name":"Current","func":"msg.topic = \"current\"\nreturn msg;","outputs":1,"noerr":0,"x":457,"y":180,"wires":[["8d6b94.e811447","c51c3692.52d0e8"]]},{"id":"14fc7aee.8549b5","type":"function","z":"271cda61.84a4a6","name":"Min","func":"msg.topic = \"Min\"\nreturn msg;","outputs":1,"noerr":0,"x":480,"y":125,"wires":[["8d6b94.e811447","28a8e858.fc94c8"]]},{"id":"28a8e858.fc94c8","type":"ui_text","z":"271cda61.84a4a6","group":"8d1a9ea2.79fdb","order":9,"width":4,"height":1,"name":"","label":"MIN","format":"{{msg.payload}}","layout":"row-center","x":605,"y":120,"wires":[]},{"id":"c51c3692.52d0e8","type":"ui_text","z":"271cda61.84a4a6","group":"8d1a9ea2.79fdb","order":8,"width":4,"height":1,"name":"","label":"Current","format":"{{msg.payload}}","layout":"row-center","x":619,"y":197,"wires":[]},{"id":"84480e1b.680a3","type":"ui_text","z":"271cda61.84a4a6","group":"8d1a9ea2.79fdb","order":9,"width":4,"height":1,"name":"","label":"MAX","format":"{{msg.payload}}","layout":"row-center","x":604,"y":85,"wires":[]},{"id":"884a139e.4016f","type":"function","z":"271cda61.84a4a6","name":"Max","func":"msg.topic = \"Max\"\nreturn msg;","outputs":1,"noerr":0,"x":478,"y":88,"wires":[["84480e1b.680a3"]]},{"id":"b7e9dd77.cb497","type":"smooth","z":"271cda61.84a4a6","name":"Max","property":"payload","action":"max","count":"8640","round":"","mult":"single","reduce":false,"x":288,"y":102,"wires":[["884a139e.4016f"]]},{"id":"990a4d98.bc4d3","type":"time-range-switch","z":"271cda61.84a4a6","name":"","lat":"","lon":"","startTime":"12:00","endTime":"12:01","startOffset":0,"endOffset":0,"x":421,"y":281,"wires":[["b7e9dd77.cb497","8035dab8.1c3408"],[]]},{"id":"dd053d2.57df4c","type":"change","z":"271cda61.84a4a6","name":"","rules":[{"t":"set","p":"reset","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":239,"y":267,"wires":[["990a4d98.bc4d3"]]},{"id":"8d1a9ea2.79fdb","type":"ui_group","name":"Group 2","tab":"49b1129d.40876c","order":2,"disp":true,"width":12},{"id":"49b1129d.40876c","type":"ui_tab","z":"","name":"Climate","icon":"dashboard","order":1}]