+ elif capability == "capability.colorTemperature":
+ event = open("eventSimulator/colorTemperatureSwitchOffEvent.groovy", "r")
+ for line in event:
+ extractedEvents.write(line)
+ event.close()
+ elif eventList[i] == "switch.on":
+ #Check which capability
+ variable = eventVarMap[eventList[i]]
+ if eventList[i] not in eventVarCounterMap.keys():
+ eventVarCounterMap[eventList[i]] = 1
+ eventVarCount = 0
+ else:
+ eventVarCount = eventVarCounterMap[eventList[i]]
+ eventVarCounterMap[eventList[i]] = eventVarCount + 1
+ capability = capabilityMap[variable[eventVarCount]]
+ #Write two events subsequently
+ if capability == "capability.switch":
+ event = open("eventSimulator/switchOnDefaultEvent.groovy", "r")
+ elif capability == "capability.switchLevel":
+ event = open("eventSimulator/switchLevelOnDefaultEvent.groovy", "r")
+ elif capability == "capability.relaySwitch":
+ event = open("eventSimulator/relaySwitchOnDefaultEvent.groovy", "r")
+ elif capability == "capability.colorControl":
+ event = open("eventSimulator/colorControlSwitchOnDefaultEvent.groovy", "r")
+ elif capability == "capability.colorTemperature":
+ event = open("eventSimulator/colorTemperatureSwitchOnDefaultEvent.groovy", "r")
+ for line in event:
+ extractedEvents.write(line)
+ event.close()
+ elif eventList[i] == "switch.off":
+ #Check which capability
+ variable = eventVarMap[eventList[i]]
+ if eventList[i] not in eventVarCounterMap.keys():
+ eventVarCounterMap[eventList[i]] = 1
+ eventVarCount = 0
+ else:
+ eventVarCount = eventVarCounterMap[eventList[i]]
+ eventVarCounterMap[eventList[i]] = eventVarCount + 1
+ capability = capabilityMap[variable[eventVarCount]]
+ #Write two events subsequently
+ if capability == "capability.switch":
+ event = open("eventSimulator/switchOffDefaultEvent.groovy", "r")
+ elif capability == "capability.switchLevel":
+ event = open("eventSimulator/switchLevelOffDefaultEvent.groovy", "r")
+ elif capability == "capability.relaySwitch":
+ event = open("eventSimulator/relaySwitchOffDefaultEvent.groovy", "r")
+ elif capability == "capability.colorControl":
+ event = open("eventSimulator/colorControlSwitchOffDefaultEvent.groovy", "r")
+ elif capability == "capability.colorTemperature":
+ event = open("eventSimulator/colorTemperatureSwitchOffDefaultEvent.groovy", "r")