Nissan Leaf Plugin

Posted on
Fri Jan 15, 2016 11:37 am
dustysparkle offline
Posts: 54
Joined: Dec 14, 2015

Nissan Leaf Plugin

I've been working on a plugin for an extra-large home automation device: the Nissan Leaf

https://github.com/jdhorne/indigo-leaf-plugin

It works pretty well for me at the moment for reading data. There are a few known limitations, which I've listed on the README at GitHub.

I await your comments/suggestions/praise/vitriol. :)

2017-06-13: version 0.2.1: fix for missing "RemoteACRecords" structure
2017-02-23: version 0.2: new version of pycarwings2 library with fix for latest web service endpoint change, bug fixes; added "secondsSinceLastUpdate" and "lastUpdateTimestamp" states; delays between updates now configurable on plugin dialogue
...
2016-04-02: version 0.1.1: potential fix for alternate structure of login response; try re-login if status 404 returned by carwings
2016-04-01: version 0.1.0: support for Nissan "secure" API
...
2016-01-20: version 0.0.4: improved handling of session timeouts; 'debug logging' plugin configuration parameter
2016-01-18: version 0.0.2: added EU server support
2016-01-17: version 0.0.1: initial disclosure
Last edited by dustysparkle on Tue Jun 13, 2017 10:47 am, edited 4 times in total.

Posted on
Fri Jan 15, 2016 1:06 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Nissan Leaf Plugin

Cool!

I bet Durosity will be along to see if it supports Renault Zoé :-)


Sent from my iPhone using Tapatalk

Posted on
Fri Jan 15, 2016 6:44 pm
durosity offline
User avatar
Posts: 4320
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: Nissan Leaf Plugin

Hehe no it won't, different system. That said someone here did write a lovely plugin for me that does work with the Zoe, although Renault ruined it on Wednesday with an overhaul of the site.. That removed functions and made it pretty. Like apple. :)

Computer says no.

Posted on
Sat Jan 16, 2016 1:57 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Nissan Leaf Plugin

I know, I was kidding. :-)

I wish you could use mention tags on here; might raise it as feature request.


Sent from my iPhone using Tapatalk

Posted on
Sat Jan 16, 2016 3:34 am
Gusten offline
Posts: 171
Joined: Dec 30, 2015
Location: Sweden, Gothenburg

Re: Nissan Leaf Plugin

Hi

I feel a bit stupid, but i have problems installing this plugin?

I downloaded the zip file and normally it create the .indigoplugin and installed it self. But now i only get the unzipped folders/files.

I there a special way to install this?

By the way, this is easy the coolest plugin (If i get it running and working)

/Martin

Posted on
Sat Jan 16, 2016 4:15 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Nissan Leaf Plugin

Good point.

If you rename the "indigo-leaf-plugin-master" folder to "indigo-leaf.indigoPlugin" then it will work as normal.

Dusty, can you make this change to the github so folk can download and install it with one click.

Peter

Posted on
Sat Jan 16, 2016 7:49 am
Gusten offline
Posts: 171
Joined: Dec 30, 2015
Location: Sweden, Gothenburg

Re: Nissan Leaf Plugin

Hi

Yep now the plugin is installed.

But i have a problem with the login.

I get this in the log

Nissan Leaf Error Log in invalid, please try again

(I tripple checked my username and password)

I also tried using my email as username, but same error

Is it possible that its a country issue? Different accounts uses different servers?

If so is it possible to update the plugin to support sweden ?

/Martin

Posted on
Sat Jan 16, 2016 8:13 am
Bollar offline
Posts: 528
Joined: Aug 11, 2013

Re: Nissan Leaf Plugin

Thank you for the work you did on this! Maybe it's enough of a framework for me to make a Tesla Model S/X plugin. I have a script that works already.

Insteon / Z-Wave / Bryant Evolution Connex /Tesla / Roomba / Elk M1 / SiteSage / Enphase Enlighten / NOAA Alerts

Posted on
Sat Jan 16, 2016 1:41 pm
dustysparkle offline
Posts: 54
Joined: Dec 14, 2015

Re: Nissan Leaf Plugin

OK, I moved the files to a nested folder (named "Nissan Leaf.indigoPlugin") that should make installation easier (download, unzip, double click on ".indigoPlugin" folder).

Gusten, it's possible that there are regional issues; I saw something about that on the Leaf forum. I'll investigate and see if there's anything I can do.

Posted on
Sat Jan 16, 2016 6:13 pm
dustysparkle offline
Posts: 54
Joined: Dec 14, 2015

Re: Nissan Leaf Plugin

Yep, there's a different server for the EU. I've written code to allow you to configure your region, but I can't test it at the moment because the Nissan USA owners' site is down. :|

I'll push to GitHub and post another update once I've had a chance to test more.

Posted on
Sun Jan 17, 2016 5:22 am
Gusten offline
Posts: 171
Joined: Dec 30, 2015
Location: Sweden, Gothenburg

Re: Nissan Leaf Plugin

I am realy looking forward to trying it :D

Posted on
Sun Jan 17, 2016 9:04 pm
dustysparkle offline
Posts: 54
Joined: Dec 14, 2015

Re: Nissan Leaf Plugin

Gusten: I've pushed an update that I believe enables support for EU region; you can specify which region to use in the plugin configuration dialog.

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

Posted on
Mon Jan 18, 2016 3:54 am
Gusten offline
Posts: 171
Joined: Dec 30, 2015
Location: Sweden, Gothenburg

Re: Nissan Leaf Plugin

Hi and thank ypu for the update.

Now its working

I can confirm that starting the AC/Heat is working from a trigger

I Think you forgot to change the version number from 0.0.1 it was not possible to update the plugin, i had ti uninstall and reeinstall.

Thanx again. for the coolest plugin :-)

Posted on
Mon Jan 18, 2016 7:10 am
Gusten offline
Posts: 171
Joined: Dec 30, 2015
Location: Sweden, Gothenburg

Re: Nissan Leaf Plugin

Hi again

It seems to be something wrong the plugin or maybe i set something up in the wrong way?

(If i reload the plugin, it seems to bee stable for a couple of hours, then it starts again)

I get this error


Nissan Leaf updating status for SJNFAAZE0U6007560
Nissan Leaf Error Error in plugin execution runConcurrentThread:

Traceback (most recent call last):
File "plugin.py", line 154, in runConcurrentThread
File "/Library/Application Support/Perceptive Automation/Indigo 6/Plugins/Nissan Leaf.indigoPlugin/Contents/Server Plugin/indigo_leaf.py", line 43, in update_status
File "/Library/Application Support/Perceptive Automation/Indigo 6/Plugins/Nissan Leaf.indigoPlugin/Contents/Server Plugin/pycarwings/userservice.py", line 57, in get_latest_status
File "/Library/Application Support/Perceptive Automation/Indigo 6/Plugins/Nissan Leaf.indigoPlugin/Contents/Server Plugin/pycarwings/response.py", line 42, in __init__
File "/Library/Application Support/Perceptive Automation/Indigo 6/Plugins/Nissan Leaf.indigoPlugin/Contents/Server Plugin/pycarwings/response.py", line 47, in parse
File "/Library/Application Support/Perceptive Automation/Indigo 6/Plugins/Nissan Leaf.indigoPlugin/Contents/Server Plugin/pycarwings/response.py", line 60, in __init__
File "/Library/Application Support/Perceptive Automation/Indigo 6/Plugins/Nissan Leaf.indigoPlugin/Contents/Server Plugin/pycarwings/response.py", line 63, in parse
File "/Library/Application Support/Perceptive Automation/Indigo 6/Plugins/Nissan Leaf.indigoPlugin/Contents/Server Plugin/pycarwings/response.py", line 7, in get_first
<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'getElementsByTagNameNS'

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

18 jan 2016 13:55:45
Nissan Leaf updating status for SJNFAAZE0U6007560
Nissan Leaf Error Error in plugin execution runConcurrentThread:

Traceback (most recent call last):
File "plugin.py", line 154, in runConcurrentThread
File "/Library/Application Support/Perceptive Automation/Indigo 6/Plugins/Nissan Leaf.indigoPlugin/Contents/Server Plugin/indigo_leaf.py", line 43, in update_status
File "/Library/Application Support/Perceptive Automation/Indigo 6/Plugins/Nissan Leaf.indigoPlugin/Contents/Server Plugin/pycarwings/userservice.py", line 57, in get_latest_status
File "/Library/Application Support/Perceptive Automation/Indigo 6/Plugins/Nissan Leaf.indigoPlugin/Contents/Server Plugin/pycarwings/response.py", line 42, in __init__
File "/Library/Application Support/Perceptive Automation/Indigo 6/Plugins/Nissan Leaf.indigoPlugin/Contents/Server Plugin/pycarwings/response.py", line 47, in parse
File "/Library/Application Support/Perceptive Automation/Indigo 6/Plugins/Nissan Leaf.indigoPlugin/Contents/Server Plugin/pycarwings/response.py", line 60, in __init__
File "/Library/Application Support/Perceptive Automation/Indigo 6/Plugins/Nissan Leaf.indigoPlugin/Contents/Server Plugin/pycarwings/response.py", line 63, in parse
File "/Library/Application Support/Perceptive Automation/Indigo 6/Plugins/Nissan Leaf.indigoPlugin/Contents/Server Plugin/pycarwings/response.py", line 7, in get_first
<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'getElementsByTagNameNS'

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

18 jan 2016 13:56:15
Nissan Leaf updating status for SJNFAAZE0U6007560
Nissan Leaf Error Error in plugin execution runConcurrentThread:

Traceback (most recent call last):
File "plugin.py", line 154, in runConcurrentThread
File "/Library/Application Support/Perceptive Automation/Indigo 6/Plugins/Nissan Leaf.indigoPlugin/Contents/Server Plugin/indigo_leaf.py", line 43, in update_status
File "/Library/Application Support/Perceptive Automation/Indigo 6/Plugins/Nissan Leaf.indigoPlugin/Contents/Server Plugin/pycarwings/userservice.py", line 57, in get_latest_status
File "/Library/Application Support/Perceptive Automation/Indigo 6/Plugins/Nissan Leaf.indigoPlugin/Contents/Server Plugin/pycarwings/response.py", line 42, in __init__
File "/Library/Application Support/Perceptive Automation/Indigo 6/Plugins/Nissan Leaf.indigoPlugin/Contents/Server Plugin/pycarwings/response.py", line 47, in parse
File "/Library/Application Support/Perceptive Automation/Indigo 6/Plugins/Nissan Leaf.indigoPlugin/Contents/Server Plugin/pycarwings/response.py", line 60, in __init__
File "/Library/Application Support/Perceptive Automation/Indigo 6/Plugins/Nissan Leaf.indigoPlugin/Contents/Server Plugin/pycarwings/response.py", line 63, in parse
File "/Library/Application Support/Perceptive Automation/Indigo 6/Plugins/Nissan Leaf.indigoPlugin/Contents/Server Plugin/pycarwings/response.py", line 7, in get_first
<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'getElementsByTagNameNS'

Posted on
Mon Jan 18, 2016 9:52 am
Gusten offline
Posts: 171
Joined: Dec 30, 2015
Location: Sweden, Gothenburg

Re: Nissan Leaf Plugin

Hi

An update

It seems like the error comes 15min after the Reload. for most of the time, sometimes nothing happens (No updates on the device)

It updates the status directly after the reload, every time.


/Martin

Who is online

Users browsing this forum: No registered users and 8 guests

cron