mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-20 05:10:51 +00:00
Harmony better error handling
This commit is contained in:
@@ -38,7 +38,7 @@
|
|||||||
definition(
|
definition(
|
||||||
name: "Logitech Harmony (Connect)",
|
name: "Logitech Harmony (Connect)",
|
||||||
namespace: "smartthings",
|
namespace: "smartthings",
|
||||||
author: "Juan Pablo Risso",
|
author: "SmartThings",
|
||||||
description: "Allows you to integrate your Logitech Harmony account with SmartThings.",
|
description: "Allows you to integrate your Logitech Harmony account with SmartThings.",
|
||||||
category: "SmartThings Labs",
|
category: "SmartThings Labs",
|
||||||
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Partner/harmony.png",
|
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Partner/harmony.png",
|
||||||
@@ -394,7 +394,9 @@ def discovery() {
|
|||||||
} catch (java.net.SocketTimeoutException e) {
|
} catch (java.net.SocketTimeoutException e) {
|
||||||
log.warn "Connection to the hub timed out. Please restart the hub and try again."
|
log.warn "Connection to the hub timed out. Please restart the hub and try again."
|
||||||
state.resethub = true
|
state.resethub = true
|
||||||
}
|
} catch (e) {
|
||||||
|
log.warn "Hostname in certificate didn't match. Please try again later."
|
||||||
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -459,7 +461,9 @@ def activity(dni,mode) {
|
|||||||
msg = ex
|
msg = ex
|
||||||
state.aux = 0
|
state.aux = 0
|
||||||
}
|
}
|
||||||
}
|
} catch(Exception ex) {
|
||||||
|
msg = ex
|
||||||
|
}
|
||||||
runIn(10, "poll", [overwrite: true])
|
runIn(10, "poll", [overwrite: true])
|
||||||
return msg
|
return msg
|
||||||
}
|
}
|
||||||
@@ -517,7 +521,9 @@ def poll() {
|
|||||||
state.remove("HarmonyAccessToken")
|
state.remove("HarmonyAccessToken")
|
||||||
return "Harmony Access token has expired"
|
return "Harmony Access token has expired"
|
||||||
}
|
}
|
||||||
}
|
} catch(Exception e) {
|
||||||
|
log.trace e
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -550,7 +556,9 @@ def getActivityList() {
|
|||||||
log.trace e
|
log.trace e
|
||||||
} catch (java.net.SocketTimeoutException e) {
|
} catch (java.net.SocketTimeoutException e) {
|
||||||
log.trace e
|
log.trace e
|
||||||
}
|
} catch(Exception e) {
|
||||||
|
log.trace e
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return activity
|
return activity
|
||||||
}
|
}
|
||||||
@@ -565,9 +573,9 @@ def getActivityName(activity,hubId) {
|
|||||||
httpGet(uri: url, headers: ["Accept": "application/json"]) {response ->
|
httpGet(uri: url, headers: ["Accept": "application/json"]) {response ->
|
||||||
actname = response.data.data.activities[activity].name
|
actname = response.data.data.activities[activity].name
|
||||||
}
|
}
|
||||||
} catch (groovyx.net.http.HttpResponseException e) {
|
} catch(Exception e) {
|
||||||
log.trace e
|
log.trace e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return actname
|
return actname
|
||||||
}
|
}
|
||||||
@@ -585,9 +593,9 @@ def getActivityId(activity,hubId) {
|
|||||||
actid = it.key
|
actid = it.key
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (groovyx.net.http.HttpResponseException e) {
|
} catch(Exception e) {
|
||||||
log.trace e
|
log.trace e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return actid
|
return actid
|
||||||
}
|
}
|
||||||
@@ -602,9 +610,9 @@ def getHubName(hubId) {
|
|||||||
httpGet(uri: url, headers: ["Accept": "application/json"]) {response ->
|
httpGet(uri: url, headers: ["Accept": "application/json"]) {response ->
|
||||||
hubname = response.data.data.name
|
hubname = response.data.data.name
|
||||||
}
|
}
|
||||||
} catch (groovyx.net.http.HttpResponseException e) {
|
} catch(Exception e) {
|
||||||
log.trace e
|
log.trace e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return hubname
|
return hubname
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user