Standard prefix - not a programmer and I don't know Java or Groovy
One of the apps I use with HE is SleepIQ, which creates presence sensors from my Sleep Number bed. Work pretty well, when I have it poll every 5 minutes. But I know from past experiments that when it polled every minute, other devices on my HE would respond slowly.
I was looking at the code yesterday and there's a section where httpGet and httpPut are used. How difficult would it be to convert these to use asynchttp? I have cut and paste the section that uses httpGet as an example:
try {
def statusParams = [
uri: ApiUriBase() + '/rest/bed/familyStatus?_k=' + state.session?.key,
headers: [
'Content-Type': 'application/json;charset=UTF-8',
'Host': ApiHost(),
'User-Agent': ApiUserAgent(),
'Cookie': state.session?.cookies,
'DNT': '1',
],
]
httpGet(statusParams) { response ->
if (response.status == 200){
// log.trace "doStatus() Success - Request was successful: ($response.status) $response.data"
state.requestData = response.data
} else {
// log.trace "doStatus() Failure - Request was unsuccessful: ($response.status) $response.data"
state.session = null
state.requestData = [:]
}
}
} catch(Exception e) {
if (alreadyLoggedIn) {
// log.error "doStatus() Error ($e)"
} else {
// log.trace "doStatus() Error ($e)"
doLogin()
}
}
}
I was reading this post. But I'm not understanding how to change things, because whatever I try doesn't give an error, but the status doesn't update. So, obviously, I don't know what I'm doing.