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

Storage API returns 504 error #16

Open
Sjord opened this issue Sep 15, 2020 · 16 comments
Open

Storage API returns 504 error #16

Sjord opened this issue Sep 15, 2020 · 16 comments

Comments

@Sjord
Copy link
Owner

Sjord commented Sep 15, 2020

The storage API doesn't seem to work well for everyone. There are two reports of it returning 504:

@Sjord
Copy link
Owner Author

Sjord commented Sep 15, 2020

get_storage_params only takes a storage serial number. That method still works for certain storage_sns, so it's not always broken. It doesn't work for some other storage_sns, which make me suspect the storage_sn is incorrect. Could it be that the serial returned by get_all_device_list is incorrect, or doesn't correspond to the storage unit?

Could you take a look at the screenshots in this comment? There, TEE194904F is the storage sn which seems to work correctly with the API. What does it say for you there? Is it the same serial as returned by get_all_device_list?

@WynandPrivate
Copy link

WynandPrivate commented Sep 16, 2020

Hi Sjord,

Thank you very much for responding.

I can confirm that the serial number I get from get_all_device_list is the same as what is displayed on the web server.

This is what I get from the command:

[{'lost': False, 'location': '', 'datalogSn': 'NAC5A142E4', 'batteryType': 1, 'deviceSn': 'BKE6A19067', 'deviceStatus': '6', 'pCharge': '0', 'deviceAilas': 'BKE6A19067', 'deviceType': 'SPA3000', 'eChargeToday': '6.7', 'capacity': '100%', 'energy': '0', 'vbat': ''}]}
image

An this is the web server:

@Sjord
Copy link
Owner Author

Sjord commented Sep 21, 2020

Apparently, the SPA3000 doesn't use the storage API, but the newSpaApi.do endpoint. Currently there are no methods in this project that call that endpoint.

@Sjord
Copy link
Owner Author

Sjord commented Sep 21, 2020

I have made a few methods. Please check out the storage branch, and try something like this:

with GrowattApi() as api:
    api.login(username, password)
    spa = api.spa(plant_id, device_sn)
    print(spa.get_energy_overview())
    print(spa.get_system_status())

@WynandPrivate
Copy link

WynandPrivate commented Sep 22, 2020

I've tried the two API calls and it works perfectly!!!! Thank you very much. Can I ask how did you manage to figure this out?

I can't get the get_energy_prod_and_cons_data call to work though.

print(spa.get_energy_prod_and_cons_data(datetime.date.today(), Timespan.day))

I get the following error:
File "/home/wdewit/growatt_api_client/growatt/__init__.py", line 310, in get_energy_prod_and_cons_data return _obj_success_response(response) File "/home/wdewit/growatt_api_client/growatt/__init__.py", line 32, in _obj_success_response raise GrowattApiError("Request failed: %s" % response) growatt.GrowattApiError: Request failed: <Response [500]>

I have another question regarding the data packets received from the ShinLan box, but don't think this is the place to have the discussion. Is there another way for me to contact you?

@Sjord
Copy link
Owner Author

Sjord commented Sep 23, 2020

I've tried the two API calls and it works perfectly!!!!

Nice to hear it works.

Can I ask how did you manage to figure this out?

I intercepted the traffic from the mobile app, and replaced your data in the response to get_all_device_list. That made the app think I have a SPA3000, and it performs the calls to the SPA endpoint.

I can't get the get_energy_prod_and_cons_data call to work though.

Apparently, this uses a different value for type/timespan than the other methods. I updated this function, please pull the change and try again.

I have another question regarding the data packets received from the ShinLan box

I don't think I can help you with this, but you are free to send me an email.

@WynandPrivate
Copy link

WynandPrivate commented Sep 25, 2020

Hi,

Thank you very much for your time! I've tried the new get_energy_prod_and_cons_data call as follow:

date = datetime.date.today()
print(date)
print(spa.get_energy_prod_and_cons_data(date, Timespan.day))

But still get the following error:
raise GrowattApiError("Request failed: %s" % response)
growatt.GrowattApiError: Request failed: <Response [500]>

I will have a look at the interception of the app as I'm also having issues to get my solar inverter energy storage (deviceType = tlx)

@WynandPrivate
Copy link

Hi,

I've been using the hybrid API calls (newMixApi) for a few months without any issues. A few days ago this stopped working and none of my API calls work.

Is anyone experiencing the same issue with any other API call? I've checked the network captured data and nothing seems to have change.

Any help will be greatly appreciate.

@Sjord
Copy link
Owner Author

Sjord commented Sep 23, 2021

Yes, other people were having the same problem. I fixed it in the master branch, but you didn't get the fix because you are on another branch. I'll fix this soon.

@WynandPrivate
Copy link

WynandPrivate commented Sep 23, 2021 via email

@WynandPrivate
Copy link

WynandPrivate commented Sep 23, 2021 via email

@Sjord
Copy link
Owner Author

Sjord commented Sep 23, 2021

That's right. I merged the changes from master into the storage branch, so this should now work correctly on both branches.

@WynandPrivate
Copy link

WynandPrivate commented Sep 24, 2021 via email

@WynandPrivate
Copy link

WynandPrivate commented Oct 11, 2022 via email

@Sjord
Copy link
Owner Author

Sjord commented Oct 28, 2022

@WynandPrivate
Copy link

Hi @Sjord Thank you for letting me know. So far so good for me. I've not experienced any issues yet. Will keep an eye out!

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

No branches or pull requests

2 participants