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

Growatt API Add Data #14

Open
NathanealV opened this issue May 10, 2020 · 8 comments
Open

Growatt API Add Data #14

NathanealV opened this issue May 10, 2020 · 8 comments

Comments

@NathanealV
Copy link

How would I add more data to the JSON read out that is not already available there?

I see there are things like "PlantList.do" but where do I find these .do files or tags

Thank you so much for the API btw.

@Sjord
Copy link
Owner

Sjord commented May 10, 2020

I found the URLs by reverse engineering the Android app, and intercepting traffic between the Android app and the server. Is there particular data you are looking for? I recently added many storage functions, these just need some more testing.

@NathanealV
Copy link
Author

NathanealV commented May 10, 2020

Would you be able to share the different URLs? Or share how you reverse engineered it? I tried looking at the website + 'PlantList.do' but it said I don't have permission. I guess I just need the entire stack of data that is there on the website - like the entire thing.

@NathanealV
Copy link
Author

NathanealV commented May 11, 2020

I have managed to find these URLs and have been getting the data that I need. Just one question, would you be able to help me with a json parsing error with one of the pages? It's with NewTwoPlantList.do and with parameter

"op": "getUserCenterEnertyDataByPlantid",

Python seems to return an error parsing the json

Edit: It seems that I somehow cannot get authorised for this Api part but I can for the other ones which doesn't make sense to me. Would you know anything about this?

@Sjord
Copy link
Owner

Sjord commented May 12, 2020

Did you provide the plantId and language parameters? Try this:

def get_user_center_energy_data_by_plant_id(self, plant_id):
    response = self.session.post(
        self.get_url("newTwoPlantAPI.do"),
        params={"op": "getUserCenterEnertyDataByPlantid"},
        data={"plantId": plant_id, "language": 1},
    )
    return response.json()

@NathanealV
Copy link
Author

Yes, that seems to work! Thank you for that.

@NathanealV
Copy link
Author

Is there any way to login and complete a GET/POST request all in the same go/same url?

@Sjord
Copy link
Owner

Sjord commented May 14, 2020

No, I don't think so. You first need to login and then you can use the session to retrieve information.

@NathanealV
Copy link
Author

NathanealV commented May 14, 2020

Ah ok. I was planning to use a third-party interface that gets JSON data but it only provides 1 URL and so I don't know if I can do this. Thank you. I was planning to do it without the use of Python.

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