From 6cf2e56e176c75f6e11cc8911420b2c86780dc0a Mon Sep 17 00:00:00 2001 From: rtrimana Date: Sun, 11 Aug 2019 14:28:41 -0700 Subject: [PATCH] Adding another value for illuminance measurement event. --- Extractor/ExtractorScript.py | 13 ++++++++++--- .../illuminanceMeasurementHighEvent.groovy | 2 ++ ...groovy => illuminanceMeasurementLowEvent.groovy} | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 eventSimulator/illuminanceMeasurementHighEvent.groovy rename eventSimulator/{illuminanceMeasurementEvent.groovy => illuminanceMeasurementLowEvent.groovy} (58%) diff --git a/Extractor/ExtractorScript.py b/Extractor/ExtractorScript.py index 1643c43..660295d 100644 --- a/Extractor/ExtractorScript.py +++ b/Extractor/ExtractorScript.py @@ -47,7 +47,7 @@ eventTypeCounterMap = {'lock': 2, 'saturation' : 1, 'energy' : 1, 'power' : 2, - 'illuminance' : 1, + 'illuminance' : 2, 'humidity' : 2, 'alarm' : 4, 'contact' : 2, @@ -60,7 +60,7 @@ eventTypeCounterMap = {'lock': 2, 'heatingSetpoint' : 1, 'coolingSetpoint' : 1, 'thermostatSetpoint' : 1, - 'threeAxis' : 1} + 'threeAxis' : 1} # Mapping for specific event types eventTypesMap = {'alarm.both': 'alarm', @@ -824,7 +824,14 @@ def ExtractEvents(extractedEvents): extractedEvents.write(line) event.close() elif eventList[i] == "illuminance": - event = open("eventSimulator/illuminanceMeasurementEvent.groovy", "r") + event = open("eventSimulator/illuminanceMeasurementLowEvent.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/illuminanceMeasurementHighEvent.groovy", "r") for line in event: extractedEvents.write(line) event.close() diff --git a/eventSimulator/illuminanceMeasurementHighEvent.groovy b/eventSimulator/illuminanceMeasurementHighEvent.groovy new file mode 100644 index 0000000..c2c5029 --- /dev/null +++ b/eventSimulator/illuminanceMeasurementHighEvent.groovy @@ -0,0 +1,2 @@ + illuminanceMeasurementObject.setValue([name: "illuminance", value: "100"/*A number between 0 to 100 as a charge*/, deviceId: "illuminanceMeasurementID0", descriptionText: "", + displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}']) diff --git a/eventSimulator/illuminanceMeasurementEvent.groovy b/eventSimulator/illuminanceMeasurementLowEvent.groovy similarity index 58% rename from eventSimulator/illuminanceMeasurementEvent.groovy rename to eventSimulator/illuminanceMeasurementLowEvent.groovy index de15937..f515640 100644 --- a/eventSimulator/illuminanceMeasurementEvent.groovy +++ b/eventSimulator/illuminanceMeasurementLowEvent.groovy @@ -1,2 +1,2 @@ - illuminanceMeasurementObject.setValue([name: "illuminance", value: "70"/*A number between 0 to 100 as a charge*/, deviceId: "illuminanceMeasurementID0", descriptionText: "", + illuminanceMeasurementObject.setValue([name: "illuminance", value: "0"/*A number between 0 to 100 as a charge*/, deviceId: "illuminanceMeasurementID0", descriptionText: "", displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}']) -- 2.34.1