Metadata-Version: 2.1
Name: aio_ld2410
Version: 0.1.0
Summary: Asynchonous library for the HiLink LD2410 presence detector module
Author-email: Romain Bezut <morian@xdec.net>
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
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 :: Home Automation
Classifier: Topic :: Scientific/Engineering :: Human Machine Interfaces
Classifier: Topic :: Software Development :: Embedded Systems
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Hardware
Classifier: Topic :: Terminals :: Serial
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: async-timeout>=4; python_version < "3.11"
Requires-Dist: construct<3.0,>=2.10
Requires-Dist: dacite<2.0,>=1.8
Requires-Dist: pyserial-asyncio-fast<1.0,>=0.14

Python asyncio LD2410 Library
=============================

`aio_ld2410` allows you to interact with the LD2410 radar sensors from Hi-Link using asyncio.


## How to install

This package requires python 3.9 or later, and depends on the following packages:
- [construct](https://pypi.org/project/construct/) for binary serialization/deserialization
- [dacite](https://pypi.org/project/dacite/) to build dataclasses with a minimal footprint
- [pyserial-asyncio-fast](https://pypi.org/project/pyserial-asyncio-fast/) for serial async communication


### Install from pip

```console
$ pip install aio-ld2410
```

### Install for development
```console
$ python -m venv venv
$ source venv/bin/activate
$ make install
```

## Implementation references

User manual and serial communication protocol can be found on
[Hi-Link Website](https://www.hlktech.net/index.php?id=1095).

This implementation was originally based on `LD2410C Serial communication protocol V1.00.pdf`.

Auxiliary commands were implemented based on `LD2410B Serial communication protocol V1.06.pdf`,
translated from Chinese, as mentioned in the following comment:
- https://github.com/esphome/feature-requests/issues/2156#issuecomment-1472962509

Note that some commands may not be available depending on your device model and firmware version.


## Example usage

```python
from aio_ld2410 import LD2410

async def async_main():
    async with LD2410('/dev/ttyUSB0', baudrate=256000) as device:
        async with device.configure():
            ver = await device.get_firmware_version()
            print(f'Running with firmware {ver}')

            # Ask for engineering (advanced) reports as well.
            await device.set_engineering_mode(True)

        # Reports are generated every 100ms.
        async for report in device.get_reports():
            print(report)
```

Full documentation is not written yet.
