c8 pro..upgraded to 2.5.1.242 broken husqvarna automower integration.. not sure if it is a change in http response or oauth but even with re-authorizing in the interface and getting info/new token the application fails to get a list of children.. not sure how to further debug what changed.
more info i tried the upgrade again with added debugging and there were no differnces in the url called.. it is an http get with a header with token and a null query..
i tried with the query removed thinking that was it.. same issue..
then i tried though maybe its not even calling the query if the query is null..
so i added garbage to the end of the token and i did get an unauthorized error so it is calling the end point..
i am out of ideas
here is the working log image
and the same call not working after upgrading again (part of the token commented out for security reasons)
more info please look into it but the httpget is broken.. when using json or text
it worked with those parameters with async mode but otherwise was broke.. i had to modify the code to get back the raw entity.. and then go on and parse it and then it worked fine..
ie
If resp.data is still returning null even with */*, it means Hubitat is silently failing to extract the raw text stream from the HTTP socket before it closes. [1]
When resp.data fails on a 200 OK, the reliable workaround in the Hubitat ecosystem is to consume the raw string buffer directly from the underlying network entity via resp.entity.content.
The Direct Network Buffer Extraction Fix
This approach completely bypasses Hubitat's data layer and extracts the response string directly from the HTTP data stream.
here is the changed code
and i will put the github link up in a few
if(myfrc || !skipIt) {
updTsVal("getAutoUpdDt")
Map deviceListParams=[
uri: getMowerApiEndpoint() +"/mowers",
headers: [
"Authorization": "Bearer ${(String)state.authToken}",
"Authorization-Provider": "husqvarna",
"X-Api-Key":getHusqvarnaApiKey()
],
query: null,
timeout: 30
]
if(debugLevel(4)){
msg+="http params -- ${deviceListParams} "
}
msg +="HTTPGET "
if(msg){
if(debugLevel(4)) log.debug "url header = $msgH, msg = $msg"
LOG(msgH + msg, 3, sTRACE)
msg=sBLANK
}
Boolean exitout
exitout=false
try {
httpGet(deviceListParams){ resp ->
LOG(msgH + "httpGet() ${resp.status} Response", 4, sTRACE)
Map adata
if(debugLevel(4)) log.debug "resp = $resp"
if (resp.entity != null && resp.entity.content != null) {
//if(resp){
rdata = resp.entity.content.text
// use raw method
//rdata=resp.data.text // need to save first time since it is a ByteArrayInputStream
if (rdata) adata=(Map)new JsonSlurper().parseText(rdata)
}
if(resp && resp.status == 200 && adata){
if(debugLevel(4)) log.debug "resp status = ${resp.status}"
if(debugLevel(4)) log.debug "rdata = $rdata"
if(debugLevel(4)) log.debug "adata = $adata"
List<Map> ndata=((List<Map>)adata.data)?.findAll{ it.type == "mower" }
@kahn-hubitat , the fix will revert the JSON detection behavior to its pre-2.5.1.142 state. You may want to add a fall back that handles both scenarios. Sorry about the trouble. This will go into beta first so we can confirm it doesn't break something else.
yes but if you want the long and lat. and battery level etc working better you need to get my version.. it was not updating those regularly from the websocket only the normal polling.