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

Refactor Api code to support various api clients #130

Open
thomluther opened this issue Sep 15, 2024 · 1 comment
Open

Refactor Api code to support various api clients #130

thomluther opened this issue Sep 15, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@thomluther
Copy link
Owner

thomluther commented Sep 15, 2024

The API cloud has multiple endpoint categories.
The API class was originally developed to handle only power services endpoints which are used for power systems like created for solarbank and powerpanels.
However, there are many charging endpoints that might be used for PPS (power stations). Those endpoints actually work only on the non EU cloud server. This might be temporary and depend in which geo Anker releases which products.
The Anker account assignment to the server is done by the account country and cannot be changed after registration.
There are also new hes_* endpoints, probably related to managed devices like announced X1 home energy system.
They should be handled via different API client since their structure might be completely different to known power systems and device structures of the power services endpoints.
See apitypes.py module for known cloud endpoints and potential server assignment.

@thomluther thomluther added the enhancement New feature or request label Sep 15, 2024
@thomluther
Copy link
Owner Author

The common request handling code should be in a new apihandler class which can be reused by any api client.
If any api client will request and cache a new login response due to invalid token, other clients need to able to update their tokens from the cache file before doing new login requests on their own.
Ideally the handler should use a common ecdh object for any encryption services againstthe used account and api clients should register to the handler. The handler could then centrally manage the server communication and authentication for any registered api client.

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

No branches or pull requests

1 participant