Fixing bug in Mobile Presence class
[smartthings-infrastructure.git] / ContactSensor / ContactSensors.groovy
1 //Create a class for contact sensor
2 package ContactSensor
3 import SmartThing.SmartThings
4
5 public class ContactSensors extends SmartThings {
6         List contacts = new ArrayList()
7
8         ContactSensors(Closure sendEvent, boolean init) {
9                 // Only initialize one time since we only have one device for each capability
10                 contacts = smartThings
11
12                 // Initialization
13                 String id = "contactID0"
14                 String label = "contact"
15                 String displayName = "contactSensor"
16                 String currentContact
17                 
18                 if (init)
19                         currentContact = "closed"
20                 else
21                         currentContact = "open"
22
23                 contacts.add(new ContactSensor(sendEvent, id, label, displayName, currentContact))
24         }
25 }