Nissan Leaf Component(s)/Platform

I have this exact issue. UK late-2014 CarWings Leaf. It’s been like this for ages, finally decided to ask because wife keeps asking me charge left in the car.

Whenever I try to refresh its values, either automatically according to setting or forced update, I always get this CarWings error, status 408.

But if I restart HA, it fetches the battery level and it works (except during HA 0.118). Anyone else experiencing this? Anyone know why?

I have this same exact issue, worked fine until the update to 2021.1.5… I wonder what changed in this update to break the Leaf integration.

I downgraded back to 2021.1.4 and still has the same issue.
I also tried with the dartcarwings library and have the same issue.

Maybe it is the api that changed on nissan’s side?

The question should be: Is there anyone that does not have this issue? If yes, which region are you in?

I do not have this issue.
Home Assistant 2021.1.5. Europe, 2013 Leaf.

The component doesn’t work 50% of the time. If I restart HA, I resolve the issue.

By(t)e

1 Like

For people complaining about the integration failing to run… Please consider that Nissan servers are very slow and unreliable. If the integration is broken, there is a high change the official Nissan mobile app would also be broken (or just extremely slow).


There is a related topic on the Feature Requests category: Enhanced Nissan leaf integration

HI there
I am managing to get all the stats downloaded fine (charge percentage, range) but when I try to switch on the climate control it comes back with ‘cannot call service turn_on’ or similar. Anyone any thoughts?
Many thanks
Andy

@denilsonsa The leaf integration uses the Carwings api from Nissan. in Canada with my Leaf made in 2018, I cannot use this API anymore for some reason (Cannot login since 10 days, not related to slowness). Nissan has two other API: NissanConnect and NissanConnectNA. NissanConnectNA does work with my car.

Because of this, and because I was tired to see my home assistant taking forever to bootup because of the Leaf integration, I decided to start from @Troon’s docker container and modify it (completely) to support multiple vehicles and all of the 3 APIs.

For now, only NissanConnect (all Leafs made after May 2019 per My Leaf app) and NissanConnectNA (North America Leafs older than May 2019) are implemented right now (I need feedback if someone can test with a May 2019 or newer Leaf). However, for the other older Leafs from other region, I am missing a blowfish implementation in Dart (did not have time to look for work around).

So, if you have a completely broken integration (not working at all, even after restart), if you want to have a faster home assistant startup or if you want to help me test other Leafs/Regions, then you are welcome to try it (read the readme).

For now, it supports battery info, climate info (if supported by API), start charging, start/stop hvac (with target temperature if supported by API).

This is all I use for my setup, but if there is demand, I may add more.
Note that I am just starting to use it, there could be issues.

1 Like

Looking forward to this working — it’s how mine should have been from the start but I’m not proficient enough in Dart to do a proper MQTT app and too time-poor to learn. I’ll certainly try it out with my UK 2020 car when it’s stable enough.

Polling from HA via MQTT request as required is definitely better than a scheduled update in the container, particularly if I’m right about frequent updates giving 12V battery issues. Can set up HA to not query overnight when idle and no-one cares, can align to charging times for quicker updates on charge curves etc.

I just started another approach - using Node-Red - just Node-Red, no other dependencies.

I mainly extracted all the bits & pieces from dartnissanconnect and implemented these in three Node-Red-Subflows. It’s not complete yet, but Battery/Climate and Location-Updates are working, start/stop HVac also.

All the Infos are stored to MQTT.

Bildschirmfoto 2021-02-07 um 13.11.22

Hello @Troon, no worries, it is my first experience with Dart, but the similarities with C# helped me a lot!

So I added a retry mechanism and better error handling (receives many Exceptions and Errors from the DartNissanConnectNA library). I run it since yesterday without issue. If you decide to try it and you have issues, please enable the logs with the environment variable LOG_LEVEL=“all” and then you can get the logs with the command docker logs leaf2mqtt.

About the 12V battery issues, I also think it should not be done frequently. As you can see in the setup section of the readme, you can specify a custom value (I personally use 1440, for 1 day).
I also added the script I use to call for an update from Home Assistant. It was always reliable for me even with the native integration : https://github.com/yp87/leaf2mqtt#recommended-battery-status-update-script

Again, if anyone wants to give it a try, go ahead and open an issue if you find a problem or you want something added.

@Sriracha does it working with hassio? i am notsure how to use mqtt

Hello @ExtrixNL, leaf2mqtt is made to be independent of Home Assistant.
You can use the Mosquitto addon to have a MQTT broker.
Once you have that, you can run leaf2mqtt on another computer (not sure if you can manually start a container on the hassio host). If leaf2mqtt and the mosquitto addon are correctly configured, you will then be able to receive data and send commands using the examples I posted in the Readme of leaf2mqtt.

Mosquitto works like a middle man like this: leaf2mqtt < — > MQTT Broker < — > Home assistant

To run leaf2mqtt natively in hassio, it needs to be made into an home assistant addon.

Hi @Sriracha ,

Working on running the docker container. Got problem with one thing the run string wouldn;t execute.

docker run -e LEAF_USERNAME=[*] -e LEAF_PASSWORD="[*]" -e LEAF_TYPE=[newerThanMay2019] -e MQTT_USERNAME="[homeassistant]" -e MQTT_PASSWORD="[*]" -e MQTT_HOST=[192.168.2.180] -e MQTT_BASE_TOPIC=[leaf] -e UPDATE_INTERVAL_MINUTES=[60] -e CHARGING_UPDATE_INTERVAL_MINUTES=[15] --name leaf2mqtt leaf2mqtt

it gives me a error on Leaf type is not correct. can you help me out with this one?

SEVERE: 2021-02-09 14:57:52.062063: main: LEAF_TYPE environment variable must be set to a valid value from: [LeafType.newerThanMay2019, LeafType.olderCanada, LeafType.olderUsa]

@ExtrixNL you have to omit the [ ] :slight_smile: I will clarify this later in the readme!

fixed it thank you! new to docker

Can you give any more information how you did this? It would be nice to get my Leaf also connected in Home Assistant.

I’ve created three Nodes. The first one is for session/login. The second one is the Action-Node. Actions in NissanConnect are mostly connections to the car itself (takes some time). The third Node is a Status-Node. This Node fetches the last known states from the Nissan-Connect-Database. All in all its just an extract from DartNissanConnect.

But you get all the flexibility from Node-Red. In the attached Image you can see how it works.
It only supports the new NissanConnect-Api (Modelyear MY19 upwards, Mid. 2019).

Do you have a link with some additional info on the Node-Red setup? I’m running something similar for my other card and that works ok.

I’ve uploaded the Subflows and a Demo-flow to Github

1 Like