CharlesGillanders / alphaess-openAPI

This Python library uses the Alpha ESS Open API to retrieve data on your Alpha ESS inverter, photovoltaic panels, and battery if you have one.
MIT License
9 stars 5 forks source link

getDisChargeConfigInfo returns 'The maximum number of requests has been reached' #7

Open dan-s-github opened 9 months ago

dan-s-github commented 9 months ago

Seems that AlphaESS is doing maintenance during end of year break period

Since this morning 29/12 UTC +13 I get the following exception in my HA logs, this is when it started

2023-12-29 01:35:17.654 ERROR (MainThread) [alphaess.alphaess] 502, message='Bad Gateway', url=URL('https://openapi.alphaess.com/api/getEssList')
2023-12-29 01:35:17.655 ERROR (MainThread) [alphaess.alphaess] Error: 502, message='Bad Gateway', url=URL('https://openapi.alphaess.com/api/getEssList') when calling https://openapi.alphaess.com/api/getEssList
2023-12-29 01:35:17.655 ERROR (MainThread) [alphaess.alphaess] 'NoneType' object is not iterable
2023-12-29 01:35:17.655 ERROR (MainThread) [custom_components.alphaess] Unexpected error fetching alphaess data: 'NoneType' object is not iterable
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 300, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/alphaess/coordinator.py", line 30, in _async_update_data
    jsondata: json = await self.api.getdata()
                     ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/alphaess/alphaess.py", line 301, in getdata
    for unit in units:
TypeError: 'NoneType' object is not iterable
2023-12-29 01:36:20.295 INFO (MainThread) [custom_components.alphaess] Fetching alphaess data recovered
2023-12-29 01:41:35.304 ERROR (MainThread) [alphaess.alphaess] Unexpected json_response : {'code': 6053, 'msg': 'The maximum number of requests has been reached', 'expMsg': None, 'data': None, 'extra': None} when calling https://openapi.alphaess.com/api/getDisChargeConfigInfo?sysSn=XXXXXXXXXXX
2023-12-29 01:42:38.653 ERROR (MainThread) [alphaess.alphaess] Unexpected json_response : {'code': 6053, 'msg': 'The maximum number of requests has been reached', 'expMsg': None, 'data': None, 'extra': None} when calling https://openapi.alphaess.com/api/getDisChargeConfigInfo?sysSn=XXXXXXXXXXX

and after updating core and restarting

2023-12-29 11:50:13.129 ERROR (MainThread) [alphaess.alphaess] Unexpected json_response : {'code': 6053, 'msg': 'The maximum number of requests has been reached', 'expMsg': None, 'data': None, 'extra': None} when calling https://openapi.alphaess.com/api/getDisChargeConfigInfo?sysSn=XXXXXXXXXXX
2023-12-29 11:51:16.260 ERROR (MainThread) [alphaess.alphaess] Unexpected json_response : {'code': 6053, 'msg': 'The maximum number of requests has been reached', 'expMsg': None, 'data': None, 'extra': None} when calling https://openapi.alphaess.com/api/getDisChargeConfigInfo?sysSn=XXXXXXXXXXX
2023-12-29 11:52:19.625 ERROR (MainThread) [alphaess.alphaess] Unexpected json_response : {'code': 6053, 'msg': 'The maximum number of requests has been reached', 'expMsg': None, 'data': None, 'extra': None} when calling https://openapi.alphaess.com/api/getDisChargeConfigInfo?sysSn=XXXXXXXXXXX
2023-12-29 11:53:22.283 ERROR (MainThread) [alphaess.alphaess] Unexpected json_response : {'code': 6053, 'msg': 'The maximum number of requests has been reached', 'expMsg': None, 'data': None, 'extra': None} when calling https://openapi.alphaess.com/api/getDisChargeConfigInfo?sysSn=XXXXXXXXXXX

Only getDischargeConfigInfo returns this error and all other calls work fine. Confirmed using Postman to test all requests.

jasonwins commented 9 months ago

I’m seeing this too, but I think this is a deliberate change, see https://github.com/alphaess-developer/alphacloud_open_api/issues/54 There now appears to be a limit of one update per 24hrs. API documentation seems to confirm this change.

Gaspode69 commented 9 months ago

I’m seeing this too, but I think this is a deliberate change

I don't think so, I guess it is not intended to block read access to these values. In your linked issue @ElevenFan is talking about write access only.

See alphaess-developer/alphacloud_open_api/issues/56

dan-s-github commented 9 months ago

I also think that the announcement on https://github.com/alphaess-developer/alphacloud_open_api/issues/54 is related to write requests but it seems that they messed up their API with blocking all requests related to the getXXXChargeConfigInfo instead of only blocking the updateXXXChargeConfigInfo.

Hopefully this get addressed soon

djsepp commented 9 months ago

Alpha ess announced yesterday that the limit of 1x every 24 hours will be raised. However, you have expressed yourself somewhat confusingly as to how often you can now set the value for charging / discharging. https://github.com/alphaess-developer/alphacloud_open_api/issues/54

dan-s-github commented 9 months ago

seems that the restriction on getDisChargeConfigInfo has been removed with an update last night. Usually I got an ERROR log every minute but that has no disappeared around 01:06 UTC+13

2024-01-04 01:00:51.415 ERROR (MainThread) [alphaess.alphaess] Unexpected json_response : {'code': 6053, 'msg': 'The maximum number of requests has been reached', 'expMsg': None, 'data': None, 'extra': None} when calling https://openapi.alphaess.com/api/getDisChargeConfigInfo?sysSn=XXXXXXXXXXXXX
2024-01-04 01:01:54.323 ERROR (MainThread) [alphaess.alphaess] Unexpected json_response : {'code': 6053, 'msg': 'The maximum number of requests has been reached', 'expMsg': None, 'data': None, 'extra': None} when calling https://openapi.alphaess.com/api/getDisChargeConfigInfo?sysSn=XXXXXXXXXXXXX
2024-01-04 01:02:57.731 ERROR (MainThread) [alphaess.alphaess] Unexpected json_response : {'code': 6053, 'msg': 'The maximum number of requests has been reached', 'expMsg': None, 'data': None, 'extra': None} when calling https://openapi.alphaess.com/api/getDisChargeConfigInfo?sysSn=XXXXXXXXXXXXX
2024-01-04 01:04:00.339 ERROR (MainThread) [alphaess.alphaess] Unexpected json_response : {'code': 6053, 'msg': 'The maximum number of requests has been reached', 'expMsg': None, 'data': None, 'extra': None} when calling https://openapi.alphaess.com/api/getDisChargeConfigInfo?sysSn=XXXXXXXXXXXXX
2024-01-04 01:05:03.366 ERROR (MainThread) [alphaess.alphaess] Unexpected json_response : {'code': 6053, 'msg': 'The maximum number of requests has been reached', 'expMsg': None, 'data': None, 'extra': None} when calling https://openapi.alphaess.com/api/getDisChargeConfigInfo?sysSn=XXXXXXXXXXXXX
2024-01-04 01:06:06.306 ERROR (MainThread) [alphaess.alphaess] Unexpected json_response : {'code': 6053, 'msg': 'The maximum number of requests has been reached', 'expMsg': None, 'data': None, 'extra': None} when calling https://openapi.alphaess.com/api/getDisChargeConfigInfo?sysSn=XXXXXXXXXXXXX
2024-01-04 01:15:00.321 WARNING (MainThread) [homeassistant.helpers.script.trigger_update_coordinator] Trigger Update Coordinator: Running script requires passing in a context

seems that they actually read the comments on tickets