Device Current Status Help


(Michael) #1

I am working on an app that requires the status of a SmartSense Multi Sensor that is connected to a Garage Door as well as a Z-Wave Schlage Door lock. I am strugging with the code to understand the current status of these devices, ie if the door is locked/unlocked and the garage door is open/closed.

I have used code from example SmartThings apps:
Lock Status: def anyLocked = lock1.currentLock == 'locked'
Garage Door:

def latestThreeAxisState = multisensor1.threeAxisState
if (latestThreeAxisState) {
        def isOpen = Math.abs(latestThreeAxisState.xyzValue.z) > 250
}

I have logged the input of both and they aren’t working as expected. With the MultiSensor I am getting a java.lang.IndexOutOfBoundsException. I am new to developing apps on SmartThings so any help is appreciated with these types of devices.

Thanks in advance!