Modes. How are people defining modes in CC

I’m progressing along and gradually shifting all rules/pistons/zigbee devices from HE onto NR.
Currently I’m running mode manager on HE and turning on/off virtual devices for Home, Evening, Night and Away. These devices are then defined in NR to do certain things depending on the current Mode.
I’m just wondering how people using NR deal with Modes.
I’m happy to leave one HE hub powered up as I haven’t got a zwave dongle yet and I’ll probably leave my zwave devices (I only have 15) connected to HE for the time being. (Also makes it easier to drop back to HE should I need too. Which I won’t. :wink: )
So, how are you doing it guys and gals or don’t you use them. Maybe you just define the time of day in your flows to do different things. :man_shrugging:

I’m using global variables in NR to replicate the modes from HE, i.e. Day, Evening, Night and Home & Away. These are then used in the same manner as in HE, like conditions in flows such as motion lighting etc. The only downside in using global variables is that these are not persistent, but that could easily be solved just by using the file write/read node as a second layer.

1 Like

I believe this is the default setup in NR on Core.

2 Likes

Looks like I will need to read up on GV’s.
This learning curve keeps going up.
In all fairness though, this time 2 weeks ago I hadn’t touched NR. I now have 83 paused pistons which have all been converted to NR.
Keep on truckin’. :slight_smile:

5 Likes

I had thought the GV would be complicated. As mentioned above persistent storage is setup by default.

Then GV can easily be manipulated with change nodes. It was much less complicated than what I envisioned in my head (usually these things are lol). There is a context tab in the right side toolbar that will display the values of all GV’s for you.

2 Likes

OK. Time to be cheeky.
Would you care to share your flow for these GV’s.
It will give me a starting point.
Thanks.

Sure… I’m not 100% sure that everything is according to any standard, but it works for me! :wink:

[
    {
        "id": "a92f9372b46c6298",
        "type": "switch",
        "z": "35b59f1987dd3629",
        "name": "Home/Away",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "home",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "away",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 790,
        "y": 1000,
        "wires": [
            [
                "480bb9c6df63b3fa"
            ],
            [
                "5af2b14a1d0f08ab"
            ]
        ]
    },
    {
        "id": "badd7c38b494f8e1",
        "type": "function",
        "z": "35b59f1987dd3629",
        "name": "Presence - Away",
        "func": "// define variable\nvar presence = global.get(\"presence\") || 0\n\n// set global variable\nglobal.set (\"presence\", \"away\")\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 610,
        "y": 940,
        "wires": [
            []
        ]
    },
    {
        "id": "13499c2bcb471c71",
        "type": "inject",
        "z": "35b59f1987dd3629",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 400,
        "y": 940,
        "wires": [
            [
                "badd7c38b494f8e1"
            ]
        ]
    },
    {
        "id": "480bb9c6df63b3fa",
        "type": "debug",
        "z": "35b59f1987dd3629",
        "name": "Home",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 950,
        "y": 960,
        "wires": []
    },
    {
        "id": "7b7ed304f4886135",
        "type": "function",
        "z": "35b59f1987dd3629",
        "name": "Presence - Home",
        "func": "// define variable\nvar presence = global.get(\"presence\") || 0\n\n// set global variable\nglobal.set (\"presence\", \"home\")\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 610,
        "y": 900,
        "wires": [
            []
        ]
    },
    {
        "id": "5af2b14a1d0f08ab",
        "type": "debug",
        "z": "35b59f1987dd3629",
        "name": "Away",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 950,
        "y": 1040,
        "wires": []
    },
    {
        "id": "77483446a07c4d42",
        "type": "inject",
        "z": "35b59f1987dd3629",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 400,
        "y": 900,
        "wires": [
            [
                "7b7ed304f4886135"
            ]
        ]
    },
    {
        "id": "1fc971188730f364",
        "type": "function",
        "z": "35b59f1987dd3629",
        "name": "Read Presence",
        "func": "// get value from global variable and check if it exists\n// if not set value to 0\nvar presence = global.get(\"presence\") || 0\n\nmsg.payload = presence\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 600,
        "y": 1000,
        "wires": [
            [
                "a92f9372b46c6298"
            ]
        ]
    },
    {
        "id": "d4e85a3c5525fa93",
        "type": "inject",
        "z": "35b59f1987dd3629",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 400,
        "y": 1000,
        "wires": [
            [
                "1fc971188730f364"
            ]
        ]
    }
]
1 Like

To set a global variable you use a change node.
Something to be noted about globals -If you set a local variable, you MUST keep that in the same pallet page in which you use it. A global can be used from anywhere within Node-RED. If you’re setting a global, you can either set it to [RAM - which will not survive a reboot] or to [FILE, which will be stored and will survive a reboot.]

See below for the setup of a global variable for mode
using a change node
image
use set
global
name it
notice that it’s set to ram (will survive a reboot)
image
node

[{"id":"84fd24c557d539e3","type":"change","z":"b12af926a1d7a0d3","name":"Global Mode","rules":[{"t":"set","p":"mode","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1270,"y":320,"wires":[["c2c8151fb31f1ff6","f0f5b58dc5c142f9","63b0756106b63df0"]]}]

This creates your global.
To change or set the global, you simply use a change node that will set that global name. If/Then/Else triggers these changes
example - Set quiet/home/away/night

[{"id":"fea5fa40d1464ddf","type":"change","z":"b12af926a1d7a0d3","name":"set quiet","rules":[{"t":"set","p":"payload","pt":"msg","to":"quiet","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1060,"y":320,"wires":[["84fd24c557d539e3"]]},{"id":"0d33287693d5d026","type":"change","z":"b12af926a1d7a0d3","name":"set home","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload","pt":"msg","to":"home","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":900,"y":520,"wires":[["84fd24c557d539e3"]]},{"id":"8ebde446b1b87fd6","type":"change","z":"b12af926a1d7a0d3","name":"set away","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload","pt":"msg","to":"away","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":980,"y":660,"wires":[["84fd24c557d539e3"]]},{"id":"96f34b55ba9d7e9d","type":"change","z":"b12af926a1d7a0d3","name":"set night","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload","pt":"msg","to":"night","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"mode","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":880,"y":100,"wires":[["84fd24c557d539e3"]]}]

Most times, you will want to check against certain criteria to make sure that all conditions are met. in that case you run these through a switch node to trigger the correct mode. Below is the code for my modes. Mine are based on whether we’re home, away, or one or two of us in in bed. It complicates things, but I also have pressure mats that lets CORE know that someone or both are in bed. Please treat this as an example as there are other aspects that will not make sense as they link in from other areas. Like globals trigger from a different page as well as bed sensors or presence. The flow mainly represents checking against other globals to keep mode in check with what’s happening in the house.

[{"id":"0da612bb155f8199","type":"switch","z":"b12af926a1d7a0d3","name":"JeffIn","property":"payload","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":430,"y":80,"wires":[["15dbb4a664a8a5eb"]]},{"id":"480f436d4735b0a1","type":"switch","z":"b12af926a1d7a0d3","name":"Quiet","property":"mode","propertyType":"global","rules":[{"t":"eq","v":"quiet","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":730,"y":100,"wires":[["96f34b55ba9d7e9d"]]},{"id":"fe9b1e93a9043215","type":"switch","z":"b12af926a1d7a0d3","name":"AprilIn","property":"payload","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":430,"y":120,"wires":[["56a04c4a02be8e3b"]]},{"id":"22d8a2af154108ee","type":"switch","z":"b12af926a1d7a0d3","name":"JeffIn","property":"payload","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":430,"y":220,"wires":[["cb369f2dad1bd7f6"]]},{"id":"a9c19f2794e48b42","type":"switch","z":"b12af926a1d7a0d3","name":"AprilIn","property":"payload","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":430,"y":260,"wires":[["a74eb78f12a71fca"]]},{"id":"0c721adbcba6a4ed","type":"switch","z":"b12af926a1d7a0d3","name":"Home","property":"mode","propertyType":"global","rules":[{"t":"eq","v":"home","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":730,"y":240,"wires":[["fea5fa40d1464ddf","96b5e25c123d81dd"]]},{"id":"f4c68ec494166108","type":"switch","z":"b12af926a1d7a0d3","name":"JeffOut","property":"payload","propertyType":"msg","rules":[{"t":"false"}],"checkall":"true","repair":false,"outputs":1,"x":440,"y":360,"wires":[["322d0141a4b16ebf"]]},{"id":"979707a5ca267938","type":"switch","z":"b12af926a1d7a0d3","name":"AprilOut","property":"payload","propertyType":"msg","rules":[{"t":"false"}],"checkall":"true","repair":false,"outputs":1,"x":440,"y":400,"wires":[["12c33ba6e08dedc8"]]},{"id":"cbe1bd07081cd5ce","type":"switch","z":"b12af926a1d7a0d3","name":"JeffOut","property":"payload","propertyType":"msg","rules":[{"t":"false"}],"checkall":"true","repair":false,"outputs":1,"x":440,"y":500,"wires":[["23c76713c41216c4"]]},{"id":"88ab70ae3cf383b3","type":"switch","z":"b12af926a1d7a0d3","name":"AprilOut","property":"payload","propertyType":"msg","rules":[{"t":"false"}],"checkall":"true","repair":false,"outputs":1,"x":440,"y":540,"wires":[["0cd70212c4698c07"]]},{"id":"35aff5a5604f99cd","type":"switch","z":"b12af926a1d7a0d3","name":"Night","property":"mode","propertyType":"global","rules":[{"t":"eq","v":"night","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":730,"y":380,"wires":[["fea5fa40d1464ddf"]]},{"id":"9d0a56a0bf1a00e0","type":"switch","z":"b12af926a1d7a0d3","name":"Quiet","property":"#:(file)::mode","propertyType":"global","rules":[{"t":"eq","v":"quiet","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":730,"y":520,"wires":[["0d33287693d5d026","889ad689084be9ce"]]},{"id":"96f34b55ba9d7e9d","type":"change","z":"b12af926a1d7a0d3","name":"set night","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload","pt":"msg","to":"night","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"mode","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":880,"y":100,"wires":[["84fd24c557d539e3"]]},{"id":"fea5fa40d1464ddf","type":"change","z":"b12af926a1d7a0d3","name":"set quiet","rules":[{"t":"set","p":"payload","pt":"msg","to":"quiet","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1060,"y":320,"wires":[["84fd24c557d539e3"]]},{"id":"0d33287693d5d026","type":"change","z":"b12af926a1d7a0d3","name":"set home","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload","pt":"msg","to":"home","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":900,"y":520,"wires":[["84fd24c557d539e3"]]},{"id":"720aac48c03e24ba","type":"comment","z":"b12af926a1d7a0d3","name":"If 1 becomes false and 1 is already false set quiet to home","info":"","x":590,"y":460,"wires":[]},{"id":"d020a8d79b60ac95","type":"comment","z":"b12af926a1d7a0d3","name":"If 1 becomes true and 1 is false set home to quiet","info":"","x":560,"y":180,"wires":[]},{"id":"a7b42fad749eaf6e","type":"comment","z":"b12af926a1d7a0d3","name":"If 1 Becomes true and one is already true set quiet to night","info":"","x":590,"y":40,"wires":[]},{"id":"926607cfa39cce06","type":"comment","z":"b12af926a1d7a0d3","name":"If 1 becomes false and 1 is true set night to quiet","info":"","x":560,"y":320,"wires":[]},{"id":"958fd7a1f05e17b3","type":"link in","z":"b12af926a1d7a0d3","name":"-> April Prescence","links":["df9480405e03fb25","a0bca2e7ef01dd89"],"x":355,"y":600,"wires":[["7a3cd4bb4040af26"]]},{"id":"527f5bb24ae806cc","type":"link in","z":"b12af926a1d7a0d3","name":"-> Jeff Presence","links":["b656fc6a70fc5679","721171ffe0b765a4"],"x":355,"y":660,"wires":[["5bbc60f1c7c1734c"]]},{"id":"8e6b7de9a57211f6","type":"comment","z":"b12af926a1d7a0d3","name":"April  Presence ->","info":"","x":240,"y":600,"wires":[]},{"id":"816123fbecb48a84","type":"comment","z":"b12af926a1d7a0d3","name":"Jeff Presence ->","info":"","x":240,"y":660,"wires":[]},{"id":"5bbc60f1c7c1734c","type":"switch","z":"b12af926a1d7a0d3","name":"Home/Away","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"home","vt":"str"},{"t":"eq","v":"away","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":470,"y":660,"wires":[["fd657f47a91faed5"],["a30e0e7a15381c02"]]},{"id":"7a3cd4bb4040af26","type":"switch","z":"b12af926a1d7a0d3","name":"Home/Away","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"home","vt":"str"},{"t":"eq","v":"away","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":470,"y":600,"wires":[["fd657f47a91faed5"],["c50107ae90455d54"]]},{"id":"84fd24c557d539e3","type":"change","z":"b12af926a1d7a0d3","name":"Global Mode","rules":[{"t":"set","p":"mode","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1270,"y":320,"wires":[["c2c8151fb31f1ff6","f0f5b58dc5c142f9","63b0756106b63df0"]]},{"id":"c2c8151fb31f1ff6","type":"link out","z":"b12af926a1d7a0d3","name":"MasterMode->","links":["1985cc5ca9b4eed6","8c14e94e208652a6","8f1388c21d8a0ccc","97077f71faf3bf27","bb8bd4b89c81215d","e7220e502ae0a3ac","53a2e2e9a65ff446","8dbed1788d203131","12838c8ff310c915","f28fbd1f2c5bef71","545971656afebb52"],"x":1435,"y":320,"wires":[]},{"id":"c1c095e390459e77","type":"link in","z":"b12af926a1d7a0d3","name":"->AprilBed","links":["c7c360855ba9f7b5","d1960d6edd2a9140","bad1fbbdfd0b4767","93e5bdc36451c22f"],"x":175,"y":260,"wires":[["fe9b1e93a9043215","a9c19f2794e48b42","88ab70ae3cf383b3","979707a5ca267938"]]},{"id":"fd657f47a91faed5","type":"switch","z":"b12af926a1d7a0d3","name":"ModeAway","property":"#:(file)::mode","propertyType":"global","rules":[{"t":"eq","v":"away","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":790,"y":600,"wires":[["0d33287693d5d026"]]},{"id":"a30e0e7a15381c02","type":"switch","z":"b12af926a1d7a0d3","name":"AprilAway","property":"#:(file)::AprilStatus","propertyType":"global","rules":[{"t":"eq","v":"away","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":620,"y":680,"wires":[["2937fa831650a413"]]},{"id":"c50107ae90455d54","type":"switch","z":"b12af926a1d7a0d3","name":"JeffAway","property":"#:(file)::JeffStatus","propertyType":"global","rules":[{"t":"eq","v":"away","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":620,"y":620,"wires":[["2937fa831650a413"]]},{"id":"2937fa831650a413","type":"switch","z":"b12af926a1d7a0d3","name":"ModeHome","property":"#:(file)::mode","propertyType":"global","rules":[{"t":"eq","v":"home","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":790,"y":660,"wires":[["8ebde446b1b87fd6"]]},{"id":"8ebde446b1b87fd6","type":"change","z":"b12af926a1d7a0d3","name":"set away","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload","pt":"msg","to":"away","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":980,"y":660,"wires":[["84fd24c557d539e3"]]},{"id":"56a04c4a02be8e3b","type":"switch","z":"b12af926a1d7a0d3","name":"JeffIn","property":"jeffinbed","propertyType":"global","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":570,"y":120,"wires":[["480f436d4735b0a1"]]},{"id":"15dbb4a664a8a5eb","type":"switch","z":"b12af926a1d7a0d3","name":"AprilIn","property":"aprilinbed","propertyType":"global","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":570,"y":80,"wires":[["480f436d4735b0a1"]]},{"id":"a74eb78f12a71fca","type":"switch","z":"b12af926a1d7a0d3","name":"JeffOut","property":"jeffinbed","propertyType":"global","rules":[{"t":"false"}],"checkall":"true","repair":false,"outputs":1,"x":580,"y":260,"wires":[["0c721adbcba6a4ed"]]},{"id":"cb369f2dad1bd7f6","type":"switch","z":"b12af926a1d7a0d3","name":"AprilOut","property":"aprilinbed","propertyType":"global","rules":[{"t":"false"}],"checkall":"true","repair":false,"outputs":1,"x":580,"y":220,"wires":[["0c721adbcba6a4ed"]]},{"id":"12c33ba6e08dedc8","type":"switch","z":"b12af926a1d7a0d3","name":"JeffIn","property":"jeffinbed","propertyType":"global","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":570,"y":400,"wires":[["35aff5a5604f99cd"]]},{"id":"322d0141a4b16ebf","type":"switch","z":"b12af926a1d7a0d3","name":"AprilIn","property":"aprilinbed","propertyType":"global","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":570,"y":360,"wires":[["35aff5a5604f99cd"]]},{"id":"0cd70212c4698c07","type":"switch","z":"b12af926a1d7a0d3","name":"JeffOut","property":"jeffinbed","propertyType":"global","rules":[{"t":"false"}],"checkall":"true","repair":false,"outputs":1,"x":580,"y":540,"wires":[["9d0a56a0bf1a00e0"]]},{"id":"23c76713c41216c4","type":"switch","z":"b12af926a1d7a0d3","name":"AprilOut","property":"aprilinbed","propertyType":"global","rules":[{"t":"false"}],"checkall":"true","repair":false,"outputs":1,"x":580,"y":500,"wires":[["9d0a56a0bf1a00e0"]]},{"id":"3f985ebf74f9f92d","type":"link in","z":"b12af926a1d7a0d3","name":"->JeffBed","links":["11ca254639449adb","1cfbeb46805e7dfa"],"x":175,"y":360,"wires":[["0da612bb155f8199","22d8a2af154108ee","f4c68ec494166108","cbe1bd07081cd5ce"]]},{"id":"9baafc1ea2cc0e22","type":"inject","z":"b12af926a1d7a0d3","name":"quiet","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"quiet","payloadType":"str","x":980,"y":280,"wires":[["84fd24c557d539e3"]]},{"id":"f0f5b58dc5c142f9","type":"function","z":"b12af926a1d7a0d3","name":"","func":"const globalMode = global.get(\"mode\",\"file\");\nlet color = \"red\";\nswitch(globalMode) {\n    case \"away\":\n        color = \"blue\";\n        break;\n    case \"morning\":\n        color = \"orange\";\n        break;\n    case \"home\":\n        color = \"green\";\n        break;\n    case \"quiet\":\n        color = \"yellow\";\n        break;\n    case \"cleaning\":\n        color = \"red\";\n        break;\n    case \"night\":\n        color = \"black\";\n}\nnode.status({fill:color,shape:\"dot\",text:globalMode});\nreturn null;","outputs":1,"noerr":0,"initialize":"const globalMode = global.get(\"mode\",\"file\");\nlet color = \"red\";\nswitch(globalMode) {\n    case \"away\":\n        color = \"blue\";\n        break;\n    case \"morning\":\n        color = \"orange\";\n        break;\n    case \"home\":\n        color = \"green\";\n        break;\n    case \"quiet\":\n        color = \"yellow\";\n        break;\n    case \"cleaning\":\n        color = \"red\";\n        break;\n    case \"night\":\n        color = \"black\";\n}\nnode.status({fill:color,shape:\"dot\",text:globalMode});\nreturn null;","finalize":"","libs":[],"x":1440,"y":420,"wires":[[]]},{"id":"96b5e25c123d81dd","type":"link out","z":"b12af926a1d7a0d3","name":"ModeHome2Quiet ->","links":[],"x":885,"y":220,"wires":[]},{"id":"889ad689084be9ce","type":"link out","z":"b12af926a1d7a0d3","name":"Quiet2Home ->","links":["502f831d.7c334c"],"x":885,"y":460,"wires":[]},{"id":"a1d0f9787ea26dc5","type":"inject","z":"b12af926a1d7a0d3","name":"home","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"home","payloadType":"str","x":990,"y":380,"wires":[["84fd24c557d539e3"]]},{"id":"bd14316762df0707","type":"link in","z":"b12af926a1d7a0d3","name":"->Mode_ButtonNight","links":["365c2d1557c41ebe","4e66f752df669ac1","751192e1f619b0b5","d93152ddcbc06eb2","3e1f5a23c5074cb6","c0db7430dd4d81d7","8af003f1829fa132"],"x":1095,"y":180,"wires":[["84fd24c557d539e3"]]},{"id":"961f3517593fc19b","type":"switch","z":"b12af926a1d7a0d3","name":"","property":"kbutton_2_single","propertyType":"global","rules":[{"t":"eq","v":"0","vt":"num"},{"t":"eq","v":"1","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":1300,"y":160,"wires":[[],[]]},{"id":"4157e329db51836d","type":"inject","z":"b12af926a1d7a0d3","name":"night","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"night","payloadType":"str","x":990,"y":240,"wires":[["84fd24c557d539e3"]]},{"id":"63b0756106b63df0","type":"debug","z":"b12af926a1d7a0d3","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1480,"y":200,"wires":[]},{"id":"89448898f58bda3c","type":"link in","z":"b12af926a1d7a0d3","name":"-> Set Mode","links":["0f260abe9f460fe6","e498f855649bc821","e693abd2bb6665eb"],"x":1095,"y":140,"wires":[["84fd24c557d539e3"]]}]

Hope this helps a bit.

3 Likes

I also get the option to set flow variables to either save to disk or RAM. Running NR3… not sure if NR2 provides this option.

Yes, but default in 2 is file.
You can change it if you click the arrow next to it.

So ram survives a reboot and not file?

NO file survives a reboot. did i say that wrong in my description… I should check.
EDIT
I bracketed that so it’s a bit more clear
RAM - Temporary
FILE - Persistent

1 Like

Either way, I’ve come to realize that I will redo all my flows including GV… they are far more complicated to what the need to be by using the function node! :blush:

BTW… how do I delete a persistent variable, i.e saved as file?

HOPE THIS HELPS A BIT. WOW!!! :astonished:

1 Like

Found it! :wink:

1 Like

Expand the right hand menu click the down arrow by the debug window and choose “Context data”
Find your global in the list (usually alphabetical) and click the trash can
image

1 Like

Too much?

I can never get too much information.
Whether it makes sense to me… … … … … well, that’s a different story. :wink:

3 Likes

Keep in mind that I choose not to use functions for my modes. So you’ve got a couple of ways to do that. One being a function. One without.

2 Likes

From my brief scan of your post, I like the way you are doing it. It just makes more sense to me.
I think this will be tomorrows project. :thinking:
Thanks again.

1 Like