Adding 2 events for temperature sensors: above and below thresholds.
authorrtrimana <rtrimana@uci.edu>
Thu, 8 Aug 2019 16:03:04 +0000 (09:03 -0700)
committerrtrimana <rtrimana@uci.edu>
Thu, 8 Aug 2019 16:03:04 +0000 (09:03 -0700)
Extractor/ExtractorScript.py
eventSimulator/temperatureEvent.groovy [deleted file]
eventSimulator/temperatureHighEvent.groovy [new file with mode: 0644]
eventSimulator/temperatureHighMeasurementEvent.groovy [new file with mode: 0644]
eventSimulator/temperatureLowEvent.groovy [new file with mode: 0644]
eventSimulator/temperatureLowMeasurementEvent.groovy [new file with mode: 0644]
eventSimulator/temperatureMeasurementEvent.groovy [deleted file]

index c8786e6..b274e4d 100644 (file)
@@ -56,7 +56,7 @@ eventTypeCounterMap =  {'lock': 2,
                                                'trackDescription' : 1,
                                                'trackData' : 1,
                                                'mute' : 2,
-                                               'temperature' : 1,
+                                               'temperature' : 2,
                                                'heatingSetpoint' : 1,
                                                'coolingSetpoint' : 1,
                                                'thermostatSetpoint' : 1}
@@ -951,10 +951,21 @@ def ExtractEvents(extractedEvents):
                                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()
diff --git a/eventSimulator/temperatureEvent.groovy b/eventSimulator/temperatureEvent.groovy
deleted file mode 100644 (file)
index d044685..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-                       thermostatObject.setValue([name: "temperature", value: "55", deviceId: "thermostatID0", descriptionText: "",
-                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/temperatureHighEvent.groovy b/eventSimulator/temperatureHighEvent.groovy
new file mode 100644 (file)
index 0000000..d044685
--- /dev/null
@@ -0,0 +1,2 @@
+                       thermostatObject.setValue([name: "temperature", value: "55", deviceId: "thermostatID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/temperatureHighMeasurementEvent.groovy b/eventSimulator/temperatureHighMeasurementEvent.groovy
new file mode 100644 (file)
index 0000000..9e7db63
--- /dev/null
@@ -0,0 +1,2 @@
+                       temperatureMeasurementObject.setValue([name: "temperature", value: "55"/*A number between 0 to 100*/, deviceId: "temperatureMeasurementID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/temperatureLowEvent.groovy b/eventSimulator/temperatureLowEvent.groovy
new file mode 100644 (file)
index 0000000..cddbef7
--- /dev/null
@@ -0,0 +1,2 @@
+                       thermostatObject.setValue([name: "temperature", value: "45", deviceId: "thermostatID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/temperatureLowMeasurementEvent.groovy b/eventSimulator/temperatureLowMeasurementEvent.groovy
new file mode 100644 (file)
index 0000000..b8bce76
--- /dev/null
@@ -0,0 +1,2 @@
+                       temperatureMeasurementObject.setValue([name: "temperature", value: "45"/*A number between 0 to 100*/, deviceId: "temperatureMeasurementID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/temperatureMeasurementEvent.groovy b/eventSimulator/temperatureMeasurementEvent.groovy
deleted file mode 100644 (file)
index b8bce76..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-                       temperatureMeasurementObject.setValue([name: "temperature", value: "45"/*A number between 0 to 100*/, deviceId: "temperatureMeasurementID0", descriptionText: "",
-                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])