Two questions...
- Why is persistence not identified in some way in the context view?
I created a flow variable, using default in memory defined in settings.js. I then created a flow variable, using 'persistent' as localfilesystem, i.e. persistence enabled, per the settings.js.
This results in two variables, even if they have the same name in the context view...
It would be a good idea to some how persistence is used in the context data view, no? More user friendly IMHO. Maybe in the label/name column, so variable name (storage name) type of thing?
- How do you pull the flow variable value in a typical change node? I tried the following but it did not work. Of course in a function node I could do 'flow.get('time', 'persistent')' to get the value.
The actual variable pulled right now is only the first found match right? So time default is pulled before time persistent given the example above?
Sample flows...
[{"id":"e7148563.aad51","type":"inject","z":"5eda2e05.dcff38","name":"Invoke","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":90,"y":180,"wires":[["58babbaa.769a0c"]]},{"id":"26e13b9a.1e092c","type":"debug","z":"5eda2e05.dcff38","name":"Message","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":400,"y":180,"wires":[]},{"id":"41e7b4cc.bd66dc","type":"inject","z":"5eda2e05.dcff38","name":"Invoke","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":90,"y":300,"wires":[["51df9970.57a9d"]]},{"id":"51df9970.57a9d","type":"change","z":"5eda2e05.dcff38","name":"Default","rules":[{"t":"set","p":"payload","pt":"msg","to":"time","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":240,"y":300,"wires":[["ad8f744e.f7d058"]]},{"id":"ad8f744e.f7d058","type":"debug","z":"5eda2e05.dcff38","name":"Message","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":400,"y":300,"wires":[]},{"id":"58babbaa.769a0c","type":"function","z":"5eda2e05.dcff38","name":"Default","func":"flow.set('time', msg.payload);\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":240,"y":180,"wires":[["26e13b9a.1e092c"]]},{"id":"ea9f0895.3ad2e","type":"inject","z":"5eda2e05.dcff38","name":"Invoke","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":90,"y":220,"wires":[["648ef7d7.a34c18"]]},{"id":"14b562ff.d7c8b5","type":"debug","z":"5eda2e05.dcff38","name":"Message","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":400,"y":220,"wires":[]},{"id":"648ef7d7.a34c18","type":"function","z":"5eda2e05.dcff38","name":"Persistent","func":"flow.set('time', msg.payload, 'persistent');\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":240,"y":220,"wires":[["14b562ff.d7c8b5"]]},{"id":"beb7cb34.6f2ed8","type":"inject","z":"5eda2e05.dcff38","name":"Invoke","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":90,"y":340,"wires":[["adfea59e.9ec49"]]},{"id":"adfea59e.9ec49","type":"change","z":"5eda2e05.dcff38","name":"Persistent","rules":[{"t":"set","p":"payload","pt":"msg","to":"time,persistent","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":240,"y":340,"wires":[["178c7636.d93842"]]},{"id":"178c7636.d93842","type":"debug","z":"5eda2e05.dcff38","name":"Message","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":400,"y":340,"wires":[]}]
Settings...
module.exports = {
uiPort: process.env.PORT || 1880,
mqttReconnectTime: 15000,
serialReconnectTime: 15000,
debugMaxLength: 1000,
flowFile: 'flows.json',
credentialSecret: "[Redacted]",
functionGlobalContext: {
os:require('os'),
},
exportGlobalContextKeys: false,
contextStorage: {
default: {
module: "memory"
},
persistent: {
module: "localfilesystem"
},
},
logging: {
console: {
level: "info",
metrics: false,
audit: false
}
},
editorTheme: {
projects: {
enabled: false
}
}
}