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
275 stars 8 forks source link

[Issue]: New Daikin Integration not working -> Last step (after clientID & Secret) does not work #139

Closed SolarEdgeUser closed 7 months ago

SolarEdgeUser commented 7 months ago

Just found out about the new integration for Daikin devices. I have a heatpump. I installed the integration using HACS. I then tried to configure that integration.

It asks for a clientID & Secret. According to the website from Daikin, that does not work yet, so I am using the one that is provided by daikin for as long you can not create your own. I believe I have created a developer account. I used the same email adress as I used for the Onecta app on my phone.

After giving the clientID & Secret, I am then directed to a daikin website, where I have to approve that data is being sent. I have approved. It loads a new screen asking me:

"Link account to Home Assistant? Linking your account will grant your Home Assistant instance access to your account. All credentials are stored locally."

The second I click the button 'Link Account', it fails, telling me:

_Deze pagina werkt niet homeassistant.local heeft geen gegevens verzonden. ERR_EMPTYRESPONSE

I do not know why this is happening, nor do I know how to fix it. Any help would be appreciated. Currently, I am on 4.0.21 for the Daikin Onecta integration, and I have installed that integration on HA 2024.1.3.

jwillemsen commented 7 months ago

Probably this is a problem with MyHomeAssistant and the fact that the redirect uri can't be set, see the readme and https://www.home-assistant.io/integrations/home_connect/ for some info about MyHomeAssistant, and https://github.com/jwillemsen/daikin_onecta/issues/45

SolarEdgeUser commented 7 months ago

Probably this is a problem with MyHomeAssistant and the fact that the redirect uri can't be set, see the readme and https://www.home-assistant.io/integrations/home_connect/ for some info about MyHomeAssistant, and #45

I have already read those. I'm starting to think I'm not too bright, because I still do not understand how this is connected to one another. I have home connect because my dryer is 'smart' and uses Home Connect since it is a Bosch dryer. However, I fail to understand how that is relevant for a Daikin heatpump?

jwillemsen commented 7 months ago

HomeConnect uses the same oauth2 authorization infrastructure from HA so the suggestions people give how they got HomeConnect to work could also help Daikin users.

Very likely you have configured HomeConnect with a custom redirect uri (you mention homeassistant.local which is custom, currently only https://my.home-assistant.io/redirect/oauth works with Daikin as redirect uri

SolarEdgeUser commented 7 months ago

HomeConnect uses the same oauth2 authorization infrastructure from HA so the suggestions people give how they got HomeConnect to work could also help Daikin users.

Very likely you have configured HomeConnect with a custom redirect uri (you mention homeassistant.local which is custom, currently only https://my.home-assistant.io/redirect/oauth works with Daikin as redirect uri

I do not know if I configured homeConect with a custom redirect uri. I don't even know what that is (see...not too bright..) but if I did, how do I get rid of it? Dryer is nice and all, but I value the data from my heatpump way more than the data from my dryer, so how do I fix this?

jwillemsen commented 7 months ago

I think you should check your configuration.yaml, see https://github.com/jwillemsen/daikin_onecta/issues/45#issuecomment-1954974569

SolarEdgeUser commented 7 months ago

I think you should check your configuration.yaml, see #45 (comment)

That looks like I should add 'my:' to my configuration.yaml?

jwillemsen commented 7 months ago

Yes, that will enable MyHomeAssistant and set the redirect uri, that hopefully should do the trick

SolarEdgeUser commented 7 months ago

Yes, that will enable MyHomeAssistant and set the redirect uri, that hopefully should do the trick

Allright, does it matter at all where in the configuration.yaml I place this 'my:' ? That .yaml is 29 lines long (including white lines), but in that file, I have also configured my duckduckdns in order to reach HA from outside.

Will this action break that? Because I don't want to lose access to HA from outside my home. If that will be the case, I will switch over to Nabu Casa, but that is a separate issue I guess.

So 1. where do I add this 'my:' and 1a, will it break my 'outside-access' to my HA?

(I do realize these a probably stupid questions but even though I have been using HA for quite a while, I'm not comfortable changing stuff in the configuration out of fear of breaking things).

SolarEdgeUser commented 7 months ago

Yes, that will enable MyHomeAssistant and set the redirect uri, that hopefully should do the trick

Does not work. I have added 'my' at the bottom of configuration.yaml, after a white line (30) and then 'my:' on line 31. Saved it, restarted HA, tried Onecta app again, but exact same result. However, I also could not get the HA app to work anymore.

I removed the 'my:', saved, rebooted, and now I can reach it again from the HA app on my phone. However, that leaves me with a non-working Daikin heatpump integration unfortunately.

jwillemsen commented 7 months ago

Not sure what the solution is, check the comments related to #45 and #41, maybe you need a custom redirect uri, but hard to tell from here. Check your HA logs to see if anything is there

SolarEdgeUser commented 7 months ago

Not sure what the solution is, check the comments related to #45 and #41, maybe you need a custom redirect uri, but hard to tell from here. Check your HA logs to see if anything is there

Is the issue at it's core here that I am using duckduckdns and not 'the normal' way of Nabu Casa? In other words, would starting to use Nabu Casa circumvent this whole issue?

jwillemsen commented 7 months ago

I don't think so, I don't have anything of HA public and it works without problems. You have to make sure that when you open https://my.home-assistant.io/ in your local browser it redirects to your local HA setup, maybe add a local DNS entry for https://my.home-assistant.io/ which is the IP address of your local HA setup? Maybe see https://www.home-assistant.io/docs/authentication/#error-invalid-client-id-or-redirect-url

SolarEdgeUser commented 7 months ago

I don't think so, I don't have anything of HA public and it works without problems. You have to make sure that when you open https://my.home-assistant.io/ in your local browser it redirects to your local HA setup, maybe add a local DNS entry for https://my.home-assistant.io/ which is the IP address of your local HA setup? Maybe see https://www.home-assistant.io/docs/authentication/#error-invalid-client-id-or-redirect-url

When I open that my.home-assistant.io link, it tells me that my HA instance is located at http://homeassistant.local:8123/ however, when I click on that, it shows me the same thing I get when I tried to configure the Daikin integration earlier:

Deze pagina werkt niethomeassistant.local heeft geen gegevens verzonden.

However, when I look at the URL that is mentioned when I open my HA in a browser, it is that same link with /lovelace/default_view following it

jwillemsen commented 7 months ago

Probably you need a dns entry to let http://homeassistant.local:8123/ resolve to your local HA setup

SolarEdgeUser commented 7 months ago

Probably you need a dns entry to let http://homeassistant.local:8123/ resolve to your local HA setup

hmmm, then I'm gonna try and figure out how to get that done.

jwillemsen commented 7 months ago

See https://www.home-assistant.io/more-info/no-url-available/, check the Local Network setting

SolarEdgeUser commented 7 months ago

See https://www.home-assistant.io/more-info/no-url-available/, check the Local Network setting

This is really weird. See because that section in the settings is greyed out, because it states that I have it configured in the configuration.yaml. So, in that part of the HA settings in the interface, it is simply displaying what is configured in the config.yaml.

The weird thing however is that when I copy that url (http://ipadress:8123) , and I paste it in a browser, it does not work. It gives me the exact same error as before. That's weird to me. However, as soon as I make it httpS:// it works. But if the configured 'internal' URL does not work, then even if I am using the HA app on my phone while that phone is connected to my wifi, it will still use the external URL I guess.

Yes, I have just checked the settings in the app on my phone, and the internal URL is not even configured. Only the external one is configured, and that is the same one as in the config.yaml.

Theory then would be to change http to https in the config.yaml, and that should solve it...I guess?

SolarEdgeUser commented 7 months ago

See https://www.home-assistant.io/more-info/no-url-available/, check the Local Network setting

This is really weird. See because that section in the settings is greyed out, because it states that I have it configured in the configuration.yaml. So, in that part of the HA settings in the interface, it is simply displaying what is configured in the config.yaml.

The weird thing however is that when I copy that url (http://ipadress:8123) , and I paste it in a browser, it does not work. It gives me the exact same error as before. That's weird to me. However, as soon as I make it httpS:// it works. But if the configured 'internal' URL does not work, then even if I am using the HA app on my phone while that phone is connected to my wifi, it will still use the external URL I guess.

Yes, I have just checked the settings in the app on my phone, and the internal URL is not even configured. Only the external one is configured, and that is the same one as in the config.yaml.

Theory then would be to change http to https in the config.yaml, and that should solve it...I guess?

Nope. As soon as I input that in the companion app, it no longer connects because it is a certificate that is not trustworthy apparently, so, it does not work with httpS or with the internal http.

jwillemsen commented 7 months ago

You could try to manually accept the self signed certificate

SolarEdgeUser commented 7 months ago

You could try to manually accept the self signed certificate

I don't see anywhere where I can do that. There is no popup or anything.

jwillemsen commented 7 months ago

Open the https link in your regular browser, when it is a non trusted source it will normally ask that you add an exception. After that try to add the integration again

SolarEdgeUser commented 7 months ago

Open the https link in your regular browser, when it is a non trusted source it will normally ask that you add an exception. After that try to add the integration again

It does not. It only gives me a warning, and asks me if I want to continue anyway when I open it on a browser on my phone. When I continue, it gives me the logon screen for HA. But if I set that same adress in the HA app, it tells me the link is invalid, and I can either change it or continue anyway. If I continue, it does not work.

All this to get the Daikin integration to work. But part of the explanation on that site where the different options are explained, the 1st option is Nabu Casa. Now, I'm willing to use that, but, I don't want to pay for it and find out it does not solve the issue.

jwillemsen commented 7 months ago

Try to use a regular PC instead of your phone. No need for nabu casa, I think most people use this integration without that.

SolarEdgeUser commented 7 months ago

Try to use a regular PC instead of your phone. No need for nabu casa, I think most people use this integration without that.

When I do it on PC I get a warning because it could be unsafe, and I can either stop or continue. When I continue, I get the logon screen of HA. There is no option of saving anything with regards to a certificate.

jwillemsen commented 7 months ago

And have you tried to add the integration from your pc

SolarEdgeUser commented 7 months ago

And have you tried to add the integration from your pc

!!!!! I (well...you) fixed it! It was really simple. I could've solved this this morning already. Once you add the integration, you have to configure it, it then opens up some Daikin website where you have to give your OK. Once you do that, it continues on and asks you if you are OK with data being sent to your Home Assistant. In THAT screen, it shows you the link it is going to open. That was http, not httpS.

It has a pencil behind it, I just now realised. I clicked it, which allowed me to change the url. I added an S, and it worked. Now I have 2 more issues.

  1. I read somewhere that the updates stop after 12 hours, but you can somehow change the...well..the polling I guess? So that it no longer wants an update every X minutes, but you can change that to once every hour. I believe I read somewhere that it fixes the 'stops working after 12 hours' issue.

It gives me a shitload of sensors and whatnot. For the leaving water offset, it says 0 for 'heating' and it says 0 for 'current'. There is however another sensor: DomesticHotWaterTank Tank Temperature

  1. That temperature is now displaying 54 degrees. However, when I open the Daikin Onecta app on my phone, and check the temperature of the tank, it says 57. Why is there a difference?
jwillemsen commented 7 months ago

For 1, some users have a problem renewing their access token after 12 hours, see #41

For 2, onecta and HA have different poll frequencies, could be that hot water has been used and that the temperature dropped. 57 is pretty high, our tank is at 48, above a certain temp a backup heater will be used, costs more energy

Good to hear that it works now!