Server.permanent table

Does anyone knows how to use this?

I’ve used it in the past but found it to be a bit cumbersome have resorted to using nv. table and plan to use agents server.save().

`server.setpermanentvalues({fridge=“0”,kettle=“0”,pir=“0”});

if(_state==0 && “fridge” in server.permanent) {
_lastOpen = server.permanent.fridge;
}`

thanks,
server.setpermanentvalues works fine for me, but I thought you can do something else with server.permanent table, because it has a separate mentioning in the server object documentation

Here’s a simple two-part test program. Use save_data, comment it out, then toggle the power and run it again using only get_data. Thus verifying that the data was stored remotely. Other than this, I’m not sure what else you expect it to do?

`// Testing non-volatile, server-side storage

mytable <- {A=“ABC”,
B=“DEF”,
C=“GHI”};

function save_data()
{
server.setpermanentvalues(mytable);
}

function get_data()
{
if ((“A”) in server.permanent) // if index doesn’t exist, program fails, best to check before reading
server.log(server.permanent.A);

foreach(idx,val in server.permanent)
    server.log("index="+idx+" value="+val);

}

imp.configure(“Storage test”, [], []);
//save_data();
get_data();
`

I don’t know either, that’s why I don’t know why it has a mentioning in the documentation.
But your documentation helps me to make things a bit more efficient, thanks.
I’ll try that server.save() as well, maybe I get rid of that ping-pong communication…

server.save isn’t there yet, is it?

not officially

server.save() will be part of Release 23. We’re in the final stages of testing the release, and are hoping to have it out sometime next week (or shortly after).