today i updatet to 3.50, but now the persistent variables are not anymore at all persistent… Few are, but not all. I turn on this feature in settings.js, also now in venussettings.js. What is changed in 3.50?
According to this,
https://communityarchive.victronenergy.com/questions/155949/node-red-config-files.html
you should be using:
- /data/home/nodered/.node-red/settings-user.js is used to override and/or extend the second file and will survive Venus OS updates. You are allowed to edit this file if you please, but don’t be too surprised if that causes Node-RED to break after an upgrade.
I read this allready, but i don’t have such file there, only config.users.json but there is nothing to uncommend. Should i insert there?
I noticed that the context is saved right, but the ui-control dont remember anymore the value.
@andreask, did you ever get an answer regarding persistent context variables? I have search and found that the information about the locating of the settings file is dated and wrong in the newest software.
I hate to start a new topic if this has been answered recently.
I have been struggling with this one too. After much digging I found the settings.js file in the folder root@einstein:/usr/lib/node_modules/node-red. I edited the file to un-comment the relevant part but context variables still don’t seem to persist. i.e. the option is not there in the change node.
Has anyone done this successfully on the Cerbo GX??
@SimonGrey , I ran into this and was not finding a solution. Then I talked to a friend who was also doing some programming and he suggested that I try an Ai program.
I do not consider myself a programmer but I am learning. I tried my friends suggestion and the Ai bot suggested this Java Script change to the Setting.js file.
First, backup your setting.js file. I did not do this the first time and I created my own headaches.
Second, do not delete the stock software. I left it commented out.
I added this code:
contextStorage: {
default: {
module: “memory”
},
file: {
module: “localfilesystem”
},
},
I have been using this code in my settings.js file for about a week and I have one persistent variable that is being written to and read from my RPI 5.
I found the storage location under '~/.node-re
d/context/global’ and the file name was global.json. When I do a ‘cat global.json’ I get
{
“g13_originalShorePower”: 26
}
In my flows, I have been using
global.set(‘g13_originalShorePower’ , some_value, ‘file’)
to store a value and
global.get(‘g13_originalShorePower’ , ‘file’)
to retrieve the value.
I hope that this helps.