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

I get a 502 error message #2

Closed
fbosman opened this issue Jun 20, 2019 · 4 comments
Closed

I get a 502 error message #2

fbosman opened this issue Jun 20, 2019 · 4 comments

Comments

@fbosman
Copy link
Contributor

fbosman commented Jun 20, 2019

I do not get any info from the Growatt API, when debugging the return is 502.
My credentials are ok..

@sincze
Copy link
Owner

sincze commented Jun 23, 2019

Did you switch on all debugging so we can see if you obtain a token correctly?
502 would indicate some sort of server problem. As the Growatt installation that I monitor is working this seems unlikely and needs some more investigation indeed.

@fbosman
Copy link
Contributor Author

fbosman commented Jun 25, 2019

I did find the issue. The password MD5 is not correct in a standard md5 calculation.
I found a python script:
Normal MD5, except add c if a byte of the digest is less than 10.
"""
password_md5 = hashlib.md5(password.encode("utf-8")).hexdigest()
for i in range(0, len(password_md5), 2):
if password_md5[i] == "0":
password_md5 = password_md5[0:i] + "c" + password_md5[i + 1 :]
return password_md5
Can you merge this in your code?

@sincze
Copy link
Owner

sincze commented Jun 25, 2019

Great find, however I am not a programmer and use the MD5 calculation as provided by PHP.

PHP Manual
W3Schools
Can you rewrite it to PHP and make a pull request?

I assume the answer is just, but just in case.
Did you test your generated python password in the PHP script? Line 50?

define('PASSWORD', '*****');

And then it works?

Small alternative would be to change your password for the website,
and the MD5 calculation should do it's job.

@sincze
Copy link
Owner

sincze commented Jun 27, 2019

Fixed with merge Request. tnx.

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