Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR (MainThread) [homeassistant.setup] Error during setup of component miele #4

Closed
JamieP83 opened this issue Jul 7, 2020 · 10 comments

Comments

@JamieP83
Copy link

JamieP83 commented Jul 7, 2020

Home Assistant 0.112.3

arch armv7l
chassis embedded
dev false
docker true
docker_version 19.03.8
hassio true
host_os HassOS 4.11
installation_type Home Assistant OS
os_name Linux
os_version 4.19.127-v7l
python_version 3.7.7
supervisor 228
timezone Europe/London
version 0.112.3
virtualenv false
Log Details (ERROR)
Logger: homeassistant.setup
Source: custom_components/miele/miele_at_home.py:24
First occurred: 12:46:00 (1 occurrences)
Last logged: 12:46:00

Error during setup of component miele
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/requests_oauthlib/oauth2_session.py", line 478, in request
    url, http_method=method, body=data, headers=headers
  File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 198, in add_token
    raise TokenExpiredError()
oauthlib.oauth2.rfc6749.errors.TokenExpiredError: (token_expired) 

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 193, in _async_setup_component
    result = await asyncio.wait_for(task, SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/config/custom_components/miele/__init__.py", line 127, in async_setup
    data_get_devices = await client.get_devices(lang)
  File "/config/custom_components/miele/miele_at_home.py", line 41, in get_devices
    home_devices = await self._get_devices_raw(lang)
  File "/config/custom_components/miele/miele_at_home.py", line 24, in _get_devices_raw
    devices = await self.hass.async_add_executor_job(func)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 543, in get
    return self.request('GET', url, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests_oauthlib/oauth2_session.py", line 497, in request
    self.auto_refresh_url, auth=auth, **kwargs
  File "/usr/local/lib/python3.7/site-packages/requests_oauthlib/oauth2_session.py", line 446, in refresh_token
    self.token = self._client.parse_request_body_response(r.text, scope=self.scope)
  File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 421, in parse_request_body_response
    self.token = parse_token_response(body, scope=scope)
  File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 431, in parse_token_response
    validate_token_parameters(params)
  File "/usr/local/lib/python3.7/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 441, in validate_token_parameters
    raise MissingTokenError(description="Missing access token parameter.")
oauthlib.oauth2.rfc6749.errors.MissingTokenError: (missing_token) Missing access token parameter.
Home Assistant has started!

@vistalba
Copy link

Same for me. I recreated new client_id and client_scret and deleted .miele-token-cache file. After a restart I was able to relink my account to client-secret. New .miele-token-cache file was generated but it still doesn't work for me.

Now the error looks like this:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 193, in _async_setup_component
    result = await asyncio.wait_for(task, SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/config/custom_components/miele/__init__.py", line 127, in async_setup
    data_get_devices = await client.get_devices(lang)
  File "/config/custom_components/miele/miele_at_home.py", line 46, in get_devices
    for home_device in home_devices:
TypeError: 'coroutine' object is not iterable

I also opend that issue there: docbobo#23
But I now switched to this repo as this is now working with HACS too.

@Filhgd
Copy link

Filhgd commented Aug 21, 2020

Can't find .miele-token-cache in my configuration. Also not working anymore.

Working with Home Assistant 0.114.3 and HACS integration

2020-08-21 13:16:24 ERROR (MainThread) [homeassistant.setup] Error during setup of component miele File "/config/custom_components/miele/__init__.py", line 127, in async_setup File "/config/custom_components/miele/miele_at_home.py", line 41, in get_devices File "/config/custom_components/miele/miele_at_home.py", line 24, in _get_devices_raw

@shortibln
Copy link

Try to check if the account works in the Miele@Mobile App on your smartphone .
After accepting the changed terms within the app delete the .miele-token-cache file . If you did not change the default path it should be in your config folder. After a restart of HA you should be able to link your account again.

At least this worked for me ....

@vistalba
Copy link

Yes I‘m using the App. There is no new terms to accept.

@simonlenton
Copy link

It appears that this component doesn't work with !secrets (which I saw you mention in your linked issue on the docbobo repo). I spotted this after configuring the miele integration after reboot and the browser URL contained &client_id=!secret miele_client_id. Once I switched from using !secret to directly using the client_id and client_secret, it worked fine and the URL contained the actual client_id.

@vistalba
Copy link

vistalba commented Sep 9, 2020

@simonlenton Are you sure this is the issue? As I tried to use it direct in configuration.yaml and it wasn't working.
I then deleted token file, restarted homeassistant and did everything from scratch. After this it was working again.
At this time, my client_id and client_secret were on configuration.yaml and I've moved them to secrets.yaml again after it was working. Now it is working again. So maybe it does not work with secrets.yaml if the token is expired and have to be renewed or if we install it from scratch.

May this is a easy thing that could be fixed?

@simonlenton
Copy link

@vistalba I think that the component uses client_id and client_secret only once; when it's first started to create the .miele-token-cache. So, I'd say that the behaviour you're seeing reflects that...

  1. You start fresh; no .miele-token-cache is present.
  2. You add the plaintext version of client_id and client_secret to the miele configuration.
  3. You restart HA and set up the Miele integration (being redirected to the Miele website to authenticate)
    .miele-token-cache is now present.
  4. You change the miele configuration and switch from plaintext to !secret
    Because .miele-token-cache is present, the !secret versions of client_id and client_secret aren't used.

I suspect that after this point, if you delete .miele-token-cache and restart (leaving the !secret versions of client_id and client_secret in your miele configuration) it'll break and you won't be able to auth with the miele site (Step 3).

@vistalba
Copy link

I suspect that after this point, if you delete .miele-token-cache and restart (leaving the !secret versions of client_id and client_secret in your miele configuration) it'll break and you won't be able to auth with the miele site (Step 3).

Probably my token was expired after a long period it was working without problem and I moved client_id and client_secret to secrets.yaml file. So the component wasn't able to refecht a new token. Just guessing. But that would explain it.

How difficult is it to get !secret working?

@kloknibor
Copy link
Collaborator

It appears that this component doesn't work with !secrets (which I saw you mention in your linked issue on the docbobo repo). I spotted this after configuring the miele integration after reboot and the browser URL contained &client_id=!secret miele_client_id. Once I switched from using !secret to directly using the client_id and client_secret, it worked fine and the URL contained the actual client_id.

For me !secret seems to work without any problem. You still have this issue?

@kloknibor
Copy link
Collaborator

Because of a recent change in the structure of the git repo this repo has been renamed and will be no longer active. When you still require support with your question/issue please open a new issue at : https://github.com/HomeAssistant-Mods/home-assistant-miele

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants