Some minor changes!
[smartthings-infrastructure.git] / Extractor / ExtractorScript.py
index 1ad102977466a6eb9c3ba7dc72c4ab22348eb2be..2c965908705c6ce01e97c1a12739009886ffa5c4 100644 (file)
@@ -72,6 +72,7 @@ eventTypesMap =          {'alarm.both': 'alarm',
                                                'tamper.tampered' : 'contact',
                                                'doorState.open' : 'doorState',
                                                'doorState.closed' : 'doorState',
+                                               'position' : 'location',
                                                'mode' : 'location',
                                                'mode.away' : 'location',
                                                'mode.home' : 'location',
@@ -334,8 +335,12 @@ def ExtractEvents(extractedEvents):
        #print "DEBUG: App1: %d" % indexApp1
        #print "DEBUG: App2: %d" % indexApp2
        #print "DEBUG: eventList: %d" % len(eventList)
+       #print eventAppList
        #print eventList
-       isApp1 = True
+       if indexApp2Start > 0:
+               isApp1 = True
+       else:
+               isApp1 = False
        while counter < numOfActualEvents:
                # Interleave events from App1 and App2
                if isApp1 is True:
@@ -456,6 +461,7 @@ def ExtractEvents(extractedEvents):
                                extractedEvents.write(line)
                        event.close()
                elif eventList[i] == "motion":
+                        print("HERE????")
                        #Write two events subsequently
                        event = open("eventSimulator/motionActiveEvent.groovy", "r")                    
                        for line in event:
@@ -646,7 +652,6 @@ 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():