Metadata-Version: 2.4
Name: pyhomecast
Version: 0.2.0
Summary: Async Python client for the Homecast API
Author-email: Parob <hello@homecast.cloud>
License-Expression: MIT
Project-URL: Homepage, https://github.com/parob/pyhomecast
Project-URL: Documentation, https://docs.homecast.cloud
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.12
Description-Content-Type: text/markdown
Requires-Dist: aiohttp>=3.9.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
Requires-Dist: aioresponses>=0.7; extra == "dev"

# pyhomecast

Async Python client for the [Homecast](https://homecast.cloud) REST API.

## Installation

```bash
pip install pyhomecast
```

## Usage

```python
import aiohttp
from pyhomecast import HomecastClient

async with aiohttp.ClientSession() as session:
    client = HomecastClient(session)
    client.authenticate("your_access_token")

    # Get all device state
    state = await client.get_state()
    for device in state.devices.values():
        print(f"{device.name} ({device.device_type}): {device.state}")

    # Control a device
    await client.set_state({
        "my_home_0bf8": {
            "living_room_a1b2": {
                "ceiling_light_c3d4": {"on": True, "brightness": 80}
            }
        }
    })

    # Run a scene
    await client.run_scene("my_home_0bf8", "Good Morning")
```

## API

### `HomecastClient(session, api_url="https://api.homecast.cloud")`

- `authenticate(token)` - Set the Bearer token
- `get_state(home?, room?, device_type?, name?)` - Fetch device state (returns `HomecastState`)
- `set_state(updates)` - Control devices
- `run_scene(home, name)` - Execute a scene

### Models

- `HomecastState` - Contains `devices` and `homes` dicts
- `HomecastDevice` - Single device with `state`, `settable`, `device_type`
- `HomecastHome` - Home with `key` and `name`

### Exceptions

- `HomecastError` - Base exception
- `HomecastAuthError` - 401/403 errors
- `HomecastConnectionError` - Network/server errors

## License

MIT
