BLE (LELink2) / leaf open-source libraries

My Nissan Leaf Forum

Help Support My Nissan Leaf Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

LeafAutomator

New member
Joined
Apr 19, 2023
Messages
1
I would like to implement an extension for Home Assistant ( an opensource home Automation solution) that communicates with the LeLink2 as my Leaf returns home, to at least capture the current battery charge.
This could then trigger automations/ show on dashboards the state of charge.
Are there any opensource libraries that implement the communication with a Lelink over BLE?
I understand the BLE turns off a few minutes after the car is turned off.
 
I would like to implement an extension for Home Assistant ( an opensource home Automation solution) that communicates with the LeLink2 as my Leaf returns home, to at least capture the current battery charge.
This could then trigger automations/ show on dashboards the state of charge.
Are there any opensource libraries that implement the communication with a Lelink over BLE?
I understand the BLE turns off a few minutes after the car is turned off.
I don't have any experience with the LeLink2, but those metrics you mention are certainly available on the CAN bus and readily decodable using pulicly known methods. It should definitely be possible to extract them to your HA system in various ways :)

The way that I'm doing it is with an MCP2515 CAN board and an ESP32 microcontroller with wifi. I use OpenHab in the role that you use Home Assistant but otherwise similar ideas, ie presence detection when the device is near home, automatically obtaining and logging current SoC and odometer reading upon arrival back, and controlling the EVSE's own power supply to enable limiting vehicle charge to presets (eg 75%).

One thing to keep in mind when using an OBD solution is that unlike the *ZE0 models, in the ZE1 Leaf there is no CAN bus background traffic to monitor at the OBD - you have to bridge on to one of the 3 CAN busses elsewhere in the car to get that (ie downstream of the CAN gateway). If you're working with an older model then it's no problem as all the CAN traffic is right there at the OBD connector. It can still be done at the OBD on the ZE1 too, but your micro has to constantly poll the ECUs instead of just sniffing the background traffic, and that's an order of magnitude more work to implement.
 
I would like to implement an extension for Home Assistant ( an opensource home Automation solution) that communicates with the LeLink2 as my Leaf returns home, to at least capture the current battery charge.
This could then trigger automations/ show on dashboards the state of charge.
Are there any opensource libraries that implement the communication with a Lelink over BLE?
I understand the BLE turns off a few minutes after the car is turned off.
I am documenting my progress here:
https://mynissanleaf.com/threads/my-nissan-leaf-2021-obd2-elm327-bluetooth-adventure.35042/

I now have a trace of what Leaf Spy Pro is doing, so it should be relatively straight-forward (but "hard" work) from here.
 
Back
Top