Hi everyone.
I wonder if there is a way to save data of a module and load it back at module startup.
I'm thinking about automatic leanring module (ex : the module change one of it parameters (ex: a table of integer [4,5,..]) save it and load it back when the z-way server start the module.). a sort of non volatile memory in short.
I think this could be done using the module Id to create a file and save data to it, but i wonder if there is a smarter way to do it (using the Z-way API for exemple). If this options should be use I also wonder where is the perfect location to save this file?
if somebody can answer any of this questions to give me a hint...
thanks
Devel : Is there a way to save data using javascript API?
Re: Devel : Is there a way to save data using javascript API
Yes, you can. Look at other modules. For logging for example.
Re: Devel : Is there a way to save data using javascript API
Ok thank.
I looked at DeviceHistory.
To save an object and load it i have to call :
Great!
I looked at DeviceHistory.
To save an object and load it i have to call :
Code: Select all
// to save object :
saveObject("history", self.history);
// to load object :
this.history = loadObject('history') || [];
Re: Devel : Is there a way to save data using javascript API
Hi everybody.
I'm working on an presence auto learning modules. it will permits to anticipate your presence to launch heating for exemple.
So for now i'm able to create and save presence data when the module is running. I tried to uninstall the module and install it back but the saved object is reload from the last install. So how to remove the saved object when the module is uninstalled (removed from active modules)?
Thanks.
I'm working on an presence auto learning modules. it will permits to anticipate your presence to launch heating for exemple.
So for now i'm able to create and save presence data when the module is running. I tried to uninstall the module and install it back but the saved object is reload from the last install. So how to remove the saved object when the module is uninstalled (removed from active modules)?
Thanks.
Re: Devel : Is there a way to save data using javascript API
I have done that in the past as follows:
- stop Zway
- open /opt/z-way-server/automation/storage/configjson-xxxxxxxx.json
- delete the offending virtualDevice(s)
I do use Notepad++ with the JSTool plugin. A bit clumsy, but afaik the only possibility at the moment
- stop Zway
- open /opt/z-way-server/automation/storage/configjson-xxxxxxxx.json
- delete the offending virtualDevice(s)
I do use Notepad++ with the JSTool plugin. A bit clumsy, but afaik the only possibility at the moment
Since 29-12-2016 I am no longer a moderator for this forum