Subscribe to contact sensor not working

Hello All,

I’m writing a smart app and have hit a wall.

input “rainSensor”, “capability.contactSensor”, title: “Sensor?”, required: true
subscribe(rainSensor,“contact.closed”,rainSensorHandler)

No matter what I try the rainSensorHandler never gets called. I am still learning, any help would be appreciated.

Solved my own problem. Subscribe is looking for state changes when I needed current state. This works for me.

def rainState = rainSensor.currentValue(‘contact’)

© 2019 SmartThings, Inc. All Rights Reserved. Terms of Use | Privacy Policy

SmartThings; SmartApps®; Physical Graph; Hello, Home; and Hello, Smart Home are all trademarks of the SmartThings, Inc.