Merge branch 'master' of ssh://plrg.eecs.uci.edu/home/git/smartthings-infrastructure
authorrtrimana <rtrimana@uci.edu>
Tue, 23 Jul 2019 23:26:39 +0000 (16:26 -0700)
committerrtrimana <rtrimana@uci.edu>
Tue, 23 Jul 2019 23:26:39 +0000 (16:26 -0700)
32 files changed:
Extractor/ExtractorScript.py
eventSimulator/appTouchEvent.groovy
eventSimulator/batteryChargeEvent.groovy [new file with mode: 0644]
eventSimulator/buttonHeldEvent.groovy
eventSimulator/buttonPushedEvent.groovy
eventSimulator/carbonMonoxideClearEvent.groovy [new file with mode: 0644]
eventSimulator/carbonMonoxideDetectedEvent.groovy [new file with mode: 0644]
eventSimulator/carbonMonoxideTestedEvent.groovy [new file with mode: 0644]
eventSimulator/contactClosedEvent.groovy
eventSimulator/contactOpenEvent.groovy
eventSimulator/doorClosedEvent.groovy
eventSimulator/doorOpenEvent.groovy
eventSimulator/locationAwayEvent.groovy [new file with mode: 0644]
eventSimulator/locationHomeEvent.groovy [new file with mode: 0644]
eventSimulator/locationNightEvent.groovy [new file with mode: 0644]
eventSimulator/lockEvent.groovy
eventSimulator/motionActiveEvent.groovy [new file with mode: 0644]
eventSimulator/motionInactiveEvent.groovy [new file with mode: 0644]
eventSimulator/nfcTouchEvent.groovy
eventSimulator/presenceLeftEvent.groovy
eventSimulator/presencePresentEvent.groovy
eventSimulator/smokeClearEvent.groovy [new file with mode: 0644]
eventSimulator/smokeDetectedEvent.groovy [new file with mode: 0644]
eventSimulator/smokeTestedEvent.groovy [new file with mode: 0644]
eventSimulator/switchOffEvent.groovy [new file with mode: 0644]
eventSimulator/switchOnEvent.groovy [new file with mode: 0644]
eventSimulator/thermostatAutoModeEvent.groovy [new file with mode: 0644]
eventSimulator/thermostatCoolModeEvent.groovy [new file with mode: 0644]
eventSimulator/thermostatEmergencyHeatModeEvent.groovy [new file with mode: 0644]
eventSimulator/thermostatHeatModeEvent.groovy [new file with mode: 0644]
eventSimulator/thermostatOffModeEvent.groovy [new file with mode: 0644]
eventSimulator/unlockEvent.groovy

index d4b26d2..4e51bec 100644 (file)
@@ -279,16 +279,6 @@ def ExtractEvents(extractedEvents):
                        for line in event:
                                extractedEvents.write(line)
                        event.close()
-               elif eventMap[i] == "switch.on":
-                       event = open("eventSimulator/switchOnEvent.groovy", "r")
-                       for line in event:
-                               extractedEvents.write(line)
-                       event.close()
-               elif eventMap[i] == "switch.off":
-                       event = open("eventSimulator/switchOffEvent.groovy", "r")
-                       for line in event:
-                               extractedEvents.write(line)
-                       event.close()
                elif eventMap[i] == "nfcTouch":
                        event = open("eventSimulator/nfcTouchEvent.groovy", "r")
                        for line in event:
@@ -338,6 +328,131 @@ def ExtractEvents(extractedEvents):
                        for line in event:
                                extractedEvents.write(line)
                        event.close()
+               elif eventMap[i] == "motion":
+                       #Write two events subsequently
+                       event = open("eventSimulator/motionActiveEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
+                       extractedEvents.write("\t\t\tbreak\n")
+                       eventCounter = eventCounter + 1
+                       extractedEvents.write("\t\tcase %d:\n" % eventCounter)
+                       event = open("eventSimulator/motionInactiveEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
+               elif eventMap[i] == "smoke":
+                       #Write three events subsequently
+                       event = open("eventSimulator/smokeClearEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
+                       extractedEvents.write("\t\t\tbreak\n")
+                       eventCounter = eventCounter + 1
+                       extractedEvents.write("\t\tcase %d:\n" % eventCounter)
+                       event = open("eventSimulator/smokeDetectedEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
+                       extractedEvents.write("\t\t\tbreak\n")
+                       eventCounter = eventCounter + 1
+                       extractedEvents.write("\t\tcase %d:\n" % eventCounter)
+                       event = open("eventSimulator/smokeTestedEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
+               elif eventMap[i] == "carbonMonoxide":
+                       #Write three events subsequently
+                       event = open("eventSimulator/carbonMonoxideClearEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
+                       extractedEvents.write("\t\t\tbreak\n")
+                       eventCounter = eventCounter + 1
+                       extractedEvents.write("\t\tcase %d:\n" % eventCounter)
+                       event = open("eventSimulator/carbonMonoxideDetectedEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
+                       extractedEvents.write("\t\t\tbreak\n")
+                       eventCounter = eventCounter + 1
+                       extractedEvents.write("\t\tcase %d:\n" % eventCounter)
+                       event = open("eventSimulator/carbonMonoxideTestedEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
+               elif eventMap[i] == "battery":
+                       event = open("eventSimulator/batteryChargeEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
+               elif eventMap[i] == "thermostatMode":
+                       #Write five events subsequently
+                       event = open("eventSimulator/thermostatAutoModeEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
+                       extractedEvents.write("\t\t\tbreak\n")
+                       eventCounter = eventCounter + 1
+                       extractedEvents.write("\t\tcase %d:\n" % eventCounter)
+                       event = open("eventSimulator/thermostatCoolModeEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
+                       extractedEvents.write("\t\t\tbreak\n")
+                       eventCounter = eventCounter + 1
+                       extractedEvents.write("\t\tcase %d:\n" % eventCounter)
+                       event = open("eventSimulator/thermostatEmergencyHeatModeEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
+                       extractedEvents.write("\t\t\tbreak\n")
+                       eventCounter = eventCounter + 1
+                       extractedEvents.write("\t\tcase %d:\n" % eventCounter)
+                       event = open("eventSimulator/thermostatHeatModeEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
+                       extractedEvents.write("\t\t\tbreak\n")
+                       eventCounter = eventCounter + 1
+                       extractedEvents.write("\t\tcase %d:\n" % eventCounter)
+                       event = open("eventSimulator/thermostatOffModeEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
+               elif eventMap[i] == "switch":
+                       #Write two events subsequently
+                       event = open("eventSimulator/switchOnEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
+                       extractedEvents.write("\t\t\tbreak\n")
+                       eventCounter = eventCounter + 1
+                       extractedEvents.write("\t\tcase %d:\n" % eventCounter)
+                       event = open("eventSimulator/switchOffEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
+               elif eventMap[i] == "Location":
+                       #Write three events subsequently
+                       event = open("eventSimulator/locationHomeEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
+                       extractedEvents.write("\t\t\tbreak\n")
+                       eventCounter = eventCounter + 1
+                       extractedEvents.write("\t\tcase %d:\n" % eventCounter)
+                       event = open("eventSimulator/locationAwayEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
+                       extractedEvents.write("\t\t\tbreak\n")
+                       eventCounter = eventCounter + 1
+                       extractedEvents.write("\t\tcase %d:\n" % eventCounter)
+                       event = open("eventSimulator/locationNightEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
                eventCounter = eventCounter + 1
 
                ###TODO: Add more events later
index 025f036..0b2177e 100644 (file)
@@ -1,2 +1,2 @@
-                       appObject.setValue([name: "Touched", value: "Touched", deviceId: 0, descriptionText: "",
-                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: []])
+                       appObject.setValue([name: "Touched", value: "touched", deviceId: "touchedSensorID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
diff --git a/eventSimulator/batteryChargeEvent.groovy b/eventSimulator/batteryChargeEvent.groovy
new file mode 100644 (file)
index 0000000..adf0018
--- /dev/null
@@ -0,0 +1,2 @@
+                       smokeDetectorObject.setValue([name: "battery", value: "5"/*A number between 0 to 100 as a charge*/, deviceId: "smokeDetectorID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
\ No newline at end of file
index b808a29..d350c29 100644 (file)
@@ -1,2 +1,2 @@
-                       aeonKeyFobObject.setValue([name: "button", value: "held", deviceId: 0, descriptionText: "",
-                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [value: "held"]])
+                       aeonKeyFobObject.setValue([name: "button", value: "held", deviceId: "aeonKeyFobID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
\ No newline at end of file
index 52e74cc..2f8c0f1 100644 (file)
@@ -1,2 +1,2 @@
-                       aeonKeyFobObject.setValue([name: "button", value: "pushed", deviceId: 0, descriptionText: "",
-                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [value: "pushed"]])
+                       aeonKeyFobObject.setValue([name: "button", value: "pushed", deviceId: "aeonKeyFobID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
\ No newline at end of file
diff --git a/eventSimulator/carbonMonoxideClearEvent.groovy b/eventSimulator/carbonMonoxideClearEvent.groovy
new file mode 100644 (file)
index 0000000..71486e0
--- /dev/null
@@ -0,0 +1,2 @@
+                       smokeDetectorObject.setValue([name: "carbonMonoxide", value: "clear", deviceId: "smokeDetectorID0", descriptionText: "",
+                                               displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
\ No newline at end of file
diff --git a/eventSimulator/carbonMonoxideDetectedEvent.groovy b/eventSimulator/carbonMonoxideDetectedEvent.groovy
new file mode 100644 (file)
index 0000000..d7aa316
--- /dev/null
@@ -0,0 +1,2 @@
+                       smokeDetectorObject.setValue([name: "carbonMonoxide", value: "detected", deviceId: "smokeDetectorID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
\ No newline at end of file
diff --git a/eventSimulator/carbonMonoxideTestedEvent.groovy b/eventSimulator/carbonMonoxideTestedEvent.groovy
new file mode 100644 (file)
index 0000000..455c65f
--- /dev/null
@@ -0,0 +1,2 @@
+                       smokeDetectorObject.setValue([name: "carbonMonoxide", value: "tested", deviceId: "smokeDetectorID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
\ No newline at end of file
index 505a2e8..e8aa87c 100644 (file)
@@ -1,2 +1,2 @@
-                       contactObject.setValue([name: "contact.closed", value: "closed", deviceId: 0, descriptionText: "",
-                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [value: "closed"]])
+                       contactObject.setValue([name: "contact.closed", value: "closed", deviceId: "contactSensorID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
index 15bface..5890676 100644 (file)
@@ -1,2 +1,2 @@
-                       contactObject.setValue([name: "contact.open", value: "closed", deviceId: 0, descriptionText: "",
-                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [value: "open"]])
+                       contactObject.setValue([name: "contact.open", value: "open", deviceId: "contactSensorID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
index 91e3e5a..6bf5004 100644 (file)
@@ -1,2 +1,2 @@
-                       doorControlObject.setValue([name: "doorState", value: "closed", deviceId: 0, descriptionText: "",
-                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [value: "closed"]])
+                       doorControlObject.setValue([name: "doorState", value: "closed", deviceId: "doorControlID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
index aa841c6..5f95d3a 100644 (file)
@@ -1,2 +1,2 @@
-                       doorControlObject.setValue([name: "doorState", value: "open", deviceId: 0, descriptionText: "",
-                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [value: "open"]])
+                       doorControlObject.setValue([name: "doorState", value: "open", deviceId: "doorControlID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
diff --git a/eventSimulator/locationAwayEvent.groovy b/eventSimulator/locationAwayEvent.groovy
new file mode 100644 (file)
index 0000000..7f10f78
--- /dev/null
@@ -0,0 +1,2 @@
+                       locationObject.setValue([name: "Location", value: "away", deviceId: "locationID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
\ No newline at end of file
diff --git a/eventSimulator/locationHomeEvent.groovy b/eventSimulator/locationHomeEvent.groovy
new file mode 100644 (file)
index 0000000..c4d4763
--- /dev/null
@@ -0,0 +1,2 @@
+                       locationObject.setValue([name: "Location", value: "home", deviceId: "locationID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
\ No newline at end of file
diff --git a/eventSimulator/locationNightEvent.groovy b/eventSimulator/locationNightEvent.groovy
new file mode 100644 (file)
index 0000000..eb8284b
--- /dev/null
@@ -0,0 +1,2 @@
+                       locationObject.setValue([name: "Location", value: "night", deviceId: "locationID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
\ No newline at end of file
index ec825e4..72b0109 100644 (file)
@@ -1,2 +1,2 @@
-                       lockObject.setValue([name: "lock", value: "locked", deviceId: 0, descriptionText: "",
-                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [value: "locked"]])
+                       lockObject.setValue([name: "lock", value: "locked", deviceId: "lockID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
diff --git a/eventSimulator/motionActiveEvent.groovy b/eventSimulator/motionActiveEvent.groovy
new file mode 100644 (file)
index 0000000..bcec327
--- /dev/null
@@ -0,0 +1,2 @@
+                       motionSensorObject.setValue([name: "motion", value: "active", deviceId: "motionSensorID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
\ No newline at end of file
diff --git a/eventSimulator/motionInactiveEvent.groovy b/eventSimulator/motionInactiveEvent.groovy
new file mode 100644 (file)
index 0000000..2346a0b
--- /dev/null
@@ -0,0 +1,2 @@
+                       motionSensorObject.setValue([name: "motion", value: "inactive", deviceId: "motionSensorID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
\ No newline at end of file
index 00dbe6d..97bbcfe 100644 (file)
@@ -1,2 +1,2 @@
-                       appObject.setValue([name: "nfcTouch", value: "Touched", deviceId: 0, descriptionText: "",
-                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [value: "Touched"]])
+                       appObject.setValue([name: "nfcTouch", value: "touched", deviceId: "nfcSensorID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
index dc5cc86..8de48ed 100644 (file)
@@ -1,2 +1,2 @@
-                       presenceSensorObject.setValue([name: "presence", value: "not present", deviceId: 0, descriptionText: "",
-                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [value: "not present"]])
+                       presenceSensorObject.setValue([name: "presence", value: "not present", deviceId: "presenceSensorID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
\ No newline at end of file
index fc814e7..addb3c1 100644 (file)
@@ -1,2 +1,2 @@
-                       presenceSensorObject.setValue([name: "presence", value: "present", deviceId: 0, descriptionText: "",
-                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [value: "present"]])
+                       presenceSensorObject.setValue([name: "presence", value: "present", deviceId: "presenceSensorID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
\ No newline at end of file
diff --git a/eventSimulator/smokeClearEvent.groovy b/eventSimulator/smokeClearEvent.groovy
new file mode 100644 (file)
index 0000000..c47d3c0
--- /dev/null
@@ -0,0 +1,2 @@
+                       smokeDetectorObject.setValue([name: "smoke", value: "clear", deviceId: "smokeDetectorID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
\ No newline at end of file
diff --git a/eventSimulator/smokeDetectedEvent.groovy b/eventSimulator/smokeDetectedEvent.groovy
new file mode 100644 (file)
index 0000000..34ff73b
--- /dev/null
@@ -0,0 +1,2 @@
+                       smokeDetectorObject.setValue([name: "smoke", value: "detected", deviceId: "smokeDetectorID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
\ No newline at end of file
diff --git a/eventSimulator/smokeTestedEvent.groovy b/eventSimulator/smokeTestedEvent.groovy
new file mode 100644 (file)
index 0000000..1c0dc65
--- /dev/null
@@ -0,0 +1,2 @@
+                       smokeDetectorObject.setValue([name: "smoke", value: "tested", deviceId: "smokeDetectorID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
\ No newline at end of file
diff --git a/eventSimulator/switchOffEvent.groovy b/eventSimulator/switchOffEvent.groovy
new file mode 100644 (file)
index 0000000..84e90a4
--- /dev/null
@@ -0,0 +1,2 @@
+                       switchObject.setValue([name: "switch", value: "off", deviceId: "switchID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
\ No newline at end of file
diff --git a/eventSimulator/switchOnEvent.groovy b/eventSimulator/switchOnEvent.groovy
new file mode 100644 (file)
index 0000000..324f6e8
--- /dev/null
@@ -0,0 +1,2 @@
+                       switchObject.setValue([name: "switch", value: "on", deviceId: "switchID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
\ No newline at end of file
diff --git a/eventSimulator/thermostatAutoModeEvent.groovy b/eventSimulator/thermostatAutoModeEvent.groovy
new file mode 100644 (file)
index 0000000..311731c
--- /dev/null
@@ -0,0 +1,2 @@
+                       thermostatObject.setValue([name: "thermostatMode", value: "auto", deviceId: "thermostatID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
\ No newline at end of file
diff --git a/eventSimulator/thermostatCoolModeEvent.groovy b/eventSimulator/thermostatCoolModeEvent.groovy
new file mode 100644 (file)
index 0000000..e65ad9a
--- /dev/null
@@ -0,0 +1,2 @@
+                       thermostatObject.setValue([name: "thermostatMode", value: "cool", deviceId: "thermostatID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
\ No newline at end of file
diff --git a/eventSimulator/thermostatEmergencyHeatModeEvent.groovy b/eventSimulator/thermostatEmergencyHeatModeEvent.groovy
new file mode 100644 (file)
index 0000000..a594e65
--- /dev/null
@@ -0,0 +1,2 @@
+                       thermostatObject.setValue([name: "thermostatMode", value: "emergencyHeat", deviceId: "thermostatID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
\ No newline at end of file
diff --git a/eventSimulator/thermostatHeatModeEvent.groovy b/eventSimulator/thermostatHeatModeEvent.groovy
new file mode 100644 (file)
index 0000000..51e59c9
--- /dev/null
@@ -0,0 +1,2 @@
+                       thermostatObject.setValue([name: "thermostatMode", value: "heat", deviceId: "thermostatID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
\ No newline at end of file
diff --git a/eventSimulator/thermostatOffModeEvent.groovy b/eventSimulator/thermostatOffModeEvent.groovy
new file mode 100644 (file)
index 0000000..19f05c9
--- /dev/null
@@ -0,0 +1,2 @@
+                       thermostatObject.setValue([name: "thermostatMode", value: "off", deviceId: "thermostatID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
\ No newline at end of file
index 189e4d2..49bcdef 100644 (file)
@@ -1,2 +1,2 @@
-                       lockObject.setValue([name: "unlock", value: "unlocked ", deviceId: 0, descriptionText: "",
-                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [value: "locked"]])
+                       lockObject.setValue([name: "unlock", value: "unlocked ", deviceId: "lockID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])