NumberFormatException when using a variable to set dimmer level fade

I am trying to use the "Fade dimmer level over time" Action using a variable for the dimmer level to fade towards, but it fails to process the Action, and the logs show the error:

java.lang.NumberFormatException: For input string: "%High-lights%" on line 4875 (appButtonHandler)

The Action works if I use a hard-coded number (80). I've tried using a global variable (named %High-lights%) and a local variable (named %high%) but both suffered the same error. Here is a screenshot of both attempts, then a successful attempt using a hard-coded number:

I'm currently running version 2.1.4.130

I think it is the decimal point in the number. May be wrong, but I have encountered before and corrected by using integers only. There are probably other ways, but one second resolution seemed sufficient to me (it is a eye-perceived value, and I assure you few will notice 10 vice 10.5 or 11 vice 10.6 seconds.

Dave

The variables must be of type Number. Post a screen grab of your global variables page?

Where are you trying to use this global variable? Inside Button Controller or inside Rule Machine? I don't know that you can use global variables there. But also, you might want to try not having any spaces in your GV. That will avoid some issues.

I'm using the variable inside Rule Machine. Both local and global variables that errored in the logs above are of type number. I also attempted to use a decimal, but it wouldn't save the rule using that decimal variable.

23%20PM

I don't know that the fade over time can use a global variable. But you should definitely take out the "-" and the spaces.

The logs screenshot above show that it also errored on the local variable %high%, and that it ran successfully ran using the %Fade time% variable but hard-coding the dimmer level.

I.e. this failed:

Action: Fade Living Room Lights up to %high% over %Fade time% minutes with 10.0 seconds interval
java.lang.NumberFormatException: For input string: "%high%" on line 4875 (appButtonHandler)

But this succeeded:

Action: Fade Living Room Lights up to 80 over %Fade time% minutes with 10.0 seconds interval
...
Living Room Lights was set to 52% [digital]

So it looks like there's a bug when trying to parse a number from any variable in the dimmer level slot. Which is weird because when I am creating the Action it definitely checks that the dimmer level variable is valid.

This is a bug. It's been identified, and will be fixed in the next release.

3 Likes

Awesome! Thanks for letting me know. I look forward to the fix.

BTW, all dimmer values have to be integer, no decimals.