Can device properties be accessed without being a trigger

I’m trying to get familiar with the site and working on my first app.  I am having trouble understanding if it is possible to read both the  contact and acceleration values of a multi-sensor.  e.g. I only want the push notification to occur when there is acceleration motion detected, but the contact sensor remains in a closed state.  I don’t want to name both as inputs and unsure how to subscribe without naming the device.


Anyone have any ideas?

@llfarm - You can ask for the latest value of the state of the contact sensor with the latestValue( attributeName ) method.  So if your multi is called sensor1 and you’ve subscribed to acceleration events, you’d get the sensor’s latest contact value by calling sensor1.latestValue( “contact” ) in your acceleration event handler.

See the example here:


Thanks Dan!  Just what I needed.  My virtual doorbell is pretty much working, but I’m still getting some false positives when the door slams shut. (closed + vibration).  I guess I want to add more code to check a time interval to have passed while closed before firing off the event.  But this definitely gets me on the right path.


Is there a git repository that contains the sample apps and/or additional samples?

@llfarm – At the moment, all of the examples are in the IDE under the Help & Examples tab.  If you create a new SmartApp and select one of the examples from the menu it will overwrite your document with the example code.  We’re currently exploring different ways to share code between IDE users - GitHub integration is certainly on the list of options.

Thanks Dan.  I know about the examples. I have a project called test I use to view them without overwriting my current SmartApp.  I was hoping there would be a place where stable updates would be available to view as pure sources and users could help update the SA’s by providing patch files for SmartThings approval.