Metadata-Version: 2.4
Name: py-nissan-leaf-obd-ble
Version: 0.1.0
Summary: Python hardware API for Nissan Leaf OBD BLE dongles (BLE + ELM327 over CAN), extracted from the Home Assistant integration.
Project-URL: Homepage, https://github.com/pbutterworth/py-nissan-leaf-obd-ble
Project-URL: Repository, https://github.com/pbutterworth/py-nissan-leaf-obd-ble
Project-URL: Issues, https://github.com/pbutterworth/py-nissan-leaf-obd-ble/issues
Author: Paul Butterworth
License: GPL-2.0-or-later
License-File: LICENSE
Keywords: ble,can,home-assistant,leaf,nissan,obd
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.9
Requires-Dist: bleak
Requires-Dist: bleak-retry-connector
Description-Content-Type: text/markdown

# py-nissan-leaf-obd-ble

Python hardware API for Nissan Leaf OBD-II over BLE dongles.

This library encapsulates the low-level BLE, ELM327 and CAN protocol handling
used by the Home Assistant `nissan_leaf_obd_ble` integration, and exposes a
simple async API for querying vehicle data from a `BLEDevice`.

It has **no Home Assistant dependency** and can be used in other Python
applications that talk to the same BLE OBD dongle.

## Installation

Once published on PyPI:

```bash
pip install py-nissan-leaf-obd-ble
```

## Quickstart

```python
import asyncio
from bleak import BleakScanner

from py_nissan_leaf_obd_ble import NissanLeafObdBleApiClient


async def main() -> None:
    # Discover your OBDBLE device with bleak, or obtain a BLEDevice from elsewhere
    device = await BleakScanner.find_device_by_address("AA:BB:CC:DD:EE:FF", timeout=10.0)
    if device is None:
        raise RuntimeError("Could not find OBDBLE device")

    client = NissanLeafObdBleApiClient(device)
    data = await client.async_get_data()
    print(data)


if __name__ == "__main__":
    asyncio.run(main())
```

## License

This package includes code derived from **python-OBD (a derivative of pyOBD)**,
licensed under the GNU General Public License, version 2 or later.

See `LICENSE` for full terms.

