Removing getXXX methods + properties. Adding getProperty feature to SmartThing(s)
[smartthings-infrastructure.git] / CarbonMonoxideDetector / CarbonMonoxideDetector.groovy
1 //Create a class for carbon monoxide detector
2 package CarbonMonoxideDetector
3 import SmartThing.SmartThing
4
5 public class CarbonMonoxideDetector extends SmartThing {
6         // id, label, and display name of the device
7         String id
8         String label
9         String displayName
10         // Maps from features to values
11         HashMap<String, String> deviceValuesMap = new HashMap<String, String>()
12
13         CarbonMonoxideDetector(Closure sendEvent, String id, String label, String displayName, String currentCarbonMonoxideValue) {
14                 deviceValueSmartThing = deviceValuesMap 
15                 idSmartThing = id
16                 labelSmartThing = label
17                 displayNameSmartThing = displayName
18                 sendEventSmartThings = sendEvent
19
20                 // Initialization
21                 this.id = id
22                 this.label = label
23                 this.displayName = displayName
24
25                 deviceValuesMap.put("carbonMonoxide", currentCarbonMonoxideValue)
26         }
27 }