Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add http (socks) proxy support #360

Open
zzz676 opened this issue Mar 13, 2024 · 7 comments
Open

Add http (socks) proxy support #360

zzz676 opened this issue Mar 13, 2024 · 7 comments

Comments

@zzz676
Copy link

zzz676 commented Mar 13, 2024

Bosch servers have recently been unavailable from some countries for connection from this integration. For this reason, there is a request to add the ability to use a proxy server to connect to Bosch servers.

@ekutner
Copy link
Owner

ekutner commented Mar 16, 2024

I don't remember that the appliances themselves have an option to configure a proxy, how do they connect to the HC servers in this case? How does the mobile app connect to the appliances when not connected to wifi?

@zzz676
Copy link
Author

zzz676 commented Mar 21, 2024

I don't remember that the appliances themselves have an option to configure a proxy, how do they connect to the HC servers in this case? How does the mobile app connect to the appliances when not connected to wifi?

The devices themselves connect without problems, as does the proprietary Home Connect application. The problem, as I understand it, is precisely the connection through their API, through which the integration works.

@moskovskiy82
Copy link

I don't remember that the appliances themselves have an option to configure a proxy, how do they connect to the HC servers in this case? How does the mobile app connect to the appliances when not connected to wifi?

The devices themselves connect without problems, as does the proprietary Home Connect application. The problem, as I understand it, is precisely the connection through their API, through which the integration works.

Exactly. Furthermore a local only mode is supported by the HomeConenct. You can enable it in the app settings. See #353

@ekutner
Copy link
Owner

ekutner commented Mar 23, 2024

@zzz676 How do you know the appliances connect to the HC cloud? The mobile app can connect to them directly, without connecting to the HC cloud server, when they are on the same wifi network. The whole scenario doesn't make sense to me, if HC are blocking some countries then the appliances should be blocked too, why would they only block API access but still allow the appliances to connect from the same countries?
Have you reached out to HC about this?
What error is generated when the integration is connecting to the API?

As already discussed in #353 I have no plan to reverse engineer the local protocol, so unless HC officially support local API access it's not going to happen.

@alexbilevskiy
Copy link

TL;DR
Set up VPN on your home router and redirect traffic for api-rna.home-connect.com, singlekey-id.com (both needed for auth flow) and api.home-connect.com (used by integration, ip address is the same as api-rna...) via vpn.

How do you know the appliances connect to the HC cloud?

From official home connect app (with wifi disabled)
image

The whole scenario doesn't make sense to me, if HC are blocking some countries then the appliances should be blocked too, why would they only block API access but still allow the appliances to connect from the same countries?

Actually it's been like this for a while now. The funny thing is that even mobile app works fine (except authorization part), but not api.

What error is generated when the integration is connecting to the API?

With vpn disabled, this error is shown

2024-04-08 19:09:53.884 ERROR (MainThread) [aiohttp_sse_client.client] fetch https://api.home-connect.com/api/homeappliances/events failed: 403

When requested with curl, there is 403 in plain html:

[alex@home ~]> curl https://api.home-connect.com/api/homeappliances/events
<html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
</body>
</html>

and this is with vpn

[alex@home ~]> curl https://api.home-connect.com/api/homeappliances/events
{
  "error": {
    "key": "401",
    "description": "Authentication is possible but has failed or not yet been provided."
  }
}

@ekutner
Copy link
Owner

ekutner commented Apr 9, 2024

That's really strange.
To be honest I would accept a PR that add this but doubt it will be something I get to do myself in the foreseeable future.
You may want to consider a workaround by adding a routing rule on your Home Assistant server that would direct traffic for api.home-connect.com (IP addresses 18.193.228.33, .124.235.66, 18.196.116.41) to the VPN. That's all you really need because the authentication is done from your browser which already support proxy definitions.

@zzz676
Copy link
Author

zzz676 commented Apr 9, 2024

TL;DR Set up VPN on your home router and redirect traffic for api-rna.home-connect.com, singlekey-id.com (both needed for auth flow) and api.home-connect.com (used by integration, ip address is the same as api-rna...) via vpn.

How do you know the appliances connect to the HC cloud?

From official home connect app (with wifi disabled) image

The whole scenario doesn't make sense to me, if HC are blocking some countries then the appliances should be blocked too, why would they only block API access but still allow the appliances to connect from the same countries?

Actually it's been like this for a while now. The funny thing is that even mobile app works fine (except authorization part), but not api.

What error is generated when the integration is connecting to the API?

With vpn disabled, this error is shown

2024-04-08 19:09:53.884 ERROR (MainThread) [aiohttp_sse_client.client] fetch https://api.home-connect.com/api/homeappliances/events failed: 403

When requested with curl, there is 403 in plain html:

[alex@home ~]> curl https://api.home-connect.com/api/homeappliances/events
<html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
</body>
</html>

and this is with vpn

[alex@home ~]> curl https://api.home-connect.com/api/homeappliances/events
{
  "error": {
    "key": "401",
    "description": "Authentication is possible but has failed or not yet been provided."
  }
}

Thank you for your reply. Couldn't answer, was unavailable. I confirm, everything is the same for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants