Adding switchLevelChangeEvent to python script!
authoramiraj <amiraj.95@uci.edu>
Thu, 8 Aug 2019 18:30:03 +0000 (11:30 -0700)
committeramiraj <amiraj.95@uci.edu>
Thu, 8 Aug 2019 18:30:03 +0000 (11:30 -0700)
Extractor/ExtractorScript.py
eventSimulator/switchLevelChangeEvent.groovy [new file with mode: 0644]

index 3a87c23..502d422 100644 (file)
@@ -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():
@@ -655,6 +656,8 @@ def ExtractEvents(extractedEvents):
                                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":
@@ -925,6 +928,8 @@ def ExtractEvents(extractedEvents):
                                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()
diff --git a/eventSimulator/switchLevelChangeEvent.groovy b/eventSimulator/switchLevelChangeEvent.groovy
new file mode 100644 (file)
index 0000000..502de0a
--- /dev/null
@@ -0,0 +1,2 @@
+                       switchObject.setValue([name: "level", value: "45", deviceId: "switchID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])