Merge branch 'master' of ssh://plrg.eecs.uci.edu/home/git/smartthings-infrastructure
[smartthings-infrastructure.git] / Extractor / ExtractorScript.py
index 502d422..8194816 100644 (file)
@@ -48,7 +48,7 @@ eventTypeCounterMap =  {'lock': 2,
                                                'energy' : 1,
                                                'power' : 2,
                                                'illuminance' : 1,
-                                               'humidity' : 1,
+                                               'humidity' : 2,
                                                'alarm' : 4,
                                                'contact' : 2,
                                                'status' : 3,
@@ -56,7 +56,7 @@ eventTypeCounterMap =  {'lock': 2,
                                                'trackDescription' : 1,
                                                'trackData' : 1,
                                                'mute' : 2,
-                                               'temperature' : 1,
+                                               'temperature' : 2,
                                                'heatingSetpoint' : 1,
                                                'coolingSetpoint' : 1,
                                                'thermostatSetpoint' : 1}
@@ -740,16 +740,6 @@ def ExtractEvents(extractedEvents):
                        for line in event:
                                extractedEvents.write(line)
                        event.close()
-               elif eventList[i] == "acceleration.active":
-                       event = open("eventSimulator/accelerationDefaultActiveEvent.groovy", "r")
-                       for line in event:
-                               extractedEvents.write(line)
-                       event.close()
-               elif eventList[i] == "acceleration.inactive":
-                       event = open("eventSimulator/accelerationDefaultInactiveEvent.groovy", "r")
-                       for line in event:
-                               extractedEvents.write(line)
-                       event.close()
                elif eventList[i] == "sleeping":
                        #Write two events subsequently
                        event = open("eventSimulator/sleepSleepingEvent.groovy", "r")                   
@@ -833,7 +823,14 @@ def ExtractEvents(extractedEvents):
                                extractedEvents.write(line)
                        event.close()
                elif eventList[i] == "humidity":
-                       event = open("eventSimulator/humidityMeasurementEvent.groovy", "r")
+                       event = open("eventSimulator/humidityHighMeasurementEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
+                       extractedEvents.write("\n\t\t\tbreak\n")
+                       counter = counter + 1
+                       extractedEvents.write("\t\tcase %d:\n" % counter)
+                       event = open("eventSimulator/humidityLowMeasurementEvent.groovy", "r")
                        for line in event:
                                extractedEvents.write(line)
                        event.close()
@@ -966,10 +963,21 @@ def ExtractEvents(extractedEvents):
                                eventVarCount = eventVarCounterMap[eventList[i]]
                                eventVarCounterMap[eventList[i]] = eventVarCount + 1
                        capability = capabilityMap[variable[eventVarCount]]
+                       #Write two events subsequently
+                       if capability == "capability.thermostat":
+                               event = open("eventSimulator/temperatureHighEvent.groovy", "r")
+                       elif capability == "capability.temperatureMeasurement":
+                               event = open("eventSimulator/temperatureHighMeasurementEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
+                       extractedEvents.write("\n\t\t\tbreak\n")
+                       counter = counter + 1
+                       extractedEvents.write("\t\tcase %d:\n" % counter)
                        if capability == "capability.thermostat":
-                               event = open("eventSimulator/temperatureEvent.groovy", "r")
+                               event = open("eventSimulator/temperatureLowEvent.groovy", "r")
                        elif capability == "capability.temperatureMeasurement":
-                               event = open("eventSimulator/temperatureMeasurementEvent.groovy", "r")
+                               event = open("eventSimulator/temperatureLowMeasurementEvent.groovy", "r")
                        for line in event:
                                extractedEvents.write(line)
                        event.close()