Nissan Leaf Plugin

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

Re: Nissan Leaf Plugin

Looks like Nissan has disabled the API after security researchers disclosed a vulnerability today: http://www.usatoday.com/story/tech/news ... /80882756/

That means this plugin won't work, at least not until they re-enable the API and I'm able to (hopefully) make it work again. I'll keep an eye out and update when I learn more.

Posted on
Thu Feb 25, 2016 8:07 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Nissan Leaf Plugin

Spent most of yesterday drooling over the Leaf's big brother, the e-NV200. (Combi, not Van)

It's the Nissan electric version of the Peugeot and Renault diesel cars I've driven for 10+ years.

Does this plugin use the new EV Connect system or the old CarWings system?


Sent from my iPhone using Tapatalk

Posted on
Fri Feb 26, 2016 6:06 am
durosity offline
User avatar
Posts: 4320
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: Nissan Leaf Plugin

I thought EV connect was just the new name for carwings?

Computer says no.

Posted on
Fri Feb 26, 2016 10:06 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Nissan Leaf Plugin

Not sure.

Some pages/brochures mention CarWings, others EV Connect.


Sent from my iPhone using Tapatalk

Posted on
Fri Feb 26, 2016 10:45 am
dustysparkle offline
Posts: 54
Joined: Dec 14, 2015

Re: Nissan Leaf Plugin

I think the only difference between CarWings and NissanConnect EV is branding--they're the same thing. There have been two different APIs for this multi-named service: the first one was XML-based, and clunky. I don't think there was any correlation between the two names and the two APIs, but I could be wrong.

I wrote the plugin to use that original XML API, via the pycarwings library. A couple weeks ago, that API stopped working, so I rewrote the plugin to use the newer (and much better, IMHO) JSON-based API. Now, that API has also been shut down, presumably temporarily while they address the security vulnerability.

I really, really, really hope that Nissan does the right thing to "fix" the API, in that they only add authentication checks, leaving the API available to properly-authenticated 3rd-party applications. There could really be a rich ecosystem of third-party applications around the Leaf, including this plugin. Such an ecosystem would only make the Leaf more attractive to potential buyers.

Posted on
Fri Mar 11, 2016 10:50 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Nissan Leaf Plugin

Dusty,

I've been chatting with a chap on SpeakEV today - he runs https://evhighwaystatus.co.uk/

He's added the ability to control AC, start charging and get the battery status - and it is working now.

Could you look at https://github.com/ScottHelme/CarWingsI ... import.php which is where he got the core idea from; Scott Helme is happy for people to use his code to build their own systems.

See if that's any help to you getting the plugin working whilst Nissan is down / in case Nissan do close up the API?

Peter

Posted on
Fri Mar 18, 2016 9:21 pm
dustysparkle offline
Posts: 54
Joined: Dec 14, 2015

Re: Nissan Leaf Plugin

howartp,

That's a good idea; looks like they're screen-scraping the Carwings/NissanConnectEV web site, treating the actual website as an API.

Yep, there's a path forward using this approach. I've been hoping that Nissan would soon release a tweaked version of the disabled REST-based API, though, which would make the screen-scraping approach unnecessary. I've found screen-scraping approaches to be generally brittle, since Nissan (for example) could change the design on their web site at any time, but if we don't hear an update from Nissan soon, I'll give it a shot.

Thanks for the pointer.

Posted on
Fri Apr 01, 2016 10:13 am
Gusten offline
Posts: 171
Joined: Dec 30, 2015
Location: Sweden, Gothenburg

Re: Nissan Leaf Plugin

Now finaly Nissan uppdated the iOS App and tis working :)


Skickat från min iPhone med Tapatalk

Posted on
Fri Apr 01, 2016 11:08 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Nissan Leaf Plugin

Thanks for heads up; my App Store hadn't noticed it until i checked.

Is the plugin ok or does it need work?


Sent from my iPhone using Tapatalk

Posted on
Fri Apr 01, 2016 11:16 am
dustysparkle offline
Posts: 54
Joined: Dec 14, 2015

Re: Nissan Leaf Plugin

I tried re-enabling it, and I still got HTTP 404 errors from the server in the Indigo event log. I tried USA, Canada, and Europe servers, but all returned 404s. I'm encouraged that Gusten's is working, but I'm not sure how!

Might have to proxy again to see where the app is connecting, because the new app does clearly work.

Posted on
Fri Apr 01, 2016 11:17 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Nissan Leaf Plugin

I think Gusten meant the app is working, not the plugin.

I just jumped on my indigo remotely and that's failing as you say.


Sent from my iPhone using Tapatalk

Posted on
Fri Apr 01, 2016 12:26 pm
Gusten offline
Posts: 171
Joined: Dec 30, 2015
Location: Sweden, Gothenburg

Re: Nissan Leaf Plugin

Yes the app is working not the plugin, sorry for the mixup


Skickat från min iPhone med Tapatalk

Posted on
Fri Apr 01, 2016 8:28 pm
dustysparkle offline
Posts: 54
Joined: Dec 14, 2015

Re: Nissan Leaf Plugin

I've got an updated version of the plugin that seems to be working with the new 'secure' API. The encryption in the new API requires use of the "pycrypto" library, which I don't think I can bundle into the plugin because: 1) it compiles code upon installation; and, 2) well, it contains crypto, which is, of course, naughty.

So, before using the new version, you'll have to install the pycrypto library manually, using the terminal. The following command worked for me on the two machines that I tested with:

Code: Select all
sudo easy_install-2.6 pycrypto


After installing pycrypto, you should be able to update from GitHub per usual. At least, this worked for me.

Give it a shot and let me know how it goes.

Posted on
Fri Apr 01, 2016 8:39 pm
dustysparkle offline
Posts: 54
Joined: Dec 14, 2015

Re: Nissan Leaf Plugin

Well, of course, after I post the plugin update here, I go back to my indigo log and notice what seems like a "timeout" error using the new API: error response said "NO MACH VIN".

But, then I restarted and everything seems to be working fine for quite a while now. So, YMMV? Let me know if you have trouble.

Posted on
Sat Apr 02, 2016 2:49 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Nissan Leaf Plugin

Ok, I've installed the update, deleted by current 'Leaf' device and edited and saved the config dialog. (I notice you've changed the Region parameter - I had to reselect that).

I'm getting tonnes of:

Code: Select all
2016-04-02 09:34:43.331   Nissan Leaf   requesting status for
2016-04-02 09:34:43.332   Nissan Leaf   not yet logged in; doing that first
2016-04-02 09:34:48.025   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 148, 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'>: 'vehicle'

2016-04-02 09:34:48.026   Nissan Leaf Error   plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)

I then enabled debug, which gave me two lines of debug then promptly stopped attempting any communication with CarWings:

Code: Select all
2016-04-02 09:37:19.630   Nissan Leaf Debug   debug logging enabled
2016-04-02 09:37:19.630   Nissan Leaf Debug   using distance scale 'm'

I've had nothing from the plugin in my log since then (12 minutes ago).

Peter

Who is online

Users browsing this forum: No registered users and 8 guests

cron