This release is a pre-release and may not be stable for production use.
Python clients for HNAP devices
Generic HNAP client and specialized clients for motion sensors, sirens, routers, water detectors and more.
Async devices
All network operations are asynchronous. Pass a DeviceType to construct a
known device without querying it first, or omit the type to discover the
concrete device:
import asyncio
import aiohttp
from hnap import DeviceConfig, DeviceFactory, DeviceType
config = DeviceConfig(hostname="192.0.2.10", password="secret")
async def main():
async with aiohttp.ClientSession() as http_client:
siren = await DeviceFactory(
DeviceType.SIREN, config=config, http_client=http_client
)
await siren.authenticate()
await siren.soap_client.call("GetSirenAlarmSettings")
discovered = await DeviceFactory(config=config)
async with discovered:
await discovered.reconnect()
asyncio.run(main())
DeviceConfig retains connection settings independently of authentication
state. await device.reconnect() authenticates a fresh SOAP client before
replacing the current one, preserves the device class and module ID, and does
not repeat type discovery. A failed reconnect leaves the current client in
place. Operations are not retried after transport errors because the device
may have completed an action even if its response was lost.
SoapClient creates an aiohttp.ClientSession when await client.start() is
called, when the client or device is entered as an async context manager, or
before its first network request. Sessions created by HNAP are closed by
await client.close() or on context-manager exit. You can instead supply an
existing session via http_client; caller-supplied sessions remain
caller-owned and are not closed by the SOAP client or device.
Device operations such as is_playing(), play(), beep(), and
get_clients() must be awaited. Cached device information is retrieved with
await device.get_info().
Useful links
Metadata
Release files for hnap 2.0.0a0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| hnap-2.0.0a0.tar.gz | 23.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hnap-2.0.0a0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 49.2 kB
Release files / hnap-2.0.0a0.tar.gz
| Download URL | hnap-2.0.0a0.tar.gz |
|---|---|
| Size | 23.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aac72165df314b4105dc8e831471060262d956b55b09ec41a303cefe929124ad
|
|
BLAKE2b-256 checksum How to use checksums |
1287acee0f495a2a51e51c1cfdb303327e9b2841f23d2772406d231ae53df86c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / hnap-2.0.0a0-py3-none-any.whl
| Download URL | hnap-2.0.0a0-py3-none-any.whl |
|---|---|
| Size | 26.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
79c5875afcf2acb8ba1403895c50bbad0c143f382834a1ee89a49ab122356e3a
|
|
BLAKE2b-256 checksum How to use checksums |
594fa9a03f6bcb6530edf47200544e6891eac9deee7ebafe5fb8c074bfaa29a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Security for hnap 2.0.0a0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.