Merge branch 'master' of ssh://plrg.eecs.uci.edu/home/git/smartthings-infrastructure
authoramiraj <amiraj.95@uci.edu>
Wed, 7 Aug 2019 02:05:48 +0000 (19:05 -0700)
committeramiraj <amiraj.95@uci.edu>
Wed, 7 Aug 2019 02:05:48 +0000 (19:05 -0700)
Extractor/ExtractorScript.py
GlobalVariables/GlobalVariablesEachApp.groovy
SpeechSynthesis/SpeechSynthesis.groovy
SpeechSynthesis/SpeechSynthesises.groovy
eventSimulator/powerMeterHighPowerEvent.groovy [new file with mode: 0644]
eventSimulator/powerMeterLowPowerEvent.groovy [new file with mode: 0644]

index 5d92fc4..cf4b9de 100644 (file)
@@ -76,6 +76,7 @@ eventTypesMap =          {'alarm.both': 'alarm',
                                                'mode.away' : 'location',
                                                'mode.home' : 'location',
                                                'mode.night' : 'location',
+                                               'unlock' : 'lock',
                                                'lock.locked' : 'lock',
                                                'lock.unlocked' : 'lock',
                                                'motion.active' : 'motion',
@@ -331,6 +332,7 @@ def ExtractEvents(extractedEvents):
        #print "DEBUG: App1: %d" % indexApp1
        #print "DEBUG: App2: %d" % indexApp2
        #print "DEBUG: eventList: %d" % len(eventList)
+       #print eventList
        isApp1 = True
        while counter < numOfActualEvents:
                # Interleave events from App1 and App2
@@ -359,9 +361,6 @@ def ExtractEvents(extractedEvents):
                        for line in event:
                                extractedEvents.write(line)
                        event.close()
-               elif eventList[i] == "unlock":
-                       #Don't do anything for this case
-                       counter = counter - 1
                elif eventList[i] == "nfcTouch":
                        event = open("eventSimulator/nfcTouchEvent.groovy", "r")
                        for line in event:
@@ -796,7 +795,15 @@ def ExtractEvents(extractedEvents):
                                extractedEvents.write(line)
                        event.close()
                elif eventList[i] == "power":
-                       event = open("eventSimulator/powerMeterEvent.groovy", "r")
+                       #Write two events subsequently
+                       event = open("eventSimulator/powerMeterHighPowerEvent.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/powerMeterLowPowerEvent.groovy", "r")
                        for line in event:
                                extractedEvents.write(line)
                        event.close()
index ae8b936..ba78f98 100644 (file)
@@ -3,11 +3,11 @@ def state = [home:[],away:[],night:[]]
 //Create a global logger object for methods
 def log = new Logger()
 //Create a global variable for Functions in Subscribe method
-def functionList = []
+def functionList = new ArrayList(20)
 //Create a global variable for Objects in Subscribe method
-def objectList = []
+def objectList = new ArrayList(20)
 //Create a global variable for Events in Subscribe method
-def eventList = []
+def eventList = new ArrayList(20)
 //Create a global variable for settings
 def settings
 //Zip code
index fb91378..1f25d79 100644 (file)
@@ -29,9 +29,9 @@ public class SpeechSynthesis {
                println("Speech synthesis with id:$id, SPEAKING:\"$message\"!")
                // As a conflict variable
                if (oneUser) {
-                       oneUser = false
+                       this.oneUser = false
                } else {
-                       oneUser = true
+                       this.oneUser = true
                }
        }
 }
index 69601c4..876e48d 100644 (file)
@@ -61,9 +61,9 @@ public class SpeechSynthesises {
                speechSynthesises[0].speak(message)
                // As a conflict variable
                if (oneUser) {
-                       oneUser = false
+                       this.oneUser = false
                } else {
-                       oneUser = true
+                       this.oneUser = true
                }
        }
 
diff --git a/eventSimulator/powerMeterHighPowerEvent.groovy b/eventSimulator/powerMeterHighPowerEvent.groovy
new file mode 100644 (file)
index 0000000..2fdf6dd
--- /dev/null
@@ -0,0 +1,2 @@
+                       powerMeterObject.setValue([name: "power", value: "70"/*A number between 0 to 100 as a charge*/, deviceId: "powerMeterID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/powerMeterLowPowerEvent.groovy b/eventSimulator/powerMeterLowPowerEvent.groovy
new file mode 100644 (file)
index 0000000..58f7c58
--- /dev/null
@@ -0,0 +1,2 @@
+                       powerMeterObject.setValue([name: "power", value: "30"/*A number between 0 to 100 as a charge*/, deviceId: "powerMeterID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])