OpenZWave / node-openzwave-shared

OpenZWave addon for Node.js (all versions) including management and security functions
Other
199 stars 113 forks source link

writeConfig is dead, use writeCache #313

Closed gxapplications closed 4 years ago

gxapplications commented 5 years ago

writeConfig has been deprecated on 1.6, so you removed it, so now to have a similar feature, you should call writeCache from Driver part on open-zwave... but there is not function to do that in node-openzwave-shared.

Since the only way to persist the config is to shutdown / restart the app, we cannot make "config snapshots" anymore like with writeConfig before.

Fishwaldo commented 5 years ago

See https://github.com/OpenZWave/open-zwave/wiki/OpenZWave-1.6-Release-Notes#managerwriteconfig-and-zwcfg_xml-rename

Driver::WriteConfig is a internal only method. Applications do not need to call any of these functions (writeCache/WriteConfig) anymore.

gxapplications commented 5 years ago

Yes, I'm aware of this changelog, but in specific cases, the missing feature is a great step backward. The main case is when the driver fails in a segmentation fault, and its very often... Or when node shuts down without enough time to shutdown the driver. In this specific cases, all changes that occurred on the nodes are not put in the cache file, even if the changes were made hours before. I used this function to force the cache every 5 minutes or after a settings change on a node. This was my only way to have a consistency when the driver crashes and restart... I known this is not on your node wrapper to do this, but its was a bad idea to deprecate it from openzwave project...

Anyway, thank you for your reply.

Fishwaldo commented 5 years ago

The main case is when the driver fails in a segmentation fault, and its very often

Then we should be fixing the crashes instead.

In this specific cases, all changes that occurred on the nodes are not put in the cache file, even if the changes were made hours before.

The Cache File is not intended to Store "The Values" but rather the information about a Node. In fact, the actual values are not used when restarting (as we immediatly query the device for updated values when loading the Node from Cache - And Battery Powered Devices will not proceed past CacheLoad (and thus expose ValueID's) till the device wakes up.

The WriteConfig had the possibility to write out corrupted information if it was called at the "wrong" times during OZW. We now internally write out updated Cache information when pertinent information changes, and its safe to do so. Thus there is no need to call this anymore. If the Cache File isn't updated, its because there is no need to update it.

Anyway - You can delete, blow up, format, erase etc the Cache file. It has no impact to the ongoing operation of OZW or applications. The only side effect of it not being there is a slightly longer interview process when restarting.