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

Expose storage API #13

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Expose storage API #13

wants to merge 11 commits into from

Conversation

Sjord
Copy link
Owner

@Sjord Sjord commented Apr 25, 2020

New methods:

  • get_energy_prod_and_cons_data(self, plant_id, storage_sn, date, type=0)
  • get_storage_energy_data(self, plant_id, storage_sn, date)
  • get_system_status_data(self, plant_id, storage_sn)
  • get_energy_overview_data(self, plant_id, storage_sn)
  • get_storage_params(self, storage_sn)

@Sjord Sjord mentioned this pull request Apr 25, 2020
@Sjord Sjord mentioned this pull request May 10, 2020
@Sjord
Copy link
Owner Author

Sjord commented May 10, 2020

These need some more testing and at least some documentation before I am going to merge this. If you use these, please let me know which functions work best for you, and which data from each function is useful for you.

@Sjord
Copy link
Owner Author

Sjord commented May 17, 2020

This other project also has some storage functions.

@WynandPrivate
Copy link

WynandPrivate commented Sep 15, 2020

Hi. I'm trying to use your storage API calls, but none of them are working for me.

Example:
storage_data = api.get_storage_energy_data(plant_id,"BKE6A19067", datetime.date.today())

I get the following error message:

raise GrowattApiError(data)

growatt.GrowattApiError: {'result': 0, 'obj': None, 'msg': '504'}

I've used the get_all_device_list API call to get the AC coupled inverter serial number.

@Sjord
Copy link
Owner Author

Sjord commented Sep 15, 2020

Thanks @wynandmyriota. I have created a separate issue for this problem: Storage API returns 504 error #16

@Sjord
Copy link
Owner Author

Sjord commented Sep 21, 2020

These methods need better names or namespaces. get_energy_overview_data currently calls newStorageAPI.do?op=getEnergyOverviewData, but this is very similar to newSpaApi.do?op=getEnergyOverview, and I expect the same to exist for other device types.

@Sjord
Copy link
Owner Author

Sjord commented Sep 21, 2020

I moved the storage and spa calls to their own class. It now works like this:

with GrowattApi() as api:
    api.login(username, password)
    s = api.storage(plant_id, storage_sn)
    print(s.get_system_status_data())

So api.storage returns a storage object with additional storage specific methods.

It seems this is one lower than the timespan.value. Also, format the date
according to timespan.
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.

3 participants