Sjord / growatt_api_client

Use indykoning/PyPi_GrowattServer instead of this project.
https://github.com/indykoning/PyPi_GrowattServer
MIT License
66 stars 28 forks source link

Current/daily usage #12

Open SchalkGreyling opened 4 years ago

SchalkGreyling commented 4 years ago

Thank you for this amazing app.

I was wondering if there is an API to find daily consumption?

I'm trying to compare my Solar charge against usage to figure out if my battery has fully charged. (My SOC graph stays on 100% until the battery is pretty much dead- the BMS cannot connect to my inverter).

Sjord commented 4 years ago

Can you see this information somewhere in the web app or in the mobile app? Where and how is it displayed there?

SchalkGreyling commented 4 years ago

Hi Sjord,

Thank you for the response.

Yes it is availbale in both web page and mobile, please see the attached screenshots.

In the mobile app you can get the current solar production/storage/consumption and the daily overview (Please see screenshot below): thumbnail_Image

In the web page you can see the same on a different layout style (Please see screenshot below):

Screen Shot 2020-04-24 at 7 47 50 AM
SchalkGreyling commented 4 years ago

Hi Sjord,

Should you be able to access the battery voltage I'll be able to use that as well. Please let me know should you need Access to the website then I can share the details with you.

Screen Shot 2020-04-25 at 6 56 55 AM
Sjord commented 4 years ago

I have added several new methods in the storage branch. Please try them out and let me know which are useful to you, and whether this solves your issue.

This comment describes how to switch branches. The branch is called storage. The new function are listed here.

Use something like the following to retrieve the information for your plant:

with GrowattApi() as api:
    api.login(username, password)
    plant_info = api.plant_list()

    plant_id = plant_info["data"][0]["plantId"]
    storage_sn = "TEE194904F"   # Or call get_all_device_list
    print(api.get_energy_overview_data(plant_id, storage_sn))
    print(api.get_system_status_data(plant_id, storage_sn))
    print(api.get_storage_energy_data(plant_id, storage_sn, "2020-04-20"))
    print(api.get_energy_prod_and_cons_data(plant_id, storage_sn, "2020-04-20"))
    print(api.get_storage_params(storage_sn))
SchalkGreyling commented 4 years ago

This is AMAZING!!

Thank you very much :) I would not have been able to get this without your assistance. Really owe you for this.

schimmelbirne commented 4 years ago

Hi,

thanks for the good work!!! Unfortunately, it seems the API is no longer able to connect to the new storage endpoints. E.g. the get_energy_overview_data function is returning:

File "/volume2/software/scripting/git/growatt_api_client/growatt/__main__.py", line 26, in <module> print("System Status: " + str(yaml.load(json.dumps(api.get_system_status_data(plant_id, storage_sn))))) File "growatt/__init__.py", line 180, in get_system_status_data return self._obj_success_response(response) File "growatt/__init__.py", line 225, in _obj_success_response raise GrowattApiError(data) growatt.GrowattApiError: {u'msg': u'504', u'obj': None, u'result': 0}

Seems like a http 504 status? Kind regards, Andi.