gboudreau / nissan-connect-php Goto Github PK
View Code? Open in Web Editor NEWUse the Nissan Connect (was Carwings) API using a simple PHP class.
License: GNU General Public License v3.0
Use the Nissan Connect (was Carwings) API using a simple PHP class.
License: GNU General Public License v3.0
It looks like Nissan changed their API (or API URL) again. Within the European Nissan EV app they are now stating that a new version of the app is available and the old app has stopped working by July 29th.
Does anyone know the new API configuration so this PHP class can be updated as well?
Seems I have been getting a new formatted response to the pull inquiry:
[03-Dec-2019 21:02:48 Canada/Eastern] [2019-12-03 21:02:48] [NissanConnect] Response: {"status":200,"VoltLabel":{"HighVolt":"240","LowVolt":"120"},"BatteryStatusRecords":{"OperationResult":"START","OperationDateAndTime":"Dec 3, 2019 08:50 PM","BatteryStatus":{"BatteryChargingStatus":"NOT_CHARGING","BatteryCapacity":"240","BatteryRemainingAmount":"74","BatteryRemainingAmountWH":"11600","BatteryRemainingAmountkWH":"","SOC":{"Value":"31"}},"PluginState":"NOT_CONNECTED","CruisingRangeAcOn":"64000","CruisingRangeAcOff":"75000","TimeRequiredToFull":{"HourRequiredToFull":"24","MinutesRequiredToFull":"0"},"TimeRequiredToFull200":{"HourRequiredToFull":"9","MinutesRequiredToFull":"30"},"TimeRequiredToFull200_6kW":{"HourRequiredToFull":"5","MinutesRequiredToFull":"30"},"NotificationDateAndTime":"2019/12/04 01:50","TargetDate":"2019/12/04 01:50"}}
Not quite sure if it's a new way of getting the data or just my car that is causing some troubles… The nissan connect app always tells me that it cannot contact my car but the website, seems to work fine. Did you notice any changes on your side?
First, let me thank you for posting a new fix on Oct 24th, I am sooo happy to be able to use my custom webpage again! The issue I am having is that when you change source, or after a delay, the script does not work anymore. In the issue page, you mention to delete the json cache from the server. When I do that, it works fine on my PC. Then I check the page on my iphone, and it does not work anymore. I go back on my pc browser (that was working) and it's not working anymore. If I delete back that json file, it works again, until I try from another source.
Do you think we could remove that file save/reading? Can it maybe delete the file after sending the request?
Salut!!!
Even with the fix that you have done a few days ago (thanks for that btw!!), I still get this error message:
Request for 'POST https://icm.infinitiusa.com/NissanConnectEVProd/rest/auth/authenticationForAAS' failed. Response received: <title>Error</title>Unauthorized
I am not quite sure what might be the issue, as I just overwrited the class with the new content, just like I do normally.
Error_Log:
[01-Feb-2022 22:45:25 Canada/Eastern] [2022-02-01 22:45:25] [NissanConnect] Request: POST https://icm.infinitiusa.com/NissanConnectEVProd/rest/auth/authenticationForAAS {"authenticate":{"userid":"XXXXXXXXXXXXXX","password":"XXXXXXXXXXXXXX","brand-s":"N","language-s":"en","country":"CA"}}
[01-Feb-2022 22:45:25 Canada/Eastern] [2022-02-01 22:45:25] [NissanConnect] Request for 'POST https://icm.infinitiusa.com/NissanConnectEVProd/rest/auth/authenticationForAAS' failed. Response received: <html><head><title>Error</title></head><body>Unauthorized</body></html>. Will retry.
[01-Feb-2022 22:45:25 Canada/Eastern] [2022-02-01 22:45:25] [NissanConnect] Request: POST https://icm.infinitiusa.com/NissanConnectEVProd/rest/auth/authenticationForAAS {"authenticate":{"userid":"XXXXXXXXXXXXXX","password":"XXXXXXXXXXXXXX","brand-s":"N","language-s":"en","country":"CA"}}
Any ideas?
Hi,
Thanks for you work, I've used it to create a small 'batterystatus' cli for myself last months.
Recently it stopped working (as the Android 'Leaf Manager' app), raising a 404....
BUT the 'leaf manager' app apparently started working again:
I see the author of the app talking here:
http://www.mynissanleaf.com/viewtopic.php?f=31&t=2214&sid=0735bb59ec930c8b6f2e95cb6f308e3b&start=120
fyi, the app I mean; https://play.google.com/store/apps/details?id=no.darkspawns.leafmanager
this python api also fixed stuff apparently: https://github.com/jdhorne/pycarwings2/commits/master
If I find time, i'll see if I can have a look into this too, but my php is a little rusty :-)
I don't think this is an issue with the nissan-connect-php class, but I wanted to raise it just in case.
I'm no longer getting updated battery info after the switch to the new API (Was working fine until May 27 when the old API shut down) It also updates fine on the Nissan Owners Portal, so this issue is specific to the new API:
php test.php
[2018-05-31 09:43:31] [NissanConnect] Request: POST https://icm.infinitiusa.com/NissanLeafProd/rest/auth/authenticationForAAS {"authenticate":{"userid":"[email protected]","password":"MyPassword","brand-s":"N","language-s":"en","country":"US"}}
[2018-05-31 09:43:41] [NissanConnect] Response: {"vehicles":[{"uvi":"<MyVIN>","brands":"N","modelcode":"17216","modelname":"LEAF","modelyear":"2016","extcolor":"PEARL WHITE","nickname":"2016 Leaf","pinAndPassword":null,"batteryRecords":null,"interiorTempRecords":null,"subcriptionList":null,"genType":null,"deviceId":null,"svlStatus":null,"accountId":null,"contactId":null,"subscriberType":null,"subscriptionId":null,"firstName":null,"lastName":null,"rdlRequestId":null,"rdulRequestId":null,"accountStatus":null,"productSpecificationCode":null,"remoteStartReqId":null,"remoteStopReqId":null,"enrollmentCompleted":true}],"authenticationInfo":{"pinConfigured":false,"securityQuestions":null},"displayMessage":"BatteryStatusRecords not available for the user","displayNoTemperatureMessage":"InteriorTemperature Records are not available for the VIN","accountID":"<accountID>","authToken":"<authToken>","status":200}
[2018-05-31 09:43:41] [NissanConnect] Saving authToken, VIN and accountID into local file /tmp/.nissan-connect-storage-<redacted>.json
[2018-05-31 09:43:41] [NissanConnect] Request: POST https://icm.infinitiusa.com/NissanLeafProd/rest/battery/vehicles/<MyVIN>/getChargingStatusRequest []
An error occurred: Non-JSON response received for request to 'battery/vehicles/<MyVIN>/getChargingStatusRequest'. Response received: ""
I checked the app itself with mitmproxy, and the official Nissan App has the same issue. I just have never noticed because I never use the official app anymore.
Any thoughts on how to resolve this? Everything else in the new API seems to work. HVAC start/stop, driving and electricity records, etc. Everything is fine except for battery status updates.
I got this message since last 2 days:
Request for 'GET https://icm.infinitiusa.com/NissanLeafProd/rest/battery/vehicles/1N4AZ1CP6XXXXXXXX/getChargingStatusRequest' failed. Response received: "<html><head><title>JBoss Web\/7.4.10.Final-redhat-1 - JBWEB000064: Error report<\/title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--><\/style> <\/head><body><h1>JBWEB000065: HTTP Status 401 - Unauthorized<\/h1><HR size=\"1\" noshade=\"noshade\"><p><b>JBWEB000309: type<\/b> JBWEB000067: Status report<\/p><p><b>JBWEB000068: message<\/b> <u>Unauthorized<\/u><\/p><p><b>JBWEB000069: description<\/b> <u>JBWEB000121: This request requires HTTP authentication.<\/u><\/p><HR size=\"1\" noshade=\"noshade\"><h3>JBoss Web\/7.4.10.Final-redhat-1<\/h3><\/body><\/html>"
This isn't really an issue with nissan-connect-php as such, but since I lack a better place to discuss it, I'm bringing it up here.
I can update the battery status, from PHP, from the NissanConnect web site, and even with the official Android app.
However, I cannot start climate control. It sends the command via https://gdcportalgw.its-mo.com/api_v190426_NE/gdc/ACRemoteRequest.php, but then gets an error message when looking for the result via ACRemoteResult.php.
Response received: {"status":"-6004","ErrorCode":"-6004","ErrorMessage":"NoRecordInDatabase"}
Does anyone else have the same problem? I've tried with Nissan customer service, but they have no idea, and I think the customer service people don't even have a way of passing the issue on to someone who has enough access/knowledge to be able to troubleshoot.
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
Hi!
This is not an issue.
When you use Nissan Connect, you can get alot of stats from the car (driving km, consumption, etc etc.). Do you think there would be a way to get this information? This way, we could automaticaly builld our own stats page. Thanks!
Using the password that I log into the CarWings website with, and using a copy of the example app, I just get an INVALID PARAMS response:
$ php getStatus.php
[2018-08-04 23:08:44] [NissanConnect] Request: POST https://gdcportalgw.its-mo.com/gworchest_160803EC/gdc/InitialApp.php {"custom_sessionid":"","initial_app_strings":"geORNtsZe5I4lRGjG9GZiA","RegionCode":"NE","lg":"en-US","DCMID":"","VIN":"","tz":"Europe\/Dublin"}
[2018-08-04 23:08:45] [NissanConnect] Response: {"status":200,"message":"success","baseprm":"uyI5Dj9g8VCOFDnBRUbr3g"}
[2018-08-04 23:08:45] [NissanConnect] Request: POST https://gdcportalgw.its-mo.com/gworchest_160803EC/gdc/UserLoginRequest.php {"UserId":"[email protected]","Password":"XXXXXXXXXXXX","custom_sessionid":"","initial_app_strings":"geORNtsZe5I4lRGjG9GZiA","RegionCode":"NE","lg":"en-US","DCMID":"","VIN":"","tz":"Europe\/Dublin"}
An error occurred: Request for 'UserLoginRequest.php' failed. Response received: {"status":"-2010","message":"INVALID PARAMS"}
I see the same error using the github.com/joeshaw/carwings code, so this isn't PHP specific - just frustrating :-/
Thanks,
Andrew McMillan.
So the issue starts again today (the query worked fine this morning, but not this evening):
Non-JSON response received for request to 'POST https://icm.infinitiusa.com/NissanEVProd/rest/auth/authenticationForAAS'. Response received: BlahBlah
Originally posted by @gboudreau in #35 (comment)
The current Base URL of:
https://gdcportalgw.its-mo.com/gworchest_160803A/gdc/
Is returning this error message:
Http Status: 404: Not Found:
<title>404 Not Found</title>The requested URL /gworchest_160803A/gdc/UserLoginRequest.php was not found on this server.
Did they change the base URL again or is this a temporary issue?
-Jeremy
Is there a way to send the startCharge function without waiting for an answer, just like the Climate Control? Just to avoid timeouts?
Perhaps that would make sense?
public function startCharge($waitForResult=FALSE) {
$this->prepare();
$result = $this->sendRequest('BatteryRemoteChargingRequest.php');
if ($waitForResult) {
// Wait until it completes
return $result;
}
}
Thanks!
It's this time of year where they change everything and it does not work anymore! So any request will result in a Unauthorised request. I guess they changed the API authentification process or key... Anyways, if you can update your api with the new authentification code, if available, would be awesome!
Thanks again!
Steven
Is it possible to implement the find my car function as well to get the latitude and longitude of the car?
Hello,
I'm trying to use your example code but I got this error:
An error occurred: Request for 'RemoteACRecordsRequest.php' failed. Response received: {"status":400,"message":"\u8981\u6c42\u30a8\u30e9\u30fc","OperationDateAndTime":""}
The authentication should be ok because I got a different error if I specify fake user or password.
Thanks for your help
Enhancement - Not an Issue
With the new Leaf's gen2 available, can you check if we can get the folowing (they are available in Nissan Connect app):
Thanks!
Since April 4th, I get this error when pulling status: Missing 'RemoteACRecords' in response received in call to 'RemoteACRecordsRequest.php': {"status":200}
Sometimes, it seems that the requests works fine but sometimes I get this:
Non-JSON response received for request to 'GET https://icm.infinitiusa.com/NissanLeafProd/rest/battery/vehicles/1N4AZ0CP8FC30XXXX/getChargingStatusRequest'. Response received: ""
With the last update, I get this issue: Request for 'battery/vehicles/1N4AZ0CP8FC30XXXX/getChargingStatusRequest' failed. Response received: "<html><head><title>JBoss Web\/7.4.10.Final-redhat-1 - JBWEB000064: Error report<\/title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--><\/style> <\/head><body><h1>JBWEB000065: HTTP Status 405 - <\/h1><HR size=\"1\" noshade=\"noshade\"><p><b>JBWEB000309: type<\/b> JBWEB000067: Status report<\/p><p><b>JBWEB000068: message<\/b> <u><\/u><\/p><p><b>JBWEB000069: description<\/b> <u>JBWEB000125: The specified HTTP method is not allowed for the requested resource.<\/u><\/p><HR size=\"1\" noshade=\"noshade\"><h3>JBoss Web\/7.4.10.Final-redhat-1<\/h3><\/body><\/html>"
I have a Problem with the User-Login:
An error occurred: Request for 'UserLoginRequest.php' failed. Response received: {"status":"-2010","message":"INVALID PARAMS"}
I have a Modelyear 2014 Leaf made for Austria.
Maybe there is a general Issue?
thanks for the library!
the get location example doesn't seem to work for some reason. the other tests run fine.
here's the error:
Prepare Session
Login...
request_location
ERROR:pycarwings2.pycarwings2:carwings error -5256: [MyCarFinder] API call error
Traceback (most recent call last):
File "get-leaf-location.py", line 32, in <module>
result_key = l.request_location()
File "C:\Python27\lib\site-packages\pycarwings2\pycarwings2.py", line 415, in request_location
"UserId": self.session.gdc_user_id, # this userid is the 'gdc' userid
File "C:\Python27\lib\site-packages\pycarwings2\pycarwings2.py", line 101, in _request_with_retry
ret = self._request(endpoint, params)
File "C:\Python27\lib\site-packages\pycarwings2\pycarwings2.py", line 141, in _request
raise CarwingsError
pycarwings2.pycarwings2.CarwingsError
When I try to get the status of my vehicle, I receive the error below. I am using the latest code. I see that you encountered this error previously and fixed it so a similar change may need to be made. Thanks
An error occurred: Invalid 'OperationResult' received in call to 'RemoteACRecordsRequest.php': ELECTRIC_WAVE_ABNORMAL
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.