+ 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()