Custom component Nissan Leaf via LeLink 2 (ELM327) BLE

Hey @pbutterworth any other thoughts on how I could get this working?

Ok, since it is not a lelink, it probably has different BLE UUIDs.

Got any documentation on this unit?

Also, where are you located?

I have a 2020 Leaf (ZE1) and was doing some background reading to get a solution for monitoring the carā€™s charge as live as possible (and triggering climate etc), without using the awful Nissan cloud stuff.

Am I right in thinking that the OBD port is physically shut off when the car is idle, with no way to trigger it at all? I can see some discussion of commands used by the TCU (Nissan Connect) to wake up the system but thereā€™s no real conclusions, and also removing the TCU might be necessary, which apparently stops lots of important parts of the entertainment system working.

I think the only real way to achieve this seems to be splicing into the EV CAN (which runs through the passenger cabin), connecting that to an ESP32 (which does CAN natively) and then reading the data directly off the bus. Hopefully being able to insert commands to control the heating etc? I have some transceivers on order from AliExpress, although I might impatiently buy one from a UK seller to get started soonerā€¦ It would be nice if it could all be done from ESPHome, but I suspect it might be a bit too complicated.

Yep, thereā€™s no apparent way of ā€˜waking upā€™ the CAN gateway. Not sure about the TCU stuff, as my New Zealand model doesnā€™t have any of that stuff.

If you are looking to tee into the EV CAN, then you should check out OVMS (https://www.openvehicles.com/). Thereā€™s a few out there who have done some work to splice into the CAN busses on the other side of the gateway. I just could bring myself to pony up the US$250 for the module.

Hiya, yes I read about OVMS ages ago and itā€™s tempting, but indeed seems a bit OTT for what I need to do, although it does have 3x CAN buses and doing more than 2x on the ESP32 means you need an external CAN controller (a bit messy), although I donā€™t think Iā€™ll need to use more than the EV and CAR CAN, soā€¦

I just re-read this thread fully (which you contributed to) and I didnā€™t spot that you can tap into the buses using 24 pin extension cable - much neater than the other posts I had read about hacking open the installed wiring! Iā€™ll order in one of those cables nowā€¦

1 Like

Hi Paul,

Iā€™m just getting back into this now. Iā€™ve had to change a few slices to suit a 30kWh car but the odometer has me stumped. I can see the correct value in the initial frame but I canā€™t figure out how to get it.

The frame is 763037F2211FFFFFFFF
The odo is 164,583 which I can get from starting from index 2 to index 5 (37, F2, 21) but instead the system provides 1,114,112.

Any ideas?

Thanks!
Daniel

Looks to me a bit like it is reporting km*50.

763 - header
03 - length
7F2211 - payload
FFFFFFFF - garbage

7F2211 = 8331793
8331793/50 = 166636
Your odo = 164585 (pretty close)

hmm, good guess but I just tried it on our other leaf (24kWh) which has half the number of km and it provided the same 763037F2211FFFFFFFF. Iā€™m picking b"03220e00", isnā€™t correct for the older cars but unfortunately there is not much online for them.
p.s. ignore finding164583 (above) in 37fe21 - that was ChatGPT hallucinating!

@Arquiteto, would you mind sharing your config? I have a 2016 AZE0 Leaf and similar Vgate iCar Pro BT4.0 dongle. But I havenā€™t managed to get it to work with this.

The first problem I see to have is getting HA to see the dongle. I have flashed an ESP32 with bluetooth proxy, but I donā€™t know how to get it to appear in HA.

Then, the tweaks youā€™ve made to Paulā€™s code are likely to be helpful.

Thanks!
Luke

The good news is I was able to get it to work with my 2016 Leaf using the tweaks @Arquiteto posted above, with my Vgate iCar Pro BT4.0 using these UUIDs in elm327.py:

    SERVICE_UUID = "000018f0-0000-1000-8000-00805f9b34fb"
    CHARACTERISTIC_UUID_READ = "00002af0-0000-1000-8000-00805f9b34fb"
    CHARACTERISTIC_UUID_WRITE = "00002af1-0000-1000-8000-00805f9b34fb"

It would be good to expose the UUIDs in the config somewhere so we donā€™t have to mod the code (I may look into that).

I have the same problem as others with older Leafs with the odometer. I found these to links that reference PID 5C5 = 1477 for the odometer:

https://leaf-obd.readthedocs.io/en/latest/pid/5c5.html

But, Iā€™m unclear how this translates into the code. @pbutterworth any pointers?

2 Likes

Iā€™ve been messing around with my attempt at solving the problem within ESPHome. Iā€™ll probably create a separate thread, but Iā€™ve been able to splice the 24 pin connector behind the instrument panel (into the CAN gateway) and then filter some messages using the CAN bus component. Iā€™m just using the car/vehicle CAN at the moment, some relevant stuff does appear on there, for example I can get the SOC when the car is on or charging. Iā€™ll look at the EV bus in more detail later. I havenā€™t been able to wake the EV system through the car/vehicle CAN yet, although the car CAN does seem to be active all the time and HA responds instantly to a door being opened etc.

Iā€™ve put some details in this blog post, which Iā€™ll try and update: Notes on integrating a Nissan Leaf ZE1 and Home Assistant

1 Like

I have one of those dongles, It doesnā€™t seem to work with LeafPpy pro, so I doubt it will work with this setup either.

hello
can anyone recommend a solution to this problem on last HA 2024.12 ?

Ticking ā€˜cache sensor valuesā€™ (in the integration config) fixed this for me.

Good day. I ask for help from the community. I got a NISSAN LEAF AZE0 2017. Iā€™m trying to install ā€œnissan_leaf_obd_bleā€.

OBD 2 scanner - Viecar V1.5 Bluetooth 4.0, has:
(is determined using: https://play.google.com/store/apps/details?id=com.macdom.ble.blescanner&hl)

SERVICE_UUID = "0000fff0-0000-1000-8000-00805f9b34fb"
CHARACTERISTIC_UUID_READ = "0000fff1-0000-1000-8000-00805f9b34fb"
CHARACTERISTIC_UUID_WRITE = "0000fff2-0000-1000-8000-00805f9b34fb"

Made changes to the files elm327.py and bleserial.py
Iā€™m getting an error when i try to install this integration: ā€œno_unconfigured_devicesā€
Bluetooth-proxy log:

[10:44:34][V][esp32_ble:348]: (BLE) gap_event_handler - 3
[10:44:34][V][bluetooth_proxy:058]: Proxying raw packet from XX:XX:XX:XX:XX:XX, length 18. RSSI: -71 dB
[10:44:34][V][bluetooth_proxy:061]: Proxying 1 packets
[10:44:34][VV][api.service:345]: send_bluetooth_le_raw_advertisements_response: BluetoothLERawAdvertisementsResponse {
advertisements: BluetoothLERawAdvertisement {
address: 154886500828764
rssi: -71
address_type: 0
data: ' Viecar\xf0\xff
}

Homeassistant.log : 2025-01-08 16:30:44.956 WARNING (ImportExecutor_0) [homeassistant.core] Config was used from nissan_leaf_obd_ble, this is a deprecated alias which will be removed in HA Core 2025.11. Use homeassistant.core_config.Config instead, please report it to the author of the 'nissan_leaf_obd_ble' custom integration

ā€¦the solution is found. In my case, it is necessary to replace the UUID in the manifest.json file