Nissan Leaf Component(s)/Platform

If you know someone that can help fixing that please tell me.
I can help but I cannot do it myself alone unfortunately.

Is asking to much to you to open this “issue” on the HA development if some one are able to help fixing this?
I can try to do that but for sure you have a lot more good inputs to add on it.

Thanks

Just updated to 2021.4.3, and the Nissan Integration didn’t load. So I found this thread, and just followed @andbad 's advice. Reboot. Now it works again on 2021.4.3

Yes, sometimes happens. :slight_smile:

By(t)e

This was working fine for me until I decide to make my Cloudflare Access a bit more secure.

Is there a way to know what server Is used (Or the IP range or at least the geo?)

Otherwise, and that would be a better solution, Cloudflare Access allow to bypass based on the URL, just wondering if anybody already tried this?

For an AZE1 new-shape LEAF, you could try my solution or @Sriracha’s fork. Not a full integration, but works well here.

2 Likes

I have this problem again.
I resolve in the same way of previous time. I edited the file
homeassistant/lib/python3.8/site-packages/pycarwings2/pycarwings2.py

at line 125:
headers={"User-Agent": "pycarwings2/2.10"}

with this:
headers={"User-Agent": ""}

By(t)e

4 Likes

@filcole Hi mate, it looks like the Nissan Leaf Integration has been borked again with the latest core-2021.5.5 update. Would you be able to take a look at it please?

Logger: pycarwings2.pycarwings2
Source: /usr/local/lib/python3.8/site-packages/pycarwings2/pycarwings2.py:164
First occurred: 6:40:30 PM (1 occurrences)
Last logged: 6:40:30 PM

carwings error INVALID PARAMS: 404

@andbad has a fix in the above post.

Thanks etc. :slight_smile:

Thank you! This fixed it.

For people using Container based install (OS, supervised, Docker), the file path is:
/usr/local/lib/python3.8/site-packages/pycarwings2/pycarwings2.py

For supervised and Docker, use this command to get into HA Core Container to get at the file:
docker container exec -it homeassistant bash

2 Likes

I have the same problem using Home Assistant OS on a Raspberry Pi with core-2021.5.3
Been struggling to get to file. Is there a way to edit the file on my setup?

I use the Leaf data to always charge the car to 70% overnight in low tariff. If I need the car, I set a departure percentage, day and time and the automation will top up the car if needed and activate climate control just before I am leaving.
I just realize now how much I love this automation, now it is broken.

Try this for HA OS (the second set of steps)

Then inside HA container, use the path I posted above with Linux CLI editor of your choice (nano or vi)

Thanks! I’ll dive into this when I have enough time, probably Tuesday.
Let you know.

Sorry, i have home assistant based on linux on a vm in proxmox.
I cannot find /usr/local/lib/python3.8/site-packages/pycarwings2/pycarwings2.py even it’s the fil I see in the log.
I user the terminal extension to do ssh, is it the issue??
Kindly

Gregori

My integration was working fine, I was using some Node red automation and everything was perfect
but since three day ago the Nissan Leaf entity vanished and my dashboard show instead

Entity not available: sensor.leaf1mail_charge (and etc…)

Looking at the log I have some error

2021-05-22 17:32:54 ERROR (SyncWorker_9) [pycarwings2.pycarwings2] carwings error INVALID PARAMS: 404
2021-05-22 17:32:54 ERROR (SyncWorker_9) [homeassistant.components.nissan_leaf] An unknown error occurred while connecting to Nissan: <class 'pycarwings2.pycarwings2.CarwingsError'>
2021-05-22 17:50:20 ERROR (SyncWorker_2) [homeassistant.components.nissan_leaf] An unknown error occurred while connecting to Nissan: <class 'pycarwings2.pycarwings2.CarwingsError'>

I didn’t touch the config since but here it is


nissan_leaf:
  username: !secret nissan_user
  password: !secret nissan_pwd
  region: "NE"
  update_interval:
    hours: 1
  update_interval_charging:
    minutes: 15
  update_interval_climate:
    minutes: 5
  force_miles: false
logger:
  default: critical
  logs:
    homeassistant.components.nissan_leaf: debug
    homeassistant.components.sensor.nissan_leaf: debug
    homeassistant.components.switch.nissan_leaf: debug

See my answer above. Nissan change something in its server.

By(t)e

Sorry. ok thanks.

I can see the file using SSH but It’s seems like nano is not installed, how can I make the change?

Try vi rather than vim

1 Like

Thank you!

Screenshot 2021-05-24 at 11.12.09 Screenshot 2021-05-24 at 11.12.01

I created a (ugly) card for my wife’s leaf, but I would like to add a text like “last check: 10 min ago” or whatever.

any idea how to implement that? or then only showing the late update date?

for example how could I display binary_sensor.leaf1mail_charging_status sub state (updated_on) formatted like HH:MM ?

At the linked page it was suggested to use the Portainer add-on to access the homeassistant container. That turned out to be surprisingly easy.
When inside the container I used VI to edit pycarwings2.py, using the path provided by wyx087 and the change provided by andbad.

My car is connected again, thanks guys!

1 Like