Nissan Leaf Component(s)/Platform

Thanks for this @filcole, bit I’m not as savvy as you may think I am :slight_smile:

These changes you’ve been doing, am I supposed to be updating my files somehow, from somewhere?

Cheers :slight_smile:

P.S. my config has the nissan_connect: set to false as I’m using carwings.

1 Like

Updated the custom_components for 0.88.0

LINKY

3 Likes

So, I think I’m getting pretty close to nailing this, but my Hassio keep nagging about this missing pycarwings2 module. And I cant figure out how to, and where to install it om my Hassoi

File “/config/custom_components/nissan_leaf/init.py”, line 91, in async_setup
import pycarwings2
ModuleNotFoundError: No module named ‘pycarwings2’

Managed too remove other error messages after installing the last pack of components for 0.88.0
I’m pretty noob in this and have no idea how I activate this as an Entity. But I’m really keen to get my Leaf on my HA :slight_smile:

Have you tried to restart your pi? :slight_smile:

I’ve been a little absent last weeks, but now I’m jumping in to the testing again.

Just grabbbed the new files and I’m gettting a few new errors.

carwings error INVALID PARAMS: -2010

5:28 PM deps/lib/python3.7/site-packages/pycarwings2/pycarwings2.py (ERROR)

An unknown error occurred while connecting to Nissan: <class 'pycarwings2.pycarwings2.CarwingsError'>

5:28 PM custom_components/nissan_leaf/__init__.py (ERROR)

Things were completly fine when running a few weeks old files.

Which files are you using @Abertil? The ones I’ve linked to or some other files?

I was using the ones that you linked, I was too lazy to dig them up from @filcoles repository. But since the errors refers to pycarwings, I’m guessing it shouldn’t matter.

1 Like

It should download and install itself. Did you do a full pi reset after “installing”. Not just restart HA?

Not running on a pi, and I’ve been toggling around with the versions earlier, so it should be there.

It’s the NISSAN API (carwings) again. Myleaf app is not working either.

Makes sense, earlier we got other error messages, but that may be the case.

Yes, there have been lots of complaining about Nissan servers being down today, and they just released a new version of their app today. Maybe they did some changes to their API again?

Btw. How can I verify if the pycarwings2 have been downloaded automatically to my pi or not? can I look for it in any folder location. I quess a full pi reset can be found in the HA somewhere, or should I just pull the plugg for a few sec, and plug it back in? Is it the one called Reboot under Hassio>system>reboot I should use for a full pi restart?

Thats the one :slight_smile:
“The one called Reboot under Hassio>system>reboot. Use for a full pi restart.”

I’m told the plug is only when left no choice.

Thanks… It looks like the pycarwings2 is now installed, as the error now is different:

2019-02-25 21:09:19 WARNING (MainThread) [homeassistant.loader] You are using a custom component for nissan_leaf which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.

2019-02-25 21:09:29 ERROR (MainThread) [pycarwings2.pycarwings2] carwings error INVALID PARAMS: -2010

2019-02-25 21:09:29 ERROR (MainThread) [custom_components.nissan_leaf] An unknown error occurred while connecting to Nissan: <class ‘pycarwings2.pycarwings2.CarwingsError’>

Hi,

If you could try adding the following to your configuration.yaml to increase the logging for pycarwings2:

logger:
    default: critical
    logs:
        homeassistant.components.nissan_leaf: debug
        pycarwings2: debug

The nissan servers have been working OK for me on my installation (on a Raspberry Pi). btw it looks like this might make it into the next release of home assistant, version 0.89.

Thanks, and what do I do with the log? (I’m a noob at this)

Here is what I get from the logs.

2019-02-26 07:36:26 DEBUG (MainThread) [pycarwings2.pycarwings2] invoking carwings API: https://gdcportalgw.its-mo.com/api_v181217_NE/gdc/InitialApp.php
2019-02-26 07:36:26 DEBUG (MainThread) [pycarwings2.pycarwings2] params: {
   "RegionCode": "NE",
   "custom_sessionid": "",
   "initial_app_strings": "geORNtsZe5I4lRGjG9GZiA",
   "lg": "en-US"
}
2019-02-26 07:36:28 DEBUG (MainThread) [pycarwings2.pycarwings2] Response HTTP Status Code: 200
2019-02-26 07:36:28 DEBUG (MainThread) [pycarwings2.pycarwings2] Response HTTP Response Body: b'{"status":200,"message":"success","baseprm":"uyI5Dj9g8VCOFDnBRUbr3g"}'
2019-02-26 07:36:28 DEBUG (MainThread) [pycarwings2.pycarwings2] invoking carwings API: https://gdcportalgw.its-mo.com/api_v181217_NE/gdc/UserLoginRequest.php
2019-02-26 07:36:28 DEBUG (MainThread) [pycarwings2.pycarwings2] params: {
   "Password": "removed for privacy reasons",
   "RegionCode": "NE",
   "UserId": "removed for privacy reasons",
   "custom_sessionid": "",
   "initial_app_strings": "geORNtsZe5I4lRGjG9GZiA"
}
2019-02-26 07:36:32 DEBUG (MainThread) [pycarwings2.pycarwings2] Response HTTP Status Code: 200
2019-02-26 07:36:32 DEBUG (MainThread) [pycarwings2.pycarwings2] Response HTTP Response Body: b'{"status":"-2010","message":"INVALID PARAMS"}'
2019-02-26 07:36:32 ERROR (MainThread) [pycarwings2.pycarwings2] carwings error INVALID PARAMS: -2010

The strange part is that the password shown in the log isn’t my password from configuration.yaml.

It looks like I get very much the same in my log, and also wondered about the pw being replaced by a random string. Is it encrypted somehow?

After a restart this morning the errors were gone.

So my guess is that this is the error code for service not available or something similar.

I’m afraid it’s not working any more, the errors are gone but the status is not correctly updated. Battery shows 100% while the Myleaf app shows 97% (which is correct). The Myleaf app had an update yesterday stating “Migrated to new REST API.”