I’m real new to Node-Red. People here have been so kind to help me out, so I thought I’d try to help others. I didn’t see where someone showed a reset capability. Here is the solution I use that resets every day.
[
{
"id": "b079c63558100c2d",
"type": "mqtt in",
"z": "660480f6a68e2c2d",
"name": "Temperature",
"topic": "Outside/temperature",
"qos": "2",
"datatype": "auto-detect",
"broker": "b8758158381423f0",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 110,
"y": 100,
"wires": [
[
"1cab0dd86162fd95"
]
]
},
{
"id": "1cab0dd86162fd95",
"type": "function",
"z": "660480f6a68e2c2d",
"name": "function 1",
"func": "let old = context.get('Day');\nlet day = new Date().getDay();\nif (old != day)\n{\n context.set('Day', day);\n msg.min = 10E6;\n msg.max = -10E6;\n}\nelse\n{\n msg.min = context.get('Min');\n msg.max = context.get('Max');\n}\n\nif (msg.payload < msg.min) \n{\n msg.min = msg.payload;\n context.set('Min', msg.min);\n}\nif (msg.payload > msg.max) \n{\n msg.max = msg.payload;\n context.set('Max', msg.max);\n}\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "if (context.get(\"Day\") === undefined)\n context.set(\"Day\", -1);\nif (context.get(\"Min\") === undefined)\n context.set(\"Min\", 10E6);\nif (context.get(\"Max\") === undefined)\n context.set(\"Max\", -10E6);",
"finalize": "",
"libs": [],
"x": 280,
"y": 100,
"wires": [
[
"f03eada3305694ef",
"3155dd6e832f91d2"
]
]
},
{
"id": "f03eada3305694ef",
"type": "ui_text",
"z": "660480f6a68e2c2d",
"group": "e8d1ae835631bb1a",
"order": 0,
"width": 0,
"height": 0,
"name": "",
"label": "Today's Min",
"format": "{{msg.min}}",
"layout": "row-spread",
"className": "",
"style": false,
"font": "",
"fontSize": 16,
"color": "#000000",
"x": 470,
"y": 60,
"wires": []
},
{
"id": "3155dd6e832f91d2",
"type": "ui_text",
"z": "660480f6a68e2c2d",
"group": "e8d1ae835631bb1a",
"order": 1,
"width": 0,
"height": 0,
"name": "",
"label": "Today's Max",
"format": "{{msg.max}}",
"layout": "row-spread",
"className": "",
"style": false,
"font": "",
"fontSize": 16,
"color": "#000000",
"x": 470,
"y": 140,
"wires": []
},
{
"id": "b8758158381423f0",
"type": "mqtt-broker",
"name": "Local Broker",
"broker": "localhost",
"port": 1883,
"clientid": "",
"autoConnect": true,
"usetls": false,
"protocolVersion": 4,
"keepalive": 60,
"cleansession": true,
"autoUnsubscribe": true,
"birthTopic": "",
"birthQos": "0",
"birthRetain": "false",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closeRetain": "false",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willRetain": "false",
"willPayload": "",
"willMsg": {},
"userProps": "",
"sessionExpiry": ""
},
{
"id": "e8d1ae835631bb1a",
"type": "ui_group",
"name": "Group 1",
"tab": "b9feac347f4789ce",
"order": 1,
"disp": true,
"width": 6
},
{
"id": "b9feac347f4789ce",
"type": "ui_tab",
"name": "Tab 12",
"icon": "dashboard",
"order": 12
}
]





