this.level = initLevel
def initTemp = Verify.getIntFromList(10000, 15000)
this.colorTemperature = initTemp
- def init = Verify.getBoolean
+ def init = Verify.getBoolean()
if (init) {
this.currentSwitch = "off"
} else {
'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()
--- /dev/null
+ colorControlObject.setValue([name: "switch.off", value: "off", deviceId: "colorControlID0", descriptionText: "",
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
\ No newline at end of file
--- /dev/null
+ colorControlObject.setValue([name: "switch.on", value: "on", deviceId: "colorControlID0", descriptionText: "",
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
\ No newline at end of file
--- /dev/null
+ colorTemperatureObject.setValue([name: "switch.off", value: "off", deviceId: "switchID0", descriptionText: "",
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
\ No newline at end of file
--- /dev/null
+ colorTemperatureObject.setValue([name: "switch", value: "off", deviceId: "switchID0", descriptionText: "",
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
\ No newline at end of file
--- /dev/null
+ colorTemperatureObject.setValue([name: "switch.on", value: "on", deviceId: "switchID0", descriptionText: "",
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
\ No newline at end of file
--- /dev/null
+ colorTemperatureObject.setValue([name: "switch", value: "on", deviceId: "switchID0", descriptionText: "",
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
\ No newline at end of file
--- /dev/null
+ relaySwitchObject.setValue([name: "switch.off", value: "off", deviceId: "relaySwitchID0", descriptionText: "",
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
\ No newline at end of file
--- /dev/null
+ relaySwitchObject.setValue([name: "switch.on", value: "on", deviceId: "relaySwitchID0", descriptionText: "",
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
\ No newline at end of file
switchLevelObject.setValue([name: "level", value: "45"/*A number between 0 to 100*/, deviceId: "switchLevelID0", descriptionText: "",
- displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
\ No newline at end of file
--- /dev/null
+ switchLevelObject.setValue([name: "switch.off", value: "off", deviceId: "switchLevelID0", descriptionText: "",
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
\ No newline at end of file
--- /dev/null
+ switchLevelObject.setValue([name: "switch.on", value: "on", deviceId: "switchLevelID0", descriptionText: "",
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
\ No newline at end of file
--- /dev/null
+ switchObject.setValue([name: "switch.off", value: "off", deviceId: "switchID0", descriptionText: "",
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
\ No newline at end of file
--- /dev/null
+ switchObject.setValue([name: "switch.on", value: "on", deviceId: "switchID0", descriptionText: "",
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
\ No newline at end of file