[RELEASE] Echo Speaks V4

That's not the case for me. I opted in to the Alexa+ beta several weeks ago. ES is still working fine on all devices. There must be something else at play here.

I never send any speech commands to individual devices though, only to groups (set up in ES). Maybe that's relevant, maybe not.

I do both every day and have not had any problems.

Look here:

Mine has not got a new cookie in 320+ days... it works fine, when It quits I will run my server and refresh it. I don't even run the server anymore, it is in a wsl ready to go though

Judging by reports from others here over the last few weeks, you probably shouldn’t assume you’ll be able to refresh your cookie if it expires.

Not much anyone can do about it, but it’s something to be aware of.

2 Likes

For now the cookie refreshes seem to still be working. Mine auto refreshes every 5 days. That being said, how long this will remain working is anyone's guess.

Interesting. Mine hasn’t refreshed in a few weeks, it used to have no issue refreshing every five days.

I’m sure it’s possible that something is up with the docker container on my end, I haven’t bothered to look into it yet.

1 Like

My only known issue is with the Auth Status:

image

Here’s mine:

Like others are seeing, cookie is still good, but no longer refreshing every five days.

:man_shrugging:

1 Like

Same here still refreshing every 5 days. Individual and group messaging working on all devices. Not on Alexa+ though.

1 Like

Yes, my ES is set to refresh automatically every 5 days, which it has not. But all still seems to be working for now. :face_with_peeking_eye:

1 Like

UPDATED WITH NEW URL and functions:

Not in the position to say everything that needs updated here (the node.js code is really old), but one of the problems is in the ""/api/bootstrap" api no longer returns as a valid check.

Replace both validateCookie && validateCookieResp functions in the Echo Speaks application code starting at line 2143.

I deleted the cookie and reauthorized from scratch and showing greens and my echo's are talking again. I am US region so not sure if this solves everything...but helped so far.

Boolean validateCookie(Boolean frc=false) {
    Boolean valid; valid = (Boolean)state.authValid
    Integer lastChk = getLastTsValSecs("lastCookieChkDt", 3600)
    Integer lastSpoke = getLastTsValSecs("lastSpokeToAmazon", 3600)
    Boolean cookieOk = getCookieVal() && getCsrfVal()
    if(!frc && valid && lastChk <= 1800 && cookieOk) { return valid }
    if(!frc && valid && lastSpoke <= 1800 && lastChk < 3600 && cookieOk) { return valid }
    if(frc && valid && lastChk <= 60 && cookieOk) { return valid }

    valid = false
    String meth='validateCookie'
    if(!cookieOk) {
        authValidationEvent(valid, meth)
        return valid
    }
    try {
        Long execDt = wnow()
        Map params = [
            uri: getAmazonUrl(),
            path: "/api/customer-status",
            query: ["version": iZ],
            headers: getReqHeaderMap(true),
            contentType: sAPPJSON,
            timeout: 20,
        ]
        logTrace(meth)
        if(!frc) { execAsyncCmd("get", "validateCookieResp", params, [dt:execDt]) }
        else {
            httpGet(params) { resp->
                valid = validateCookieResp(resp, [dt:execDt])
            }
        }
    } catch(ex) {
        respExceptionHandler(ex, "validateCookie", true)
        incrementCntByKey("err_app_cookieValidCnt")
    }
    return valid
}

Boolean validateCookieResp(resp, data){
    try {
        String meth = 'validateCookieResp'
        if(resp?.status != 200) { logWarn("${resp?.status} $meth"); return false }
        else {
            logDebug "$meth ${resp?.data}"
            updTsVal("lastSpokeToAmazon")
            authValidationEvent(true, meth)
            updTsVal("lastCookieChkDt")
            logDebug("Cookie Validation: (true) | Process Time: (${(wnow()-(Long)data.dt)}ms)")
            return true
        }
    } catch(ex) {
        respExceptionHandler(ex, "validateCookieResp", true)
        incrementCntByKey("err_app_cookieValidCnt")
    }
    return false
}

This is better:

8 Likes

Nice!!

Thanks for figuring that out.

its still broken in the server ie docker images.. api/bootstrap can be fixed to return a vailid result but it looks like the apis all need to be updated..

as to this fix it is a step in the right direction.. thanks

At least for this api, the server doesn’t have anything to really do or knowledge of. I would expect the docker to follow the node.js code.

My guess you are seeing something different than this api call.

When I was working up all my guides I looked into updating the cookie server. The back end that talks to Amazon is forked from some other project but modified quite a bit. I do know the other project was still being updated so I wanted to try and update that module, but there was too much modifications to make it easy and I gave up. Point being, if anyone wants to chase down that other project again it may still be getting updates and allow the server to be updated.

My reason for wanting to update it was I was hoping i would help people having auth issues with various forms of 2FA that seemed to be casing issues at the time.

I had a working version using the newer alexa-cookie2 node module. It had the same problem with the Groovy code asking for /api/bootstrap and didn’t solve anything else. The proxy was defaulting to German, which I never did find a solution for, so I shelved it and fixed the bootstrap call. That is something to revisit another day since it should support 2FA.

It works for some of the 2FA, the TOPT works which is what my account has on it. But when people were having login issues they always were using some other type of 2FA so I was suspecting maybe the old API did not support it. Had a few people switch or disable the 2FA which got it to work. It was just a hunch at best.

1 Like

@tonesto7 I'm sure you already know, but the app is not really working so well these days. Yes, it continues to work for those that already have it running, but new setups are failing. I don't mean to be a pest, and I'm sure others are just as curious as I am. Is there any chance you might have an opportunity to attempt to sort things out with the app? It's 100% understandable if you are not willing to do so. The app has had a decent run and perhaps with the changes Amazon is making, it might be time to move on. Either way, thanks for your work on ES and for your consideration.

5 Likes

FWIW: I just did a fresh install on a windows 11 system in WSL using the latest github image. I followed the Not In Docker instructions JTP put out a couple years ago, got it going on the server (wsl) in about 5 minutes. Setup after that was just the standard from echo speaks in hubitat. My only hurdle was getting the network stuff setup so it could be seen and give back the right IP etc. gemini 3 figured that out in a few minutes. Seems to be fully working, announcements working, got a good cookie etc.

4 Likes