Is it possible to set reset preferences in code. I am able to get the value just using the preference name as a variable but I can’t seem to “set” that value in code.
I have a preferences for my modified Fibaro Motion Sensor Code and I want the “reset to defaults” button to send the zwave settings as they are configured out of the box and change the preferences back to the defaults.
For example I have a preference for lux report interval, IlumReportInt
input(“illumReportInt”, “number”, title: “Illum Report Interval (42) 0-65535 0=none (default), <5 may block temp readings, too low will waste battery”, description: “Time interval in seconds to report illum regardless of change”)
When reset is selected I would like this to reset to 0.
I can use the variable like this
log.debug “Illum Interval Preference illumReportInt=$illumReportInt”
but trying to set that value does not work
groovy.lang.MissingPropertyException: No such property: illumReportInt for class: script14283931762081368481694 @ line 183
preferences.illumReportInt=0 which I think I saw somewhere but it produces no error but also doesn’t change the value.
Is it possible to alter preferences settings from code ?