Skip to content

Expose storage API - #13

Open
Sjord wants to merge 11 commits into
masterfrom
storage
Open

Expose storage API#13
Sjord wants to merge 11 commits into
masterfrom
storage

Conversation

@Sjord

@Sjord Sjord commented Apr 25, 2020

Copy link
Copy Markdown
Owner

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

Sjord commented May 10, 2020

Copy link
Copy Markdown
Owner Author

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

Sjord commented May 17, 2020

Copy link
Copy Markdown
Owner Author

This other project also has some storage functions.

@WynandPrivate

WynandPrivate commented Sep 15, 2020

Copy link
Copy Markdown

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

Sjord commented Sep 15, 2020

Copy link
Copy Markdown
Owner Author

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

@Sjord

Sjord commented Sep 21, 2020

Copy link
Copy Markdown
Owner Author

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

Sjord commented Sep 21, 2020

Copy link
Copy Markdown
Owner Author

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