ekutner / home-connect-hass

Alternative (and improved) Home Connect integration for Home Assistant
MIT License
639 stars 62 forks source link

Keep hitting API limits with 10 appliances #331

Closed cregeland closed 9 months ago

cregeland commented 10 months ago

First of all - thank you for this great integration!

I’m using it in a house with 10 appliances hooked up to Home Connect.

I believe I have issues with the API limits. Quite often all the entities will have an unknown state. The following day it will work again for a few hours.

Would it be possible to reduce the number of API hits somehow?

Thanks:)

ekutner commented 10 months ago

A few months ago I did a whole optimization session to reduce the number of API calls as much as possible and what the integration does now is the best I managed to do and to be honest, I don't see what else can be improved to reduce the calls further. The Home Connect API has a fixed 1000 calls/day limit that doesn't consider the number of appliances a user has, so it ends up hurting their best customers who have a house full of BSH appliances. It doesn't make any sense. I tried reaching out to them to convince them to tie the limit to the number of appliances in the account but didn't get any response. I recommend that you also try to contact them and maybe you'll have more success as a prime customer. The only workaround that I can suggest is disabling some of the less useful appliances for automation. For example, coffee machine generate a lot of API calls and by their nature and probably less relevant for automation so you can try disabling it in the integration configuration and see if it solves the rate limit issue. You can see here how to do that.

Rep-Hueman commented 10 months ago

Maybe a workaround...

Make a copy of the Home connect alt and edit it in two or more new integrations and change domain etc. Home connect one, Home connect two, etc..

create an application per integration in the Home Connect developers website!

cregeland commented 9 months ago

Thanks for the reply and suggestion. I'll give it a shot with multiple integrations. I guess I will have to filter out a couple of appliances in each integration in order to reduce the number of active appliances on each application?

cregeland commented 9 months ago

@Rep-Hueman - how would I duplicate the integration? I have copied the folder under custom components, renamed the folder (home_connect_alt_2) and renamed the domain and name in manifest.json.

When attempting to add the integration (Home Connect Alt 2) i get this message:

Error Config flow could not be loaded: {"message":"Invalid handler specified"}

ekutner commented 9 months ago

It's an interesting idea but I'm not sure it's really going to work. Try also changing the DOMAIN variable in const.py and see if that gets it to work. Note that if it does work you'll have to do this process every time the integration is updated. You should also use the disabling configuration I suggested above to split the appliances between the two instances of the integrations or they'll just both get rate limited together.

cregeland commented 9 months ago

thanks @ekutner, I've updated the domain variable in const.py as well. still same error. Here's the top section of the const.py:

"""Constants for the Home Connect Alt integration."""

DOMAIN = "home_connect_alt_2"
NAME = "Home Connect Alt 2"
DEFAULT_API_HOST = "https://api.home-connect.com"

ENDPOINT_AUTHORIZE = "/security/oauth/authorize"
ENDPOINT_TOKEN = "/security/oauth/token"
SCOPES = "IdentifyAppliance Monitor Control Settings"
CONF_API_HOST = "api_host"
CONF_API_HOST_OPTIONS = [ "https://api.home-connect.com", "https://api.home-connect.cn" ]
# CONF_API_HOST_OPTIONS = [
#     {"label": "default", "value": "https://api.home-connect.com"},
#     {"label": "china", "value": "https://api.home-connect.cn"}
# ]

It is still throwing the same error. Looks like the icon is white when adding the integration: homeconnect configflow

ekutner commented 9 months ago

Yeah, not sure why it's not working now but it was a long shot to begin with

ekutner commented 9 months ago

Check out version 1.1.0-b1 and the "dealing with API rate limit" in the README.

Rep-Hueman commented 9 months ago

Nice how can i test this?
I have 5 appliances hooked up to Home Connect. Can you now add multiple integrations of Home connect alt and create an app per device in the def portal?

Would like to test it for you. I have a washing machine, steam oven, combi oven, espresso machine and extractor hood

ekutner commented 9 months ago

Nice how can i test this? Follow the instructions in the README

cregeland commented 9 months ago

Thank you for your effort.

I have added a second set of credentials and installed the second version of the integration. creds

image

Devices are found, but unable to click "configure" due to error message:

image

ekutner commented 9 months ago

@cregeland Make sure that you removed the home_connect_alt section from configuration.yaml then enable debug logging, restart home assistant and if still have issues attach the full log file here.

zufivan commented 9 months ago

Hi @ekutner, I configured a second developer app and setup "Home Connect Alt", everything is working. Unfortunately with beta version 1.1.0-b1 and 1.1.0-b2 I got the same problem (500 Internal Error) when I try use the "CONFIGURE" button, I see in the log following error: AttributeError: 'NoneType' object has no attribute 'update' home-assistant_home_connect_alt_2024-02-13T00-39-48.870Z.log

ekutner commented 9 months ago

Try b3

cregeland commented 9 months ago

Great job @ekutner - «configure» is now working😁👍 I’ll give it a shot running two instances while dividing appliances between them.

ekutner commented 9 months ago

Closing as done