Hello, I am new to node red and need to find a way to prepopulate a datetime picker text input with information that the user typed in. I am doing this in case they refresh the page or switch tabs, I want them to come back to the fields still being filled out. I attached a copy of my flow. The top group of nodes is my attempt at having the datetime picker repopulate and the bottom two work until you refresh.
[
{
"id": "29c15ef223100fe3",
"type": "tab",
"label": "Flow 5",
"disabled": false,
"info": "",
"env": []
},
{
"id": "bbe80fd22b034803",
"type": "ui_text",
"z": "29c15ef223100fe3",
"group": "2168a1906452fbf3",
"order": 1,
"width": 5,
"height": 1,
"name": "Start Time",
"label": "",
"format": "Start Time",
"layout": "row-left",
"className": "",
"x": 630,
"y": 40,
"wires": []
},
{
"id": "54ab455e044a069b",
"type": "ui_text",
"z": "29c15ef223100fe3",
"group": "2168a1906452fbf3",
"order": 2,
"width": 5,
"height": 1,
"name": "End Time",
"label": "",
"format": "End Time",
"layout": "row-left",
"className": "",
"x": 800,
"y": 40,
"wires": []
},
{
"id": "88c6923cc7f3395f",
"type": "ui_text",
"z": "29c15ef223100fe3",
"group": "2168a1906452fbf3",
"order": 3,
"width": 2,
"height": 1,
"name": "Status",
"label": "",
"format": "Status",
"layout": "col-center",
"className": "",
"x": 930,
"y": 40,
"wires": []
},
{
"id": "46890a1b58d5ac04",
"type": "ui_template",
"z": "29c15ef223100fe3",
"group": "36cc2755864341b7",
"name": "Clock Toolbar",
"order": 1,
"width": 0,
"height": 0,
"format": "<script id=\"titleScript\" type=\"text/javascript\">\n\n$(function() {\n if($('.md-toolbar-tools').length != 0){\n loadClock();\n }else setTimeout(loadClock, 500)\n});\n\nfunction loadClock(){\n $('#clock').remove();\n var toolbar = $('.md-toolbar-tools');\n \n var div = $('<div/>');\n var p = $('<p/ id=\"clock\">');\n \n div.append(p);\n div[0].style.margin = '5px 5px 5px auto';\n toolbar.append(div);\n\n function displayTitle(lh) {\n p.text(lh); \n }\n \n function upTime() {\n var d = new Date();\n p.text(d.toLocaleString());\n }\n\n if(document.clockInterval){ \n clearInterval(document.clockInterval);\n document.clockInterval = null;\n }\n \n document.clockInterval = setInterval(upTime,1000);\n}\n\n</script>",
"storeOutMessages": false,
"fwdInMessages": false,
"resendOnRefresh": false,
"templateScope": "global",
"className": "",
"x": 440,
"y": 40,
"wires": [
[]
]
},
{
"id": "71837fc2c00b49a0",
"type": "ui_text_input",
"z": "29c15ef223100fe3",
"name": "",
"label": "Start Time 2",
"tooltip": "",
"group": "2168a1906452fbf3",
"order": 10,
"width": 5,
"height": 1,
"passthru": true,
"mode": "datetime-local",
"delay": 300,
"topic": "start2",
"sendOnBlur": true,
"className": "",
"topicType": "str",
"x": 630,
"y": 520,
"wires": [
[
"2bdd3959aed7d656"
]
]
},
{
"id": "d397edbf446726f7",
"type": "ui_text_input",
"z": "29c15ef223100fe3",
"name": "",
"label": "End Time 2",
"tooltip": "",
"group": "2168a1906452fbf3",
"order": 11,
"width": 5,
"height": 1,
"passthru": true,
"mode": "datetime-local",
"delay": 300,
"topic": "end2",
"sendOnBlur": true,
"className": "",
"topicType": "str",
"x": 630,
"y": 480,
"wires": [
[
"2bdd3959aed7d656"
]
]
},
{
"id": "0f693243407a1d6a",
"type": "ui_text",
"z": "29c15ef223100fe3",
"group": "2168a1906452fbf3",
"order": 12,
"width": 2,
"height": 1,
"name": "Status 2",
"label": "2.",
"format": "{{msg.payload}}",
"layout": "row-center",
"className": "",
"x": 1000,
"y": 540,
"wires": []
},
{
"id": "afde9c22e4f7411a",
"type": "ui_button",
"z": "29c15ef223100fe3",
"name": "Shutoff 2",
"group": "2168a1906452fbf3",
"order": 13,
"width": 2,
"height": 1,
"passthru": false,
"label": "Shutoff",
"tooltip": "",
"color": "",
"bgcolor": "RED",
"className": "",
"icon": "",
"payload": "Shutoff by User",
"payloadType": "str",
"topic": "topic",
"topicType": "msg",
"x": 840,
"y": 560,
"wires": [
[
"0f693243407a1d6a"
]
]
},
{
"id": "e2f7a265c571d0fb",
"type": "ui_button",
"z": "29c15ef223100fe3",
"name": "Restart 2",
"group": "2168a1906452fbf3",
"order": 14,
"width": 2,
"height": 1,
"passthru": false,
"label": "Restart",
"tooltip": "",
"color": "",
"bgcolor": "GREEN",
"className": "",
"icon": "",
"payload": "True",
"payloadType": "str",
"topic": "topic",
"topicType": "msg",
"x": 640,
"y": 560,
"wires": [
[
"2bdd3959aed7d656"
]
]
},
{
"id": "dece16d8a81a67e8",
"type": "ui_text_input",
"z": "29c15ef223100fe3",
"name": "",
"label": "Start Time 3",
"tooltip": "",
"group": "2168a1906452fbf3",
"order": 15,
"width": 5,
"height": 1,
"passthru": true,
"mode": "datetime-local",
"delay": 300,
"topic": "start3",
"sendOnBlur": true,
"className": "",
"topicType": "str",
"x": 630,
"y": 700,
"wires": [
[
"058dbb953be80546"
]
]
},
{
"id": "3d5564e19fc86bdc",
"type": "ui_text_input",
"z": "29c15ef223100fe3",
"name": "",
"label": "End Time 3",
"tooltip": "",
"group": "2168a1906452fbf3",
"order": 16,
"width": 5,
"height": 1,
"passthru": true,
"mode": "datetime-local",
"delay": 300,
"topic": "end3",
"sendOnBlur": true,
"className": "",
"topicType": "str",
"x": 630,
"y": 740,
"wires": [
[
"058dbb953be80546"
]
]
},
{
"id": "41e1641ef6478542",
"type": "ui_text",
"z": "29c15ef223100fe3",
"group": "2168a1906452fbf3",
"order": 17,
"width": 2,
"height": 1,
"name": "Status 3",
"label": "3. ",
"format": "{{msg.payload}}",
"layout": "row-center",
"className": "",
"x": 1000,
"y": 760,
"wires": []
},
{
"id": "2c0295dd206fca1b",
"type": "ui_button",
"z": "29c15ef223100fe3",
"name": "Shutoff 3",
"group": "2168a1906452fbf3",
"order": 18,
"width": 2,
"height": 1,
"passthru": false,
"label": "Shutoff",
"tooltip": "",
"color": "",
"bgcolor": "RED",
"className": "",
"icon": "",
"payload": "Shutoff by User",
"payloadType": "str",
"topic": "topic",
"topicType": "msg",
"x": 840,
"y": 780,
"wires": [
[
"41e1641ef6478542"
]
]
},
{
"id": "e495573f060237cd",
"type": "ui_button",
"z": "29c15ef223100fe3",
"name": "Restart 3",
"group": "2168a1906452fbf3",
"order": 19,
"width": 2,
"height": 1,
"passthru": false,
"label": "Restart",
"tooltip": "",
"color": "",
"bgcolor": "GREEN",
"className": "",
"icon": "",
"payload": "True",
"payloadType": "str",
"topic": "topic",
"topicType": "msg",
"x": 640,
"y": 780,
"wires": [
[
"058dbb953be80546"
]
]
},
{
"id": "2bdd3959aed7d656",
"type": "function",
"z": "29c15ef223100fe3",
"name": "",
"func": "let topic = msg.topic\nif (topic == \"start2\"){\n let startTime2 = msg.payload;\n context.set(\"startSave2\", startTime2);\n}\nif (topic == \"end2\"){\n let endTime2 = msg.payload;\n context.set(\"endSave2\", endTime2);\n}\nelse\n\n\nstartTime2 = context.get(\"startSave2\");\nendTime2 = context.get(\"endSave2\");\n\nlet startTimeUnix = new Date(startTime2).valueOf();\nlet endTimeUnix = new Date(endTime2).valueOf();\n\nvar time = new Date();\nlet timeUnix = new Date(time).valueOf();\ntimeUnix = timeUnix - 14400000;\n//var timeISO = time.toISOString();\n\n\nif (timeUnix > startTimeUnix && timeUnix < endTimeUnix){\n msg.payload = \"Running\";\n}\nelse {\n msg.payload = \"Stopped\";\n}\n\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 840,
"y": 520,
"wires": [
[
"0f693243407a1d6a"
]
]
},
{
"id": "058dbb953be80546",
"type": "function",
"z": "29c15ef223100fe3",
"name": "",
"func": "let topic = msg.topic\nif (topic == \"start2\"){\n let startTime2 = msg.payload;\n context.set(\"startSave2\", startTime2);\n}\nif (topic == \"end2\"){\n let endTime2 = msg.payload;\n context.set(\"endSave2\", endTime2);\n}\nelse\n\n\nstartTime2 = context.get(\"startSave2\");\nendTime2 = context.get(\"endSave2\");\n\nlet startTimeUnix = new Date(startTime2).valueOf();\nlet endTimeUnix = new Date(endTime2).valueOf();\n\nvar time = new Date();\nlet timeUnix = new Date(time).valueOf();\ntimeUnix = timeUnix - 14400000;\n//var timeISO = time.toISOString();\n\n\nif (timeUnix > startTimeUnix && timeUnix < endTimeUnix){\n msg.payload = \"Running\";\n}\nelse {\n msg.payload = \"Stopped\";\n}\n\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 840,
"y": 740,
"wires": [
[
"41e1641ef6478542"
]
]
},
{
"id": "a82e4653d36243ad",
"type": "inject",
"z": "29c15ef223100fe3",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "60",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 630,
"y": 440,
"wires": [
[
"2bdd3959aed7d656"
]
]
},
{
"id": "b70003dbbbe7e4c3",
"type": "inject",
"z": "29c15ef223100fe3",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "60",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 630,
"y": 660,
"wires": [
[
"058dbb953be80546"
]
]
},
{
"id": "9f1f1eda6a9c1cc4",
"type": "ui_text_input",
"z": "29c15ef223100fe3",
"name": "",
"label": "Start Time 1",
"tooltip": "",
"group": "2168a1906452fbf3",
"order": 5,
"width": 5,
"height": 1,
"passthru": false,
"mode": "datetime-local",
"delay": 300,
"topic": "start1",
"sendOnBlur": true,
"className": "",
"topicType": "str",
"x": 370,
"y": 220,
"wires": [
[
"a92ecad0630e82ef"
]
]
},
{
"id": "435b944443eb3d7c",
"type": "ui_text_input",
"z": "29c15ef223100fe3",
"name": "",
"label": "End Time 1",
"tooltip": "",
"group": "2168a1906452fbf3",
"order": 6,
"width": 5,
"height": 1,
"passthru": false,
"mode": "datetime-local",
"delay": 300,
"topic": "end1",
"sendOnBlur": true,
"className": "",
"topicType": "str",
"x": 370,
"y": 260,
"wires": [
[
"0ac7f3f40c75d00d"
]
]
},
{
"id": "9c2e0089b14643d3",
"type": "ui_text",
"z": "29c15ef223100fe3",
"group": "2168a1906452fbf3",
"order": 7,
"width": 2,
"height": 1,
"name": "Status 1",
"label": "1.",
"format": "{{msg.payload}}",
"layout": "row-center",
"className": "",
"x": 960,
"y": 260,
"wires": []
},
{
"id": "50bdb49d2f67f6c8",
"type": "function",
"z": "29c15ef223100fe3",
"name": "",
"func": "let topic = msg.topic\nif (topic == \"start1\"){\n let startTime1 = msg.payload;\n context.set(\"startSave1\", startTime1);\n}\nif (topic == \"end1\"){\n let endTime1 = msg.payload;\n context.set(\"endSave1\", endTime1);\n}\nelse\n\n\nstartTime1 = context.get(\"startSave1\");\nendTime1 = context.get(\"endSave1\");\n\nlet startTimeUnix = new Date(startTime1).valueOf();\nlet endTimeUnix = new Date(endTime1).valueOf();\n\nvar time = new Date();\nlet timeUnix = new Date(time).valueOf();\ntimeUnix = timeUnix - 14400000;\n//var timeISO = time.toISOString();\n\n\nif (timeUnix > startTimeUnix && timeUnix < endTimeUnix){\n msg.payload = \"Running\";\n}\nelse {\n msg.payload = \"Stopped\";\n}\n\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 780,
"y": 240,
"wires": [
[
"9c2e0089b14643d3"
]
]
},
{
"id": "d1b96e8f62aaeb66",
"type": "ui_button",
"z": "29c15ef223100fe3",
"name": "Shutoff 1",
"group": "2168a1906452fbf3",
"order": 8,
"width": 2,
"height": 1,
"passthru": false,
"label": "Shutoff",
"tooltip": "",
"color": "",
"bgcolor": "RED",
"className": "",
"icon": "",
"payload": "Shutoff by User",
"payloadType": "str",
"topic": "topic",
"topicType": "msg",
"x": 780,
"y": 280,
"wires": [
[
"9c2e0089b14643d3"
]
]
},
{
"id": "6ac9c0d42e81d6c1",
"type": "ui_button",
"z": "29c15ef223100fe3",
"name": "Restart 1",
"group": "2168a1906452fbf3",
"order": 9,
"width": 2,
"height": 1,
"passthru": false,
"label": "Restart",
"tooltip": "",
"color": "",
"bgcolor": "GREEN",
"className": "",
"icon": "",
"payload": "msg.complete",
"payloadType": "str",
"topic": "complete",
"topicType": "msg",
"x": 620,
"y": 320,
"wires": [
[
"50bdb49d2f67f6c8"
]
]
},
{
"id": "ecf1e3922dfdee30",
"type": "inject",
"z": "29c15ef223100fe3",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "60",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 630,
"y": 120,
"wires": [
[
"50bdb49d2f67f6c8"
]
]
},
{
"id": "a92ecad0630e82ef",
"type": "function",
"z": "29c15ef223100fe3",
"name": "",
"func": "let topic = msg.topic\nif (topic == \"start1\"){\n let startTime1 = msg.payload;\n context.set(\"startSave1\", startTime1);\n}\n\nstartTime1 = context.get(\"startSave1\");\n\nmsg.payload = startTime1;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 580,
"y": 220,
"wires": [
[
"50bdb49d2f67f6c8",
"9f1f1eda6a9c1cc4"
]
]
},
{
"id": "0ac7f3f40c75d00d",
"type": "function",
"z": "29c15ef223100fe3",
"name": "",
"func": "let topic = msg.topic\nif (topic == \"end1\"){\n let endTime1 = msg.payload;\n context.set(\"endSave1\", endTime1);\n}\n\nendTime1 = context.get(\"endSave1\");\n\nmsg.payload = endTime1;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 580,
"y": 260,
"wires": [
[
"50bdb49d2f67f6c8",
"435b944443eb3d7c"
]
]
},
{
"id": "542b868c035aec52",
"type": "ui_spacer",
"z": "29c15ef223100fe3",
"name": "spacer",
"group": "2168a1906452fbf3",
"order": 4,
"width": 4,
"height": 1
},
{
"id": "2168a1906452fbf3",
"type": "ui_group",
"name": "Shift Times",
"tab": "ce97154d030f0ae4",
"order": 2,
"disp": true,
"width": "16",
"collapse": false,
"className": ""
},
{
"id": "36cc2755864341b7",
"type": "ui_group",
"name": "Clock",
"tab": "ce97154d030f0ae4",
"order": 1,
"disp": false,
"width": "6",
"collapse": false,
"className": ""
},
{
"id": "ce97154d030f0ae4",
"type": "ui_tab",
"name": "Scheduler",
"icon": "dashboard",
"disabled": false,
"hidden": false
}
]