I wrote a smartapp that I want to restrict valid entries from 0.5 through 9.9 in the preferences section for user input. I am using the optional setting of range to do this. I am trying to only allow the user to input an updated value between 0.5 though 9.9
If I use this range: “1…99” it allows me to use any of those valid inputs between 0.5 though 9.9 however also the ones outside of 9.9 like 10 and up to 99. This is what one would expect.
How am I supposed to write the line of code with range to limit the user between 0.5 and 9.9?
If I change it to range: “1…9” I can only use whole integers or else it causes an error and the preference will not be updated.
So the question is did I find a bug or how do I define the range correctly to restrict valid entries to be only within say 0.5 through 9.9
Here is the line of code below that isn’t working right.
section(“Enter the desired differential temp between fan speeds (default=1.0)…”){
input “fanDiffTemp”, “decimal”, title: “Fan Differential Temp”, range: “1…99”, required: false
{
That is a great idea since the range: “x…y” is buggy. Thanks Mike !!
I was hoping to make my ceiling fan thermostat smartapp more user friendly for those outside the US that use °C instead of °F and the default of 1°C for those using Centigrade is going to be more than most would want since every degree Centigrade converts to almost 2 degrees Fahrenheit
you could use something like this to auto generate the enum options based on the users location temp units.
This is from an SA of mine, it may work in a DTH, don’t know.
Well it sure looks great when I set it up as enum but it totally breaks the smartapp. I am wondering if the enum returns only text versus number values which is causing the problem when I try to use it’s value?
Is there a trick to converting enum values from text to number value that anyone knows of?