core: Evohome fails to initialize: Invalid response from server: string indices must be integers, not 'str'

[EDIT by @zxdavb] This issue was caused by a temporary issue with the vendor’s webservers, and poor error reporting by this integration.

The problem

2024-12-05 12:02:16.881 WARNING (MainThread) [evohomeasync2] Response JSON may be invalid: POST https://tccna.honeywell.com/Auth/OAuth/Token: expected a dictionary
2024-12-05 12:02:16.881 ERROR (MainThread) [homeassistant.components.evohome.helpers] Failed to authenticate with the vendor's server. Check your username and password. NB: Some special password characters that work correctly via the website will not work via the web API. Message is: Invalid response from server: string indices must be integers, not 'str'
2024-12-05 12:02:16.883 ERROR (MainThread) [homeassistant.setup] Setup failed for 'evohome': Integration failed to initialize.

What version of Home Assistant Core has the issue?

2024.12

What was the last working version of Home Assistant Core?

2024.11.3

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

Honeywell Total Connect Comfort (Europe)

Link to integration documentation on our website

https://www.home-assistant.io/integrations/evohome/

Diagnostics information

2024-12-05 12:02:16.881 WARNING (MainThread) [evohomeasync2] Response JSON may be invalid: POST https://tccna.honeywell.com/Auth/OAuth/Token: expected a dictionary
2024-12-05 12:02:16.881 ERROR (MainThread) [homeassistant.components.evohome.helpers] Failed to authenticate with the vendor's server. Check your username and password. NB: Some special password characters that work correctly via the website will not work via the web API. Message is: Invalid response from server: string indices must be integers, not 'str'
2024-12-05 12:02:16.883 ERROR (MainThread) [homeassistant.setup] Setup failed for 'evohome': Integration failed to initialize.

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 3
  • Comments: 96 (9 by maintainers)

Most upvoted comments

My setup is a Pi running HA OS. That means HA itself runs as a docker container. If your HA doesn’t run in a container you can edit the files directly. The steps I did:

  • Open a terminal window (I use the Advanced SSH & Web Terminal add-on)
  • docker ps | grep homeassistant:2024 to find the homeassistant container ID
  • docker exec -it <homeassistant container ID> bash to open a shell inside the container
  • vi /usr/local/lib/python3.13/site-packages/evohomeasync2/const.py and change tccna.honeywell.com to tccna.resideo.com
  • Save and exit the editor
  • vi /usr/local/lib/python3.13/site-packages/evohomeasync/broker.py and change tccna.honeywell.com to tccna.resideo.com
  • Save and exit the editor
  • Note: instead of vi you can also nano.
  • Restart HA

I’m still on 2024.10.1 and have the same issue. I suspect this issue is related to a change to Honeywell’s API, not anything on HA side. Happened at ~ 10:20 UTC

I’m getting two issues on HA (the app works though but not the website). Might try changing the password but it looks like this isn’t the issue

Logger: homeassistant.components.evohome.helpers Source: components/evohome/helpers.py:73 integration: evohome (documentation, issues) First occurred: 12:09:52 (1 occurrences) Last logged: 12:09:52

Failed to authenticate with the vendor’s server. Check your username and password. NB: Some special password characters that work correctly via the website will not work via the web API. Message is: Cannot connect to host tccna.honeywell.com:443 ssl:True [SSLCertVerificationError: (1, “[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Hostname mismatch, certificate is not valid for ‘tccna.honeywell.com’. (_ssl.c:1020)”)]

Logger: homeassistant.setup Source: setup.py:269 First occurred: 12:09:52 (1 occurrences) Last logged: 12:09:52

Setup failed for ‘evohome’: Integration failed to initialize.

Thinking about it, I will not issue a enhancement/fix to v0.4.20 of evohomeasync2 at this stage.

Instead, we’ll look at getting v1.x.x merged into HA.

Do not close this issue - it will remind me to tweak the integration so to prove a better error message.

I didnt update, and have a non working evohome integration. I also cannot login to connect site with my credentials. Its definitely a Honeywell issue for now if you ask me.

I think the HA core 2024.12 update is just a coincidence of timing. I opened up the Evohome ‘TCC Home’ App on my phone and it too failed to login. I was able to log back in to the phone app but next time I open the Evohome phone app it fails again. So does look like an Evohome authentication issue/change at their side.

I rolled back to the previous version however the issue remains, I suspect the issue is with the Honeywell web service rather than the 2024.12 release.

Taking a quick look at the Honeywell API guide (online) I note the base URL address is different or changed. That said, both API URLs authenticate to my Postman requests with valid JSON so it’s unlikely the issue.

Previous URL

https://tccna.honeywell.com/WebAPI/

New URL

https://mytotalconnectcomfort.com/WebApi/

My guess is the Evohome API response has been modified which is causing issues with the integration.

Log extract

Response JSON may be invalid: POST https://tccna.honeywell.com/Auth/OAuth/Token: expected a dictionary

AFAIC this isn’t a HA Core issue at all…

The root cause is honeywell/resideo messing up their ssl certificates. This prevents the python package the evohome integration depends on to connect to the API server, because the API server address is hardcoded in there (see https://github.com/zxdavb/evohome-async/issues/32 as already mentioned a few times in this thread).

I know the code owner of said package maintains a good rapport with the honeywell/resideo tech people. Ideally Resideo fixes their ssl certs, but they might be doing some upgrades and throwing hostnames around as a result.

I you are comfortable exec’ing into running docker containers, you can try the fix described in https://github.com/zxdavb/evohome-async/issues/32. A step by step instruction is posted a few posts earlier in this thread: https://github.com/home-assistant/core/issues/132366#issuecomment-2539283798 (thanks, @leen67 !)

running 2024.12.2 I don’t see quote the same thing today but connection is failing with SSL issues now: 2024-12-12 09:18:48.849 ERROR (MainThread) [homeassistant.components.evohome.helpers] Failed to authenticate with the vendor's server. Check your username and password. NB: Some special password characters that work correctly via the website will not work via the web API. Message is: Cannot connect to host tccna.honeywell.com:443 ssl:True [SSLCertVerificationError: (1, "[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Hostname mismatch, certificate is not valid for 'tccna.honeywell.com'. (_ssl.c:1020)")] 2024-12-12 09:18:48.853 ERROR (MainThread) [homeassistant.setup] Setup failed for 'evohome': Integration failed to initialize.

Related?

There is a new, completely refactored version of the client library coming out that should not have the above deficiency:

async def _post_at_request(self, url: StrOrURL, /, **kwargs: Any) -> AuthTokenResponseT:
    try:
        async with self.websession.post(url, **kwargs) as rsp:
            rsp.raise_for_status()
            return await rsp.json()

    except (aiohttp.ContentTypeError, json.JSONDecodeError) as err:
        response = await rsp.text()
        raise AuthenticationFailedError(f"Server response is not JSON: POST {url}: {response}") from err

    except aiohttp.ClientResponseError as err:
        hint = _ERR_MSG_LOOKUP_AUTH.get(err.status) or str(err)
        raise AuthenticationFailedError(hint, status=err.status) from err

    except aiohttp.ClientError as err:
        raise AuthenticationFailedError(str(err)) from err

There is another Evohome maintenance scheduled for 17th February at 03:00 est https://status.resideo.com/

I am closing this issue (poor error reporting), as it is resolved by #135436.

December 24, 2024 from 9:13 CET, maintenance of the Evohome system at the supplier for approximately 2 hours. There will be issues with HA integration and the application. https://status.resideo.com/

@cathelijne Thanks for your input - the primary reason I want to keep this open is to remind me to address exactly what you allude to - evohome should have thrown a more useful error message!

Fix worked for me in Ireland. Midnight Commander for easy editing: apk add mc image image

I am not sure this PR is a duplicate of the hostname bug - please leave it open for now.

Thank you all. Fixed it!

My setup is a Pi running HA OS. That means HA itself runs as a docker container. If your HA doesn’t run in a container you can edit the files directly. The steps I did:

  • Open a terminal window (I use the Advanced SSH & Web Terminal add-on)
  • docker ps | grep homeassistant:2024 to find the homeassistant container ID
  • docker exec -it <homeassistant container ID> bash to open a shell inside the container
  • vi /usr/local/lib/python3.13/site-packages/evohomeasync2/const.py and change tccna.honeywell.com to tccna.resideo.com
  • Save and exit the editor
  • vi /usr/local/lib/python3.13/site-packages/evohomeasync/broker.py and change tccna.honeywell.com to tccna.resideo.com
  • Save and exit the editor
  • Note: instead of vi you can also nano.
  • Restart HA

My setup is a Pi running HA OS. That means HA itself runs as a docker container. If your HA doesn’t run in a container you can edit the files directly. The steps I did:

  • Open a terminal window (I use the Advanced SSH & Web Terminal add-on)
  • docker ps to find the homeassistant container ID
  • docker exec -it <homeassistant container ID> bash to open a shell inside the container
  • vi /usr/local/lib/python3.13/site-packages/evohomeasync2/const.py and change tccna.honeywell.com to tccna.resideo.com
  • vi /usr/local/lib/python3.13/site-packages/evohomeasync/broker.py and change tccna.honeywell.com to tccna.resideo.com
  • Restart HA

This worked perfectly and fixed the issue for me. Thank you!!!

just checked and my evo tcc app works

The website login does not work though. I think it is just a wating game for Honeywell to fix their SSL certificate.

This is the cause of the first logged line, WARNING ... Response JSON may be invalid: (indeed, it wasn’t):

try:  # the access token _should_ be valid...
    _ = SCH_OAUTH_TOKEN(content) 
except vol.Invalid as err:
    self._logger.warning(f"Response JSON may be invalid: POST {AUTH_URL}: {err}")

This is the second, ERROR ... Invalid response from server: string indices must be integers, not 'str':

try:
    self.access_token = content[SZ_ACCESS_TOKEN]  # type: ignore[assignment]
    self.access_token_expires = dt.now() + td(seconds=content[SZ_EXPIRES_IN] - 15)
    self.refresh_token = content[SZ_REFRESH_TOKEN]  # type: ignore[assignment]
except (KeyError, TypeError) as err:
    raise exc.AuthenticationFailed(f"Invalid response from server: {err}") from err

The base issue is the the response is a string, and is not JSON.

The solution is to check the response is JSON before the first of the two code blocks and throw an exception (with a useful message) if it is not.

Its working too!

Working here now too!

For me as well - back to normal after HA restart in 2014.12

I am on 2024.12.0 and it is working again indeed!

I’m still on HA core 2024.11.3. The Honeywell app started working for me again a few minutes ago, restarted HA and it is fine too. Looks like indeed the Honeywell servers had an issue for a while.

Yes, app working for me again too. I might risk a core upgrade again then… after you! 😃

I’m still on HA core 2024.11.3. The Honeywell app started working for me again a few minutes ago, restarted HA and it is fine too. Looks like indeed the Honeywell servers had an issue for a while.

Same issue with my phone app. I can log in but when I close the app and re-open it, it says it cannot retrieve the account information. I guess when I restored a backup on HA it caused the integration to log in again.

Your restore is probably using a cached (working) Evohome authentication. Looks like the HA core 2024.12 update reset these login credentials and revealed the Evohome issue when it tried to log back in. You are probably best staying on the restored HA until Evohome fix it… and in the interim not updating HA or restarting the Evohome integration so it stays authenticated.

Maybe when the Homeconnect phone app is working again it might be safe to upgrade HA??

I also just restored a backup and Evohome integration is back and working again. I will leave it all well alone for now! 😃

@cedricdelecole it’s added via YAML, probably in your configuration.yaml file