Adding events to emulate values above and below thresholds.
authorrtrimana <rtrimana@uci.edu>
Thu, 8 Aug 2019 16:47:46 +0000 (09:47 -0700)
committerrtrimana <rtrimana@uci.edu>
Thu, 8 Aug 2019 16:47:46 +0000 (09:47 -0700)
Extractor/ExtractorScript.py
eventSimulator/humidityHighMeasurementEvent.groovy [new file with mode: 0644]
eventSimulator/humidityLowMeasurementEvent.groovy [new file with mode: 0644]

index b274e4d..fb03c70 100644 (file)
@@ -48,7 +48,7 @@ eventTypeCounterMap =  {'lock': 2,
                                                'energy' : 1,
                                                'power' : 2,
                                                'illuminance' : 1,
-                                               'humidity' : 1,
+                                               'humidity' : 2,
                                                'alarm' : 4,
                                                'contact' : 2,
                                                'status' : 3,
@@ -820,7 +820,14 @@ def ExtractEvents(extractedEvents):
                                extractedEvents.write(line)
                        event.close()
                elif eventList[i] == "humidity":
-                       event = open("eventSimulator/humidityMeasurementEvent.groovy", "r")
+                       event = open("eventSimulator/humidityHighMeasurementEvent.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/humidityLowMeasurementEvent.groovy", "r")
                        for line in event:
                                extractedEvents.write(line)
                        event.close()
diff --git a/eventSimulator/humidityHighMeasurementEvent.groovy b/eventSimulator/humidityHighMeasurementEvent.groovy
new file mode 100644 (file)
index 0000000..bcfe170
--- /dev/null
@@ -0,0 +1,2 @@
+                       humidityMeasurementObject.setValue([name: "humidity", value: "70"/*A number between 0 to 100 as a charge*/, deviceId: "humidityMeasurementID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/humidityLowMeasurementEvent.groovy b/eventSimulator/humidityLowMeasurementEvent.groovy
new file mode 100644 (file)
index 0000000..4692c5d
--- /dev/null
@@ -0,0 +1,2 @@
+                       humidityMeasurementObject.setValue([name: "humidity", value: "30"/*A number between 0 to 100 as a charge*/, deviceId: "humidityMeasurementID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])