mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-08 05:31:56 +00:00
DVCSMP-2487 OpenT2T: Update to 3/2 submission
This commit is contained in:
@@ -322,20 +322,28 @@ private getLocationModeInfo() {
|
||||
//Map each device to a type given it's capabilities
|
||||
private getDeviceType(device) {
|
||||
def deviceType
|
||||
def caps = device.capabilities
|
||||
log.debug "capabilities: [${device}, ${caps}]"
|
||||
def capabilities = device.capabilities
|
||||
log.debug "capabilities: [${device}, ${capabilities}]"
|
||||
log.debug "supported commands: [${device}, ${device.supportedCommands}]"
|
||||
caps.each {
|
||||
switch (it.name.toLowerCase()) {
|
||||
|
||||
//Loop through the device capability list to determine the device type.
|
||||
capabilities.each { capability ->
|
||||
switch (capability.name.toLowerCase()) {
|
||||
case "switch":
|
||||
deviceType = "switch"
|
||||
if (caps.any { it.name.toLowerCase() == "power meter" }) {
|
||||
|
||||
//If the device also contains "Switch Level" capability, identify it as a "light" device.
|
||||
if (capabilities.any { it.name.toLowerCase() == "switch level" }) {
|
||||
|
||||
//If the device also contains "Power Meter" capability, identify it as a "dimmerSwitch" device.
|
||||
if (capabilities.any { it.name.toLowerCase() == "power meter" }) {
|
||||
deviceType = "dimmerSwitch"
|
||||
return deviceType
|
||||
}
|
||||
if (caps.any { it.name.toLowerCase() == "switch level" }) {
|
||||
} else {
|
||||
deviceType = "light"
|
||||
return deviceType
|
||||
}
|
||||
}
|
||||
break
|
||||
case "contact sensor":
|
||||
deviceType = "contactSensor"
|
||||
@@ -414,7 +422,7 @@ private mapDeviceCommands(command, value) {
|
||||
resultCommand = "setSaturation"
|
||||
resultValue = value
|
||||
break
|
||||
case "ct":
|
||||
case "colorTemperature":
|
||||
resultCommand = "setColorTemperature"
|
||||
resultValue = value
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user