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,19 +322,27 @@ private getLocationModeInfo() {
|
|||||||
//Map each device to a type given it's capabilities
|
//Map each device to a type given it's capabilities
|
||||||
private getDeviceType(device) {
|
private getDeviceType(device) {
|
||||||
def deviceType
|
def deviceType
|
||||||
def caps = device.capabilities
|
def capabilities = device.capabilities
|
||||||
log.debug "capabilities: [${device}, ${caps}]"
|
log.debug "capabilities: [${device}, ${capabilities}]"
|
||||||
log.debug "supported commands: [${device}, ${device.supportedCommands}]"
|
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":
|
case "switch":
|
||||||
deviceType = "switch"
|
deviceType = "switch"
|
||||||
if (caps.any { it.name.toLowerCase() == "power meter" }) {
|
|
||||||
return deviceType
|
//If the device also contains "Switch Level" capability, identify it as a "light" device.
|
||||||
}
|
if (capabilities.any { it.name.toLowerCase() == "switch level" }) {
|
||||||
if (caps.any { it.name.toLowerCase() == "switch level" }) {
|
|
||||||
deviceType = "light"
|
//If the device also contains "Power Meter" capability, identify it as a "dimmerSwitch" device.
|
||||||
return deviceType
|
if (capabilities.any { it.name.toLowerCase() == "power meter" }) {
|
||||||
|
deviceType = "dimmerSwitch"
|
||||||
|
return deviceType
|
||||||
|
} else {
|
||||||
|
deviceType = "light"
|
||||||
|
return deviceType
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case "contact sensor":
|
case "contact sensor":
|
||||||
@@ -384,7 +392,7 @@ private deviceAttributeList(device) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Map device command and value.
|
//Map device command and value.
|
||||||
//input command and value are from UWP,
|
//input command and value are from UWP,
|
||||||
//returns resultCommand and resultValue that corresponds with function and value in SmartApps
|
//returns resultCommand and resultValue that corresponds with function and value in SmartApps
|
||||||
private mapDeviceCommands(command, value) {
|
private mapDeviceCommands(command, value) {
|
||||||
@@ -414,7 +422,7 @@ private mapDeviceCommands(command, value) {
|
|||||||
resultCommand = "setSaturation"
|
resultCommand = "setSaturation"
|
||||||
resultValue = value
|
resultValue = value
|
||||||
break
|
break
|
||||||
case "ct":
|
case "colorTemperature":
|
||||||
resultCommand = "setColorTemperature"
|
resultCommand = "setColorTemperature"
|
||||||
resultValue = value
|
resultValue = value
|
||||||
break
|
break
|
||||||
|
|||||||
Reference in New Issue
Block a user