-
Notifications
You must be signed in to change notification settings - Fork 19
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
Nissan API Change Again? #26
Comments
I'm a new user who hasn't used this library before and I'm seeing the same INVALID PARAMS: -2010 error. Here is a log with username and password (hopefully) redacted: DEBUG:root:login = email@example.com, password = ----------, region = NE
Prepare Session
Login...
DEBUG:pycarwings2.pycarwings2:invoking carwings API: https://gdcportalgw.its-mo.com/api_v190426_NE/gdc/InitialApp_v2.php
DEBUG:pycarwings2.pycarwings2:params: {
"RegionCode": "NE",
"custom_sessionid": "",
"initial_app_str": "9s5rfKVuMrT03RtzajWNcA",
"lg": "en-US"
}
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): gdcportalgw.its-mo.com:443
DEBUG:urllib3.connectionpool:https://gdcportalgw.its-mo.com:443 "POST /api_v190426_NE/gdc/InitialApp_v2.php HTTP/1.1" 200 None
DEBUG:pycarwings2.pycarwings2:Response HTTP Status Code: 200
DEBUG:pycarwings2.pycarwings2:Response HTTP Response Body: b'{"status":200,"message":"success","baseprm":"88dSp7wWnV3bvv9Z88zEwg"}'
DEBUG:pycarwings2.pycarwings2:invoking carwings API: https://gdcportalgw.its-mo.com/api_v190426_NE/gdc/UserLoginRequest.php
DEBUG:pycarwings2.pycarwings2:params: {
"Password": "--------------------",
"RegionCode": "NE",
"UserId": "[email protected]",
"custom_sessionid": "",
"initial_app_str": "9s5rfKVuMrT03RtzajWNcA"
}
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): gdcportalgw.its-mo.com:443
DEBUG:urllib3.connectionpool:https://gdcportalgw.its-mo.com:443 "POST /api_v190426_NE/gdc/UserLoginRequest.php HTTP/1.1" 200 None
DEBUG:pycarwings2.pycarwings2:Response HTTP Status Code: 200
DEBUG:pycarwings2.pycarwings2:Response HTTP Response Body: b'{"status":"-2010","message":"INVALID PARAMS","resultKey":""}'
ERROR:pycarwings2.pycarwings2:carwings error INVALID PARAMS: -2010
Traceback (most recent call last):
File "./get-latest-battery.py", line 47, in <module>
leaf = s.get_leaf()
File "/usr/local/lib/python3.5/dist-packages/pycarwings2/pycarwings2.py", line 217, in get_leaf
self.connect()
File "/usr/local/lib/python3.5/dist-packages/pycarwings2/pycarwings2.py", line 191, in connect
"Password": encodedPassword,
File "/usr/local/lib/python3.5/dist-packages/pycarwings2/pycarwings2.py", line 165, in _request
raise CarwingsError("INVALID PARAMS")
pycarwings2.pycarwings2.CarwingsError: INVALID PARAMS I am in the UK, running this on Python 3.5.3 on a Raspberry Pi using the version installed via Pip3. |
@filcole hope you are good. Same for me starting with a fresh HA install and your integration
|
Has anyone made any progress with this problem? I decided to check back in again with the latest version of pycarwings2 as I actually do want to use it for something now, but I'm still seeing the same problem with the latest version. And yes, I am running the patch in #29 which changes the user agent to empty string, but it doesn't seem to be related to my issue. I've noticed that the password parsing in the example scripts is really bad - I originally had a % character in my Nissan password and that was throwing a Python syntax error complaining about that character (it looks like python was trying to interpret it as a string function instead of passing it through as escaped data) so it occurs to me that the example scripts or pycarwings2 itself may not be handling certain punctuation in passwords very well, and potentially causing this error by mangling the password. (eg the INVALID params reported back by Nissan may just be due to the encoded password being incorrect after being mangled) Unfortunately the Nissan website does actually require punctuation in the password! Is anyone using this successfully who could offer any suggestions ? If it works for some people and not others with no apparent correlation maybe it is in fact handling of certain password characters that is the issue since everyone is using different passwords.. |
Ok, by hard coding the username/password into the Not sure what to check next as unlike most other people here I have never had a working configuration, which is a bit harder to troubleshoot than an installation that has previously been working. One thing I also forgot to mention earlier in this thread is that I have a 2016 30kWh Leaf - which uses the older Nissan Connect EV app, not the newer app used by mid 2018 Leaf 2 and later - could this have a bearing on my issue? |
Found the problem. For anyone reading, this was in fact fixed by applying the user agent fix in #29 I initially installed the pip version of pycarwings2 accidentally when I thought I was installing a locally downloaded copy of the PR with the fix included and didn't realise until I looked at the package in system site-files. I am puzzled why I had the same issue all the way back in February though. |
I'm still seeing this as using Home Assistant OS version: core-2021.9.3:
|
The fix didn't make it into that release of Home Assistant -- I don't know why. Looking at the docker image for the current Home Assistant stable release it's still on pycarwings 2.10. |
Yep, this has been working fine for me in the last couple of releases of homeassistant. Please see if you can reproduce using the https://github.com/filcole/pycarwings2/tree/master/examples examples with your login credentials. |
Sorry if I missed the memo but I can't make heads or tails of this thing. Reading all the separate posts is confusing and fingers are pointing everywhere. I started my journey with HA about exactly a year ago with this Nissan integration and have had this exact problem since then and it's still crazy pants. What exactly needs to be done to fix this by step? |
Sorry for confusing previous posts. I'm now running pycarwings 2.11 and python3. When I do so, I get the same "INVALID PARAMS: -2010" message that I do through HA. I've experimented, and this is the SAME message that I get when I give a bad username and/or password. This leads me to conclude that somehow my credentials aren't being accepted. My username is an email address. Does any of this seem unusual? |
@DrGomek could it be the region? |
@jmason I'm in the US, so I've been using NNA. I also tried NE, NML, and WORLD -- all with the same response |
Note that I can set my username and password to ANYTHING and I get the same response. |
I would suggest to try a password without '_'. I remember that I had a random password at first, which worked on the 'my leaf' web portal, but didn't work on Carwings. (however I dont recall which special chars I used back then) |
Thanks for the suggestion. I updated my password - the only symbol is a "!" now, and I get the same result. :( |
I've had a try with the current HEAD of that tree and the get-leaf-info.py example script is working fine with my credentials at the moment (NE region). |
The good news is that pycarwings 2.11 is now showing up correctly in Home Assistant 2021.9.6 🎉 -- however I think the Nissan backend API change from https://gdcportalgw.its-mo.com/api_v190426_NE/gdc/ to https://gdcportalgw.its-mo.com/api_v210707_NE/gdc/ is now breaking it? I see this in the debug logs:
|
I have hand-applied the change in commit 627f9e1 to my HA's version of pycarwings2 and that fixes it for me. |
The base URL has been updated in pycarwings2 for over a year - this can be closed. |
This appears to be broken again.
HA log: carwings error INVALID PARAMS: -2010
An unknown error occurred while connecting to Nissan: <class ‘pycarwings2.pycarwings2.CarwingsError’>
The text was updated successfully, but these errors were encountered: