Skip to main content

aiotruenas

Asyncio-native Python client for the TrueNAS JSON-RPC 2.0 WebSocket API (ws(s)://<host>/api/current, TrueNAS 25.04+).

No dependency on Home Assistant or any other framework — usable as a standalone library.

Installation

pip install .

Usage

import asyncio

from aiotruenas import TrueNASClient


async def main() -> None:
    async with TrueNASClient("truenas.local", "1-abcdef...") as client:
        info = await client.call("system.info")
        print(info)

        sub_id, _ = await client.subscribe("app.stats")
        try:
            events = await client.get_subscription_events(sub_id, event_timeout=5.0)
            print(events)
        finally:
            await client.unsubscribe(sub_id)


asyncio.run(main())

call() is a generic RPC surface — pass any TrueNAS JSON-RPC method name and its params (list or dict). Long-running operations that return a job id (scrub, replication, dataset lock/unlock, ...) can be polled automatically with job=True:

await client.call("pool.scrub.scrub", ["tank", "START"], job=True)

Connection and protocol failures are raised as typed exceptions (see aiotruenas.exceptions) rather than returned as an error code/string, so callers can except TrueNASAuthenticationError, except TrueNASConnectionError, etc.

Status

Early development (v1: generic call surface only, no typed per-domain convenience methods yet). See PROMPT.md for the full design brief and CLAUDE.md for repo guidance.

License

Apache-2.0, see LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiotruenas-1.2.0.tar.gz (26.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aiotruenas-1.2.0-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

Details for the file aiotruenas-1.2.0.tar.gz.

File metadata

  • Download URL: aiotruenas-1.2.0.tar.gz
  • Upload date:
  • Size: 26.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for aiotruenas-1.2.0.tar.gz
Algorithm Hash digest
SHA256 2bb25024478399417f18f1a8c0e26271b3d872c0925d9a12c8970c74ae958c8e
MD5 7a7b1ba9c3611597e4c87ae503c173d7
BLAKE2b-256 d31b68441b01d53240a47538f3af255961c3a08865d880a4bfeef7e187e35db4

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiotruenas-1.2.0.tar.gz:

Publisher: pypi.yaml on kayl-codes/aiotruenas

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aiotruenas-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: aiotruenas-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 17.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for aiotruenas-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 25c1a6214796e02fedf9d18883d690f9c24e5c5da5e98f654ec7d606e0cb7c08
MD5 f5bfb56818ba19660c22e94e8d74bfc9
BLAKE2b-256 f993804db44ca870a764e569f770f54d518cc30d84531837888fbb4a3a9ae079

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiotruenas-1.2.0-py3-none-any.whl:

Publisher: pypi.yaml on kayl-codes/aiotruenas

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

1.5.5

2 files

1.5.3

2 files

1.5.2

2 files

1.5.1

2 files

1.5.0

2 files

1.4.2

2 files

1.4.1

2 files

1.4.0

2 files

This release

1.2.0 This release

2 files

1.1.0

2 files

1.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page