HomeAssistant-Mods / home-assistant-miele

Miele integration for Home assistant
142 stars 30 forks source link

Login via api.mcs3.miele.com failed #141

Closed Kottick1 closed 1 year ago

Kottick1 commented 1 year ago

My password and login did not work in the api login. In the Miele@home (miele.nl) login it works perfect.

ramondeklein commented 1 year ago

Did you have the proper client id/secret? You can test it by going to https://www.miele.com/developer/swagger-ui/swagger.html and click the green Authorize button. You should then add your client id+secret and then you are directed to the login page. If you're certain that your username and password are correct, then your client id/secret is incorrect.

Kottick1 commented 1 year ago

I do not think that my the secret or client id the problem is. I checkt my secret en client id on the Miele website and in my Miele app without any problem. I have changed my secret, no solution.

Kind regards Gosse

Op zo 27 nov. 2022 om 13:39 schreef Ramon de Klein @.***

Did you have the proper client id/secret? You can test it by going to https://www.miele.com/developer/swagger-ui/swagger.html and click the green Authorize button. You should then add your client id+secret and then you are directed to the login page. If you're certain that your username and password are correct, then your client id/secret is incorrect.

— Reply to this email directly, view it on GitHub https://github.com/HomeAssistant-Mods/home-assistant-miele/issues/141#issuecomment-1328238469, or unsubscribe https://github.com/notifications/unsubscribe-auth/A4IU5USRJXBOST5C4LZBF7LWKNJB5ANCNFSM6AAAAAASKYBG74 . You are receiving this because you authored the thread.Message ID: @.***>

-- Groet, Gosse

It's not the lofty sails but the unseen wind that moves the ship

Miliamber commented 1 year ago

Same issue here, unsure on which side the issue is.

rvk commented 1 year ago

Same issue here also with Finnish account.

stephenmetts commented 1 year ago

I also have the same issue, these are the log details when I set the component to debug. Using the swagger, I was able to authenticate without an issue.

2022-12-12 09:00:49.701 DEBUG (MainThread) [custom_components.miele.miele_at_home] Requesting Miele device update 2022-12-12 09:01:02.977 INFO (MainThread) [custom_components.miele.miele_at_home] Request unauthorized - attempting token refresh

Edit: I'm on Home Assistant 2022.10.5

pertakman commented 1 year ago

I started having problems a couple of days ago. No change after upgrade to 2022.12.1 and later 2022.12.3. I've tested the client id and secret on https://www.miele.com/developer/swagger-ui/swagger.html and it says authorized.

The log shows the following error messages:

`This error originated from a custom integration.

Logger: homeassistant.setup Source: custom_components/miele/miele_at_home.py:174 Integration: miele (documentation, issues) First occurred: 20:48:19 (1 occurrences) Last logged: 20:48:19

Error during setup of component miele Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 253, in _async_setup_component result = await task File "/config/custom_components/miele/init.py", line 152, in async_setup data_get_devices = await client.get_devices(lang) File "/config/custom_components/miele/miele_at_home.py", line 48, in get_devices home_devices = await self._get_devices_raw(lang) File "/config/custom_components/miele/miele_at_home.py", line 32, in _get_devices_raw if await self._session.refresh_token(self.hass): File "/config/custom_components/miele/miele_at_home.py", line 165, in refresh_token self._token = await hass.async_add_executor_job( File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, self.kwargs) File "/config/custom_components/miele/miele_at_home.py", line 174, in sync_refresh_token return self._session.refresh_token( File "/usr/local/lib/python3.10/site-packages/requests_oauthlib/oauth2_session.py", line 452, in refresh_token self.token = self._client.parse_request_body_response(r.text, scope=self.scope) File "/usr/local/lib/python3.10/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 427, in parse_request_body_response self.token = parse_token_response(body, scope=scope) File "/usr/local/lib/python3.10/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 441, in parse_token_response validate_token_parameters(params) File "/usr/local/lib/python3.10/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 448, in validate_token_parameters raise_from_error(params.get('error'), params) File "/usr/local/lib/python3.10/site-packages/oauthlib/oauth2/rfc6749/errors.py", line 399, in raise_from_error raise cls(kwargs) oauthlib.oauth2.rfc6749.errors.InvalidGrantError: (invalid_grant) ` Any help would be appreciated. :-)

Tmunix82 commented 1 year ago

Hi all, I've been having the same problem for a few weeks. From June to mid-November everything worked properly, but for a month now it has been impossible to connect the home assistant to the Miele appliances.

I tried deleting and reinstalling the integration, currently I have version b.0.9.4.1 because all the others don't work.

Error during setup of component miele Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 253, in _async_setup_component result = await task File "/config/custom_components/miele/init.py", line 419, in async_setup data_get_devices = await client.get_devices(lang) File "/config/custom_components/miele/miele_at_home.py", line 48, in get_devices home_devices = await self._get_devices_raw(lang) File "/config/custom_components/miele/miele_at_home.py", line 32, in _get_devices_raw if await self._session.refresh_token(self.hass): File "/config/custom_components/miele/miele_at_home.py", line 165, in refresh_token self._token = await hass.async_add_executor_job( File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, self.kwargs) File "/config/custom_components/miele/miele_at_home.py", line 174, in sync_refresh_token return self._session.refresh_token( File "/usr/local/lib/python3.10/site-packages/requests_oauthlib/oauth2_session.py", line 452, in refresh_token self.token = self._client.parse_request_body_response(r.text, scope=self.scope) File "/usr/local/lib/python3.10/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 427, in parse_request_body_response self.token = parse_token_response(body, scope=scope) File "/usr/local/lib/python3.10/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 441, in parse_token_response validate_token_parameters(params) File "/usr/local/lib/python3.10/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 448, in validate_token_parameters raise_from_error(params.get('error'), params) File "/usr/local/lib/python3.10/site-packages/oauthlib/oauth2/rfc6749/errors.py", line 399, in raise_from_error raise cls(kwargs) oauthlib.oauth2.rfc6749.errors.InvalidGrantError: (invalid_grant)

I would be very grateful for your help because Miele integration is really very useful. Thank you

pertakman commented 1 year ago

The problem persist on my installation. Anybody else that have found a solution?

Cheers, Per

Tmunix82 commented 1 year ago

I finally fixed it and everything works. Delete the ".miele-token-cache" file from the ".storage" directory, restart HA and reconfigure the Miele integration.

Launch the "Terminal & SSH" add-on type: rm -rf ./config/.storage/.miele-token-cache reboot Reconfigure the integration and Miele works again

pertakman commented 1 year ago

I finally fixed it and everything works. Delete the ".miele-token-cache" file from the ".storage" directory, restart HA and reconfigure the Miele integration.

Launch the "Terminal & SSH" add-on type: rm -rf ./config/.storage/.miele-token-cache reboot Reconfigure the integration and Miele works again

Worked for me as well! Thank you for sharing...

stephenmetts commented 1 year ago

Ugh, stupid hidden files. Great catch. I tried your setups but the debug logs still said it failed to receive a response. Since I was impatient (and prudently took a backup of the cached file), I went to the API swagger and used the token handling there to generate a new token, and then manually recreated the .miele-cache-token file. Below is the structure if anyone else needs it.

{"access_token": "<token here>", "refresh_token": "<token here>", "token_type": "Bearer", "expires_in": 2592000, "expires_at": 1672814458.7366238}

While this is a workaround, maybe we keep this open until a more graceful code solution is found to manage this issue? I'm guessing it'll happen again when this token expires...

eikowagenknecht commented 1 year ago

Launch the "Terminal & SSH" add-on type: rm -rf ./config/.storage/.miele-token-cache reboot Reconfigure the integration and Miele works again

How do you reconfigure the integration? Remove everything from yaml, restart, put it in again, restart? Removing the file and restarting alone did not fix anything for me.

jaegerflo commented 1 year ago

doesn't work for me. Delete file / restart Integration completely deleted / restart in the yaml remove / restart everything reinstalled Unfortunately without success. tested with different miele accounts and client ids.

btw: the integration worked for months. since last week don't suffer anymore

stephenmetts commented 1 year ago

I think Miele must somehow be disabling accounts, maybe based upon usage? The reasoning is I 'registered' on their API site again, deleted the .miele-token-cache, restarted hass, and then reconfigured plugin; and now it's working again...for now.

We'll have to see if this continues to function properly.

kloknibor commented 1 year ago

I have added a new piece of code that in case there are problems with the token it will just delete it and ask you to re-authenticate with miele to try to solve the issue. Are you still experiencing this? Do you still need to manually remove the token?

myhomeiot commented 1 year ago

I have added a new piece of code that in case there are problems with the token it will just delete it and ask you to re-authenticate with miele to try to solve the issue. Are you still experiencing this? Do you still need to manually remove the token?

The code prior release v0.9.4 works much better for me. From now I should re-authenticate integration after few HA restarts.

bobskee commented 1 year ago

The code prior release v0.9.4 works much better for me. From now I should re-authenticate integration after few HA restarts.

+1

broberg commented 1 year ago

So after going through the client secret again, being able to authorize in the swagger, I went through and deleted the token and all. And still nothing. However I just noticed, that I had a mew entity: "configurator.miele_home" and upon opening that I was able to go through the pairing flow again! After this, the entity becam unavailable, and my devices showed up!

eikowagenknecht commented 1 year ago

Worked for me as well:

  1. Delete token file
  2. Restart Home Assistant
  3. Reauthorize with the configurator.miele_home entity
kloknibor commented 1 year ago

I have added a new piece of code that in case there are problems with the token it will just delete it and ask you to re-authenticate with miele to try to solve the issue. Are you still experiencing this? Do you still need to manually remove the token?

The code prior release v0.9.4 works much better for me. From now I should re-authenticate integration after few HA restarts.

Hmm I will look into this

myhomeiot commented 1 year ago

The code prior release v0.9.4 works much better for me. From now I should re-authenticate integration after few HA restarts.

Hmm I will look into this

Release v0.9.7 working well for me. Thanks!