Closed Raiden38 closed 5 years ago
Without access to an account that has such a vehicle on file, I can't test anything of that sort. My guess: they won't be available on the old API, but would be available on the new one.
I have a branch that uses the new API: https://github.com/gboudreau/nissan-connect-php/tree/new-api
Maybe you can try both that branch and master, and just by enabling DEBUG ($nissanConnect->debug = FALSE;
) you should be able to see the response received from the server, and thus see if the info you need is in there (for the indoor temp).
For the commands, searching other LEAF project on Github, you might find an answer to those. Otherwise, someone with a new LEAF on his account would need to use an HTTPS proxy to sniff the traffic of the Nissan Connect app.
Thanks for the reaply, the master API works very well with the Gen2. I will enable debut and see what the server gives. And will try to find the command for locking doors ;) And FYI, I'm still using a script from June with URL https://icm.infinitiusa.com/NissanLeafProd/rest/ and it works pretty good! :)
This is the response it gets.. Indoor temp would be inc-temp:
{
"batteryRecords": {
"operationResult": "START",
"lastUpdatedDateAndTime": "2019-01-17T18:33:31Z",
"batteryStatus": {
"batteryChargingStatus": "YES",
"batteryCapacity": 100,
"batteryRemainingAmount": 94,
"soc": {
"value": 94
}
},
"pluginState": "CONNECTED",
"cruisingRangeAcOn": 187000,
"cruisingRangeAcOff": 233000,
"timeRequired": null,
"timeRequired200": null,
"timeRequired200_6kW": {
"hourRequiredToFull": 1,
"minutesRequiredToFull": 30
},
"notificationDateAndTime": null
},
"temperatureRecords": {
"operationResult": null,
"operationDateAndTime": null,
"notificationDateAndTime": null,
"inc_temp": "13.5"
},
"noBatteryRecords": null,
"noTemperatureRecords": null,
"status": 200
}
For the temperature, this is the page it connects to, to start climate. Notice climateTemp at the end of the querystring... So maybe if we send this it would work:
https://carwings.mynissan.ca/owners/leaf/setHvacMY18?vin=1N4AZ1CP6JCXXXXXX&fan=on&climateTemp=22
The HVAC start on the new API is hvac/vehicles/{$this->config->vin}/activateHVAC
; looks pretty different than what you found. Not sure adding a param there would help.
You can try to modify this function:
public function startClimateControl($waitForResult = FALSE, $target_temperature = NULL) {
$this->prepare();
$params = array('executionTime' => date('c'));
if (!empty($target_temperature)) {
$params['climateTemp'] = $target_temperature;
}
$result = $this->sendRequest("hvac/vehicles/{$this->config->vin}/activateHVAC", $params);
return $result;
}
Ah, wait. I found some doc about it. I'll commit something in a few seconds.
Try the new version from here: https://github.com/gboudreau/nissan-connect-php/tree/new-api
Interior temperature will be in $status->interior_temperature
,
and you can set the target temperature with
$nissan-> startClimateControl(FALSE, 22, 'C');
or
$nissan-> startClimateControl(FALSE, 72, 'F');
Remote door lock has been added in the same branch (commit 575f8384287c0bf90c123920c5bc0bac67e1c8da).
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!