0.110 Home Connect not working?

Just updated to 0.110 and added Home Connect in my config. But there’s nothing happening? I used to have a 3rd party Home Connect integration but that was working poorly, so I hoped that this would work properly.

When I add the integration in the UI I get an error: ‘unauthorized_client: client or redirection URI not authorized’.

The URL, client id and secret are copied correctly.

Are these values correct? No word about them in docs:
afbeelding

I think that the setup docs reference the base_url, which is a deprecated configuration parameter. You now need to set the internal & external url parameters for this to work

I got the same problem

Yep that’s it. I saw that the redirect url was my internal one. So for whoever is facing this issue, check that.

I’m using
http://user.duckdns.org:8123/auth/external/callback
as redirect url. is this wrong?

After you’ve logged in to Home Connect, and you get the error, check the URL of your browser. There I had something like 192.168.178.x/blabla instead of my external address. When I changed that in my URL in my browser I was ready to go. :slight_smile:

I fixed the issue by changing my redirect URL in the home connect account from http://user.duckdns.org:8123/auth/external/callback to my local IP http://192.168.1.72:8123/auth/external/callback

This should be mentioned in the instructions for this integration.

Does this work with Nabu Casa, seems unclear after skimming many entries across the forum. If so can someone please explain how? Thanks

Hi,

I’m getting this error after I grant access:

500 Internal Server Error

Server got itself in trouble

I see this in the logs:
Logger: aiohttp.server
Source: helpers/config_entry_oauth2_flow.py:167
First occurred: 7:53:27 AM (2 occurrences)
Last logged: 7:53:44 AM

Error handling request
Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py”, line 418, in start
resp = await task
File “/usr/local/lib/python3.7/site-packages/aiohttp/web_app.py”, line 458, in _handle
resp = await handler(request)
File “/usr/local/lib/python3.7/site-packages/aiohttp/web_middlewares.py”, line 119, in impl
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/real_ip.py”, line 39, in real_ip_middleware
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/ban.py”, line 73, in ban_middleware
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/auth.py”, line 127, in auth_middleware
return await handler(request)
File “/usr/src/homeassistant/homeassistant/components/http/view.py”, line 125, in handle
result = await result
File “/usr/src/homeassistant/homeassistant/components/config/config_entries.py”, line 136, in get
return await super().get(request, flow_id)
File “/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py”, line 91, in get
result = await self._flow_mgr.async_configure(flow_id)
File “/usr/src/homeassistant/homeassistant/data_entry_flow.py”, line 153, in async_configure
result = await self._async_handle_step(flow, cur_step[“step_id”], user_input)
File “/usr/src/homeassistant/homeassistant/data_entry_flow.py”, line 201, in _async_handle_step
result: Dict = await getattr(flow, method)(user_input)
File “/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py”, line 248, in async_step_creation
token = await self.flow_impl.async_resolve_external_data(self.external_data)
File “/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py”, line 142, in async_resolve_external_data
“redirect_uri”: self.redirect_uri,
File “/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py”, line 167, in _token_request
resp.raise_for_status()
File “/usr/local/lib/python3.7/site-packages/aiohttp/client_reqrep.py”, line 946, in raise_for_status
headers=self.headers)
aiohttp.client_exceptions.ClientResponseError: 400, message=‘Bad Request’, url='https://api.home-connect.com/security/oauth/token

I have the same question. The setup via Nabu Casa works but after that…

I have set the correct internal and external url in the HA configuration, but i see still the internal url in the Oauth2 redirect. When i change this manually (in the redirect url) i get the same 500 error as @AndruX

Hi all,

I just realized that you need not use https and SSL. You can simply use the http address, for the Redirect URIs on the application details page at the home connect developer site

and I set both internal and external URL in my configuration.yaml to be my external accessible address (not 192.168 …) because it seems like the value from internal_URL is used in home connect.

Ok, I solved my issue. Issue was related to the configuration - ‘!secret’ was missing in configuration for ‘client_secret’ configuration variable

I am in the process of setting up this integration and when I go to authorise I get the following response:-

!The given user is not assigned to this app in the developer portal.

I am using my home connect application login credentials and not my developer login credentials. Is this correct?

Hi,

For the benefit of latter generations (including future me) I had to jump quite some hoops to get this working, and I believe that I needed to do the opposite to what the setup guide says by not using an internal IP address. That just didn’t work for me.

  • Take a note of the email you are using in your Home Connect App.
  • Register to HC developer portal. Understand that these credentials are different to ones you have to sign in to allow the access to your appliances. To my understanding email for developer account is not significant in anyway, but you need to have the username and password to log in for changing authentication settings in HC developer portal.
  • Setup a new Application in HC developer portal. Set your HC App email to Home Connect user account for testing.
  • Take a note of client id and client secret and add them to the YAML setup as the guide says.
  • For the Redirect URI (Note: this part was for me different to what the guide says): I had to use HA Nabu Casa based URI. I tried two other variations, internal and my own domain, which neither worked for some reason:
    • When I used my own domain (akin to https://ha.mydomain.com/auth/external/callback) I got a Bad Request error in my logs when HA was trying to fetch the Oauth token. This is reported earlier in this thread.
    • When I used my local IP address (http://192.168.1.10:8123/auth/external/callback). I got a different error. I was redirected to this invalid URL from HC http://192.168.1.10:8123/auth/external/callback?error=unauthorized_client&error_description=client+or+redirection+URI+not+authorized
    • Nabu Casa Redirect URI was the only that was working for me. Can’t really say why, but I’m happy that at least it works.
  • Restart HA
  • Add the integration in HA. You get redirected to HC login page where you need to log in with the email/password you are using the app with.
  • Grant the accesses by pressing the blue button
  • Hope for the best.

There are a few things that I stumbled into:

  • Ensure that you initiate the integration in HA from the same domain you have entered as the redirect URI. If you don’t you get an error.
  • Ensure you have HTTPS and HTTPs in your URLs set correctly. I.e. make sure you don’t have accidental https in your URLs when you want http and the other way around.
  • Ensure that when the integration redirects you to Home Connect web site, you log in with your Home Connect App credentials (not developer account credentials!)

Slightly off topic, it would be great if the Oauth token would be refreshed automatically. I had to re-add the integration because the token expired.

2 Likes
  • Ensure that you initiate the integration in HA from the same domain you have entered as the redirect URI. If you don’t you get an error.

Thank You, this seemed to be my problem, since I tried adding the integration via my external url.
After I tried adding it via my local address, everything went smooth.

I kept getting a ‘connection refused’ error when opening up ‘the external website’ when setting up the integration.

Solved it by disabling Brave’s blocking of fingerprinting and tracking cookies. Hope this helps!

Hey guys, just solved this and sharing for future reference:

change the redirect uri from https://my.home-assistant.io/redirect/oauth to https://my.home-assistant.io/auth/external/callback

For some reason the instructions (Home Connect - Home Assistant) have wrong URL for the callback. I will make a pull request and propose a change.