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
251 stars 9 forks source link

[Issue]: Cannot add integration in HA #108

Closed pplucky closed 6 months ago

pplucky commented 6 months ago

Version: 4.0.16

As per the documentation, I created a developer account with the same e-mail address as I used for the Onecta app. I got the clientID and clientSecret from the getting started page, and I noticed something there:

These credentials require the use of onectaintegration://callback/ as redirect URI in the authorization flow.

Not sure if this is the reason for not being able to add the integration in HA, but worth mentioning it.

When adding the integration in HA, after entering the clientID and clientSecret, I get the popup to open the website, but no matter how many times I try, I always get to a page like the following:

image

The link for the above page is something like https://id.daikin.eu/cdc/onecta/oidc/registration-login.html?error=true&mode=error&message=The%2Bredirect%2BURI%2Bin%2Bthe%2Brequest%3A%2Bhttps%3A%2F%2FHA_URLg%3AHA_PORT%2Fauth%2Fexternal%2Fcallback%2Bdid%2Bnot%2Bmatch%2Ba%2Bregistered%2Bredirect%2BURI.&code=invalid_request&skipConsent=false

The link generated by the integration and in which I clicked is something like https://idp.onecta.daikineurope.com/v1/oidc/authorize?response_type=code&client_id=MY_CLIENT_ID&redirect_uri=MY_HA_URL_PORT_AND_STATE&scope=openid+onecta:basic.integration&client_secret=MY_CLIENT_SECRET

According the documentation sentence above, shouldn't this link contained any reference to onectaintegration://callback/ ???

The 'Click here to find more' points to https://id.daikin.eu/info/en/faq/faq3.html#login-issues, but I already reported it twice to Daikin, without any result.

I tried different browsers, anonymous sessions, in different days, logged in before Daikin developer website (also not logged in), but nothing seems to work.

I also increased logger level to debug, but nothing appear on HA log while doing this...

What is even more odd is that I have currently version 4.0.11 of the custom integration working properly in a different HA server, being the only difference that I had the integration working before upgrading to version 4.x (maybe the authentication was established before and not needed anymore).

Not 100% sure the issue is in the integration or at Daikin/account side, but I would appreciate any ideas, as I'm currently out of any.

PapaErde commented 6 months ago

I think it´s an issue on Daikin´s Site. Here´s what i get, when i try to login in the dev area image

jwillemsen commented 6 months ago

See #45

jwillemsen commented 6 months ago

Currently https://my.home-assistant.io/redirect/oauth is supported, see https://www.home-assistant.io/integrations/home_connect/ for some other docu about using MyHomeAssistant

PapaErde commented 6 months ago

tnx @jwillemsen

jwillemsen commented 6 months ago

Keep me updated on the progress and when you got it working, let us know here

pplucky commented 6 months ago

Currently https://my.home-assistant.io/redirect/oauth is supported, see https://www.home-assistant.io/integrations/home_connect/ for some other docu about using MyHomeAssistant

Wouldn't it make sense to update documentation to mention this?

Keep me updated on the progress and when you got it working, let us know here

I will try this later tonight and get back to you.

jwillemsen commented 6 months ago

Added a note about MyHomeAssistant to readme

pplucky commented 6 months ago

Added a note about MyHomeAssistant to readme

As per your added note, as soon as I added my: to my configuration.yaml and restarted, I managed to add the integration perfectly. Thanks a lot for the precious tip and for adding it to the documentation.

One question I have, if I may, is that I have 3 AC units, 2 which have local control (via HA standard 'Daikin AC' integration) and a third one which is cloud only.

As soon as I added the 'Daikin Onecta' integration, 3 devices appeared and the ones which correspond to the 2 local-possible units, ALSO contain all the entities I add on the 'Daikin AC' integration.

image

If you notice, 'Daikin Onecta' and 'Daikin AC' integrations both appear under 'Device Info' and under 'Controls', the first 3 entities are for 'Daikin AC' and only the last one is for 'Daikin Onecta'. The same happens for all other entities below.

Aside from this "confusion", I'd like to be able to disable the 2 local-possible devices corresponding to the Daikin Onecta (to spare on API calls), but I could not do it, as only 1 integration entity exists and all devices are inside:

image

Let me know if you need any further info (diagnostics from the Device/integration) or if I may be missing something here.

jwillemsen commented 6 months ago

If you go to the device, you can press the three dots in the upper right corner you can disable a device in HA. FYI, the Daikin Onecta API provides all data from all devices as part of 1 call, disabling devices will not reduce the API usage.

pplucky commented 6 months ago

If you go to the device, you can press the three dots in the upper right corner you can disable a device in HA. FYI, the Daikin Onecta API provides all data from all devices as part of 1 call, disabling devices will not reduce the API usage.

Great tip, then I think I'll just manually disable the "repeated" entities and keep the cloud-only relevant entities which do not exist for the local API.

Not sure if it would make sense to add these details (your statement) and also the fact that the system will bundle 'Daikin Onecta' and 'Daikin AC' in the same device.