Expose storage API
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)
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.
This other project also has some storage functions.
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.
Thanks @wynandmyriota. I have created a separate issue for this problem: Storage API returns 504 error #16
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.
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.