Metadata-Version: 2.4
Name: allnet
Version: 0.1.0
Summary: Async Python client for ALLNET MSR devices and managed switches
Project-URL: Homepage, https://github.com/polsa/python-allnet
Project-URL: Repository, https://github.com/polsa/python-allnet
Project-URL: Bug Tracker, https://github.com/polsa/python-allnet/issues
Author-email: Filip Polsakiewicz <polsakiewicz@gmail.com>
License-Expression: MIT
Keywords: allnet,async,home-automation,iot,msr
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Home Automation
Classifier: Typing :: Typed
Requires-Python: >=3.12
Requires-Dist: aiohttp>=3.11
Description-Content-Type: text/markdown

# python-allnet

Async Python client for ALLNET MSR (Messen Steuern Regeln) devices and JSON-capable ALLNET managed switches.

This library is the external dependency for the [Home Assistant `allnet` integration](https://github.com/polsa/ha-allnet). It has no Home Assistant imports and can be used standalone.

## Supported devices

- **ALLNET MSR JSON API devices** (ALL3500 and compatible) — sensors, binary sensors, digital actors (relays)
- JSON-capable ALLNET managed switches (planned)

## Installation

```bash
pip install allnet
```

## Usage

```python
import asyncio
from aiohttp import ClientSession
from allnet import AllnetClient

async def main():
    async with ClientSession() as session:
        client = AllnetClient(
            host="192.168.1.100",
            username="xmlrpc",   # optional
            password="secret",   # optional
            use_ssl=False,
            session=session,
        )

        # Device information (model, MAC, firmware version)
        device_info = await client.async_get_device_info()
        print(device_info.model, device_info.sw_version)

        # All channels (sensors + actors)
        channels = await client.async_get_channels()
        for ch in channels:
            print(ch.id, ch.name, ch.kind, ch.value, ch.unit)

        # Switch a digital actor on/off
        await client.async_set_channel_state("6", True)

asyncio.run(main())
```

## Channel kinds

| `ChannelKind` | Description |
|---|---|
| `SENSOR` | Continuous measurement (temperature, current, CO₂, …) |
| `BINARY_SENSOR` | Binary digital input (motion, contact, …) |
| `SWITCH` | Digital output / relay |
| `NUMBER` | Analog output (deferred) |

## Error handling

```python
from allnet.exceptions import (
    AllnetAuthenticationError,   # 401/403 — wrong credentials
    AllnetConnectionError,       # Network unreachable / timeout
    AllnetUnsupportedFirmwareError,  # 404 — JSON API not available
    AllnetCommandError,          # Actor command rejected
)
```

## Out of scope

- ALLNET IoT Cloud / MQTT
- SSH / Telnet / SNMP
- Web UI scraping

## License

MIT
