Comments (9)
Something like this might work:
public function getLocation() {
$initResult = $this->sendRequest('MyCarFinderRequest.php');
$result = new stdClass;
$code = $initResult->status;
if (200 == $code && !empty($this->resultKey)) {
$start = time();
while (true) {
$result = $this->sendRequest('MyCarFinderResultRequest.php', ['resultKey' => $this->resultKey]);
// Don't get stuck forever
if (time() - $start < 100) {
if (1 != $result->responseFlag) {
echo "Still not ready...\n";
}
sleep(5);
continue;
}
else {
echo "Taking too long. Have to give up.\n";
}
break;
}
}
return $result;
}
from nissan-connect-php.
Is "find my car" a new feature in the Nissan LEAF official app, for newer LEAF models ?
I have never seen that in my version of the app.
from nissan-connect-php.
Hm, it might be? My app version is 3.0.6, last updated in November 2016. It's from Nissan Europe though, so maybe it's for European users? My Leaf is a 2016 model so it might be newer models only perhaps.
I also noticed the endpoint my app uses is a bit different, and all the requests goes to https://gdcportalgw.its-mo.com/gworchest_160803EC/gdc/
from nissan-connect-php.
I'd need a PR to integrate this functionality, as I don't have access to it.
If you tested the above function, and it works, I can integrate that.
from nissan-connect-php.
Well kinda, but it has some debugging info that is unnecessary if it is to be pushed to master. I also realized that there was a waitUntilSuccess() method that did most of what I do there, so the simplest implementation of this is really just:
public function getLocation() {
$result = $this->sendRequest('MyCarFinderRequest.php');
return $this->waitUntilSuccess('MyCarFinderResultRequest.php');
}
A var_dump of the result will give you something like this:
object(stdClass)#3 (9) {
["status"]=>
int(200)
["responseFlag"]=>
string(1) "1"
["resultCode"]=>
string(1) "1"
["timeStamp"]=>
string(19) "2017-10-12 18:38:19"
["Location"]=>
object(stdClass)#12 (12) {
["Position"]=>
string(11) "UNAVAILABLE"
["LocationType"]=>
string(5) "WGS84"
["LatitudeMode"]=>
string(5) "NORTH"
["LongitudeMode"]=>
string(4) "EAST"
["Home"]=>
string(7) "OUTSIDE"
["LatitudeDeg"]=>
string(2) "99"
["LatitudeMin"]=>
string(2) "99"
["LatitudeSec"]=>
string(4) "9999"
["LongitudeDeg"]=>
string(1) "9"
["LongitudeMin"]=>
string(2) "99"
["LongitudeSec"]=>
string(4) "9999"
["Country"]=>
string(0) ""
}
["receivedDate"]=>
string(16) "2017/10/12 18:38"
["TargetDate"]=>
string(16) "2017/10/12 18:38"
["lat"]=>
string(15) "1.234567890"
["lng"]=>
string(15) "1.234568790"
}
I can create a pull request for you.
from nissan-connect-php.
Merged in #15
from nissan-connect-php.
Where is the MyCarFinderRequest.php file? Do we need it to make it work?
Can this be called at the same time then a normal status request? How? Thanks!
from nissan-connect-php.
You just need to call the getLocation()
method after getStatus()
. For example:
$nc = new NissanConnect('YourUsername', 'YourPassword');
$status = $nc->getStatus();
$loc = $nc->getLocation();
var_dump($status, $loc);
from nissan-connect-php.
@Raiden38 This is not available to everyone.
If you have this feature in the Nissan official app, then the code posted by carestad should work.
from nissan-connect-php.
Related Issues (20)
- "status":"-2010","message":"INVALID PARAMS" HOT 2
- get-leaf-location example not working HOT 1
- Base URL Changed Again? HOT 3
- Issue with last Commit HOT 6
- Issue with new API -- No battery info? HOT 4
- Intermittent Connexion Issues? HOT 11
- Receiving INVALID PARAMS response HOT 1
- does not work since mid-December 2018 .... HOT 8
- Leaf Gen2 HOT 8
- Nissan changed api again HOT 8
- New Leaf 2019 Protocol HOT 15
- New Response since Nov 21st? HOT 2
- Response Authentication error HOT 7
- New fix does not work when changing request source. HOT 2
- API error, NoRecordInDatabase HOT 3
- BlahBlah?? HOT 10
- The return of the BlahBlah code :( HOT 4
- Here we go again! :) HOT 4
- Still getting Unauthorized response after last update HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nissan-connect-php.