X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=ContactSensor%2FContactSensor.groovy;h=e93ce58909cddc0ca60f90064f305a358b764fc8;hb=2d26e7af07daad1394408bdcf76150b5aacf3a8a;hp=91fdfd1f409a73a600893ee83a5a19c353c2f4e0;hpb=83071d3bcfc33f015ece13868342644498a9dda3;p=smartthings-infrastructure.git diff --git a/ContactSensor/ContactSensor.groovy b/ContactSensor/ContactSensor.groovy index 91fdfd1..e93ce58 100644 --- a/ContactSensor/ContactSensor.groovy +++ b/ContactSensor/ContactSensor.groovy @@ -4,18 +4,16 @@ import SmartThing.SmartThing public class ContactSensor extends SmartThing { // id, label, and display name of the device - StringBuilder id = new StringBuilder() - StringBuilder label = new StringBuilder() - StringBuilder displayName = new StringBuilder() - // Features with string values - StringBuilder currentContact = new StringBuilder() + String id + String label + String displayName // Maps from features to values - HashMap deviceValuesMap = new HashMap() + HashMap deviceValuesMap = new HashMap() // Possible values for eventsSince method - List possibleValues = new ArrayList(); + List possibleValues = new ArrayList(); - ContactSensor(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, StringBuilder currentContact) { - deviceValuesMap = deviceValueSmartThing + ContactSensor(Closure sendEvent, String id, String label, String displayName, String currentContact) { + deviceValueSmartThing = deviceValuesMap idSmartThing = id labelSmartThing = label displayNameSmartThing = displayName @@ -26,15 +24,9 @@ public class ContactSensor extends SmartThing { this.id = id this.label = label this.displayName = displayName - this.currentContact = currentContact possibleValues.add("closed") possibleValues.add("open") deviceValuesMap.put("contact", currentContact) } - - // Methods to return values - def getCurrentContact() { - return currentContact.toString() - } }