jwillemsen / daikin_onecta

Home Assistant Integration for devices supported by the Daikin Onecta App
https://github.com/jwillemsen/daikin_onecta
GNU General Public License v3.0
263 stars 9 forks source link

authorization failed #236

Closed bugac closed 3 months ago

bugac commented 3 months ago

just an hour ago everything was alright, and just now got rejected, and authorization failed.

image

bugac commented 3 months ago

cant be exceede limits, because just hour ago was ~180 tics left. iphone app works fine.

EDIT: old daikin residential API works fine

panic1 commented 3 months ago

I'm seeing the same thing this morning.

martymcfly1 commented 3 months ago

I have the same issue as well

Baker0052 commented 3 months ago

Same here

TopoDiFogna commented 3 months ago

Same Here.

I also tried to reconfigure everything and the issue is still there; i also tried via Postman both with auto oauth2 and performing manual requests to obtain the token.

Seems that is an issue on the server side

vogtmh commented 3 months ago

I had the same just today, before it worked flawlessly within the limits. I only increased the polling one time and got blocked for a while, no issues anymore since then.

liquidfusionv commented 3 months ago

Same issue here

lollozzo commented 3 months ago

https://developer.cloud.daikineurope.com/docs/b0dffcaa-7b51-428a-bdff-a7c8a64195c0/getting_started

API Credentials To access the ONECTA Cloud API and ensure secure authorization, you'll need to create an application.

new way to get auth?

vogtmh commented 3 months ago

I already have the application set up for a while.

YvoTuk commented 3 months ago

Same here, worked fine this morning, just throwing authentication errors at the moment.

Tried logging in to the Daikin development portal, but it doesn't let me in there either. May be some sort of issue on their side? Phone app is working just fine

vogtmh commented 3 months ago

I'm able to log into the developer portal. Secret for the app is there, not expired, everything looks fine. Their status page shows "operational" for all services.

Moditril commented 3 months ago

Logging in into the developer portal works fine for me. I also created a new app with a new name and followed the instructions again, but the issue remains as described above....

lollozzo commented 3 months ago

same here, login is working, app created but yes, it's a server side issue i guess.

vogtmh commented 3 months ago

Logging in into the developer portal works fine for me. I also created a new app with a new name and followed the instructions again, but the issue remains as described above....

Thanks for trying it out so we don't have to. I remember it was a pain to setup, because all the old devices get removed and you have to re-add them again, add them to the energy dashboard, automations.. quite annoying. There should be an easy option to just update the credentials inside HA to test those things.

jwillemsen commented 3 months ago

At the moment the credentials are out of data in HA there should be an option to re-authorize the integration (at least all code for that is there) but haven't had that use case myself

jwillemsen commented 3 months ago

@Daikin-Europe Anything on your side?

Schm1tz1 commented 3 months ago

Same issue here with HA, ONECTA App is working. At least the status page does not show any issues but might be an issue Daikin is not aware of yet: https://daikincloudsolutions.statuspage.io/

rgerhards commented 3 months ago

I had the temp credentials in place, system seems to have stopped. So I did

Unfortunately, the integration still does not load and shows an authentication error:

2024-06-28 10:40:29.682 ERROR (MainThread) [custom_components.daikin_onecta.daikin_api] REQUEST TYPE GET FAILED: 401 {
  "message":"Unauthorized",
  "request_id":"817db656ee31721337b0c3611a33e846"
}
2024-06-28 10:40:29.682 ERROR (MainThread) [custom_components.daikin_onecta.coordinator] Unexpected error fetching daikin_onecta data
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 312, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/daikin_onecta/coordinator.py", line 52, in _async_update_data
    daikin_api.json_data = await daikin_api.getCloudDeviceDetails()
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/daikin_onecta/daikin_api.py", line 151, in getCloudDeviceDetails
    return await self.doBearerRequest("GET", "/v1/gateway-devices")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/daikin_onecta/daikin_api.py", line 147, in doBearerRequest
    raise Exception("Communication failed! Status: " + str(res.status_code) + " " + res.text)
Exception: Communication failed! Status: 401 {
  "message":"Unauthorized",
  "request_id":"817db656ee31721337b0c3611a33e846"
}
2024-06-28 10:40:29.682 DEBUG (MainThread) [custom_components.daikin_onecta.coordinator] Finished fetching daikin_onecta data in 0.134 seconds (success: False)

Any idea if I did something wrong - or is it just that Daikin didn't mange to provide a smooth transition. Anything I can do to resolve the situation? I would prefer not to remove and re-install the integration as that probably means I need to update all my automations.

jwillemsen commented 3 months ago

It looks Daikin has an issue, I am using the new credentials already some time, and also my setup doesn't work. I have send them an email to make them aware of this, hopefully some feedback soon

lollozzo commented 3 months ago

me too, sent a ticket to helpdesk linking this thread.

george-oniceag commented 3 months ago

Had the same problem this morning. Connected to https://developer.cloud.daikineurope.com/application and noticed that the application was no longer present. Created a new application and updated the credentials in HA and the integration now works ok.

panic1 commented 3 months ago

The app was not gone in my case. I tried re-creating the application, and it still didn't work. With your confirmation it worked for you I pressed refresh and it works now too for me!

josoost commented 3 months ago

I have back my devices

On HA i removed Daikin Onecta and application credentials. Restart of HA In HACS re-installed Daikin Onecta latest version On Daikin removed de app en added new app for new id and secret. In HA installed Daikin Onecta with the new credentials For now all works as expected

Sverto commented 3 months ago

Seems the Daikin service has been restored. The integration is back functional without changing anything.

vogtmh commented 3 months ago

I can confirm it's back to normal (without changing anything).

jwillemsen commented 3 months ago

Yes, just got an email from Daikin that the issue has been fixed

rgerhards commented 3 months ago

Unfortunately, I received this with the new token:

2024-06-28 11:31:30.866 DEBUG (MainThread) [custom_components.daikin_onecta.daikin_api] Initialing Daikin Onecta API...
2024-06-28 11:31:30.866 INFO (MainThread) [custom_components.daikin_onecta.daikin_api] Daikin Onecta API initialized.
2024-06-28 11:31:31.144 ERROR (MainThread) [homeassistant.helpers.config_entry_oauth2_flow] Token request for daikin_onecta_emu20gdjdiiuxi_hnfgz69dd failed (invalid_grant): unknown error
2024-06-28 11:31:31.145 WARNING (MainThread) [homeassistant.config_entries] Config entry 'rger-hassio' for daikin_onecta integration could not authenticate: Problem refreshing token: 400, message='Bad Request', url=URL('https://idp.onecta.daikineurope.com/v1/oidc/token')
liquidfusionv commented 3 months ago

Good work team!

rgerhards commented 3 months ago

I wonder if the method I used (edit application_credentials and full restart) is insufficient and I need to do a full remove and install of the integration (this is painful as I have quite some automations). Any word on that would be highly appreciated.

jwillemsen commented 3 months ago

Not sure, I would try to edit the credentials first, not sure whether that works, maybe something to ask in a HA forum

rgerhards commented 3 months ago

It looks like some Daikin/Integration related stuff. I just noticed I have a "repair" message under intergrations. It tells me the authentication expired and forces me to connect to a web site.

image

However, that web site does not work. It also seems to try connect to a callback. From the message it looks like it does not work, because I have no redirect registered with the credentials. Are there any suggestions what to place there? My HA is intentionally on the local LAN only without possibility to connect to it from the Internet. Does the integration support this mode or do I necessarily need to expose HA to the Internet (which makes Daikin actually unusable @daikin-europe).

Sorry for persisting with questions but I need to see if I can still get this to work with HA. What a shame there is no local IF, all this wasted time...

jwillemsen commented 3 months ago

You don't need anything exposed to the internet, the redirect is local, try first the default redirect URI as mentioned in the readme, that works in 99% of the cases, there is a core component MyHomeAssistant which handles this

rgerhards commented 3 months ago

OK, I had to remove the existing integration and install it anew. There seems to be no way to change the application credentials, which would mean that everyone who installed it with the initial credentials needs to redo all work. Nice move, Daikin @daikin-europe.

I'll try to use as many external shelly sensors as possible in Front of Daikin units or try to find a good service provide who does not force customers to try half a day to keep their cloud solution somewhat working.

bugac commented 3 months ago

rate limit reseted, and new API just starts working fine again, like nothing happened 🤔

jwillemsen commented 3 months ago

I reported an issue to HA to ask for the feature to change client id/secret, see https://github.com/home-assistant/core/issues/117170

vogtmh commented 3 months ago

OK, I had to remove the existing integration and install it anew. There seems to be no way to change the application credentials, which would mean that everyone who installed it with the initial credentials needs to redo all work. Nice move, Daikin @Daikin-Europe.

I'll try to use as many external shelly sensors as possible in Front of Daikin units or try to find a good service provide who does not force customers to try half a day to keep their cloud solution somewhat working.

I had the same issue. Had to do a full reinstall just to change the credentials. Certainly not an ideal situation.