Nissan Leaf Component(s)/Platform

NissanConnectEV website is still undergoing maintenance. Suspect this is due to the new Leaf 3 release, see https://www.zap-map.com/new-62-kwh-nissan-leaf-3-zero-e-launched/. Interestingly mentions A new NissanConnectEV app will be launched at the same time.

Thank you for sharing that! Unfortunately I just traded in my Zoe for A VW eGolf :slight_smile:.

@filcole thanks for your work on this, I simply haven’t had the time lately.

You may want to tackle one issue I came across though, it seems if there’s an error of some sorts the main login method will loop over and over, spamming Nissan’s servers. Chances are they’d have no way of telling what’s going on as they probably don’t even have proper monitoring in place, but on the off-chance it’s probably best to handle this somehow so we don’t end up getting people IP banned.

The reason people are having issues with using custom_components is because you’re doing an absolute import, rather than a relative one.

from homeassistant.components.nissan_leaf import (

Should be

from ..nissan_leaf import (

This may not be within the HASS spec, but should probably be used until the component has been merged into the codebase.

Finally, there seems to be a bug with getting the climate control data right now, specifically it’s an issue in pycarwings rather than the component though. I’ve raised an issue here

3 Likes

It would be nice if the app actually launches on my phone. Apparently the OnePlus phone is not supported so the app closes immediately. Thanks for the info!

@filcole @BenWoodford Thanks for the info, it works (sort of). On start of HA the carwings info is retrieved but only once. Further requests give a 408 error.

carwings error; logging in and trying request again: {‘status’: 408}

However climate control switch still works.

Thanks for the reports. As soon as Nissan fix me on their website I can get working on this again. :frowning:

I was prompted to change my password recently on You+Nissan the other day (so I did). It didn’t actually change it for CarWings stupidly but using my old password in my car and on HASS worked.

It does seem that the servers are working again now?

I got some time over weekend to look at this again and changed the code so it works under custom_components.

This component seems to be working fine for me now.

I’ve got one minor “cosmetical” suggestion, this to make the look and feel like the other already existing car components.

Remove the hard coded icons for “binary_sensor.xxx_plug_status” and use device_class: plug for it instead.

@Abertil What files are you using? I’ve moved back to Hassio and would like to get this working again. Thanks.

How did you get the Leaf Charge time (2200w) and Leaf Charge Time (6000w) to show up?

I made a template sensor.

0.24 in the template is because I have a 24KwH leaf, and the /6 is for the 6000w.

  • platform: template
    sensors:
    leaf_charge_time_1:
    entity_id:
    - sensor.L333OND_charge
    friendly_name: “Leaf Charge Time (6000w)”
    value_template: “{{(0.24 * (100-states(‘sensor.L333OND_charge’)|int)/6) | round(2)}}”
    unit_of_measurement: ‘Hours’
    icon_template: mdi:timer
2 Likes

I took the files above and changed them according to @BenWoodford instructions.

The reason people are having issues with using custom_components is because you’re doing an absolute import, rather than a relative one.

from homeassistant.components.nissan_leaf import (

Should be

from ..nissan_leaf import (

Then put them in my custom_component folders.

1 Like

The latest version of @filcole’s pull request seems to be working pretty well for me now, except that the plug binary status never seems to change to on when my LEAF is plugged in. Is that something going on with Nissan’s API, or something I have to do on my end to get it to work?

I also notice when polling Nissan, it checks very frequently, do you think it makes sense to hit the API less frequently? It is very slow. It takes 15-20 attempts for me to get the refreshed data:

2019-01-15 22:07:30 INFO (MainThread) [homeassistant.components.nissan_leaf] Battery data (<VIN>) not in yet (21). Seeing if nissan server data has changed

Yeah it’s probably best to change the check interval, especially as Nissan’s servers are being so slow right now.

Status updates into HASS don’t need to be that instantaneous as it’s checking regularly anyway and the important bit with climate control is sending the command

Now when you mention it, I haven’t been paying attention earlier, but I’m having the same issue with the binary sensor and also the charging sensor, those never update.

It worked here to on hassio. I have a 2014 leaf.
When I activate the climate control switch the heat is on. But the other leaf sensor stops responding and I have to restart home assistant. And as others also have mentioned the binary_sensor.leaf2014_plug_status is always false.

I’ve found the issue and have submitted an issue for it, don’t really have time to PR it myself right now. Basically any errors on Nissan’s servers will crash out the update loop right now.

Thanks all. Every time I try to seriously work on this properly the Nissan servers stop working. Highly frustrating.

Think pluginStatus is foobared because the servers have started returning “PluginStatus” rather than “pluginStatus” as they used to do. Planning to update pycarwings2 to be case insensitive to hopefully elimiate these glitches. Difficult to test at the moment.

HI @stbenjam, Plugin status was not included in the updates, so was never changes. The latest version of the component should have a fix for this in it. Thanks for reporting. Phil

Hi @BenWoodford, I’ve updated the pull request to contain a few fixes. Needs a good bit of testing, but may improve things. All testing appreciated by all comers :slight_smile: Cheers, Phil