Metadata-Version: 2.4
Name: kestrel-connector
Version: 0.7.2
Summary: Talks to a Kestrel server: its cameras, events, controls and recordings
Author-email: "Aidan Timson (Timmo)" <aidan@timmo.dev>
License-Expression: Apache-2.0
Project-URL: Source Code, https://github.com/timmo001/kestrel
Project-URL: Bug Reports, https://github.com/timmo001/kestrel/issues
Project-URL: Documentation, https://kestrel.timmo.dev
Keywords: kestrel,cameras,home-assistant
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: AsyncIO
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.14
Classifier: Typing :: Typed
Requires-Python: >=3.14.2
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: aiohttp>=3.14.5
Dynamic: license-file

# kestrel-connector

Talks to a [Kestrel](https://kestrel.timmo.dev) server as a paired device: its cameras and what they can do, live events, PTZ and picture controls, recordings, and live video over WebRTC or RTSP. The [Kestrel integration for Home Assistant](https://github.com/timmo001/ha-integration-kestrel) uses it.

```sh
pip install kestrel-connector
```

## Pairing

A device pairs once, with a one-time code from **Settings > Devices** in Kestrel, and keeps the token it gets back:

```python
from aiohttp import ClientSession
from kestrelconnector import KestrelClient

async with ClientSession() as session:
    client = KestrelClient("http://192.0.2.10:7380", session)
    paired = await client.pair("ABCD-EFGH", "Home Assistant")

    client = KestrelClient("http://192.0.2.10:7380", session, paired.token)
    for camera in await client.cameras():
        print(camera.id, camera.title)
```

## Live events

```python
from kestrelconnector import events

async for event in events(client):
    print(event.camera, event.kind, event.active)
```

The stream ends when the server closes it, such as when it restarts, so connect again to carry on.

## Versions

The client doesn't send its version, so a server of any version lets it in. Read `version` from `await client.server()` to check the server is new enough for what you use.

The [API docs](https://kestrel.timmo.dev/api) describe everything the server sends.
