Global Context to file

Hi Everyone,
I am working on a telemetry project that is using a RPI4 and Node-Red to provide 16 digital inputs, 16 digital outputs and 8 analogue inputs. One of the requirements is to have all of the buttons, status, units configurable without the need to touch the Node-red flow. I have done this by creating a config page and storing all of the variables in their own global context which is working well.
As part of the configuration, I need the ability to back up to a file which can be then loaded into another device.
I have achieved this by using a function node to create a json object and then sending it to a write file node. This works well, however now that i need to add more variable to the storage (~200 in total) it is getting too cumbersome to manage.
I am looking at breaking this up into smaller groups to make it more manageable and easier for debugging.
Would I be better to have separate config file for each group, or should i have seperate function nodes and then use a join node to bring them back together?

[{"id":"35247c1f0aebfcb2","type":"file","z":"22b91f0ad85e6dd8","name":"","filename":"filename","filenameType":"msg","appendNewline":true,"createDir":true,"overwriteFile":"true","encoding":"none","x":1060,"y":320,"wires":[["1422296e93808143"]]},{"id":"1422296e93808143","type":"debug","z":"22b91f0ad85e6dd8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1220,"y":320,"wires":[]},{"id":"65d338e0b11cfb95","type":"ui_button","z":"22b91f0ad85e6dd8","name":"","group":"f22a8217.1732d","order":7,"width":0,"height":0,"passthru":false,"label":"Write Config","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"writepath","payloadType":"global","topic":"write","topicType":"str","x":440,"y":320,"wires":[["a56d12e2f5629dde"]]},{"id":"131e353f49239207","type":"change","z":"22b91f0ad85e6dd8","name":"","rules":[{"t":"set","p":"filename","pt":"msg","to":"basepath","tot":"msg"},{"t":"change","p":"filename","pt":"msg","from":"xxxx","fromt":"str","to":"writename","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":870,"y":320,"wires":[["35247c1f0aebfcb2"]]},{"id":"a56d12e2f5629dde","type":"function","z":"22b91f0ad85e6dd8","name":"Config builder 1011","func":"msg.basepath = \"/home/telemetry/config/xxxx\"\nmsg.payload= {\"Site_Name\":global.get(\"site_name\"),\"Site_ID\":global.get(\"site_id\"),\"Inputs\":{\"Digital\":{\"Labels\":{\"In1\":global.get(\"din1lbl\"),\"In2\":global.get(\"din2lbl\"),\"In3\":global.get(\"din3lbl\"),\"In4\":global.get(\"din4lbl\"),\"In5\":global.get(\"din5lbl\"),\"In6\":global.get(\"din6lbl\"),\"In7\":global.get(\"din7lbl\"),\"In8\":global.get(\"din8lbl\")},\"InputStatusOn\":{\"In1\":global.get(\"Din1onStatus\"),\"In2\":global.get(\"Din2onStatus\"),\"In3\":global.get(\"Din3onStatus\"),\"In4\":global.get(\"Din4onStatus\"),\"In5\":global.get(\"Din5onStatus\"),\"In6\":global.get(\"Din6onStatus\"),\"In7\":global.get(\"Din7onStatus\"),\"In8\":global.get(\"Din8onStatus\")},\"InputStatusOff\":{\"In1\":global.get(\"Din1offStatus\"),\"In2\":global.get(\"Din2offStatus\"),\"In3\":global.get(\"Din3offStatus\"),\"In4\":global.get(\"Din4offStatus\"),\"In5\":global.get(\"Din5offStatus\"),\"In6\":global.get(\"Din6offStatus\"),\"In7\":global.get(\"Din7offStatus\"),\"In8\":global.get(\"Din8offStatus\")},\"Alarms\":{\"In1\":global.get(\"din1alarm\"),\"In2\":global.get(\"din2alarm\"),\"In3\":global.get(\"din3alarm\"),\"In4\":global.get(\"din4alarm\"),\"In5\":global.get(\"din5alarm\"),\"In6\":global.get(\"din6alarm\"),\"In7\":global.get(\"din7alarm\"),\"In8\":global.get(\"din8alarm\")},\"LogLevel\":{\"In1\":global.get(\"din1loglevel\"),\"In2\":global.get(\"din2loglevel\"),\"In3\":global.get(\"din3loglevel\"),\"In4\":global.get(\"din4loglevel\"),\"In5\":global.get(\"din5loglevel\"),\"In6\":global.get(\"din6loglevel\"),\"In7\":global.get(\"din7loglevel\"),\"In8\":global.get(\"din8loglevel\")}},\"Analogue\":{\"Labels\":{\"In1\":global.get(\"ain1lbl\"),\"In2\":global.get(\"ain2lbl\"),\"In3\":global.get(\"ain3lbl\"),\"In4\":global.get(\"ain4lbl\"),\"In5\":global.get(\"ain5lbl\"),\"In6\":global.get(\"ain6lbl\"),\"In7\":global.get(\"ain7lbl\"),\"In8\":global.get(\"ain8lbl\")},\"Units\":{\"In1\":global.get(\"ain1unit\"),\"In2\":global.get(\"ain2unit\"),\"In3\":global.get(\"ain3unit\"),\"In4\":global.get(\"ain4unit\"),\"In5\":global.get(\"ain5unit\"),\"In6\":global.get(\"ain6unit\"),\"In7\":global.get(\"ain7unit\"),\"In8\":global.get(\"ain8unit\")},\"calfactor\":{\"In1\":global.get(\"ain1xcal\"),\"In2\":global.get(\"ain2xcal\"),\"In3\":global.get(\"ain3xcal\"),\"In4\":global.get(\"ain4xcal\"),\"In5\":global.get(\"ain5xcal\"),\"In6\":global.get(\"ain6xcal\"),\"In7\":global.get(\"ain7xcal\"),\"In8\":global.get(\"ain8xcal\")},\"Caloffset\":{\"In1\":global.get(\"ain1caloffset\"),\"In2\":global.get(\"ain2caloffset\"),\"In3\":global.get(\"ain3caloffset\"),\"In4\":global.get(\"ain4caloffset\"),\"In5\":global.get(\"ain5caloffset\"),\"In6\":global.get(\"ain6caloffset\"),\"In7\":global.get(\"ain7caloffset\"),\"In8\":global.get(\"ain8caloffset\")},\"Min\":{\"In1\":global.get(\"ain1min\"),\"In2\":global.get(\"ain2min\"),\"In3\":global.get(\"ain3min\"),\"In4\":global.get(\"ain4min\"),\"In5\":global.get(\"ain5min\"),\"In6\":global.get(\"ain6min\"),\"In7\":global.get(\"ain7min\"),\"In8\":global.get(\"ain8min\")},\"Max\":{\"In1\":global.get(\"ain1max\"),\"In2\":global.get(\"ain2max\"),\"In3\":global.get(\"ain3max\"),\"In4\":global.get(\"ain4max\"),\"In5\":global.get(\"ain5max\"),\"In6\":global.get(\"ain6max\"),\"In7\":global.get(\"ain7max\"),\"In8\":global.get(\"ain8max\")},\"Seg1\":{\"In1\":global.get(\"ain1seg1\"),\"In2\":global.get(\"ain2seg1\"),\"In3\":global.get(\"ain3seg1\"),\"In4\":global.get(\"ain4seg1\"),\"In5\":global.get(\"ain5seg1\"),\"In6\":global.get(\"ain6seg1\"),\"In7\":global.get(\"ain7seg1\"),\"In8\":global.get(\"ain8seg1\")},\"Seg2\":{\"In1\":global.get(\"ain1seg2\"),\"In2\":global.get(\"ain2seg2\"),\"In3\":global.get(\"ain3seg2\"),\"In4\":global.get(\"ain4seg2\"),\"In5\":global.get(\"ain5seg2\"),\"In6\":global.get(\"ain6seg2\"),\"In7\":global.get(\"ain7seg2\"),\"In8\":global.get(\"ain8seg2\")}}},\"Outputs\":{\"Digital\":{\"Labels\":{\"Out1\":global.get(\"dout1lbl\"),\"Out2\":global.get(\"dout2lbl\"),\"Out3\":global.get(\"dout3lbl\"),\"Out4\":global.get(\"dout4lbl\"),\"Out5\":global.get(\"dout5lbl\"),\"Out6\":global.get(\"dout6lbl\"),\"Out7\":global.get(\"dout7lbl\"),\"Out8\":global.get(\"dout8lbl\")},\"OutputStatusOn\":{\"Out1\":global.get(\"Dout1onStatus\"),\"Out2\":global.get(\"Dout2onStatus\"),\"Out3\":global.get(\"Dout3onStatus\"),\"Out4\":global.get(\"Dout4onStatus\"),\"Out5\":global.get(\"Dout5onStatus\"),\"Out6\":global.get(\"Dout6onStatus\"),\"Out7\":global.get(\"Dout7onStatus\"),\"Out8\":global.get(\"Dout8onStatus\")},\"OutputStatusOff\":{\"Out1\":global.get(\"Dout1offStatus\"),\"Out2\":global.get(\"Dout2offStatus\"),\"Out3\":global.get(\"Dout3offStatus\"),\"Out4\":global.get(\"Dout4offStatus\"),\"Out5\":global.get(\"Dout5offStatus\"),\"Out6\":global.get(\"Dout6offStatus\"),\"Out7\":global.get(\"Dout7offStatus\"),\"Out8\":global.get(\"Dout8offStatus\")}}}}\nreturn msg;\nnode.log(\"Config Write completed\")\nnode.status(\"Config Write completed\")","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":660,"y":320,"wires":[["131e353f49239207"]]},{"id":"f22a8217.1732d","type":"ui_group","name":"System","tab":"2a33dae2.ce2106","order":1,"disp":true,"width":"4","collapse":false},{"id":"2a33dae2.ce2106","type":"ui_tab","name":"Config","icon":"dashboard","order":5,"disabled":false,"hidden":false}]

I have simplified the writing of the global context to file using the below function.
This approach means that I don't have to modify the function every time I add or remove context variables.
I really don't know how to now take the Json array stored in the file and push back to the global context in a similar streamlined fashion.

Any help would be greatly appreciated

let list = []

global.keys().forEach( key => {
    list.push ({ [key]: global.get(key)});
})

msg.payload = list
return msg

Why not use file backed context storage?

https://nodered.org/docs/api/context/store/localfilesystem

Yes, I did consider that as an option, however there is a requirement to have multiple configurations stored and be able to select and load as required.

Perhaps consider the global context variable to contain the full object instead ?

I am not sure how to do that. can you share an example?

I have tested the following and can set the global based on the object key, as i have very little JavaScript knowledge i not sure the best way to loop through this;

var payload = msg.payload
var key =Object.keys(payload[0])
var value = Object.values(payload[0])
global.set(key,value)
return msg;

This is also about how you write the all values to global context in the first place.

Let's say you create some other flow where you also want to write something to global context, those will become part of the file you want to write as well.

Storing them into an object as I suggested above will avoid that. Can you share the part (or example) of the flow where they are being written ?

For this project, it would be beneficial that all global context, regardless of the flow are saved to the file path specified in the config GUI.
Text input boxes are used on the config GUI to set all of the parameters such as input labels as per the attached sample code. The attached is a small cutdown sample of the overall project. The global context "din1...8lbl" is used elsewhere, not shown in this code, to set the labels to alarms and logging of these inputs.

[
    {
        "id": "95c23282498e5d3d",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": ""
    },
    {
        "id": "13e4ceb6a0701995",
        "type": "group",
        "z": "95c23282498e5d3d",
        "name": "Digital Input Label Config - sub-group 1",
        "style": {
            "label": true,
            "fill": "#e3f3d3"
        },
        "nodes": [
            "8fdab7a33a25134f",
            "6a48d21ebdf5fc9b",
            "c2243f070cc1692c",
            "398ced8494a50f60",
            "fe212594d4bbf7a7",
            "d7967ce678fd7c12",
            "7f9c8da0147166df",
            "f84fc1e036a58387",
            "e9a2a725cf234b69",
            "a9736fb023497854",
            "536b0494d8857e46",
            "9a05bd37f619ce3f",
            "d243a7233fb9921a",
            "45036d8729b00cf9",
            "0eab849080413da5",
            "a8bb45f0a4660308",
            "cccd0d21a3ccbe34",
            "89644aceef93084b",
            "89f31b132e3879cd",
            "f47460f5b957127e"
        ],
        "x": 434,
        "y": 399,
        "w": 892,
        "h": 202
    },
    {
        "id": "9a6503eec33441ac",
        "type": "group",
        "z": "95c23282498e5d3d",
        "name": "Group 0 - sub-group 1",
        "style": {
            "label": true
        },
        "nodes": [
            "b7dafa7c13c419a5",
            "5ab21e256d65aded",
            "65f3486ea5ed5aad",
            "dbfcb15f83ee5761",
            "c7855f354604ba4b",
            "947c5ec7c9088a8d",
            "517b759a3a6f2a9d",
            "95b04ef49907973b",
            "9a10fc36b0055c5e",
            "7f74c874295bb555",
            "8486a25aeb37d616",
            "191f5b8091fdea16",
            "6337db9a3203ae3e",
            "6dbc00d3a79792d2",
            "fd598d852e92e1c9",
            "dfd5d6fdf4a3d9a5",
            "fc1ffc7f236c55c3"
        ],
        "x": 174,
        "y": 19,
        "w": 1162,
        "h": 322
    },
    {
        "id": "8fdab7a33a25134f",
        "type": "ui_text_input",
        "z": "95c23282498e5d3d",
        "g": "13e4ceb6a0701995",
        "name": "Din1lbl",
        "label": "Digital Input 1 Label",
        "tooltip": "",
        "group": "ac717554.0045a8",
        "order": 1,
        "width": 0,
        "height": 0,
        "passthru": true,
        "mode": "text",
        "delay": "0",
        "topic": "Din1lbl",
        "topicType": "str",
        "x": 830,
        "y": 440,
        "wires": [
            [
                "c2243f070cc1692c"
            ]
        ]
    },
    {
        "id": "6a48d21ebdf5fc9b",
        "type": "debug",
        "z": "95c23282498e5d3d",
        "g": "13e4ceb6a0701995",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 1230,
        "y": 440,
        "wires": []
    },
    {
        "id": "c2243f070cc1692c",
        "type": "function",
        "z": "95c23282498e5d3d",
        "g": "13e4ceb6a0701995",
        "name": "1111",
        "func": "global.set(\"din1lbl\",msg.payload)\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1030,
        "y": 440,
        "wires": [
            [
                "6a48d21ebdf5fc9b"
            ]
        ]
    },
    {
        "id": "398ced8494a50f60",
        "type": "change",
        "z": "95c23282498e5d3d",
        "g": "13e4ceb6a0701995",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.In1",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 600,
        "y": 440,
        "wires": [
            [
                "8fdab7a33a25134f"
            ]
        ]
    },
    {
        "id": "fe212594d4bbf7a7",
        "type": "link in",
        "z": "95c23282498e5d3d",
        "g": "13e4ceb6a0701995",
        "name": "",
        "links": [
            "eb23b6a3.a89c78",
            "c7855f354604ba4b"
        ],
        "x": 475,
        "y": 440,
        "wires": [
            [
                "398ced8494a50f60"
            ]
        ]
    },
    {
        "id": "d7967ce678fd7c12",
        "type": "ui_text_input",
        "z": "95c23282498e5d3d",
        "g": "13e4ceb6a0701995",
        "name": "Din2bl",
        "label": "Digital Input 2 Label",
        "tooltip": "",
        "group": "ac717554.0045a8",
        "order": 2,
        "width": 0,
        "height": 0,
        "passthru": true,
        "mode": "text",
        "delay": "0",
        "topic": "Din2lbl",
        "topicType": "str",
        "x": 830,
        "y": 480,
        "wires": [
            [
                "f84fc1e036a58387"
            ]
        ]
    },
    {
        "id": "7f9c8da0147166df",
        "type": "debug",
        "z": "95c23282498e5d3d",
        "g": "13e4ceb6a0701995",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 1230,
        "y": 480,
        "wires": []
    },
    {
        "id": "f84fc1e036a58387",
        "type": "function",
        "z": "95c23282498e5d3d",
        "g": "13e4ceb6a0701995",
        "name": "1112",
        "func": "global.set(\"din2lbl\",msg.payload)\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1030,
        "y": 480,
        "wires": [
            [
                "7f9c8da0147166df"
            ]
        ]
    },
    {
        "id": "e9a2a725cf234b69",
        "type": "change",
        "z": "95c23282498e5d3d",
        "g": "13e4ceb6a0701995",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.In2",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 600,
        "y": 480,
        "wires": [
            [
                "d7967ce678fd7c12"
            ]
        ]
    },
    {
        "id": "a9736fb023497854",
        "type": "link in",
        "z": "95c23282498e5d3d",
        "g": "13e4ceb6a0701995",
        "name": "",
        "links": [
            "eb23b6a3.a89c78",
            "c7855f354604ba4b"
        ],
        "x": 475,
        "y": 480,
        "wires": [
            [
                "e9a2a725cf234b69"
            ]
        ]
    },
    {
        "id": "536b0494d8857e46",
        "type": "ui_text_input",
        "z": "95c23282498e5d3d",
        "g": "13e4ceb6a0701995",
        "name": "Din3lbl",
        "label": "Digital Input 3 Label",
        "tooltip": "",
        "group": "ac717554.0045a8",
        "order": 3,
        "width": 0,
        "height": 0,
        "passthru": true,
        "mode": "text",
        "delay": "0",
        "topic": "Din3lbl",
        "topicType": "str",
        "x": 830,
        "y": 520,
        "wires": [
            [
                "d243a7233fb9921a"
            ]
        ]
    },
    {
        "id": "9a05bd37f619ce3f",
        "type": "debug",
        "z": "95c23282498e5d3d",
        "g": "13e4ceb6a0701995",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 1230,
        "y": 520,
        "wires": []
    },
    {
        "id": "d243a7233fb9921a",
        "type": "function",
        "z": "95c23282498e5d3d",
        "g": "13e4ceb6a0701995",
        "name": "1113",
        "func": "global.set(\"din3lbl\",msg.payload)\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1030,
        "y": 520,
        "wires": [
            [
                "9a05bd37f619ce3f"
            ]
        ]
    },
    {
        "id": "45036d8729b00cf9",
        "type": "change",
        "z": "95c23282498e5d3d",
        "g": "13e4ceb6a0701995",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.In3",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 600,
        "y": 520,
        "wires": [
            [
                "536b0494d8857e46"
            ]
        ]
    },
    {
        "id": "0eab849080413da5",
        "type": "link in",
        "z": "95c23282498e5d3d",
        "g": "13e4ceb6a0701995",
        "name": "",
        "links": [
            "eb23b6a3.a89c78",
            "c7855f354604ba4b"
        ],
        "x": 475,
        "y": 520,
        "wires": [
            [
                "45036d8729b00cf9"
            ]
        ]
    },
    {
        "id": "a8bb45f0a4660308",
        "type": "ui_text_input",
        "z": "95c23282498e5d3d",
        "g": "13e4ceb6a0701995",
        "name": "Din4lbl",
        "label": "Digital Input 4 Label",
        "tooltip": "",
        "group": "ac717554.0045a8",
        "order": 4,
        "width": 0,
        "height": 0,
        "passthru": true,
        "mode": "text",
        "delay": "0",
        "topic": "Din4lbl",
        "topicType": "str",
        "x": 830,
        "y": 560,
        "wires": [
            [
                "89644aceef93084b"
            ]
        ]
    },
    {
        "id": "cccd0d21a3ccbe34",
        "type": "debug",
        "z": "95c23282498e5d3d",
        "g": "13e4ceb6a0701995",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 1230,
        "y": 560,
        "wires": []
    },
    {
        "id": "89644aceef93084b",
        "type": "function",
        "z": "95c23282498e5d3d",
        "g": "13e4ceb6a0701995",
        "name": "1114",
        "func": "global.set(\"din4lbl\",msg.payload)\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1030,
        "y": 560,
        "wires": [
            [
                "cccd0d21a3ccbe34"
            ]
        ]
    },
    {
        "id": "89f31b132e3879cd",
        "type": "change",
        "z": "95c23282498e5d3d",
        "g": "13e4ceb6a0701995",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.In4",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 600,
        "y": 560,
        "wires": [
            [
                "a8bb45f0a4660308"
            ]
        ]
    },
    {
        "id": "f47460f5b957127e",
        "type": "link in",
        "z": "95c23282498e5d3d",
        "g": "13e4ceb6a0701995",
        "name": "",
        "links": [
            "eb23b6a3.a89c78",
            "c7855f354604ba4b"
        ],
        "x": 475,
        "y": 560,
        "wires": [
            [
                "89f31b132e3879cd"
            ]
        ]
    },
    {
        "id": "b7dafa7c13c419a5",
        "type": "file in",
        "z": "95c23282498e5d3d",
        "g": "9a6503eec33441ac",
        "name": "",
        "filename": "",
        "format": "utf8",
        "chunk": false,
        "sendError": false,
        "encoding": "none",
        "allProps": false,
        "x": 730,
        "y": 240,
        "wires": [
            [
                "5ab21e256d65aded"
            ]
        ]
    },
    {
        "id": "5ab21e256d65aded",
        "type": "json",
        "z": "95c23282498e5d3d",
        "g": "9a6503eec33441ac",
        "name": "",
        "property": "payload",
        "action": "obj",
        "pretty": true,
        "x": 910,
        "y": 240,
        "wires": [
            [
                "6dbc00d3a79792d2",
                "fd598d852e92e1c9"
            ]
        ]
    },
    {
        "id": "65f3486ea5ed5aad",
        "type": "comment",
        "z": "95c23282498e5d3d",
        "g": "9a6503eec33441ac",
        "name": "Config from file",
        "info": "This is a test to demonstrate how to set config variables from a file. This should be run at startup.\n * data read from config file\n * data coverted from json string to json object\n * data sets global variable",
        "x": 320,
        "y": 60,
        "wires": []
    },
    {
        "id": "dbfcb15f83ee5761",
        "type": "ui_button",
        "z": "95c23282498e5d3d",
        "g": "9a6503eec33441ac",
        "name": "",
        "group": "f22a8217.1732d",
        "order": 5,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "Load Config",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "icon": "",
        "payload": "",
        "payloadType": "date",
        "topic": "topic",
        "topicType": "msg",
        "x": 290,
        "y": 240,
        "wires": [
            [
                "947c5ec7c9088a8d"
            ]
        ]
    },
    {
        "id": "c7855f354604ba4b",
        "type": "link out",
        "z": "95c23282498e5d3d",
        "g": "9a6503eec33441ac",
        "name": "Config_Load",
        "links": [
            "0cc87ba78d0c8ecb",
            "0eab849080413da5",
            "4e2229df0574db72",
            "5a9f2a46c5215632",
            "74254e2766b9ade2",
            "7670ac4b7324e23e",
            "7b29495871c02dd6",
            "8015045c31ea3224",
            "a9736fb023497854",
            "c6369e64f15862ad",
            "c7cf3a5bec5d1526",
            "cc9781c3633cef31",
            "de4270bb4072be0b",
            "f3c64b8ae0c65a06",
            "f47460f5b957127e",
            "fe212594d4bbf7a7"
        ],
        "x": 1295,
        "y": 240,
        "wires": []
    },
    {
        "id": "947c5ec7c9088a8d",
        "type": "change",
        "z": "95c23282498e5d3d",
        "g": "9a6503eec33441ac",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "filename",
                "pt": "msg",
                "to": "/home/pi/Telemetry/config/xxxx",
                "tot": "str"
            },
            {
                "t": "change",
                "p": "filename",
                "pt": "msg",
                "from": "xxxx",
                "fromt": "str",
                "to": "readname",
                "tot": "global"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 520,
        "y": 240,
        "wires": [
            [
                "b7dafa7c13c419a5"
            ]
        ]
    },
    {
        "id": "517b759a3a6f2a9d",
        "type": "change",
        "z": "95c23282498e5d3d",
        "g": "9a6503eec33441ac",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "filename",
                "pt": "msg",
                "to": "basepath",
                "tot": "msg"
            },
            {
                "t": "change",
                "p": "filename",
                "pt": "msg",
                "from": "xxxx",
                "fromt": "str",
                "to": "writename",
                "tot": "global"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 720,
        "y": 300,
        "wires": [
            [
                "95b04ef49907973b"
            ]
        ]
    },
    {
        "id": "95b04ef49907973b",
        "type": "file",
        "z": "95c23282498e5d3d",
        "g": "9a6503eec33441ac",
        "name": "",
        "filename": "",
        "appendNewline": true,
        "createDir": true,
        "overwriteFile": "true",
        "encoding": "none",
        "x": 910,
        "y": 300,
        "wires": [
            [
                "9a10fc36b0055c5e"
            ]
        ]
    },
    {
        "id": "9a10fc36b0055c5e",
        "type": "debug",
        "z": "95c23282498e5d3d",
        "g": "9a6503eec33441ac",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 1210,
        "y": 300,
        "wires": []
    },
    {
        "id": "7f74c874295bb555",
        "type": "function",
        "z": "95c23282498e5d3d",
        "g": "9a6503eec33441ac",
        "name": "Config builder 1011",
        "func": "msg.basepath = \"/home/pi/Telemetry/config/xxxx\"\nmsg.payload = {\"In1\":global.get(\"din1lbl\"),\"In2\":global.get(\"din2lbl\"),\"In3\":global.get(\"din3lbl\"),\"In4\":global.get(\"din4lbl\")}\nreturn msg;\nnode.log(\"Config Write completed\")\nnode.status(\"Config Write completed\")",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 510,
        "y": 300,
        "wires": [
            [
                "517b759a3a6f2a9d"
            ]
        ]
    },
    {
        "id": "8486a25aeb37d616",
        "type": "ui_button",
        "z": "95c23282498e5d3d",
        "g": "9a6503eec33441ac",
        "name": "",
        "group": "f22a8217.1732d",
        "order": 7,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "Write Config",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "icon": "",
        "payload": "",
        "payloadType": "date",
        "topic": "write",
        "topicType": "str",
        "x": 290,
        "y": 300,
        "wires": [
            [
                "7f74c874295bb555"
            ]
        ]
    },
    {
        "id": "191f5b8091fdea16",
        "type": "inject",
        "z": "95c23282498e5d3d",
        "g": "9a6503eec33441ac",
        "name": "Load on start",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "payloadType": "date",
        "x": 290,
        "y": 200,
        "wires": [
            [
                "6337db9a3203ae3e"
            ]
        ]
    },
    {
        "id": "6337db9a3203ae3e",
        "type": "change",
        "z": "95c23282498e5d3d",
        "g": "9a6503eec33441ac",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "filename",
                "pt": "msg",
                "to": "/home/pi/Telemetry/config/startup.cfg",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 510,
        "y": 200,
        "wires": [
            [
                "b7dafa7c13c419a5"
            ]
        ]
    },
    {
        "id": "fc1ffc7f236c55c3",
        "type": "ui_text_input",
        "z": "95c23282498e5d3d",
        "g": "9a6503eec33441ac",
        "name": "readname",
        "label": "Load Filename",
        "tooltip": "",
        "group": "f22a8217.1732d",
        "order": 4,
        "width": 0,
        "height": 0,
        "passthru": false,
        "mode": "text",
        "delay": "0",
        "topic": "topic",
        "topicType": "msg",
        "x": 300,
        "y": 120,
        "wires": [
            [
                "6d36d63940c1cea5"
            ]
        ]
    },
    {
        "id": "6d36d63940c1cea5",
        "type": "change",
        "z": "95c23282498e5d3d",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "readname",
                "pt": "global",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 500,
        "y": 120,
        "wires": [
            [
                "1ef73731633c087e"
            ]
        ]
    },
    {
        "id": "1ef73731633c087e",
        "type": "debug",
        "z": "95c23282498e5d3d",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 770,
        "y": 120,
        "wires": []
    },
    {
        "id": "1b8c1426b46119ce",
        "type": "debug",
        "z": "95c23282498e5d3d",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 770,
        "y": 160,
        "wires": []
    },
    {
        "id": "ea4346b35f812656",
        "type": "change",
        "z": "95c23282498e5d3d",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "writename",
                "pt": "global",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 500,
        "y": 160,
        "wires": [
            [
                "1b8c1426b46119ce"
            ]
        ]
    },
    {
        "id": "dfd5d6fdf4a3d9a5",
        "type": "ui_text_input",
        "z": "95c23282498e5d3d",
        "g": "9a6503eec33441ac",
        "name": "writename",
        "label": "Write Filename",
        "tooltip": "",
        "group": "f22a8217.1732d",
        "order": 6,
        "width": 0,
        "height": 0,
        "passthru": false,
        "mode": "text",
        "delay": "0",
        "topic": "topic",
        "topicType": "msg",
        "x": 290,
        "y": 160,
        "wires": [
            [
                "ea4346b35f812656"
            ]
        ]
    },
    {
        "id": "6dbc00d3a79792d2",
        "type": "debug",
        "z": "95c23282498e5d3d",
        "g": "9a6503eec33441ac",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1070,
        "y": 180,
        "wires": []
    },
    {
        "id": "fd598d852e92e1c9",
        "type": "function",
        "z": "95c23282498e5d3d",
        "g": "9a6503eec33441ac",
        "name": "Config to variables 1012",
        "func": "//Take label variables from file and out into message payload for displaying in GUI Label \n\nmsg.Din1Lbl=msg.payload.In1\nmsg.Din2Lbl=msg.payload.In2\nmsg.Din3Lbl=msg.payload.In3\nmsg.Din4Lbl=msg.payload.In4\n\n\n\n\n//Put message variables into global variable for use in other functions\n\n//Set global variables from config file load\n\nglobal.set(\"din1lbl\",msg.payload.In1)\nglobal.set(\"din2lbl\",msg.payload.In2)\nglobal.set(\"din3lbl\",msg.payload.In3)\nglobal.set(\"din4lbl\",msg.payload.In4)\n\n\n\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1110,
        "y": 240,
        "wires": [
            [
                "c7855f354604ba4b"
            ]
        ]
    },
    {
        "id": "57fb8a99495a1576",
        "type": "ui_text",
        "z": "95c23282498e5d3d",
        "group": "1e083cc4.612ef3",
        "order": 1,
        "width": 5,
        "height": 1,
        "name": "Digital Input 1 Label",
        "label": "{{Din1Lbl}}",
        "format": "",
        "layout": "row-spread",
        "x": 1840,
        "y": 160,
        "wires": []
    },
    {
        "id": "79ccd95c8054e8b4",
        "type": "ui_text",
        "z": "95c23282498e5d3d",
        "group": "1e083cc4.612ef3",
        "order": 2,
        "width": 0,
        "height": 0,
        "name": "Digital Input 2 Label",
        "label": "{{Din2Lbl}}",
        "format": "",
        "layout": "row-spread",
        "x": 1840,
        "y": 200,
        "wires": []
    },
    {
        "id": "10450a18bdcb8b0e",
        "type": "ui_text",
        "z": "95c23282498e5d3d",
        "group": "1e083cc4.612ef3",
        "order": 3,
        "width": 0,
        "height": 0,
        "name": "Digital Input 3 Label",
        "label": "{{Din3Lbl}}",
        "format": "",
        "layout": "row-spread",
        "x": 1840,
        "y": 240,
        "wires": []
    },
    {
        "id": "4a0cad442db80ca6",
        "type": "ui_text",
        "z": "95c23282498e5d3d",
        "group": "1e083cc4.612ef3",
        "order": 4,
        "width": 0,
        "height": 0,
        "name": "Digital Input 4 Label",
        "label": "{{Din4Lbl}}",
        "format": "",
        "layout": "row-spread",
        "x": 1840,
        "y": 280,
        "wires": []
    },
    {
        "id": "7b29495871c02dd6",
        "type": "link in",
        "z": "95c23282498e5d3d",
        "name": "Din4Lbl",
        "links": [
            "b54d972e.1c5478",
            "ac292e6a.cd222",
            "a5254e03.5b494",
            "57e7e235c956f517",
            "c7855f354604ba4b"
        ],
        "x": 1655,
        "y": 280,
        "wires": [
            [
                "4a0cad442db80ca6"
            ]
        ]
    },
    {
        "id": "5a9f2a46c5215632",
        "type": "link in",
        "z": "95c23282498e5d3d",
        "name": "Din3Lbl",
        "links": [
            "ac292e6a.cd222",
            "a5254e03.5b494",
            "57e7e235c956f517",
            "c7855f354604ba4b"
        ],
        "x": 1655,
        "y": 240,
        "wires": [
            [
                "10450a18bdcb8b0e"
            ]
        ]
    },
    {
        "id": "74254e2766b9ade2",
        "type": "link in",
        "z": "95c23282498e5d3d",
        "name": "Din2Lbl",
        "links": [
            "ac292e6a.cd222",
            "a5254e03.5b494",
            "57e7e235c956f517",
            "c7855f354604ba4b"
        ],
        "x": 1655,
        "y": 200,
        "wires": [
            [
                "79ccd95c8054e8b4"
            ]
        ]
    },
    {
        "id": "c7cf3a5bec5d1526",
        "type": "link in",
        "z": "95c23282498e5d3d",
        "name": "Din1Lbl",
        "links": [
            "ac292e6a.cd222",
            "c7855f354604ba4b"
        ],
        "x": 1655,
        "y": 160,
        "wires": [
            [
                "57fb8a99495a1576"
            ]
        ]
    },
    {
        "id": "ac717554.0045a8",
        "type": "ui_group",
        "name": "Digital Inputs",
        "tab": "2a33dae2.ce2106",
        "order": 2,
        "disp": true,
        "width": "4",
        "collapse": false
    },
    {
        "id": "f22a8217.1732d",
        "type": "ui_group",
        "name": "System",
        "tab": "2a33dae2.ce2106",
        "order": 1,
        "disp": true,
        "width": "4",
        "collapse": false
    },
    {
        "id": "1e083cc4.612ef3",
        "type": "ui_group",
        "name": "Digital Inputs",
        "tab": "34f404a1.5f76cc",
        "order": 1,
        "disp": true,
        "width": "5",
        "collapse": false
    },
    {
        "id": "2a33dae2.ce2106",
        "type": "ui_tab",
        "name": "Config",
        "icon": "dashboard",
        "order": 5,
        "disabled": false,
        "hidden": false
    },
    {
        "id": "34f404a1.5f76cc",
        "type": "ui_tab",
        "name": "Home",
        "icon": "dashboard",
        "order": 1,
        "disabled": false,
        "hidden": false
    }
]