1) Give a description of the problem
I have already written about this elsewhere on this forum, truth be told, but I suppose that from the Meta section, the likelihood o getting answers is small. I noticed recently that some of my chunkier pistons could not be resumed after pausing, and could not be saved whilst running. The problem is documented at Unable to Resume Pistons. I then realised that I was getting this error on the ST IDE when trying to resume:
java.lang.reflect.UndeclaredThrowableException @line 1308 (api_intf_dashboard_piston_resume)
Since there were no replies on my post (on the above link), I went about it the (very) hard way, and tried to determine what was wrong with pistons not resuming⌠And I found something in common - they all had a For Each ($device) loop, and to determine whether a device switch was on or off, I was using: âif {[$device:switch]} is âonââ or âif {[$device:switch]} is âoffââ. SmartThings seems not to like this, inconsistently, and I noticed that when I changed the code, it always manages to resume. I say inconsistently because sometimes, albeit very rarely, I do manage to resume such pistons. But itâs all very intermittent and unpredictable. See the green snippet below:
Am I doing this wrong? Should I instead use the following:
It just seems wrong to me, maybe because I am a beginner and am not understanding something⌠If I do the code like this, it seems like $device is an array, not a variable holding a single device, and surely in the FOR EACH loop, it is only putting in that variable one device at a time, and then going through the entire loop once for every single device. Or is my understanding flawed?
2) What is the expected behaviour?
I expected the âif {[$device:switch]} is âoffââ: Indeed, it actually does work whenever I manage to properly save and resume a piston that contains the said expression, but often the resume fails with the above error - and by often I mean almost always.
3) What is happening/not happening?
As detailed above, it is throwing an error. I am just looking to see whether the alternative, i⌠to build th statement through the WebCoRE interface which would thn read âif any of {$device}'s switch is onâ sounds a littl off to me, implying a list of devices rather than just one device being considered for every pass through the FOR EACH loop.
**4) Post a Green Snapshot of the piston
Uploaded in text above.
5) Attach logs after turning logging level to Full
No logs - just the IDE error above.