# 1. Clone/pull the repo
cd ~/workspace/HDE/openleaf
git pull
# 2. Install Python dependencies (Ubuntu/Debian)
sudo apt install -y python3.12-venv python3-pip
# 3. Create virtual environment
python3 -m venv venv
# 4. Activate venv
source venv/bin/activate
# 5. Install dependencies
pip install pyyaml bleak kivy
# 6. Test YAML loading
python3 -c "
from openleaf.transports.obd2_unified import OBD2Transport
import logging
logging.basicConfig(level=logging.INFO)
transport = OBD2Transport(
connection_type='ble',
ble_address='test',
pid_path='pids/leaf_aze0.yaml'
)
print(f'✅ Loaded {len(transport.pids)} PIDs')
"If you see ✅ Loaded 5 PIDs, you're good to go!
cd ~/workspace/HDE/openleaf
source venv/bin/activate# Turn car to ON/ACC position first!
python test_connection.pyThis will:
- Connect to your BLE OBD adapter
- Query 5 battery PIDs
- Print live data
- Stop after 10 iterations (~30 seconds)
Expected output:
🟢 CONNECTED
Data received: 15 values
soc_true: 45.2
ah_capacity: 10.5
soh_precise: 44.1
...
python main.py# Make sure venv is activated (you should see "(venv)" in prompt)
source venv/bin/activate
# Reinstall dependencies
pip install pyyaml bleak kivy- Make sure BLE adapter is paired with laptop
- Check adapter is powered and in range
- Try:
bluetoothctl devicesto see if adapter is visible
- Turn car to ON or ACC position (not just power button)
- Make sure OBD adapter is fully plugged in
- Try unplugging/replugging the adapter
- Adapter might be dead/low battery
- Try different OBD adapter
- Check if LeafSpy still works with this adapter
configs/leaf_2013_24kwh.yaml- Your 2013 Leaf configconfigs/leaf_2018_40kwh.yaml- 2018 Leaf config (if you have one)
pids/leaf_aze0.yaml- 2013-2017 Leaf PIDs (24/30kWh)pids/leaf_ze0.yaml- 2011-2012 Leaf PIDspids/leaf_ze1.yaml- 2018+ Leaf PIDs (40/62kWh)
logs/- Debug logs when things go wrong
From the 5 PIDs queried:
Battery Health:
- SOC (State of Charge) %
- SOH (State of Health) %
- Remaining capacity (Ah)
Cell Details:
- All 96 cell voltages
- Min/Max/Delta voltage
- Which cells are balancing
Temperatures:
- 4 pack temperature sensors
Your 2013 Leaf Status (from CAN scan):
- 44% SOH
- 126 GIDs (~10 kWh remaining)
- About 50-60 miles range
If everything works:
- Take screenshots of the dashboard
- Use it to show buyers the real battery condition
- Price accordingly (44% SOH = degraded battery)
- Sell it!
If it doesn't work:
- Copy the error messages
- Check logs in
logs/directory - Debug with me!
- Always turn car ON/ACC before running
- BLE adapters can be finicky - unplug/replug if issues
- Cell voltage query (Group 0x02) takes ~5 seconds (it's slow)
- Logs go to
logs/with timestamps - Press Ctrl+C to stop cleanly
Good luck! 🚗⚡