growatt_api_client icon indicating copy to clipboard operation
growatt_api_client copied to clipboard

Use newTwoLoginAPI to login

Open Sjord opened this issue 3 years ago • 4 comments

Closes #30

Sjord avatar Jun 28 '22 07:06 Sjord

I use newTwoLoginAPI but I get a login error:

  File "/growatt_api_client/venv/lib/python3.6/site-packages/growatt-0.0.4-py3.6.egg/growatt/__init__.py", line 71, in login
    result = self._back_success_response(response)
  File "/growatt_api_client/venv/lib/python3.6/site-packages/growatt-0.0.4-py3.6.egg/growatt/__init__.py", line 157, in _back_success_response
    raise GrowattApiError("Request failed: %s" % response)
growatt.GrowattApiError: Request failed: <Response [400]>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/growatt_api_client/venv/lib/python3.6/site-packages/growatt-0.0.4-py3.6.egg/growatt/__main__.py", line 9, in <module>
    api.login(username, password)
  File "/growatt_api_client/venv/lib/python3.6/site-packages/growatt-0.0.4-py3.6.egg/growatt/__init__.py", line 76, in login
    raise LoginError
growatt.LoginError

The Login and the pass are correct...

thomytp avatar Jul 16 '22 11:07 thomytp

@thomytp Did it work before? Have you tried quoting your username and password? Are you perhaps on another server?

Sjord avatar Jul 18 '22 08:07 Sjord

@thomytp Did it work before? Have you tried quoting your username and password? Are you perhaps on another server?

Hi,

Thanks for the Hard work on this. I just came across this 2 days ago and I am trying to install this to work with my New growatt SPH6000 inverter.

I have followed the instructions but unable to login.

I am able to login only on the server.growatt.com url website but not on the growatt us server url on the website.

I have quoted the username and password on the arguement line but it dosn work, I have edited the main_py file to add the username and password also with no luck.

With regards to the newTwoLoginAPI section in the init_py file, am I meant to change the username and password in double quote on line 68 into my username and password ( in the data brackets?)

""" password_md5 = hash_password(password) response = self.session.post( self.get_url("newLoginAPI.do"), self.get_url("newTwoLoginAPI.do"), data={"**userName**": username, "**password**": password_md5},

Thanks for your help.

Just to be sure I didnt miss any step, I followed the instructions you gave on the Setup page. I didnt edit the test.py file nor did I edit any other file aside of entering the username and password in the main_py file

username = "username" password = "password"

dejavuus avatar Jul 18 '22 19:07 dejavuus

@thomytp Did it work before? Have you tried quoting your username and password? Are you perhaps on another server?

@dejavuus sorry for the late response..

I can login in https://server.growatt.com/login but not in http://server-us.growatt.com. The Shine App works normal. I use your API since one year, without Problems...

Thanks for your Work..:-)

Greetings...

thomytp avatar Jul 24 '22 08:07 thomytp