# Saving and loading persistent values with persist in/out

**URL:** <https://discourse.nodered.org/t/saving-and-loading-persistent-values-with-persist-in-out/80174>\
**Category:** General\
**Created:** [30 July 2023 22:01 UTC](https://discourse.nodered.org/t/saving-and-loading-persistent-values-with-persist-in-out/80174 "2023-07-30T22:01:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rmystique](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rmystique/32/84365_2.png) [@rmystique](https://discourse.nodered.org/u/rmystique)\
**Post date:** [30 July 2023 22:01 UTC](https://discourse.nodered.org/t/saving-and-loading-persistent-values-with-persist-in-out/80174/1 "2023-07-30T22:01:52Z")

</div>

Here is what I have, but it is not saving/loading the values it should be, nothing is injected at startup?

```auto
[
    {
        "id": "87d417101364ced0",
        "type": "ina-sensor",
        "z": "f672d0ac69fd5b97",
        "name": "",
        "handle": "3744533d76fec284",
        "x": 90,
        "y": 360,
        "wires": [
            [],
            [
                "1cedc9bda43b0252",
                "ca6d0b6b856afe3d"
            ]
        ]
    },
    {
        "id": "1cedc9bda43b0252",
        "type": "function",
        "z": "f672d0ac69fd5b97",
        "name": "function 1",
        "func": "msg.payload = (((msg.payload ) * 2.0 )/100) - 0.1\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 320,
        "y": 360,
        "wires": [
            [
                "39f94d2e15684d69"
            ]
        ]
    },
    {
        "id": "39f94d2e15684d69",
        "type": "smooth",
        "z": "f672d0ac69fd5b97",
        "name": "",
        "property": "payload",
        "action": "low",
        "count": "20",
        "round": "",
        "mult": "single",
        "reduce": false,
        "x": 460,
        "y": 360,
        "wires": [
            [
                "68a02465c3986fa3"
            ]
        ]
    },
    {
        "id": "68a02465c3986fa3",
        "type": "smooth",
        "z": "f672d0ac69fd5b97",
        "name": "",
        "property": "payload",
        "action": "mean",
        "count": "10",
        "round": "",
        "mult": "single",
        "reduce": false,
        "x": 600,
        "y": 360,
        "wires": [
            [
                "69b7c66b14a6947a",
                "79bf726d2553f6e1",
                "37caa9e1987b0a76"
            ]
        ]
    },
    {
        "id": "79bf726d2553f6e1",
        "type": "function",
        "z": "f672d0ac69fd5b97",
        "name": "A to Watts",
        "func": "msg.payload = ((msg.payload) * 24)\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 180,
        "y": 460,
        "wires": [
            [
                "db9ed300aa801adf"
            ]
        ]
    },
    {
        "id": "db9ed300aa801adf",
        "type": "function",
        "z": "f672d0ac69fd5b97",
        "name": "watts to wattsecs",
        "func": "msg.payload = (msg.payload * 0.000278 )\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 350,
        "y": 460,
        "wires": [
            [
                "95511d01a2955634"
            ]
        ]
    },
    {
        "id": "95511d01a2955634",
        "type": "add",
        "z": "f672d0ac69fd5b97",
        "name": "",
        "topic": "",
        "x": 510,
        "y": 460,
        "wires": [
            [
                "b1b19994c2404732",
                "0f1e7a6d3a7d560c"
            ]
        ]
    },
    {
        "id": "b1b19994c2404732",
        "type": "function",
        "z": "f672d0ac69fd5b97",
        "name": "watt to kw",
        "func": "msg.payload = (msg.payload) / 1000\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 640,
        "y": 460,
        "wires": [
            [
                "ec55e34653b1d418",
                "b0ff1256780516f6"
            ]
        ]
    },
    {
        "id": "ec55e34653b1d418",
        "type": "ui_text",
        "z": "f672d0ac69fd5b97",
        "group": "8ee0bb75fa4e2113",
        "order": 8,
        "width": 3,
        "height": 1,
        "name": "",
        "label": "Kilo Watt Hours",
        "format": "{{value | number : 4}}",
        "layout": "col-center",
        "className": "",
        "style": false,
        "font": "",
        "fontSize": 16,
        "color": "#000000",
        "x": 800,
        "y": 460,
        "wires": []
    },
    {
        "id": "ceec7121f34c54d8",
        "type": "persist out",
        "z": "f672d0ac69fd5b97",
        "name": "watt secs load",
        "storageNode": "ec40f1eb3f7a7fc5",
        "x": 400,
        "y": 520,
        "wires": [
            [
                "95511d01a2955634"
            ]
        ]
    },
    {
        "id": "0f1e7a6d3a7d560c",
        "type": "persist in",
        "z": "f672d0ac69fd5b97",
        "name": "watt secs save",
        "storageNode": "ec40f1eb3f7a7fc5",
        "x": 180,
        "y": 520,
        "wires": []
    },
    {
        "id": "b604718fe208058a",
        "type": "inject",
        "z": "f672d0ac69fd5b97",
        "name": "Cost load",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "1",
        "payloadType": "msg",
        "x": 180,
        "y": 560,
        "wires": [
            [
                "ceec7121f34c54d8"
            ]
        ]
    },
    {
        "id": "3744533d76fec284",
        "type": "ina-sensor-manager",
        "address": "0x40",
        "delay": "1000",
        "ohms": "0.0003",
        "customResistor": true
    },
    {
        "id": "8ee0bb75fa4e2113",
        "type": "ui_group",
        "name": "Main",
        "tab": "9d03c9290d696c27",
        "order": 1,
        "disp": false,
        "width": 6,
        "collapse": false,
        "className": ""
    },
    {
        "id": "ec40f1eb3f7a7fc5",
        "type": "persist-store",
        "filename": "persistence.json",
        "interval": "1"
    },
    {
        "id": "9d03c9290d696c27",
        "type": "ui_tab",
        "name": "Solar Power Stats",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    }
]

```

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [31 July 2023 08:01 UTC](https://discourse.nodered.org/t/saving-and-loading-persistent-values-with-persist-in-out/80174/2 "2023-07-31T08:01:49Z")

</div>

Don't do it that way, use the node red persistent context feature. See [Working with context : Node-RED](https://nodered.org/docs/user-guide/context)

---

<div class="post-metadata">

**Author:** ![rmystique](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rmystique/32/84365_2.png) [@rmystique](https://discourse.nodered.org/u/rmystique)\
**Post date:** [14 August 2023 02:54 UTC](https://discourse.nodered.org/t/saving-and-loading-persistent-values-with-persist-in-out/80174/3 "2023-08-14T02:54:09Z")

</div>

How do i make that work? I have my node red set to save to memory, but not sure what to do in the gui to make it save and load.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [14 August 2023 08:35 UTC](https://discourse.nodered.org/t/saving-and-loading-persistent-values-with-persist-in-out/80174/4 "2023-08-14T08:35:01Z")

</div>

> [@rmystique](#):
>
> How do i make that work?

Did you read the information that Colin pointed you too?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [28 August 2023 08:35 UTC](https://discourse.nodered.org/t/saving-and-loading-persistent-values-with-persist-in-out/80174/5 "2023-08-28T08:35:56Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
