Skip to content

Raise exception in case of API rate limit reached#13

Open
N3rdix wants to merge 1 commit into
ptcryan:masterfrom
N3rdix:master
Open

Raise exception in case of API rate limit reached#13
N3rdix wants to merge 1 commit into
ptcryan:masterfrom
N3rdix:master

Conversation

@N3rdix

@N3rdix N3rdix commented Dec 13, 2022

Copy link
Copy Markdown

Might not be perfect from coding perspective (python beginner), but at least the consuming side can react on the error.
Also adjusted the API endpoint, according to the Hydrawise API docs it's https://api.* and not https://app.* although both are working (still).

@txwindsurfer

txwindsurfer commented Dec 13, 2022

Copy link
Copy Markdown

@N3rdix, I implemented your PR into my HA by adding a folder named hydrawiser in the config director (/config/hydrawiser) I copied the 2 files you changed plus added the init.py file into that directory and restarted. I can report that the integration loaded successfully even though I did see a "429 Client Error: Too Many Requests for url:" Full logs show the following (not shown as warnings or error just info):

File "/config/hydrawiser/core.py", line 53, in update_controller_info
File "/config/hydrawiser/helpers.py", line 56, in customer_details
requests.exceptions.HTTPError: 429 Client Error: Too Many Requests for url: https://api.hydrawise.com/api/v1/customerdetails.php?api_key=xxxx&type=controllers
File "/usr/src/homeassistant/homeassistant/components/hydrawise/init.py", line 70, in hub_refresh
hass.data[DATA_HYDRAWISE].data.update_controller_info()
File "/config/hydrawiser/core.py", line 58, in update_controller_info

I received warnings about sensors and switches taking over 10 seconds to load however everything did load.

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

Successfully merging this pull request may close these issues.

2 participants