Validation check for config parameters

Discussion about Z-Uno product. Visit for more details.
Post Reply
Posts: 1
Joined: 30 Jan 2019 05:46

Validation check for config parameters

Post by lylavoie » 30 Jan 2019 05:59


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.


Posts: 22
Joined: 03 Sep 2017 14:38

Re: Validation check for config parameters

Post by DerLexus » 31 Jan 2019 12:09

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...

User avatar
Posts: 5286
Joined: 26 Jan 2011 19:36

Re: Validation check for config parameters

Post by PoltoS » 02 Feb 2019 10:14

Good idea, we will think about it.

Yes, it is allowed to keep old value if the device do not validate it

Post Reply