From a0181199b71d99064f22cdb43f9df2f0d531ee92 Mon Sep 17 00:00:00 2001 From: Juan Pablo Risso Date: Thu, 26 Jul 2018 18:18:34 -0400 Subject: [PATCH] PROB-2126 - Harmony activity offline fix (#3305) Quotes --- .../logitech-harmony-connect.groovy | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/smartapps/smartthings/logitech-harmony-connect.src/logitech-harmony-connect.groovy b/smartapps/smartthings/logitech-harmony-connect.src/logitech-harmony-connect.groovy index 98919ad3d1e..3522703f60a 100644 --- a/smartapps/smartthings/logitech-harmony-connect.src/logitech-harmony-connect.groovy +++ b/smartapps/smartthings/logitech-harmony-connect.src/logitech-harmony-connect.groovy @@ -521,6 +521,13 @@ def poll() { def pollResponse(response, data) { if (response.hasError()) { log.error "Harmony - response has error: $response.errorMessage" + def activities = getChildDevices() + // Device-Watch relies on the Logitech Harmony Cloud to get the Device state. + activities.each { activity -> + if ("${activity.deviceNetworkId}".contains("harmony-${it.key}")) { + activity.sendEvent(name: "DeviceWatch-DeviceStatus", value: "offline", displayed: false, isStateChange: true) + } + } if (response.status == 401) { // token is expired state.remove("HarmonyAccessToken") log.warn "Harmony - Access token has expired" @@ -539,10 +546,9 @@ def pollResponse(response, data) { def activities = getChildDevices() ResponseValues.hubs.each { // Device-Watch relies on the Logitech Harmony Cloud to get the Device state. - def isAlive = it.value.status activities.each { activity -> if ("${activity.deviceNetworkId}".contains("harmony-${it.key}")) { - activity.sendEvent(name: "DeviceWatch-DeviceStatus", value: isAlive!=504? "online":"offline", displayed: false, isStateChange: true) + activity.sendEvent(name: "DeviceWatch-DeviceStatus", value: "online", displayed: false, isStateChange: true) } } if (it.value.message == "OK") {