I’m having issues with a microgreens watering system that I built. This is using a 16 channel relay with dosing at set times with variable dosing times based on whether or not the Switch node has the gate node on or off. The switch and number input nodes work properly to change the variables on the backend but on refresh of the page, the dashboard-2 nodes won’t pull any newly changed variables - they go back to some previous numbers from some point in time. The settings.js file is set to contextStorage: { default: { module:"localfilesystem" }, }, and it seems that is working correctly based on what context data is showing in the backend. How do I get switch state and Dose time in the Number Input nodes to correctly show the stored variable? Once I get all this refined a bit more I’ll post it as a project for others to copy.
[
{
"id": "2ad4fda26bbb81d1",
"type": "group",
"z": "4d39bd7ab87afe9a",
"style": {
"stroke": "#999999",
"stroke-opacity": "1",
"fill": "none",
"fill-opacity": "1",
"label": true,
"label-position": "nw",
"color": "#a4a4a4"
},
"nodes": [
"ab3be0e002dbcfbd",
"d6064e34e2b6cb60",
"5d1f050122321fb8",
"4062387c36245f9d",
"34d7eeddf059d2ce",
"60b17efd74201220",
"eb6b825b2b03ed8b",
"517b39654ed8e17e",
"ce771a020e5067e6",
"56da960e805df8c5",
"a6159135dd9241e6",
"9afddca9617a489c",
"503797d11831d372",
"b62a24f24e63a34c",
"07aa0c3d8adb16d0",
"f1faa72f9cbfdf9b",
"d31448924e76397e",
"c4ea439f9be7fe1d"
],
"x": 14,
"y": 3379,
"w": 1012,
"h": 202
},
{
"id": "ab3be0e002dbcfbd",
"type": "function",
"z": "4d39bd7ab87afe9a",
"g": "2ad4fda26bbb81d1",
"name": "DoseTime",
"func": "global.set(\"DoseTimeP16\",msg.payload)\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 420,
"y": 3540,
"wires": [
[
"5d1f050122321fb8"
]
]
},
{
"id": "d6064e34e2b6cb60",
"type": "debug",
"z": "4d39bd7ab87afe9a",
"g": "2ad4fda26bbb81d1",
"name": "debug P16",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 470,
"y": 3500,
"wires": []
},
{
"id": "5d1f050122321fb8",
"type": "change",
"z": "4d39bd7ab87afe9a",
"g": "2ad4fda26bbb81d1",
"name": "",
"rules": [
{
"t": "set",
"p": "DoseTimeP16",
"pt": "global",
"to": "payload",
"tot": "msg",
"dc": true
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 610,
"y": 3540,
"wires": [
[]
]
},
{
"id": "4062387c36245f9d",
"type": "gate",
"z": "4d39bd7ab87afe9a",
"g": "2ad4fda26bbb81d1",
"name": "Pump Gate",
"controlTopic": "control",
"defaultState": "closed",
"openCmd": "Open",
"closeCmd": "Close",
"toggleCmd": "toggle",
"defaultCmd": "default",
"statusCmd": "status",
"persist": true,
"storeName": "default",
"x": 330,
"y": 3460,
"wires": [
[
"ce771a020e5067e6",
"a6159135dd9241e6"
]
]
},
{
"id": "34d7eeddf059d2ce",
"type": "chronos-scheduler",
"z": "4d39bd7ab87afe9a",
"g": "2ad4fda26bbb81d1",
"name": "Pump 16 Schedule",
"config": "dbcf10fd9c32cebf",
"schedule": [
{
"trigger": {
"type": "time",
"value": "1:45",
"offset": 0,
"random": false
},
"output": {
"type": "msg",
"property": {
"name": "payload",
"type": "str",
"value": ""
}
}
},
{
"trigger": {
"type": "time",
"value": "9:45",
"offset": 0,
"random": false
},
"output": {
"type": "msg",
"property": {
"name": "payload",
"type": "str",
"value": ""
}
}
},
{
"trigger": {
"type": "time",
"value": "16:45",
"offset": 0,
"random": false
},
"output": {
"type": "msg",
"property": {
"name": "payload",
"type": "str",
"value": ""
}
}
}
],
"disabled": false,
"multiPort": false,
"nextEventPort": false,
"outputs": 1,
"x": 130,
"y": 3460,
"wires": [
[
"4062387c36245f9d"
]
]
},
{
"id": "60b17efd74201220",
"type": "function",
"z": "4d39bd7ab87afe9a",
"g": "2ad4fda26bbb81d1",
"name": "Send Stop",
"func": "msg.payload = Buffer.from([0x3A, 0x46, 0x45, 0x30, 0x35, 0x30, 0x30, 0x30, 0x46, 0x30, 0x30, 0x30, 0x30, 0x46, 0x45, 0x0D, 0x0A]);\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 810,
"y": 3460,
"wires": [
[
"eb6b825b2b03ed8b",
"d31448924e76397e"
]
]
},
{
"id": "eb6b825b2b03ed8b",
"type": "serial out",
"z": "4d39bd7ab87afe9a",
"g": "2ad4fda26bbb81d1",
"name": "",
"serial": "fbc944192c31becd",
"x": 950,
"y": 3440,
"wires": []
},
{
"id": "517b39654ed8e17e",
"type": "delay",
"z": "4d39bd7ab87afe9a",
"g": "2ad4fda26bbb81d1",
"name": "",
"pauseType": "delayv",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 660,
"y": 3460,
"wires": [
[
"60b17efd74201220"
]
]
},
{
"id": "ce771a020e5067e6",
"type": "function",
"z": "4d39bd7ab87afe9a",
"g": "2ad4fda26bbb81d1",
"name": "Send Dose",
"func": "msg.payload = Buffer.from([0x3A, 0x46, 0x45, 0x30, 0x35, 0x30, 0x30, 0x30, 0x46, 0x46, 0x46, 0x30, 0x30, 0x46, 0x46, 0x0D, 0x0A]);\nmsg.delay = global.get(\"DoseTimeP16\") * 1000;\n\nreturn [msg, null];",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 490,
"y": 3460,
"wires": [
[
"517b39654ed8e17e",
"d6064e34e2b6cb60",
"eb6b825b2b03ed8b",
"f1faa72f9cbfdf9b"
]
]
},
{
"id": "56da960e805df8c5",
"type": "ui-number-input",
"z": "4d39bd7ab87afe9a",
"g": "2ad4fda26bbb81d1",
"group": "c0604bd34c20e25b",
"name": "Dose Time P16",
"label": "Dose Time",
"order": 2,
"width": "0",
"height": "0",
"topic": "topic",
"topicType": "msg",
"min": 0,
"max": "200",
"step": "10",
"tooltip": "",
"passthru": true,
"sendOnBlur": true,
"sendOnEnter": true,
"className": "",
"clearable": false,
"icon": "",
"iconPosition": "left",
"iconInnerPosition": "inside",
"spinner": "default",
"x": 260,
"y": 3540,
"wires": [
[
"ab3be0e002dbcfbd"
]
]
},
{
"id": "a6159135dd9241e6",
"type": "change",
"z": "4d39bd7ab87afe9a",
"g": "2ad4fda26bbb81d1",
"name": "TStamp",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "iso",
"tot": "date"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 500,
"y": 3420,
"wires": [
[
"503797d11831d372"
]
]
},
{
"id": "9afddca9617a489c",
"type": "ui-text",
"z": "4d39bd7ab87afe9a",
"g": "2ad4fda26bbb81d1",
"group": "c0604bd34c20e25b",
"order": 3,
"width": 0,
"height": 0,
"name": "",
"label": "Last Run",
"format": "{{msg.payload}}",
"layout": "row-spread",
"style": false,
"font": "",
"fontSize": 16,
"color": "#717171",
"wrapText": false,
"className": "",
"x": 760,
"y": 3420,
"wires": []
},
{
"id": "503797d11831d372",
"type": "moment",
"z": "4d39bd7ab87afe9a",
"g": "2ad4fda26bbb81d1",
"name": "Last",
"topic": "",
"input": "payload",
"inputType": "msg",
"inTz": "America/Chicago",
"adjAmount": 0,
"adjType": "days",
"adjDir": "add",
"format": "M/D/YY hh:mm",
"locale": "en-GB",
"output": "payload",
"outputType": "msg",
"outTz": "America/Chicago",
"x": 630,
"y": 3420,
"wires": [
[
"9afddca9617a489c"
]
]
},
{
"id": "b62a24f24e63a34c",
"type": "inject",
"z": "4d39bd7ab87afe9a",
"g": "2ad4fda26bbb81d1",
"name": "Inject",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "DoseTimeP16",
"payloadType": "global",
"x": 110,
"y": 3540,
"wires": [
[
"56da960e805df8c5"
]
]
},
{
"id": "07aa0c3d8adb16d0",
"type": "ui-state-timeline",
"z": "4d39bd7ab87afe9a",
"g": "2ad4fda26bbb81d1",
"group": "c0604bd34c20e25b",
"name": "",
"order": 4,
"width": "0",
"height": "0",
"label": "",
"barHeight": "20",
"states": [
{
"label": "On",
"value": "on",
"valueType": "str",
"color": "#990000"
},
{
"label": "Off",
"value": "off",
"valueType": "str",
"color": "#999999"
}
],
"timelineTimeFormat": "h:mm A",
"detailsTimeFormat": "M/DD/YY h:mm A",
"minTimeLabelGap": 6,
"liveUpdate": true,
"rangeLimit": 24,
"rangeLimitUnit": "3600",
"showTimeMarkers": true,
"showOnlyStartEndTimes": true,
"x": 930,
"y": 3520,
"wires": [
[]
]
},
{
"id": "f1faa72f9cbfdf9b",
"type": "function",
"z": "4d39bd7ab87afe9a",
"g": "2ad4fda26bbb81d1",
"name": "on",
"func": "msg.payload = msg.payload || {};\nmsg.payload.time = Date.now();\nmsg.payload.state = \"on\";\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 650,
"y": 3500,
"wires": [
[
"07aa0c3d8adb16d0"
]
]
},
{
"id": "d31448924e76397e",
"type": "function",
"z": "4d39bd7ab87afe9a",
"g": "2ad4fda26bbb81d1",
"name": "off",
"func": "msg.payload = msg.payload || {};\nmsg.payload.time = Date.now();\nmsg.payload.state = \"off\";\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 790,
"y": 3500,
"wires": [
[
"07aa0c3d8adb16d0"
]
]
},
{
"id": "c4ea439f9be7fe1d",
"type": "ui-switch",
"z": "4d39bd7ab87afe9a",
"g": "2ad4fda26bbb81d1",
"name": "Off/On P16",
"label": "Off/On",
"group": "c0604bd34c20e25b",
"order": 1,
"width": 0,
"height": 0,
"passthru": true,
"decouple": false,
"topic": "control",
"topicType": "str",
"style": "",
"className": "",
"layout": "",
"clickableArea": "switch",
"onvalue": "Open",
"onvalueType": "str",
"onicon": "",
"oncolor": "",
"offvalue": "Close",
"offvalueType": "str",
"officon": "",
"offcolor": "",
"x": 110,
"y": 3420,
"wires": [
[
"4062387c36245f9d"
]
]
},
{
"id": "dbcf10fd9c32cebf",
"type": "chronos-config",
"name": "Ripon",
"latitudeType": "num",
"longitudeType": "num",
"timezone": "",
"sunPositions": []
},
{
"id": "fbc944192c31becd",
"type": "serial-port",
"name": "Relay",
"serialport": "/dev/serial/by-id/usb-1a86_USB_Serial-if00-port0",
"serialbaud": "9600",
"databits": "8",
"parity": "none",
"stopbits": "1",
"waitfor": "",
"dtr": "none",
"rts": "none",
"cts": "none",
"dsr": "none",
"newline": "\\n",
"bin": "false",
"out": "char",
"addchar": "",
"responsetimeout": "10000"
},
{
"id": "c0604bd34c20e25b",
"type": "ui-group",
"name": "Pump 16",
"page": "41cae0266ca62c93",
"width": "2",
"height": "1",
"order": 16,
"showTitle": true,
"className": "",
"visible": "true",
"disabled": "false"
},
{
"id": "41cae0266ca62c93",
"type": "ui-page",
"name": "Scheduler",
"ui": "96a33ff7e334bb72",
"path": "/schedule",
"icon": "home",
"layout": "grid",
"theme": "a6ada8e9e7cdebda",
"breakpoints": [
{
"name": "Default",
"px": "0",
"cols": "3"
},
{
"name": "Tablet",
"px": "576",
"cols": "6"
},
{
"name": "Small Desktop",
"px": "768",
"cols": "9"
},
{
"name": "Desktop",
"px": "1024",
"cols": "12"
}
],
"order": 1,
"className": "",
"visible": true,
"disabled": false
},
{
"id": "96a33ff7e334bb72",
"type": "ui-base",
"name": "Micros",
"path": "/dashboard",
"appIcon": "",
"includeClientData": true,
"acceptsClientConfig": [
"ui-notification",
"ui-control",
"ui-text",
"ui-slider",
"ui-table",
"ui-chart",
"ui-gauge",
"ui-text-input",
"ui-form",
"ui-number-input",
"ui-file-input",
"ui-button",
"ui-dropdown",
"ui-button-group",
"ui-radio-group",
"ui-switch",
"ui-audio",
"ui-markdown",
"ui-template"
],
"showPathInSidebar": false,
"headerContent": "page",
"navigationStyle": "default",
"titleBarStyle": "default",
"showReconnectNotification": true,
"notificationDisplayTime": "2",
"showDisconnectNotification": true
},
{
"id": "a6ada8e9e7cdebda",
"type": "ui-theme",
"name": "Theme 2",
"colors": {
"surface": "#000000",
"primary": "#8c8282",
"bgPage": "#000000",
"groupBg": "#303030",
"groupOutline": "#cccccc"
},
"sizes": {
"density": "compact",
"pagePadding": "12px",
"groupGap": "12px",
"groupBorderRadius": "4px",
"widgetGap": "12px"
}
}
]