I have a gen2 leaf, and it will only respond to requests via the dongle when the car is switched on. If you turn the car on when it’s charging, it stays on at least, but not a tremendously reliable strategy.
I also use a Wallbox charger which reports charging power and energy added (but not SoC) over WiFi: much more reliable.
I just put a deposit on a second gen leaf (2019 SL) and was planning on ordering a wallbox “charger” and hoping to find a way to get the SOC from the leaf so that I can use home assistant to control how full I charge the leaf. This looks like it might do it if I order a Bluetooth odb adapter?
Hi @peter.vk, I do exactly this.
I have a 2021 62kWh Lean, and a Wallbox Pulsar, which reliably reports the amount of energy added.
Since the OBD dongle can only fetch state of charge (SoC) while the car is switched on, I use an input_number helper to ‘save’ the last known SoC.
I then have an automation that calculates the estimated amount of energy to add to get to 80% SoC. This result is stored in another input_number helper.
I have a 2016 Leaf AZE0 with 24kWh battery and I ordered Vgate iCar Pro BT4.0 dongle. It has separate UUID for read and write, but that was quite an easy fix in the code.
What is not so easy is that CAN messages are a bit different for ZE0/AZE0 (which was already prompted here). What works for LBC decode for my Leaf is:
The odometer, remaining range and tire pressures sensor seem not to work, but I was testing with car plugged in and charging. I’ll check tommorow with just the igniton on
2024-09-19 23:04:54.815 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-09-19 23:04:54.815 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'74303220e25': Tyre pressure front right
2024-09-19 23:04:55.009 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 763037F2211FFFFFFFF
2024-09-19 23:04:55.009 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.OBDCommand] Message was shorter than expected (3<4). Padded message: bytearray(b'\x7f"\x11\x00')
2024-09-19 23:04:55.009 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'74303220e26': Tyre pressure front left
2024-09-19 23:04:55.223 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 763037F2211FFFFFFFF
2024-09-19 23:04:55.223 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.OBDCommand] Message was shorter than expected (3<4). Padded message: bytearray(b'\x7f"\x11\x00')
2024-09-19 23:04:55.223 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'74303220e27': Tyre pressure rear right
2024-09-19 23:04:55.435 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 763037F2211FFFFFFFF
2024-09-19 23:04:55.436 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.OBDCommand] Message was shorter than expected (3<4). Padded message: bytearray(b'\x7f"\x11\x00')
2024-09-19 23:04:55.436 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'74303220e28': Tyre pressure rear left
2024-09-19 23:04:55.635 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 763037F2211FFFFFFFF
2024-09-19 23:04:55.635 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.OBDCommand] Message was shorter than expected (3<4). Padded message: bytearray(b'\x7f"\x11\x00')
2024-09-19 23:04:55.635 INFO (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Sending command: b'74303220e24': Remaining range (km)
2024-09-19 23:04:55.839 DEBUG (MainThread) [custom_components.nissan_leaf_obd_ble.obd] Received frame: 763037F2211FFFFFFFF
2024-09-19 23:04:55.839 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')
Unfortunately the SoC parameter only updates when the car is on and does not update while charging. I did some investigation hoping I could add support of CAN monitoring via ELM327 for older Leafs that do not require CAN-polling, but it seems that the pyOBD library does not support that and I’m not sure I’m up to the task of doing it on my own. But who knows…
why not using a carwings integration? I have to admit it doesn’t provide as much data as I see the dongle does. But for charging purposes you can poll every n-minutes and retrieve the battery state.
check, I didn’t check your info, would have seen than you’re in New Zealand. A shame Nissan hasn’t made it possible to use this in New Zealand. Nice to see there are possibilities. Better than nothing.
Just wanted to say I really appreciate @pbutterworth 's work on this integration.
After a bit of playing around with the BLE proxy location and configuring some helpers to help convert and persist some of the data attributes I have this up and running in my dashboard.
A few limitations but really not a big deal for my use case:
The data is only updated when car is powered on, usually briefly pulling in and out of the drive. Practically it means charging status and SOC is not updated when charging.
I’m using helpers to persist data and when HA reboots, they loose their values. Will report ‘unavailable’ until the car again talks to the proxy.
Fun bonus:
I’ve setup a helper to remind me to regularly rotate my tires based on the car’s odometer reading and a “last rotated” helper.
I’ve been keeping an eye on the work here as I am NZ based and I’m thinking it would bug me too much that I cannot read the SOC while the car is charging
Although getting odometer reading would allow for a reminder to renew road user charges which would be very useful!
Also worth noting that if the car is charging, and you turn it on, it stays on the whole time while charging (rather than switching off after 15 mins). So if you want to monitor SoC through a whole charge, there is a (not very satisfactory) way.
I also have a recharge reminder:
alias: Car low battery warning
description: ""
mode: single
triggers:
- entity_id:
- sensor.nissan_leaf_state_of_charge
below: 30
for:
hours: 0
minutes: 5
seconds: 0
trigger: numeric_state
conditions:
- condition: state
entity_id: sensor.car_charger_status_description
state: Ready
alias: Check that the car isn't plugged in already
actions:
- metadata: {}
data:
title: Nissan Leaf
message: My battery is quite low, did you mean to plug me in?
action: notify.notify
And can also plot a nice statistics graph using the odometer reading:
alias: RUC warning
description: Post a persistent notification when there is less than 500 km left on the RUC
mode: single
triggers:
- entity_id:
- sensor.nissan_leaf_odometer
value_template: "{{ states('input_number.leaf_ruc') | float - state.state | float }}"
below: 500
trigger: numeric_state
conditions: []
actions:
- metadata: {}
data:
title: Nissan Leaf
message: Road User Charges will expire in less than 500 km.
action: notify.persistent_notification
Does your charger report the amount of energy added in the current charging session? This is much more reliable if you have a varying charge rate.
This is what I’m using to decide when to cut off charging.
So you know what the car SoC was when it was last turned on.
And (if) you know how much energy has been added in the current charging session,
Then you can estimate the current SoC
Hey @pbutterworth just got a bluetooth OBD today… Have the “install instructions” changed at all?
I’ve copied folder to custom components rebooted etc but dongle is never detected…
Hmm, what obd dongle did you get?
Also, where is your Bluetooth adapter for HA located? Signal range can be an issue. For example, I have HA yellow with on board Bluetooth adapter. This is in a cupboard in a room right next to the driveway, and I found it to be hit and miss. So now I have a esphome proxy in the garage.
I don’t have a Bluetooth adapter plugged into my HA instance but I do have 3 BT proxies dotted around the house, one is in the garage about 3m away from the car.
I’ve left it for a couple of days but no luck yet in picking up the car…