Skip to content

Instantly share code, notes, and snippets.

@sarabveer
Created June 25, 2021 20:53
Show Gist options
  • Save sarabveer/477cd446d51f24ea94abc076cf7caea5 to your computer and use it in GitHub Desktop.
Save sarabveer/477cd446d51f24ea94abc076cf7caea5 to your computer and use it in GitHub Desktop.
Fix Ecobee integration in HomeAssistant if getting "Unknown error occurred"

Fix Ecobee integration in HomeAssistant if getting Unknown error occurred


So, I accidentally deleted my Ecobee integration in HomeAssistant. I thought it was no big deal, I would just add it back normally as I have done many times. However, no matter what I did, I kept getting the error: Unknown error occurred.

These are the steps I used to get the Ecobee integration working again:

  1. First, use the yaml config for Ecobee. Put your API key obtained from ecobee.com in the secrets.yaml file, and then place the below config into configuration.yaml making sure the right name is used for the api key secret.
ecobee:
  api_key: !secret ecobee_api_key

logger:
  default: info
  logs:
    pyecobee: debug
    homeassistant.components.ecobee: debug

After adding this, restart HomeAssistant Core.

  1. After restarting, the Ecobee integration should come up in the Integrations page asking to be setup.

Use the Auth PIN given and enter it on the Ecobee site. After adding the Auth PIN to ecobee.com, press Submit then wait until the "Unknown error occurred" error comes up.

  1. Then check your log, it should contain something like this:
2021-06-25 16:01:58 DEBUG (SyncWorker_1) [pyecobee] Request response: 200: {'access_token': '<access-token>', 'token_type': 'Bearer', 'expires_in': 3600, 'scope': 'openid,smartWrite,offline_access', 'refresh_token': '<refresh-token>'}

2021-06-25 16:01:58 DEBUG (SyncWorker_1) [pyecobee] Obtained tokens from ecobee: access <access-token>, refresh <refresh-token>

Take note of the refresh token.

  1. Go to .storage/core.config_entires in the HomeAssistant config directory and add this to the json in the data > entries array:

For the entry_id, look at the other entries and make up some unique id. Put the Ecobee API Key where it says <ECOBEE API KEY> and put the refresh token from Step 3 where it says <ECOBEE REFRESH TOKEN FROM LOG>.

            {
                "entry_id": "<make up some ID to put here>",
                "version": 1,
                "domain": "ecobee",
                "title": "ecobee",
                "data": {
                    "api_key": "<ECOBEE API KEY>",
                    "refresh_token": "<ECOBEE REFRESH TOKEN FROM LOG>"
                },
                "options": {},
                "system_options": {
                    "disable_new_entities": false
                },
                "source": "user",
                "connection_class": "cloud_poll",
                "unique_id": null,
                "disabled_by": null
            },

Then restart HomeAssistant core.

  1. The Ecobee integration should come up after the restart with all your devces and entities.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment