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