As it appears above, it will never be called. No error, no log.trace, nothing. If I remove the if () block, all is well. The log.trace dispays the correct value for current. Makes no sense to me what so ever. The above handler was copied from a smartapp that works just fine. THAT handler looks like
There is a bug in ST right now that prevents logs from being printed if there is any error in the in the callback function, even if the error comes after the logging.
In your here
In ST universe, when a variable appears without keyword def, the SmartApp assumes that it’s an input. I presume latestPower is not defined as an input in your app and you are getting null. null is not a number and cannot be compared with such. Therefore you get an error, which is not being printed due to ST bug in logging.
Smartthings is not a full IDE and debugging is lacking for sure. Most likely its dumping out of that method leaving everything on the table before its get passed to logging.
I am well aware of that. Hence the “” around fix. The problem is if (latestPower > 10) is throwing an error which does not show up in the log. Because of this error even the log.trace statement does not execute