The simulator behaves differently than SmartApps on the platform. Take this piece of code for instance:
input “locks”,“capability.lock”, title: “Lock”, multiple: true
Now try to access the locks properties
if (locks?.size() > 1) { … }
It works fine in the actual SmartApp but in the simulator it throws an error:
java.lang.IllegalArgumentException: Command ‘size’ is not supported by device 262f0463-586b-4935-9548-c76f664c4a1f of type ‘Universal Z-Wave Lock With Alarms’. Supported commands: [poll, lock, unlock, refresh, lock, unlock, updateCodes, setCode, deleteCode, requestCode, reloadAllCodes, unlockwtimeout, alarmToggle, sensitiveToggle, enableAutolock, disableAutolock, setAlarm, setSensitivity, disableKeypad, enableKeypad, disableAudio, enableAudio] @ line 246
For some reason the Simulator when executing the code assumes that size() is not a groovy method but instead a method on the DH. Why would the simulator assume that size() isn’t a groovy method ?
BTW is @Dianoga still looking after the IDE?
This issue was found accidentally by @elekktronix on another thread while using an app and I’m able to replicate the results in the simulator as well.