Page 1 of 7

Nissan Leaf Plugin

PostPosted: Fri Jan 15, 2016 11:37 am
by dustysparkle
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

Re: Nissan Leaf Plugin

PostPosted: Fri Jan 15, 2016 1:06 pm
by howartp
Cool!

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


Sent from my iPhone using Tapatalk

Re: Nissan Leaf Plugin

PostPosted: Fri Jan 15, 2016 6:44 pm
by durosity
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. :)

Re: Nissan Leaf Plugin

PostPosted: Sat Jan 16, 2016 1:57 am
by howartp
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

Re: Nissan Leaf Plugin

PostPosted: Sat Jan 16, 2016 3:34 am
by Gusten
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

Re: Nissan Leaf Plugin

PostPosted: Sat Jan 16, 2016 4:15 am
by howartp
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

Re: Nissan Leaf Plugin

PostPosted: Sat Jan 16, 2016 7:49 am
by Gusten
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

Re: Nissan Leaf Plugin

PostPosted: Sat Jan 16, 2016 8:13 am
by Bollar
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.

Re: Nissan Leaf Plugin

PostPosted: Sat Jan 16, 2016 1:41 pm
by dustysparkle
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.

Re: Nissan Leaf Plugin

PostPosted: Sat Jan 16, 2016 6:13 pm
by dustysparkle
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.

Re: Nissan Leaf Plugin

PostPosted: Sun Jan 17, 2016 5:22 am
by Gusten
I am realy looking forward to trying it :D

Re: Nissan Leaf Plugin

PostPosted: Sun Jan 17, 2016 9:04 pm
by dustysparkle
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.

Re: Nissan Leaf Plugin

PostPosted: Mon Jan 18, 2016 3:54 am
by Gusten
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 :-)

Re: Nissan Leaf Plugin

PostPosted: Mon Jan 18, 2016 7:10 am
by Gusten
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'

Re: Nissan Leaf Plugin

PostPosted: Mon Jan 18, 2016 9:52 am
by Gusten
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