carwings icon indicating copy to clipboard operation
carwings copied to clipboard

INVALID PARAMS again in EU

Open avleen opened this issue 3 years ago • 15 comments

I know this was recently addressed in #34 , something seems fishy again. I'm not sure if it's me, although I'm not trying to do anything complicated.

Setup: New docker container, Go 1.15.12

$ go get -v github.com/joeshaw/carwings/cmd/carwings2

$ /root/go/bin/carwings -username 'XXXXX' -password 'XXXXX' -region NE -debug battery
Logging into Carwings...
POST /api_v200413_NE/gdc/InitialApp_v2.php HTTP/1.1
Host: gdcportalgw.its-mo.com
Content-Length: 38
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip

initial_app_str=9s5rfKVuMrT03RtzajWNcA

HTTP/1.1 200 OK
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8
Date: Wed, 12 May 2021 17:04:01 GMT
Server: Apache
Strict-Transport-Security: max-age=15768000

45
{"status":200,"message":"success","baseprm":"88dSp7wWnV3bvv9Z88zEwg"}
0



Error loading session from /root/.carwings-session: open /root/.carwings-session: no such file or directory
POST /api_v200413_NE/gdc/UserLoginRequest.php HTTP/1.1
Host: gdcportalgw.its-mo.com
Content-Length: 128
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip

Password=XXXXX&RegionCode=NE&UserId=XXXXX&initial_app_str=9s5rfKVuMrT03RtzajWNcA

HTTP/1.1 200 OK
Connection: close
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8
Date: Wed, 12 May 2021 17:04:02 GMT
Server: Apache
Strict-Transport-Security: max-age=15768000

2d
{"status":"-2010","message":"INVALID PARAMS"}
0



ERROR: received status code -2010 (INVALID PARAMS)

Happy to do lots of debugging and digging, just not sure where to start :)

avleen avatar May 12 '21 17:05 avleen

I got the exact same problem today. Anything new about this?

mstoebe avatar Oct 02 '21 12:10 mstoebe

Had a closer look a the code this afternoon but all I Could find is that the login request to carwings fails with this error code. But I couldn't find out what causes the error. The passed params seem quite reasonable to me... :/ No idea how to find out what's going on here.

mstoebe avatar Oct 02 '21 19:10 mstoebe

No, sorry. I am not in Europe or Japan so I don't have access to the apps or APIs used in those regions. Unless someone else in those regions reverse engineers the differences, I won't be able to fix things.

joeshaw avatar Oct 02 '21 19:10 joeshaw

Ok, thanks. Then I will try to find out more.

mstoebe avatar Oct 02 '21 19:10 mstoebe

Doesn't look to good.

A quick look in the app package reveals that the original nissan app sends data to several trackers (firebase, google and one more). I checked the http requests from the app with Proxyman on the iPhone and it seems, they completely changed the API, not only the baseURL. It seems they are using oauth now and are talking to a set of subdomains within the domain kamereon.io. So, I guess, that's it. No quick fix possible IMHO.

What a shame. :(

mstoebe avatar Oct 02 '21 20:10 mstoebe

they completely changed the API, not only the baseURL. It seems they are using oauth now and are talking to a set of subdomains within the domain kamereon.io

Carwings has long since been replaced by a new API. If anybody is interested, I've implemented the relevant parts as part of https://github.com/evcc-io/evcc/ in Go based on https://github.com/Tobiaswk/dartnissanconnect

andig avatar Oct 02 '21 21:10 andig

Just to be sure, when you talk about 'replaced API', are you still talking about the older ZE1 which uses the 'Nissan EV' app ? Or the newer model (afaik from 04/2019) which uses the NissanConnect app ? I have the older one and I am using pycarwings2 from my smart home. Since some time, only 1 out of 4 or 5 requests ends successfully. But apparently they didn't completely switch off the carwings API.

Ez2517-Git avatar Oct 03 '21 08:10 Ez2517-Git

I‘m talking about NissanConnect. Sorry for the confusion. I.e. replaced was referring to newer cars no longer using carwings. Carwings is still working for me (EU) for older models.

andig avatar Oct 03 '21 08:10 andig

Ah, didn't know that. That might be the reason why EVCC can see and read my Leaf (MY21) while the carwings lib can't. Now that I look at it again I notice the vehicle/nissan directory next to the carwings.go file... ;) so maybe there is hope after all.

mstoebe avatar Oct 03 '21 09:10 mstoebe

Given that this API no longer works (and I don't have any way to test the kamereon.io API) I'm inclined to archive this repository. For the US API, I've implemented it in https://github.com/joeshaw/leaf but for the EU/JP APIs I'd be happy to point folks to other implementations and tools they like. Let me know what you all think!

joeshaw avatar Oct 12 '21 15:10 joeshaw

Given that this API no longer works

@joeshaw you've caught me off-guard and now I'm surprised. I'm using this precise repo as part of https://github.com/evcc-io/evcc and just five minutes ago did a successful session with a 2017 EU Leaf. It does work?!

andig avatar Oct 12 '21 15:10 andig

@andig Hmm, ok, I don't understand the compatibility matrix then. All I know for certain that it doesn't work with any US vehicles.

If the kamereon.io API works for all EU vehicles, it's probably the right way forward. You've gotta assume that this API is going to break for everyone at some point.

In any case, I don't have an EU vehicle so I am flying blind in this respect. I can take patches from folks, and am happy to do so, but I have no ability to verify whether they are correct.

joeshaw avatar Oct 12 '21 16:10 joeshaw

To my knowledge (comments welcome!), the kamereon API only works for vehicles from April 2019 on (that use the Nissan Connect app). Older cars (including the ZE1 until April 2019) still use (and most probably will continue to use) the carwings API.

Ez2517-Git avatar Oct 12 '21 17:10 Ez2517-Git

Confirmed!

andig avatar Oct 12 '21 18:10 andig

Note https://gitlab.com/tobiaswkjeldsen/dartcarwings/-/commit/fad13b50ddcb1e8695453e2e5dcb38082e3514c6, although I can confirm the old uri still working for EU.

andig avatar Oct 23 '21 14:10 andig