Input variables reported as 'null'

Hi All –

I have a custom SmartApp used to control some lights around the house. It asks for user input to determine dim levels, timing, etc, but the dim commands stopped working at some point today. From the IDE, these variables are being reported as ‘null’ when in fact there’s integer numeric values being input at the user end. From a look at the forums, it seems there’s other problems cropping up in the system, so maybe it’s all related…

Reporting to support next.

-Js

Can you share some code or examples of what the HTTP calls look like?

If you are posting JSON, make sure you aren’t enclosing the values in " quotes:

Good:

{ 50 }

Bad:

{ "50" }

Oh, the code is nothing so interesting – neither HTTP calls or JSON post commands. In the preferences there’s a line:

input "dimLevelLow", "number", title: "Then dim lights to this level (0-100)...", required: true

and somewhat further down in a function…

log.debug "Dimming lights $lights to $dimLeveLow"
lights.setLevel(dimLevelLow)

When this code is executed, the IDE log reports ‘null’ instead of the input value for dimLevelLow. Fortunately for my bathroom and WAF, everything seems to be functional again now that yesterday’s issues were been resolved.

My bad! I guess I have HTTP calls on my mind. I should have recognized that you meant input variables in the preferences!

You’re missing the second L in “level” in your log.debug call: $dimLeveLow

2 Likes

Good catch – just double checked the IDE and found the correct spelling in the actual code. Must’ve been a mistype after I copy/pasted the text…?

-Js