gboudreau / nissan-connect-php

Use the Nissan Connect (was Carwings) API using a simple PHP class.
GNU General Public License v3.0
38 stars 17 forks source link

New Leaf 2019 Protocol #29

Open cedric222 opened 5 years ago

cedric222 commented 5 years ago

Hi,

I replace my old leaf 2016, with a very new 2019, and the new apps is "Nissan Connect Services" and no more "Nissan Connect EV". Unfortunately, I have now a http 408 error with nissan-connect-php... do you know if someone already try to reverse engineering this new apps ?

thanks

cedric

Raiden38 commented 5 years ago

Use the New API, I have a 2018 and it works fine!

gboudreau commented 5 years ago

https://github.com/gboudreau/nissan-connect-php/tree/new-api

cedric222 commented 5 years ago

I will try. @Raiden38 do your cars works with "Nissan Connect Services" ? ( and not "Nissan Connect EV" ) Since April 2019, and the new 8 inch screen, seems there is some change.

Raiden38 commented 5 years ago

It written Nissan Connect EV & Services lol. Should be the latest version. I have the 8 inch screen also. Try the new API and let us know

howartp84 commented 5 years ago

2019 uses a new API from May onwards ("Nissan Connect Services"), which nobody has yet decoded and implemented yet to my knowledge. Tobias at MyLeaf is on with it, with my credentials for testing.

cedric222 commented 5 years ago

Sorry for the delay ! I don't have many time recently

Thanks @howartp84 for the info, let us know.

I test with the branch "new-api", and the result here is [2019-09-29 00:09:39][DEBUG] : [NissanConnect] Request: POST https://gdcportalgw.its-mo.com/api_v190426_NE/gdc/InitialApp_v2.php {"custom_sessionid":"","initial_app_str":"9s5rfKVuMrT03RtzajWNcA","RegionCode":"NE","lg":"en-US","DCMID":"","VIN":"","tz":"Europe\/Paris"} [2019-09-29 00:09:49][DEBUG] : [NissanConnect] Response: {"status":200,"message":"success","baseprm":"88dSp7wWnV3xxxxxxxxxxx"} [2019-09-29 00:09:49][DEBUG] : [NissanConnect] Request: POST https://gdcportalgw.its-mo.com/api_v190426_NE/gdc/UserLoginRequest.php {"UserId":"me@hotmail.com","Password":"toto","custom_sessionid":"","initial_app_str":"9s5rfKVuMrT03RtzajWNcA","RegionCode":"NE","lg":"en-US","DCMID":"","VIN":"","tz":"Europe\/Paris"} [2019-09-29 00:09:53][DEBUG] : [NissanConnect] Found resultKey in response: [2019-09-29 00:09:53][DEBUG] : [NissanConnect] Request for 'UserLoginRequest.php' failed. Response received: {"status":"-2010","message":"INVALID PARAMS","resultKey":""} Will retry. [20

The good new is the 2019 official apps is now usable, you can start heater in less then 20 seconds.. ( was more than 2 minutes with the 2016 Leaf apps )

gboudreau commented 4 years ago

I am myself using the new-api branch, which stopped working a while ago (see #32). The master branch, I can't use for quite a while. Not sure if it is working for anyone.

andig commented 4 years ago

I'm developing a PV-controlled EV charger at https://github.com/andig/evcc and would like to support the newer Nissans. If I understand correctly the protocol has not been decoded yet? Are you aware of https://github.com/gboudreau/LEAF_Carwings_EasyAccess/issues/8#issuecomment-520143453 and does that work? Also here is an explicit reference to Nissan Connect which seems to be the "new" api: https://github.com/Tobiaswk/dartnissanconnectna

gboudreau commented 4 years ago

@andig The correct code to use to connect to the API might depend on region (EU, North America, Japan), and MY of the LEAF. I'm in Canada, have a 2011 MY, and was using the new-api branch until it stopped working a while ago. I didn't take the time to reverse engineer the Android app, to see what was wrong with my code. I was recently told that the code available at https://gitlab.com/tobiaswkjeldsen/carwingsflutter is working. You might look there to get a working code example; I didn't yet take the time to look myself.

gboudreau commented 4 years ago

Follow up: so the new-api branch is working now; that branch should fix it for North America (it is working for my 2011 MY in Canada). For 2019+, I think a completely different API is required, but I'm not sure if it applies worldwide, or only in specific regions. Anyone has a 2019+ LEAF, and could test the new-api branch, and report if it works, and in which region they are?

gboudreau commented 4 years ago

OK, so I guess you'd need completely new code, something like this: https://github.com/Tobiaswk/dartnissanconnect/tree/master/lib/src That code connects to Kamereon platform in EU. If anyone wants to modify the code to replicate Tobiaswk's code, I'd be happy to review any PR.