Nissan Leaf Component(s)/Platform

I’ve been trying to get it to work by making modifications to pycarwings2 and importing it as a custom component, but so far I’ve not been able to get it going.

I think the necessary changes are the ones I linked earlier, as I’ve seen some other projects making the same ones.

Any news on fixing this?
Is there an issue on this? If so I cant find it. Maybe the author doesn’t follow this thread :slight_smile:

@filcole did the revised component as I didn’t have much time for it.

Ideally we can get the pycarwings author to update it without it requiring a HASS update, not sure what the wildcard requirement is set to though

Edit: actually filcole IS the author of pycarwings now so he needs to update it

With the new setup, the manifest.json needs to be updated with the new pycarwings version to get the update to download. So a HA update will be needed, but if the changes are done in pycarwings it can easily be ran as a custom component until it’s merged in official release.

He hasn’t been seen on this forum anymore since the 25th of march, so I’m not counting on him to fix this :wink:

Can anyone tell us how to fix this manually?

Thanks!

Hi all,

I do not use the HomeAssistant component but the pycarwings2 library directly but, anyway, I fix my setup updating the pycarwings2.py file of the python library with the changes presented on this link:

I am not sure the default path where you have the python library files, but if you find the files and make these changes the component maybe works again.

Hi guys, I’ve tried my best and spent hours doing it, but I don’t use python, never got the hang of it.

I’ve fiddled about with some files and got nothing.

I’ve got a copy of the above updated pycarwings.py but I haven’t got a clue where to put it.

I got some time to look at this today, to get the official fix, we basically need 2 things.

@filcole, has to update his version of pycarwings2 with the above changes (to v 2.9 I guess) and then we need the manifest.json updated.

I don’t have a clue how this works on github, never used it.

But I have tested the changes in a local Hass.io installation and it does work.

Edit: Since Nissan have disabled the positioning, the device_tracker should probably be removed and maybe also some changes regarding that in pycarwings2 to get rid of some error messages.

Well?!? How did you get it going then? :wink:

Please tell.

Sure, I used an add-on named “Custom deps deployment” found here: https://github.com/home-assistant/hassio-addons-development

Using this config for the addon:

{
  "pypi": [
    "https://wheels.home-assistant.io/alpine-3.10/amd64/pycarwings2-2.8-py3-none-any.whl"
  ],
  "apk": []
}

I’m running this on a NUC so just don’t copy paste the config, consider the platform. I.e use armhf if you are running this on a pi.

Once the custom pycarwings2 is installed you can find it under /config/deps/lib/python3.7/site-packages/pycarwings2/ and here you can edit the existing file. Then it’s a reboot and it’s working again.

1 Like

Hi, thanks. I tried installing this, but It won’t work.

I made the changes as outlined here: API changes 25 July 2019 · ubarni/pycarwings2@078b710 · GitHub (3 lines)

Can you please attach your pycarwings2.py ?

Oops, it does work. After a reboot it initially didn’t work, but after restarting the homeassistant docker container it now does work.

@michel72 I don’t understand, reboot your server AND restarting the container? I have change those 3 lines inside the container (pycarwings2.py) but still get an invalid JSON response.

There is an invalid json response. Nissan has taken away the GPS tracker, so the device_tracker will give json error.

So, I finally found the time to get around to looking into this. An updated pycarwings2 (v2.9) has been released to pypi. And pull request https://github.com/home-assistant/home-assistant.io/pull/10207 now exists, awaiting merging into homeassistant.

Please note that device tracker support has been removed due to the Nissan European APIs no longer supporting it. This means that the nissan_connect: element in the config will have to be removed. This is a breaking change!

4 Likes

Cheers @filcole :slight_smile:

Great work @filcole!!

Works like a charm, very nice. Happy to be abled to see battery info in 10 secs again, instead of waiting for the Nissan server to wake up.

Thanks for fixing this!

Hello!

I am using Hassio, and home assistant v 0.99.3 and the last couple days, after updating perfectly the following rows appearing again and again until I restart the homeassistant server:
2019-09-29 10:05:01 DEBUG (MainThread) [homeassistant.components.nissan_leaf] Refresh currently in progress for Leaf
2019-09-29 10:05:01 DEBUG (MainThread) [homeassistant.components.nissan_leaf] Next update=2019-09-29 08:35:01.039855+00:100:

My refresh period is 30 minutes. It looks like after a while it stucks in this state.

Can somebody help with this?