I’m writing a SmartApp to control snow melting equipment (attached to switches) based on weather data. Weather data is pulled hourly and snow level (and melt) is calculated, resulting in a “snow level” prediction (the weather API doesn’t seem to have a way to get this directly).
In the app I am using the settings interface to display current status, calculated snow level, aggregate power usage and hourly history data (temp, precipitation, and control decision history). This is all working well, except that I would like to allow the user to directly edit the snow level if the calculated level is wrong. Ideally there would be a user editable preference field that the app could also modify. However, when I define an input variable as such:
input "snow_level", "float", title: "Snow level (in mm)", required: true, defaultValue: 0.0
I can not modify it in the app itself. That is these lines result in the following error. You can see that the variable is readable but the ide pretends it doesn’t exist when writing to it.
log.debug "trying to decrement snow_level which is ${snow_level}" snow_level = snow_level - snow_melt
groovy.lang.MissingPropertyException: No such property: snow_level for class: script1448248932993837084509 @ line 223
debug trying to decrement snow_level which is 5.0
Is there a way that I can make this property modifiable by the program (e.g. via a scheduled callback)?