'thermostatFanMode' : 5,
'thermostatOperatingState' : 5,
'switch' : 2,
+ 'switch.on' : 1,
+ 'switch.off' : 1,
'location' : 3,
'mode' : 3,
'acceleration' : 2,
event = open("eventSimulator/relaySwitchOnEvent.groovy", "r")
elif capability == "capability.colorControl":
event = open("eventSimulator/colorControlSwitchOnEvent.groovy", "r")
+ elif capability == "capability.colorTemperature":
+ event = open("eventSimulator/colorTemperatureSwitchOnEvent.groovy", "r")
for line in event:
extractedEvents.write(line)
event.close()
event = open("eventSimulator/relaySwitchOffEvent.groovy", "r")
elif capability == "capability.colorControl":
event = open("eventSimulator/colorControlSwitchOffEvent.groovy", "r")
+ 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")
for line in event:
extractedEvents.write(line)
event.close()