Merge branch 'master' of ssh://plrg.eecs.uci.edu/home/git/smartthings-infrastructure
authoramiraj <amiraj.95@uci.edu>
Thu, 8 Aug 2019 18:30:33 +0000 (11:30 -0700)
committeramiraj <amiraj.95@uci.edu>
Thu, 8 Aug 2019 18:30:33 +0000 (11:30 -0700)
1  2 
Extractor/ExtractorScript.py

@@@ -48,7 -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 +56,7 @@@
                                                'trackDescription' : 1,
                                                'trackData' : 1,
                                                'mute' : 2,
-                                               'temperature' : 1,
+                                               'temperature' : 2,
                                                'heatingSetpoint' : 1,
                                                'coolingSetpoint' : 1,
                                                'thermostatSetpoint' : 1}
@@@ -645,7 -645,6 +645,7 @@@ def ExtractEvents(extractedEvents)
                                extractedEvents.write(line)
                        event.close()
                elif eventList[i] == "switch":
 +                        
                        #Check which capability
                        variable = eventVarMap[eventList[i]]
                        if eventList[i] not in eventVarCounterMap.keys():
                                eventVarCounterMap[eventList[i]] = eventVarCount + 1
                        capability = capabilityMap[variable[eventVarCount]]
                        #Write two events subsequently
 +                        print("//////////////////////")
 +                        print(capability)
                        if capability == "capability.switch":
                                event = open("eventSimulator/switchOnEvent.groovy", "r")
                        elif capability == "capability.switchLevel":
                        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")                   
                                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()
                                event = open("eventSimulator/switchLevelEvent.groovy", "r")
                        elif capability == "capability.colorControl":
                                event = open("eventSimulator/colorLevelChangeEvent.groovy", "r")
 +                        elif capability == "capability.switch":
 +                                event = open("eventSimulator/switchLevelChangeEvent.groovy", "r")
                        for line in event:
                                extractedEvents.write(line)
                        event.close()
                                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()