PROB-870 - Harmony fails to save credentials

It seams like the user removed some activities on Harmony side without removing them from SmartThings. This is causing an issue when adding new activities. This fix checks if the activity still exists before creating a new device.
This commit is contained in:
Juan Pablo Risso
2016-02-16 14:38:37 -05:00
parent aadbcc2eee
commit 7d07b93694

View File

@@ -419,9 +419,11 @@ def addDevice() {
def d = getChildDevice(dni)
if(!d) {
def newAction = state.HarmonyActivities.find { it.key == dni }
d = addChildDevice("smartthings", "Harmony Activity", dni, null, [label:"${newAction.value} [Harmony Activity]"])
log.trace "created ${d.displayName} with id $dni"
poll()
if (newAction) {
d = addChildDevice("smartthings", "Harmony Activity", dni, null, [label:"${newAction.value} [Harmony Activity]"])
log.trace "created ${d.displayName} with id $dni"
poll()
}
} else {
log.trace "found ${d.displayName} with id $dni already exists"
}