Metadata-Version: 2.4
Name: recsrmesh
Version: 0.2.0
Summary: CSRMesh protocol library
Author-email: Sean Kinsey <oyvind@kinsey.no>
License: LGPL-3.0-or-later
Project-URL: Homepage, https://github.com/oyvindkinsey/recsrmesh
Project-URL: Repository, https://github.com/oyvindkinsey/recsrmesh
Project-URL: Issues, https://github.com/oyvindkinsey/recsrmesh/issues
Keywords: csrmesh,bluetooth,mesh,ble
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Home Automation
Classifier: Topic :: System :: Hardware
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: bleak>=0.21.0
Requires-Dist: cryptography>=41.0.0
Provides-Extra: dev
Requires-Dist: pytest>=7.4.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
Requires-Dist: pytest-mock>=3.11.0; extra == "dev"
Requires-Dist: ruff>=0.1.0; extra == "dev"
Requires-Dist: mypy>=1.5.0; extra == "dev"
Provides-Extra: test
Requires-Dist: pytest>=7.4.0; extra == "test"
Requires-Dist: pytest-asyncio>=0.21.0; extra == "test"
Requires-Dist: pytest-cov>=4.1.0; extra == "test"
Dynamic: license-file

# recsrmesh

A Python library for the CSRMesh Bluetooth mesh protocol. Provides MASP
association, MCP mesh commands, and BLE transport over GATT.

## Features

- **Device discovery** -- find unprovisioned CSRMesh devices via a bridge
- **Association** -- full MASP handshake (ECDH key exchange, device ID and
  network key distribution)
- **Mesh commands** -- send and receive MCP packets (AES-OFB encrypted)
- **Disassociate** -- remove devices from the mesh
- **Async API** -- built on [bleak](https://github.com/hbldh/bleak) for
  cross-platform BLE

## Usage

```python
from bleak import BleakClient
from recsrmesh import CSRMesh

async with BleakClient(bridge_mac) as client:
    async with CSRMesh(client, passphrase) as mesh:
        # Discover unprovisioned devices
        devices = await mesh.discover_unassociated(timeout=5.0)

        # Associate a device into the mesh
        device_id = await mesh.associate(devices[0]["uuid_hash"], device_id=100)

        # Send a mesh command
        await mesh.send(dest_id=100, opcode=0x73, payload=b"\x01\x80")

        # Receive responses
        responses = await mesh.receive(timeout=3.0)

        # Remove a device from the mesh
        await mesh.disassociate(device_id=100)
```

## Installation

```
pip install recsrmesh
```

Requires Python 3.11+.

## License

LGPL-3.0-or-later
