Hello,
Per the current documentation, Z-Wave configuration parameters are saved to the EEPROM automatically. However, this would seem to not allow the application of any validation rules. For example, if I need a parameter that only allows a valid range for 0 to 5 (just an example). How could I block values outside of that range from being saved to the EEPROM?
Is it valid (allowed within Z-Wave) to use the ZUNO_SETUP_CFGPARAMETER_HANDLER(config_parameter_changed) handler, to overwrite the EEPROM parameter back to the previous value, if the newly received value was out of range? This would seem to create a loop between many controllers that will "keep trying" to write the parameter into the "new" value, since they wouldn't know anything about the allowed range / values.
Cheers,
Lincoln
Validation check for config parameters
Re: Validation check for config parameters
I suggest to always validate the paramters read using zunoLoadCfgParam and use a fallback. The fallback could be to overwrite the values with a correct default.
And it should be no problem to overwrite using zunoSaveCfgParam in your handler!
But i'm on your side, it would be better if, for example, the parameter handler had an boolean return value that tells the zuno core to save the new value to the eeprom or to disable the auto-saving and let the handler save the value after validation. In this case the eeprom writes are minimized...
And it should be no problem to overwrite using zunoSaveCfgParam in your handler!
But i'm on your side, it would be better if, for example, the parameter handler had an boolean return value that tells the zuno core to save the new value to the eeprom or to disable the auto-saving and let the handler save the value after validation. In this case the eeprom writes are minimized...
Re: Validation check for config parameters
Good idea, we will think about it.
Yes, it is allowed to keep old value if the device do not validate it
Yes, it is allowed to keep old value if the device do not validate it