Nissan Leaf Plugin

Posted on
Mon Jan 18, 2016 1:04 pm
dustysparkle offline
Posts: 54
Joined: Dec 14, 2015

Re: Nissan Leaf Plugin

Hmm, my guess is that you are being "logged out" of Nissan's system, and the plugin is not properly signing you back in. I haven't observed this behavior on the US servers, but maybe they're somehow different.

I'll modify the plugin to make it try logging in again if it gets an error. (And, I'll update the version number so you can properly 'upgrade' this time.)

Thanks for your feedback, and sorry for the problems.

Posted on
Mon Jan 18, 2016 10:19 pm
dustysparkle offline
Posts: 54
Joined: Dec 14, 2015

Re: Nissan Leaf Plugin

I think I've solved this problem, but Nissan Carwings is now throwing an Internal Server Error error every time I attempt to log in. :|

I'll have to wait until their service is restored for me to be able to test properly. Once that happens, I'll upload the new version to GitHub and post another update to this thread.

Posted on
Tue Jan 19, 2016 11:03 pm
dustysparkle offline
Posts: 54
Joined: Dec 14, 2015

Re: Nissan Leaf Plugin

OK, I've uploaded version 0.0.4 to GitHub, which should log you back in if Nissan automatically logs you out after some time. I couldn't test exactly your scenario, but I think I was able to simulate it pretty effectively.

In other words, as always, give it a shot and let me know how it goes. :wink:

Notes:
  • if possible, please delete your existing Leaf 'device' and add it back once you've upgraded the plugin.
  • a new setting is available in the plugin configuration dialog to enable debug logging, in case you need to report a problem. Note that, due to the way Nissan didn't secure their web service, these logs will contain your username, password, and VIN in plain text!
  • I had to move lots of code around for this version, so it's possible I introduced a bug somewhere. Hopefully not, but... you know. So it goes.

Posted on
Thu Jan 21, 2016 4:03 am
Gusten offline
Posts: 171
Joined: Dec 30, 2015
Location: Sweden, Gothenburg

Re: Nissan Leaf Plugin

Hi

This version is working a lot better. But it doesn't always update the "device" even if if the communication to Carwings seems to have worked.

I did a test

The car is plugged in and is charging (I XXXed the user and password)

Then this happened
21 jan 2016 10:01:05
Nissan Leaf requesting status for SJNFAAZE0U6007560
Nissan Leaf Debug posting to: https://nissan-eu-smartphone-biz.viaaq. ... phoneProxy
Nissan Leaf Debug <?xml version="1.0" ?><ns4:SmartphoneRemoteBatteryStatusCheckRequest xmlns:ns2="urn:com:hitachi:gdc:type:portalcommon:v1" xmlns:ns3="urn:com:hitachi:gdc:type:vehicle:v1" xmlns:ns4="urn:com:airbiquity:smartphone.vehicleservice:v1"><ns3:BatteryStatusCheckRequest><ns3:VehicleServiceRequestHeader><ns2:VIN>SJNFAAZE0U6007560</ns2:VIN></ns3:VehicleServiceRequestHeader></ns3:BatteryStatusCheckRequest></ns4:SmartphoneRemoteBatteryStatusCheckRequest>
Nissan Leaf Debug reading response
Nissan Leaf Debug response read; closing
Nissan Leaf Debug processing response
Nissan Leaf Debug response: <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns5:SmartphoneErrorType xmlns:ns4="urn:com:airbiquity:smartphone.vehicleservice:v1" xmlns:ns3="urn:com:hitachi:gdc:type:vehicle:v1" xmlns:ns5="urn:com:airbiquity:smartphone.common:v1" xmlns:ns2="urn:com:hitachi:gdc:type:portalcommon:v1">
<ErrorCode>9003</ErrorCode>
</ns5:SmartphoneErrorType>

Nissan Leaf error requesting status; logging in again and retrying
Nissan Leaf Debug logging in to EU region
Nissan Leaf Debug url: https://nissan-eu-smartphone-biz.viaaq. ... phoneProxy
Nissan Leaf Debug posting to: https://nissan-eu-smartphone-biz.viaaq. ... phoneProxy
Nissan Leaf Debug <?xml version="1.0" ?><ns2:SmartphoneLoginWithAdditionalOperationRequest xmlns:ns2="urn:com:airbiquity:smartphone.userservices:v1"><SmartphoneOperationType>SmartphoneLatestBatteryStatusRequest</SmartphoneOperationType><SmartphoneLoginInfo><UUID>96df5c33c680bdcd7b07ed51dfd484699fd19317</UUID><Locale>US</Locale><UserLoginInfo><userPassword>XXXXXXXX</userPassword><userId>XXXXXXX</userId></UserLoginInfo><AppVersion>1.40</AppVersion><SmartphoneType>IPHONE</SmartphoneType><DeviceToken>DUMMY1453366865.908155</DeviceToken></SmartphoneLoginInfo></ns2:SmartphoneLoginWithAdditionalOperationRequest>
Schedule Belysningsstyrning ir vardagsrum (delayed action)
Z-Wave sent "Belysning Walking closet" off
Z-Wave received "Belysning Walking closet" power load to 0.0 W
Nissan Leaf Debug reading response
Nissan Leaf Debug response read; closing
Nissan Leaf Debug processing response
Nissan Leaf Debug response: <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:SmartphoneLoginWithAdditionalOperationResponse xmlns:ns4="urn:com:airbiquity:smartphone.reportservice:v1" xmlns:ns7="urn:com:airbiquity:smartphone.common:v1" xmlns:ns3="urn:com:hitachi:gdc:type:report:v1" xmlns:ns5="urn:com:hitachi:gdc:type:vehicle:v1" xmlns:ns2="urn:com:airbiquity:smartphone.userservices:v1" xmlns:ns6="urn:com:airbiquity:smartphone.vehicleservice:v1">
<SmartphoneUserInfoType>
<VehicleInfo>
<Vin>SJNFAAZE0U6007560</Vin>
</VehicleInfo>
<Nickname>Gustens</Nickname>
</SmartphoneUserInfoType>
<ns4:SmartphoneLatestBatteryStatusResponse>
<SmartphoneBatteryStatusResponseType>
<ns3:BatteryStatusRecords>
<ns3:OperationResult>START</ns3:OperationResult>
<ns3:OperationDateAndTime>2016-01-21T08:28:24</ns3:OperationDateAndTime>
<ns3:BatteryStatus>
<ns3:BatteryChargingStatus>NORMAL_CHARGING</ns3:BatteryChargingStatus>
<ns3:BatteryCapacity>12</ns3:BatteryCapacity>
<ns3:BatteryRemainingAmount>9</ns3:BatteryRemainingAmount>
</ns3:BatteryStatus>
<ns3:PluginState>CONNECTED</ns3:PluginState>
<ns3:CruisingRangeAcOn>86680.0</ns3:CruisingRangeAcOn>
<ns3:CruisingRangeAcOff>110320.0</ns3:CruisingRangeAcOff>
<ns3:TimeRequiredToFull200>
<ns3:HourRequiredToFull>4</ns3:HourRequiredToFull>
<ns3:MinutesRequiredToFull>0</ns3:MinutesRequiredToFull>
</ns3:TimeRequiredToFull200>
<ns3:NotificationDateAndTime>2016-01-21T08:28:44</ns3:NotificationDateAndTime>
</ns3:BatteryStatusRecords>
<VehicleInfo>
<Vin>SJNFAAZE0U6007560</Vin>
</VehicleInfo>
<lastBatteryStatusCheckExecutionTime>2016-01-21T08:28:24.000Z</lastBatteryStatusCheckExecutionTime>
</SmartphoneBatteryStatusResponseType>
</ns4:SmartphoneLatestBatteryStatusResponse>
</ns2:SmartphoneLoginWithAdditionalOperationResponse>

Nissan Leaf logged in, vin: SJNFAAZE0U6007560, nickname: Gustens
Nissan Leaf Debug posting to: https://nissan-eu-smartphone-biz.viaaq. ... phoneProxy
Nissan Leaf Debug <?xml version="1.0" ?><ns4:SmartphoneRemoteBatteryStatusCheckRequest xmlns:ns2="urn:com:hitachi:gdc:type:portalcommon:v1" xmlns:ns3="urn:com:hitachi:gdc:type:vehicle:v1" xmlns:ns4="urn:com:airbiquity:smartphone.vehicleservice:v1"><ns3:BatteryStatusCheckRequest><ns3:VehicleServiceRequestHeader><ns2:VIN>SJNFAAZE0U6007560</ns2:VIN></ns3:VehicleServiceRequestHeader></ns3:BatteryStatusCheckRequest></ns4:SmartphoneRemoteBatteryStatusCheckRequest>
Nissan Leaf Debug reading response
Nissan Leaf Debug response read; closing
Nissan Leaf Debug processing response
Nissan Leaf Debug empty response

21 jan 2016 10:01:50
Nissan Leaf updating status for SJNFAAZE0U6007560
Nissan Leaf Debug posting to: https://nissan-eu-smartphone-biz.viaaq. ... phoneProxy
Nissan Leaf Debug <?xml version="1.0" ?><ns2:SmartphoneGetVehicleInfoRequest xmlns:ns2="urn:com:airbiquity:smartphone.userservices:v1"><SmartphoneOperationType>SmartphoneLatestBatteryStatusRequest</SmartphoneOperationType><changeVehicle>false</changeVehicle><VehicleInfo><Vin>SJNFAAZE0U6007560</Vin></VehicleInfo></ns2:SmartphoneGetVehicleInfoRequest>

21 jan 2016 10:02:12
Nissan Leaf Debug reading response
Nissan Leaf Debug response read; closing
Nissan Leaf Debug processing response
Nissan Leaf Debug response: <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:SmartphoneGetVehicleInfoResponse xmlns:ns4="urn:com:airbiquity:smartphone.reportservice:v1" xmlns:ns7="urn:com:airbiquity:smartphone.common:v1" xmlns:ns3="urn:com:hitachi:gdc:type:report:v1" xmlns:ns5="urn:com:hitachi:gdc:type:vehicle:v1" xmlns:ns2="urn:com:airbiquity:smartphone.userservices:v1" xmlns:ns6="urn:com:airbiquity:smartphone.vehicleservice:v1">
<ns4:SmartphoneLatestBatteryStatusResponse>
<SmartphoneBatteryStatusResponseType>
<ns3:BatteryStatusRecords>
<ns3:OperationResult>START</ns3:OperationResult>
<ns3:OperationDateAndTime>2016-01-21T09:01:30</ns3:OperationDateAndTime>
<ns3:BatteryStatus>
<ns3:BatteryChargingStatus>NORMAL_CHARGING</ns3:BatteryChargingStatus>
<ns3:BatteryCapacity>12</ns3:BatteryCapacity>
<ns3:BatteryRemainingAmount>10</ns3:BatteryRemainingAmount>
</ns3:BatteryStatus>
<ns3:PluginState>CONNECTED</ns3:PluginState>
<ns3:CruisingRangeAcOn>95920.0</ns3:CruisingRangeAcOn>
<ns3:CruisingRangeAcOff>123824.0</ns3:CruisingRangeAcOff>
<ns3:TimeRequiredToFull200>
<ns3:HourRequiredToFull>3</ns3:HourRequiredToFull>
<ns3:MinutesRequiredToFull>0</ns3:MinutesRequiredToFull>
</ns3:TimeRequiredToFull200>
<ns3:NotificationDateAndTime>2016-01-21T09:01:50</ns3:NotificationDateAndTime>
</ns3:BatteryStatusRecords>
<VehicleInfo>
<Vin>SJNFAAZE0U6007560</Vin>
</VehicleInfo>
<lastBatteryStatusCheckExecutionTime>2016-01-21T09:01:30.000Z</lastBatteryStatusCheckExecutionTime>
</SmartphoneBatteryStatusResponseType>
</ns4:SmartphoneLatestBatteryStatusResponse>
</ns2:SmartphoneGetVehicleInfoResponse>

Nissan Leaf Debug status: !!python/object:pycarwings.response.LatestBatteryStatus
latest_battery_status: !!python/object:pycarwings.response.SmartphoneLatestBatteryStatusResponse
battery_capacity: !!python/unicode '12'
battery_charging_status: !!python/unicode 'NORMAL_CHARGING'
battery_remaining_amount: !!python/unicode '10'
cruising_range_ac_off: !!python/unicode '123824.0'
cruising_range_ac_on: !!python/unicode '95920.0'
last_battery_status_check_execution_time: 2016-01-21 09:01:30+00:00
notification_date_and_time: 2016-01-21 09:01:50+00:00
operation_date_and_time: 2016-01-21 09:01:30+00:00
operation_result: !!python/unicode 'START'
plugin_state: !!python/unicode 'CONNECTED'
time_required_to_full: null
time_required_to_full_L2: !!python/object/apply:datetime.timedelta [0, 10800, 0]

Nissan Leaf Debug using 'charger on' icon
Nissan Leaf finished updating status for SJNFAAZE0U6007560

----------------------------

Now the device updates to 83% time 10:02:12

-----------------------------
Then 15min later this happens
--------------------------

21 jan 2016 10:17:12
Nissan Leaf requesting status for SJNFAAZE0U6007560
Nissan Leaf Debug posting to: https://nissan-eu-smartphone-biz.viaaq. ... phoneProxy
Nissan Leaf Debug <?xml version="1.0" ?><ns4:SmartphoneRemoteBatteryStatusCheckRequest xmlns:ns2="urn:com:hitachi:gdc:type:portalcommon:v1" xmlns:ns3="urn:com:hitachi:gdc:type:vehicle:v1" xmlns:ns4="urn:com:airbiquity:smartphone.vehicleservice:v1"><ns3:BatteryStatusCheckRequest><ns3:VehicleServiceRequestHeader><ns2:VIN>SJNFAAZE0U6007560</ns2:VIN></ns3:VehicleServiceRequestHeader></ns3:BatteryStatusCheckRequest></ns4:SmartphoneRemoteBatteryStatusCheckRequest>
Nissan Leaf Debug reading response
Nissan Leaf Debug response read; closing
Nissan Leaf Debug processing response
Nissan Leaf Debug empty response

21 jan 2016 10:17:34
Nissan Leaf updating status for SJNFAAZE0U6007560
Nissan Leaf Debug posting to: https://nissan-eu-smartphone-biz.viaaq. ... phoneProxy
Nissan Leaf Debug <?xml version="1.0" ?><ns2:SmartphoneGetVehicleInfoRequest xmlns:ns2="urn:com:airbiquity:smartphone.userservices:v1"><SmartphoneOperationType>SmartphoneLatestBatteryStatusRequest</SmartphoneOperationType><changeVehicle>false</changeVehicle><VehicleInfo><Vin>SJNFAAZE0U6007560</Vin></VehicleInfo></ns2:SmartphoneGetVehicleInfoRequest>
Nissan Leaf Debug reading response
Nissan Leaf Debug response read; closing
Nissan Leaf Debug processing response
Nissan Leaf Debug response: <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:SmartphoneGetVehicleInfoResponse xmlns:ns4="urn:com:airbiquity:smartphone.reportservice:v1" xmlns:ns7="urn:com:airbiquity:smartphone.common:v1" xmlns:ns3="urn:com:hitachi:gdc:type:report:v1" xmlns:ns5="urn:com:hitachi:gdc:type:vehicle:v1" xmlns:ns2="urn:com:airbiquity:smartphone.userservices:v1" xmlns:ns6="urn:com:airbiquity:smartphone.vehicleservice:v1">
<ns4:SmartphoneLatestBatteryStatusResponse>
<SmartphoneBatteryStatusResponseType>
<ns3:BatteryStatusRecords>
<ns3:OperationResult>START</ns3:OperationResult>
<ns3:OperationDateAndTime>2016-01-21T09:01:30</ns3:OperationDateAndTime>
<ns3:BatteryStatus>
<ns3:BatteryChargingStatus>NORMAL_CHARGING</ns3:BatteryChargingStatus>
<ns3:BatteryCapacity>12</ns3:BatteryCapacity>
<ns3:BatteryRemainingAmount>10</ns3:BatteryRemainingAmount>
</ns3:BatteryStatus>
<ns3:PluginState>CONNECTED</ns3:PluginState>
<ns3:CruisingRangeAcOn>95920.0</ns3:CruisingRangeAcOn>
<ns3:CruisingRangeAcOff>123824.0</ns3:CruisingRangeAcOff>
<ns3:TimeRequiredToFull200>
<ns3:HourRequiredToFull>3</ns3:HourRequiredToFull>
<ns3:MinutesRequiredToFull>0</ns3:MinutesRequiredToFull>
</ns3:TimeRequiredToFull200>
<ns3:NotificationDateAndTime>2016-01-21T09:01:50</ns3:NotificationDateAndTime>
</ns3:BatteryStatusRecords>
<VehicleInfo>
<Vin>SJNFAAZE0U6007560</Vin>
</VehicleInfo>
<lastBatteryStatusCheckExecutionTime>2016-01-21T09:17:14.000Z</lastBatteryStatusCheckExecutionTime>
</SmartphoneBatteryStatusResponseType>
</ns4:SmartphoneLatestBatteryStatusResponse>
</ns2:SmartphoneGetVehicleInfoResponse>

Nissan Leaf Debug status: !!python/object:pycarwings.response.LatestBatteryStatus
latest_battery_status: !!python/object:pycarwings.response.SmartphoneLatestBatteryStatusResponse
battery_capacity: !!python/unicode '12'
battery_charging_status: !!python/unicode 'NORMAL_CHARGING'
battery_remaining_amount: !!python/unicode '10'
cruising_range_ac_off: !!python/unicode '123824.0'
cruising_range_ac_on: !!python/unicode '95920.0'
last_battery_status_check_execution_time: 2016-01-21 09:17:14+00:00
notification_date_and_time: 2016-01-21 09:01:50+00:00
operation_date_and_time: 2016-01-21 09:01:30+00:00
operation_result: !!python/unicode 'START'
plugin_state: !!python/unicode 'CONNECTED'
time_required_to_full: null
time_required_to_full_L2: !!python/object/apply:datetime.timedelta [0, 10800, 0]

Nissan Leaf Debug using 'charger on' icon
Nissan Leaf finished updating status for SJNFAAZE0U6007560

---------------------------
The device did not update, and the status is the same 83% and time 10:02:12

-----------------------------
After 15min this happens
-------------------------21 jan 2016 10:32:48
Nissan Leaf requesting status for SJNFAAZE0U6007560
Nissan Leaf Debug posting to: https://nissan-eu-smartphone-biz.viaaq. ... phoneProxy
Nissan Leaf Debug <?xml version="1.0" ?><ns4:SmartphoneRemoteBatteryStatusCheckRequest xmlns:ns2="urn:com:hitachi:gdc:type:portalcommon:v1" xmlns:ns3="urn:com:hitachi:gdc:type:vehicle:v1" xmlns:ns4="urn:com:airbiquity:smartphone.vehicleservice:v1"><ns3:BatteryStatusCheckRequest><ns3:VehicleServiceRequestHeader><ns2:VIN>SJNFAAZE0U6007560</ns2:VIN></ns3:VehicleServiceRequestHeader></ns3:BatteryStatusCheckRequest></ns4:SmartphoneRemoteBatteryStatusCheckRequest>
Nissan Leaf Debug reading response
Nissan Leaf Debug response read; closing
Nissan Leaf Debug processing response
Nissan Leaf Debug empty response

21 jan 2016 10:33:08
Trigger Belysningsstyrning ir vardagsrum
Z-Wave sent "Belysning Walking closet" on
Nissan Leaf updating status for SJNFAAZE0U6007560
Nissan Leaf Debug posting to: https://nissan-eu-smartphone-biz.viaaq. ... phoneProxy
Nissan Leaf Debug <?xml version="1.0" ?><ns2:SmartphoneGetVehicleInfoRequest xmlns:ns2="urn:com:airbiquity:smartphone.userservices:v1"><SmartphoneOperationType>SmartphoneLatestBatteryStatusRequest</SmartphoneOperationType><changeVehicle>false</changeVehicle><VehicleInfo><Vin>SJNFAAZE0U6007560</Vin></VehicleInfo></ns2:SmartphoneGetVehicleInfoRequest>
Z-Wave received "Belysning Walking closet" power load to 36.4 W
Trigger Belysningsstyrning ir vardagsrum
Z-Wave sent "Belysning Walking closet" on
Z-Wave received "Belysning Walking closet" power load to 36.9 W
Z-Wave received "Belysning Walking closet" power load to 36.7 W
Nissan Leaf Debug reading response
Nissan Leaf Debug response read; closing
Nissan Leaf Debug processing response
Nissan Leaf Debug response: <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:SmartphoneGetVehicleInfoResponse xmlns:ns4="urn:com:airbiquity:smartphone.reportservice:v1" xmlns:ns7="urn:com:airbiquity:smartphone.common:v1" xmlns:ns3="urn:com:hitachi:gdc:type:report:v1" xmlns:ns5="urn:com:hitachi:gdc:type:vehicle:v1" xmlns:ns2="urn:com:airbiquity:smartphone.userservices:v1" xmlns:ns6="urn:com:airbiquity:smartphone.vehicleservice:v1">
<ns4:SmartphoneLatestBatteryStatusResponse>
<SmartphoneBatteryStatusResponseType>
<ns3:BatteryStatusRecords>
<ns3:OperationResult>START</ns3:OperationResult>
<ns3:OperationDateAndTime>2016-01-21T09:17:13</ns3:OperationDateAndTime>
<ns3:BatteryStatus>
<ns3:BatteryChargingStatus>NORMAL_CHARGING</ns3:BatteryChargingStatus>
<ns3:BatteryCapacity>12</ns3:BatteryCapacity>
<ns3:BatteryRemainingAmount>10</ns3:BatteryRemainingAmount>
</ns3:BatteryStatus>
<ns3:PluginState>CONNECTED</ns3:PluginState>
<ns3:CruisingRangeAcOn>102080.0</ns3:CruisingRangeAcOn>
<ns3:CruisingRangeAcOff>131776.0</ns3:CruisingRangeAcOff>
<ns3:TimeRequiredToFull200>
<ns3:HourRequiredToFull>2</ns3:HourRequiredToFull>
<ns3:MinutesRequiredToFull>30</ns3:MinutesRequiredToFull>
</ns3:TimeRequiredToFull200>
<ns3:NotificationDateAndTime>2016-01-21T09:17:38</ns3:NotificationDateAndTime>
</ns3:BatteryStatusRecords>
<VehicleInfo>
<Vin>SJNFAAZE0U6007560</Vin>
</VehicleInfo>
<lastBatteryStatusCheckExecutionTime>2016-01-21T09:32:49.000Z</lastBatteryStatusCheckExecutionTime>
</SmartphoneBatteryStatusResponseType>
</ns4:SmartphoneLatestBatteryStatusResponse>
</ns2:SmartphoneGetVehicleInfoResponse>

Nissan Leaf Debug status: !!python/object:pycarwings.response.LatestBatteryStatus
latest_battery_status: !!python/object:pycarwings.response.SmartphoneLatestBatteryStatusResponse
battery_capacity: !!python/unicode '12'
battery_charging_status: !!python/unicode 'NORMAL_CHARGING'
battery_remaining_amount: !!python/unicode '10'
cruising_range_ac_off: !!python/unicode '131776.0'
cruising_range_ac_on: !!python/unicode '102080.0'
last_battery_status_check_execution_time: 2016-01-21 09:32:49+00:00
notification_date_and_time: 2016-01-21 09:17:38+00:00
operation_date_and_time: 2016-01-21 09:17:13+00:00
operation_result: !!python/unicode 'START'
plugin_state: !!python/unicode 'CONNECTED'
time_required_to_full: null
time_required_to_full_L2: !!python/object/apply:datetime.timedelta [0, 9000, 0]

-------------
Now the device has update the time to 10:33 but the battery is still 83% (Witch is not true)
------------
Then at 10:49 i get a new status update were the battery is 93% and the time is updated.
In the log i can see that this time it had to log in using my user and password.


Now it seems like i get an correct update of the device about once every hour?.
And that its only when the plugin needs to use my User and password to log in.


PS. A big thank you for this plugig in and everything you helped me with so far :-)


//Martin

Posted on
Sat Jan 23, 2016 9:33 pm
dustysparkle offline
Posts: 54
Joined: Dec 14, 2015

Re: Nissan Leaf Plugin

I'm working on this, Gusten; got sidetracked by a bit of an ice storm, but I'll get there. :)

Will post another update once I've made some progress.

Posted on
Sun Jan 24, 2016 6:10 am
durosity offline
User avatar
Posts: 4320
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: Nissan Leaf Plugin

dustysparkle wrote:
got sidetracked by a bit of an ice storm


Well good news, you can turn on the heating in your EV remotely ;)

Computer says no.

Posted on
Mon Jan 25, 2016 10:40 am
dustysparkle offline
Posts: 54
Joined: Dec 14, 2015

Re: Nissan Leaf Plugin

OK Gusten, I think the mechanics of the plugin were all working fine, but Nissan's API can take some time to get 'fresh' results from the car--from what I've read about the Nissan API, it can actually take up to five minutes for the results to come back. :roll:

Now, instead of waiting 20 seconds , checking results, and moving on, the plugin now does the following:

  1. Politely ask Nissan to fetch the latest status from the vehicle.
  2. Wait 60 seconds for Nissan to comply (stretched from 20 seconds)
  3. Ask Nissan for the results. If we get back fresh data, update Indigo and we're done!
  4. If we got 'stale' data, sleep 120 seconds; ask a second time.
  5. If we got 'stale' data again, sleep another 120 seconds; ask a third time.
  6. If we STILL got stale data after the third check, abandon hope and try again in fourteen minutes.

This seems to work for me, butI haven't been able to test it beyond the second check because the results have always come back for me by then.

I think this should solve your problem! Version 0.0.5 is now available on GitHub. Thanks for all of your feedback.

tl;dr: I think it's fixed in 0.0.5.

Posted on
Wed Jan 27, 2016 8:48 am
Gusten offline
Posts: 171
Joined: Dec 30, 2015
Location: Sweden, Gothenburg

Re: Nissan Leaf Plugin

Now it working perfectly :-)

Thanx fo a great plugin

/Martin

Posted on
Thu Feb 04, 2016 3:14 am
Gusten offline
Posts: 171
Joined: Dec 30, 2015
Location: Sweden, Gothenburg

Re: Nissan Leaf Plugin

Hi

Now the plugin havn´t updated since Monday.

I dont Think anything is wrong in the plugin, beacouse i have an IOS app called LEAF Link that stoped working at the same time.

But Nissans App NISSAN EV is working.

Is it possible that Nissan has stopped the posibbility to use the API ??

In the log i get "HTTP Error 500: Internal Server Error"






/Martin Gustafsson

Posted on
Mon Feb 15, 2016 10:22 pm
dustysparkle offline
Posts: 54
Joined: Dec 14, 2015

Re: Nissan Leaf Plugin

Hi Gusten,

I think Nissan turned off the 'old' API, so I've had to reverse engineer the new API and modify the plugin to use it. I have a couple more things to polish before releasing a test version using the new API, but I expect to do so in the next couple of days.

Just wanted to let you know I'm aware and working on it.

Posted on
Wed Feb 17, 2016 9:25 pm
dustysparkle offline
Posts: 54
Joined: Dec 14, 2015

Re: Nissan Leaf Plugin

OK, I have a new version of the plugin that's working for me using the new API. You can try it here: https://github.com/jdhorne/indigo-leaf- ... e/rest_api

A few notes, some important:

  1. after updating to the latest version of the plugin, you'll have to reselect your region in the plugin configuration screen and then reload the plugin. Nissan changed the region stuff completely when moving to the new API, but the plugin configuration screen will fix things.
  2. I've only been able to test the USA region myself, but I put region codes for Europe and Canada in there based on reports from other developers. I hope they will work.
  3. be careful posting any logs because your login/password information is in plain text on the URLs in the new Nissan API. Yep. :roll: You can just send the logs to me privately, or carefully scan/edit them before posting them publicly.

Good luck, and let me know how it goes if you decide to try it out.

Posted on
Thu Feb 18, 2016 12:42 am
Gusten offline
Posts: 171
Joined: Dec 30, 2015
Location: Sweden, Gothenburg

Re: Nissan Leaf Plugin

Hi

It seems like its looking in, but something ist right _


Enabling plugin "Nissan Leaf 0.0.6.14"
Starting plugin "Nissan Leaf 0.0.6.14" (pid 33599)
Started plugin "Nissan Leaf 0.0.6.14"
Nissan Leaf Debug debug logging enabled
Nissan Leaf Debug startup called
Nissan Leaf Debug using distance scale 'k'
Nissan Leaf Debug indigoleaf setup; username: Gusten, region: NE
Nissan Leaf Debug indigoleaf session: <pycarwings2.pycarwings2.Session object at 0x712d050>
Nissan Leaf Debug IndigoLeaf object init
Nissan Leaf Debug request and update status
Nissan Leaf requesting status for SJNFAAZE0U6007560
Nissan Leaf not yet logged in; doing that first
Nissan Leaf Debug logging in to carwings
Nissan Leaf Debug invoking carwings API: https://gdcportalgw.its-mo.com/orchestr ... rId=Gusten
Nissan Leaf Debug params: {
"Password": "XXXXXX",
"RegionCode": "NE",
"UserId": "Gusten"
}
Nissan Leaf Debug Response HTTP Status Code: 200
Nissan Leaf Debug Response HTTP Response Body: {"status":200,"message":"success","vehicleInfo":[{"vin":"SJNFAAZE0U6007560","nickname":"Gustens","charger20066":"true","telematicsEnabled":"true"}],"vehicle":{"profile":{"vin":"SJNFAAZE0U6007560","gdcUserId":"Gusten","gdcPassword":"XXXXXX","encAuthToken":"AC097D4BCD60416940AA815FFDB4A46E478A2E22FCED5E0D441FE773D6C7C62D","dcmId":"201399022684","status":"true","statusDate":"2014\/02\/26 23:00","nickname":"Gustens"}},"EncAuthToken":"88217C33CD57A62255610428861DA2F6F0A41E90906167D3EC24E55F4A297A29AC06E100B1EB2439","CustomerInfo":{"UserId":"Gusten","Language":"sv_SE","Timezone":"Europe\/Paris","RegionCode":"NE","OwnerId":"3032138600","EMailAddress":"martin@gusten.com","Nickname":"Gustens","Country":"SE","VehicleImage":"\/content\/language\/default\/images\/img\/ph_car.jpg","UserVehicleBoundDurationSec":"946771200","VehicleInfo":{"VIN":"SJNFAAZE0U6007560","DCMID":"201399022684","SIMID":"89460801070012833236","NAVIID":"102802003585","EncryptedNAVIID":"5AB38B002A17A68643A248CA321E3306","MSN":"467190003783323","LastVehicleLoginTime":"","UserVehicleBoundTime":"2014-02-28T05:42:28Z","LastDCMUseTime":"2016\/02\/18 05:45"}},"UserInfoRevisionNo":"1"}
Nissan Leaf Error Error in plugin execution runConcurrentThread:

Traceback (most recent call last):
File "plugin.py", line 136, in runConcurrentThread
File "/Library/Application Support/Perceptive Automation/Indigo 6/Plugins/Nissan Leaf.indigoPlugin/Contents/Server Plugin/indigo_leaf.py", line 113, in request_and_update_status
File "/Library/Application Support/Perceptive Automation/Indigo 6/Plugins/Nissan Leaf.indigoPlugin/Contents/Server Plugin/indigo_leaf.py", line 132, in request_status
File "/Library/Application Support/Perceptive Automation/Indigo 6/Plugins/Nissan Leaf.indigoPlugin/Contents/Server Plugin/indigo_leaf.py", line 51, in login
File "/Library/Application Support/Perceptive Automation/Indigo 6/Plugins/Nissan Leaf.indigoPlugin/Contents/Server Plugin/pycarwings2/pycarwings2.py", line 120, in connect
File "/Library/Application Support/Perceptive Automation/Indigo 6/Plugins/Nissan Leaf.indigoPlugin/Contents/Server Plugin/pycarwings2/responses.py", line 128, in __init__
<type 'exceptions.KeyError'>: 'VehicleInfoList'

Nissan Leaf Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)

Posted on
Thu Feb 18, 2016 12:32 pm
dustysparkle offline
Posts: 54
Joined: Dec 14, 2015

Re: Nissan Leaf Plugin

Hmm, odd; there's a section in the response from my login that's not present after your login. Odd.

In any case, I'll code around it and post an update soon.

Posted on
Thu Feb 18, 2016 8:36 pm
dustysparkle offline
Posts: 54
Joined: Dec 14, 2015

Re: Nissan Leaf Plugin

OK, I've added a fix that should handle your case, Gusten. Give it another try (at the GitHub URL from a couple posts back).

Still not sure why Nissan would omit that 'VehicleInfoList' block in your login, but whatever, I can work around it. :)

Posted on
Sun Feb 21, 2016 1:22 pm
Gusten offline
Posts: 171
Joined: Dec 30, 2015
Location: Sweden, Gothenburg

Re: Nissan Leaf Plugin

Thanx now it's working

/Martin

Who is online

Users browsing this forum: No registered users and 5 guests