Custom component Nissan Leaf via LeLink 2 (ELM327) BLE

OK, I’ve added odometer. There some responses that don’t match with the available documentation, so there’s probably some weird values.

@liebefuroscar, nope, this is implemented as a HA custom component directly. I use a esphome bluetooth proxy to reach the car.

2 Likes

OK, here’s a first cut https://github.com/pbutterworth/nissan-leaf-obd-ble

It’s a total shambles, and probably won’t work, but feel free to give it a go.
Installation is by pasting the nissan_leaf_obd_ble folder into you confg/custom_component folder, then restarting.
Then, if there is a LeLink BLE dongle in range of a bluetooth adapter somewhere, then HA will discover this and offer to add the Nissan component.

Warning: this is set to poll the car every 60 seconds. On my 2021 Leaf, this causes a relay in the engine bay to click every time.

Thinks still to do:

  • clean up the api stack, and move it out to a separate PyPI module.
  • Somehow knock back the polling rate when the car is off (no point, and clicking).
  • Trigger a fast polling rate when the car comes into range (arriving home).
  • Magically work out how to start fast polling again if the car is switched on. I don’t have any leads on how I might do this yet.
  • Figure out how to manage unavailable data in HA. At the moment it is caching the data forever, so if there is no data from the car (i.e. it’s off), the data showing in HA is whatever the last good data was, which seems a bit weird.
3 Likes

Nice, I managed to install it and it has populated values in HA.

I’ve noted the following - hope this helps.

At the moment it only seems to do a single update of values on first startup of the ESP32. Turning the car on and off, restarting HA or unplugging the obd adapter doesn’t result in an new data coming through to HA.

I can see via the ESP32 log that the OBD adapter and HA are talking regularly (backed up by lights on the OBD adapter).

I’ve attached screenshots of the sensors for reference. So far I’ve noticed:

  • SOC reading 1,310.7206%

  • Odometer is zero

  • There may be other sensors not working but it’s hard to tell due to the sensors not updating.

Note: I’m using it with a 2014 24kWh so some things may be different. Notably there isn’t any clicking in the engine bay.

Thanks for sharing your work. Hopefully this helps.

Capture23

Awesome! Miracle it works at all tbh.
How are you with accessing HA logs?

Try adding this to your configuration.yaml:

logger:
  default: warning
  logs:
    custom_components.nissan_leaf_obd_ble: debug

Then run it for a while and fetch the logs.
You should be able to inspect the raw data replied from each command.
Compare and contrast with this:
https://mynissanleaf.com/threads/my-nissan-leaf-2021-obd2-elm327-bluetooth-adventure.35042/post-639593

Thanks, I’ll give that a go. The log is the ESPHome device log.

It appears the data is updating every minute - I can see the values in the log changing once per minute (output copied below).

The entities in the integration update on the initial Home Assistant boot but not on each subsequent update.

> 2024-07-15 22:20:12.408 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] ======================= python-OBD (v%s) =======================
2024-07-15 22:20:17.727 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] ===================================================================
2024-07-15 22:20:18.492 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'7970210C0': Mystery command
2024-07-15 22:20:18.818 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0250C00000000000
2024-07-15 22:20:18.818 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'79703221304': Power switch status
2024-07-15 22:20:19.216 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0562130480BC0000
2024-07-15 22:20:19.216 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'79703221156': Gear position
2024-07-15 22:20:19.529 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0462115601000000
2024-07-15 22:20:19.529 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'79703221103': 12V battery voltage
2024-07-15 22:20:19.840 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A04621103A2000000
2024-07-15 22:20:19.841 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'79703221183': 12V battery current
2024-07-15 22:20:20.155 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0562118300000000
2024-07-15 22:20:20.155 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'79703221203': Number of quick charges
2024-07-15 22:20:20.386 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A05621203003E0000
2024-07-15 22:20:20.387 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'79703221205': Number of L1/L2 charges
2024-07-15 22:20:20.753 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0562120505DE0000
2024-07-15 22:20:20.753 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'7970322115d': Ambient temperature
2024-07-15 22:20:21.006 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0462115D6B000000
2024-07-15 22:20:21.006 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'79703221261': Estimated AC system power
2024-07-15 22:20:21.347 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0462126100000000
2024-07-15 22:20:21.348 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'79703221262': Estimated PTC system power
2024-07-15 22:20:21.577 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0462126200000000
2024-07-15 22:20:21.578 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'79703221152': Auxiliary equipment power
2024-07-15 22:20:21.785 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0462115204000000
2024-07-15 22:20:21.785 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'79703221151': AC system power
2024-07-15 22:20:21.998 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0462115100000000
2024-07-15 22:20:21.999 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'79703221234': Plug state of J1772 socket
2024-07-15 22:20:22.192 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0462123400000000
2024-07-15 22:20:22.193 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'7970322114e': Charging mode
2024-07-15 22:20:22.395 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0462114E00000000
2024-07-15 22:20:22.395 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'79703221255': Motor RPM
2024-07-15 22:20:22.602 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0562125500000000
2024-07-15 22:20:22.603 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'79703221236': On-board charger output power
2024-07-15 22:20:22.810 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0562123600000000
2024-07-15 22:20:22.811 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'79703221146': Traction motor power
2024-07-15 22:20:23.015 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0562114600000000
2024-07-15 22:20:23.015 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'7970322121a': Vehicle speed
2024-07-15 22:20:23.218 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0562121A00000000
2024-07-15 22:20:23.219 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'79703221106': AC status
2024-07-15 22:20:23.409 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0562110600B00000
2024-07-15 22:20:23.410 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'7970322110f': Rear heater status
2024-07-15 22:20:23.630 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0462110FA2000000
2024-07-15 22:20:23.630 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'79703221318': ECO mode status
2024-07-15 22:20:23.845 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0562131800800000
2024-07-15 22:20:23.845 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'7970322131A': e-Pedal mode status
2024-07-15 22:20:24.045 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0562131A00100000
2024-07-15 22:20:24.660 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'74303220e01': Total odometer reading (km)
2024-07-15 22:20:24.877 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 763037F2211FFFFFFFF
2024-07-15 22:20:24.878 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.OBDCommand] Message was shorter than expected (3<6). Padded message: bytearray(b'\x7f"\x11\x00\x00\x00')
2024-07-15 22:20:24.878 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'74303220e25': Tyre pressure front right
2024-07-15 22:20:25.071 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 763037F2211FFFFFFFF
2024-07-15 22:20:25.071 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.OBDCommand] Message was shorter than expected (3<4). Padded message: bytearray(b'\x7f"\x11\x00')
2024-07-15 22:20:25.071 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'74303220e26': Tyre pressure front left
2024-07-15 22:20:25.264 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 763037F2211FFFFFFFF
2024-07-15 22:20:25.264 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.OBDCommand] Message was shorter than expected (3<4). Padded message: bytearray(b'\x7f"\x11\x00')
2024-07-15 22:20:25.264 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'74303220e27': Tyre pressure rear right
2024-07-15 22:20:25.509 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 763037F2211FFFFFFFF
2024-07-15 22:20:25.510 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.OBDCommand] Message was shorter than expected (3<4). Padded message: bytearray(b'\x7f"\x11\x00')
2024-07-15 22:20:25.510 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'74303220e28': Tyre pressure rear left
2024-07-15 22:20:25.783 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 763037F2211FFFFFFFF
2024-07-15 22:20:25.783 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.OBDCommand] Message was shorter than expected (3<4). Padded message: bytearray(b'\x7f"\x11\x00')
2024-07-15 22:20:25.783 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'74303220e24': Remaining range (km)
2024-07-15 22:20:25.984 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 763037F2211FFFFFFFF
2024-07-15 22:20:25.984 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.OBDCommand] Message was shorter than expected (3<13). Padded message: bytearray(b'\x7f"\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
2024-07-15 22:20:26.899 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'79B022101': Li-ion battery controller
2024-07-15 22:20:27.154 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 7BB10296101FFFFFCE5
2024-07-15 22:20:27.154 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 7BB21028A0000006DFF
2024-07-15 22:20:27.154 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 7BB22FFFFFF05FA2AF8
2024-07-15 22:20:27.154 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 7BB2396AF32C4037C00
2024-07-15 22:20:27.154 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 7BB245C1246000C4E66
2024-07-15 22:20:27.154 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 7BB250006E58B800005
2024-07-15 22:20:27.154 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.OBDCommand] Message was shorter than expected (41<53). Padded message: bytearray(b'a\x01\xff\xff\xfc\xe5\x02\x8a\x00\x00\x00m\xff\xff\xff\xff\x05\xfa*\xf8\x96\xaf2\xc4\x03|\x00\\\x12F\x00\x0cNf\x00\x06\xe5\x8b\x80\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
2024-07-15 22:20:27.154 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble] Returning data: {'power_switch': True, 'gear_position': 'Park', 'bat_12v_voltage': 12.96, 'bat_12v_current': 0.0, 'quick_charges': 62, 'l1_l2_charges': 1502, 'ambient_temp': 13.5, 'estimated_ac_power': 0, 'estimated_ptc_power': 0, 'aux_power': 400, 'ac_power': 0, 'plug_state': 'Not plugged', 'charge_mode': 'Not charging', 'rpm': 0, 'obc_out_power': 0, 'motor_power': 0, 'speed': 0.0, 'ac_on': False, 'rear_heater': True, 'eco_mode': False, 'e_pedal_mode': False, 'odometer': 0.0, 'tp_fr': 0.0, 'tp_fl': 0.0, 'tp_rr': 0.0, 'tp_rl': 0.0, 'range_remaining': 0.0, 'state_of_charge': 668.4678, 'hv_battery_health': 0.1171875, 'hv_battery_Ah': 914.2272, 'hv_battery_current_1': -0.7763671875, 'hv_battery_current_2': 0.1064453125, 'hv_battery_voltage': 385.75}
2024-07-15 22:20:27.155 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Closing connection
2024-07-15 22:20:28.022 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble] Finished fetching nissan_leaf_obd_ble data in 15.614 seconds (success: True)

@daniel.hill.nz OK, so looks like there are a bunch of differences between your 2014 and the information about the 2018 in the pdf in the link I sent. One of the key differences between the gen1 and gen2 leafs is that in the gen2, all can traffic is routed via a can gateway, whereas on gen1, there is direct access to the canbus on the OBD connector. So on your leaf it should be possible to ask the dongle to stream the can messages continuously. I haven’t structured this HA component to deal with that, rather I intermittently connect and fetch data.

Anyhow, given that some of the request commands are different on yours, perhaps scour the internet and see if anyone has posted up information about the command/response data for the gen1? I found this, but seems to relate to the monitoring stream, rather than a query/reponse type thing.

In the meantime, I’m working on tidying up, and making the component a bit more well behaved…

PS: what was the indicated SoC on the dash when you did this? The SoC data must be in that Battery controller packet somewhere…
PPS: about 80% by any chance?

New version available v0.2.0:

Done a bit of hack and slash.

Notable changes:
If the car is out of range, it will pretty much stop polling (once an hour), and wait for a BLE advertisement. As soon as it detects the device, it’ll resume 10-second polling.
If the car is in range, but not getting any data (car probably off), then it changes to 5-minute polling.
If the car isn’t connected and feeding data through, then the sensors will appear either as Unavailable or Unknown.

Because of the 5 minute polling thing, if the car is off, then you switch it on, it could be up to 5 minutes before you see some data coming through. Feel free to adjust this in coordinator.py to suit your tastes.

1 Like

Yes, it was around 80%! I think i’ve found soc in the in the 5th frame of the battery controller - 7BB245C1243000A89D1
The reference was Active EV-CAN sampling: cell voltages, pack temperatures... | My Nissan Leaf Forum

The change I made was in decoder.py - changing line 306 to int.from_bytes(d[31:34])

I note (at least of the 2014 model) some data is available every few minutes when charging. This doesn’t include the battery controller but does have some useful info around plug state etc. It appears the lack of battery information prevents this being added to HA? (it remains unknown)

2024-07-16 23:30:23.626 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.coordinator] Check if the device is still available to connect

2024-07-16 23:30:23.626 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Connecting to BLEDevice

2024-07-16 23:30:28.177 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'7970210C0': Mystery command

2024-07-16 23:30:28.500 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0250C00000000000

2024-07-16 23:30:28.500 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'79703221304': Power switch status

2024-07-16 23:30:28.806 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0562130400BC0000

2024-07-16 23:30:28.806 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'79703221156': Gear position

2024-07-16 23:30:29.113 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0462115601000000

2024-07-16 23:30:29.113 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'79703221103': 12V battery voltage

2024-07-16 23:30:29.420 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A04621103A1000000

2024-07-16 23:30:29.420 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'79703221183': 12V battery current

2024-07-16 23:30:29.625 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0562118300000000

2024-07-16 23:30:29.625 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'79703221203': Number of quick charges

2024-07-16 23:30:29.828 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A05621203003E0000

2024-07-16 23:30:29.828 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'79703221205': Number of L1/L2 charges

2024-07-16 23:30:30.037 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0562120505E00000

2024-07-16 23:30:30.037 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'7970322115d': Ambient temperature

2024-07-16 23:30:30.237 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0462115D6F000000

2024-07-16 23:30:30.237 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'79703221261': Estimated AC system power

2024-07-16 23:30:30.441 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0462126100000000

2024-07-16 23:30:30.441 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'79703221262': Estimated PTC system power

2024-07-16 23:30:30.648 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0462126200000000

2024-07-16 23:30:30.649 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'79703221152': Auxiliary equipment power

2024-07-16 23:30:30.852 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0462115201000000

2024-07-16 23:30:30.852 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'79703221151': AC system power

2024-07-16 23:30:31.063 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0462115100000000

2024-07-16 23:30:31.064 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'79703221234': Plug state of J1772 socket

2024-07-16 23:30:31.267 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0462123402000000

2024-07-16 23:30:31.268 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'7970322114e': Charging mode

2024-07-16 23:30:31.476 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0462114E02000000

2024-07-16 23:30:31.477 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'79703221255': Motor RPM

2024-07-16 23:30:31.667 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0562125500000000

2024-07-16 23:30:31.668 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'79703221236': On-board charger output power

2024-07-16 23:30:31.881 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A05621236000F0000

2024-07-16 23:30:31.882 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'79703221146': Traction motor power

2024-07-16 23:30:32.085 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0562114600000000

2024-07-16 23:30:32.085 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'7970322121a': Vehicle speed

2024-07-16 23:30:32.282 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0562121A00000000

2024-07-16 23:30:32.282 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'79703221106': AC status

2024-07-16 23:30:32.498 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0562110600B00000

2024-07-16 23:30:32.498 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'7970322110f': Rear heater status

2024-07-16 23:30:32.633 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0462110FA1000000

2024-07-16 23:30:32.633 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'79703221318': ECO mode status

2024-07-16 23:30:32.800 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0562131800800000

2024-07-16 23:30:32.800 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'7970322131A': e-Pedal mode status

2024-07-16 23:30:32.997 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 79A0562131A00100000

2024-07-16 23:30:33.462 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'74303220e01': Total odometer reading (km)

2024-07-16 23:30:33.821 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: NO DATA

2024-07-16 23:30:33.821 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Vehicle not responding

2024-07-16 23:30:33.822 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble] Returning data: {'power_switch': False, 'gear_position': 'Park', 'bat_12v_voltage': 12.88, 'bat_12v_current': 0.0, 'quick_charges': 62, 'l1_l2_charges': 1504, 'ambient_temp': 15.5, 'estimated_ac_power': 0, 'estimated_ptc_power': 0, 'aux_power': 100, 'ac_power': 0, 'plug_state': 'Plugged', 'charge_mode': 'L2 charging', 'rpm': 0, 'obc_out_power': 1500, 'motor_power': 0, 'speed': 0.0, 'ac_on': False, 'rear_heater': False, 'eco_mode': False, 'e_pedal_mode': False}

2024-07-16 23:30:33.822 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Closing connection

2024-07-16 23:30:34.022 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.coordinator] Finished fetching nissan_leaf_obd_ble data in 10.396 seconds (success: True)

Actually i’m wrong, it alternates in HA between unknown and showing the actual value. The log shows a good connection (excluding the battery controller) every three min (I’ve changed the car off polling to 1min) between the good connections are two unsuccessful connections. This is all on v0.2.0
True values only last about 13 seconds in HA before returning to unknown.

Really need to see the full log to understand what’s happening. Can you message it to me?

My thinking is:
When data is not received from the car, then the sensors should be Unknown: because, they are definitely unknown. This is a bit of a pain for the UI, since you have to dive in to the recorder to see what the value last was when it was connected.

It’s easy to cache the data in the component; it’s just that it’s kind of telling lies.

That makes sense, the last known value can be created by an end user with an automation if it is needed. I’ll message the log to you. Thanks.

Small update:

@daniel.hill.nz there’s a caching option in there now:

This means that it will hold on to the last known values forever. If it errors out for some reason, then the data becomes “unavailable”. The result looks something like this:

Hardly perfect.

Still need to:

  • Pull out all the api stuff into separate python module, and publish on PyPI
  • Add HACS support
  • Improve stability, especially around bluetooth lockups
1 Like

hey!
has anyone tested the connection with other adapters like LeLink2?
is only this adapter ok?
I bought a 1st gen leaf, I can’t wait to connect it to HA, it’s a pity that nissanconnect is no longer active…
regards and thanks for a great job!

Should work with LeLinkII - don’t think there is much/any difference between them.

Goodday everyone,
is there some hardware that is used only to be an “accesspoint for bluetooth”, i mean something to bridge the bluetooth dongle with my wifi, without setting up a dedicated PC. Tnx

Yep, this:

Guys is there any way to monitor battery charging, or atleast battery level when I pull into the driveway, in some way to measure how much power I use to charge the car?

I am about to buy the bluetooth dongle, but I’d just as soon buy an Emporia whole home energy monitor if it’s not possible to monitor charging with a bluetooth OBD dongle