Skip to main content

Asyncio implementation of the Spinel protocol for OpenThread RCPs

Project description

aiospinel

An asyncio implementation of the Spinel protocol used to communicate with OpenThread RCPs over a serial connection.

Installation

pip install aiospinel

Usage

This library exports an SpinelProtocol asyncio protocol object.

import asyncio

import serialx

from aiospinel import CommandID, PropertyID, ResetReason, SpinelProtocol


async def main() -> None:
    loop = asyncio.get_running_loop()
    _, protocol = await serialx.create_serial_connection(
        loop=loop,
        protocol_factory=SpinelProtocol,
        url="/dev/ttyUSB0",
        baudrate=460800,
    )
    await protocol.wait_until_connected()

    try:
        await protocol.reset(ResetReason.STACK)

        rsp = await protocol.send_command(
            CommandID.PROP_VALUE_GET,
            PropertyID.HWADDR.serialize(),
        )
        prop_id, hwaddr = PropertyID.deserialize(rsp.data)
        assert prop_id == PropertyID.HWADDR

        print("Hardware address:", hwaddr.hex())
    finally:
        await protocol.disconnect()

if __name__ == "__main__":
    asyncio.run(main())

Project details


Download files

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

Source Distribution

aiospinel-1.0.0.tar.gz (59.0 kB view details)

Uploaded Source

Built Distribution

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

aiospinel-1.0.0-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file aiospinel-1.0.0.tar.gz.

File metadata

  • Download URL: aiospinel-1.0.0.tar.gz
  • Upload date:
  • Size: 59.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for aiospinel-1.0.0.tar.gz
Algorithm Hash digest
SHA256 cf07870bb0efedb5e3027d171bb0d5169a6c0df03cb0dd14e63db58990080333
MD5 04ff81d51a28c5cc2d3f3b944ef58fb7
BLAKE2b-256 d256ea9a2fadc7061e56f5d6fcc6b7e5d634c51e981a2b00b4817fa84570450e

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiospinel-1.0.0.tar.gz:

Publisher: publish-to-pypi.yml on home-assistant-libs/aiospinel

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

File details

Details for the file aiospinel-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: aiospinel-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for aiospinel-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5ac2c4bbf08ed4a0322549b22b8251a8f35fc6db81ae8577a5e8539fd6bf2d35
MD5 58c2e2e0f3951fcee723162dc7e01841
BLAKE2b-256 ec4795dc3daa84756454e3faf61551e8aae4abc5c0bdaa13c6c88491d3940e2b

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiospinel-1.0.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on home-assistant-libs/aiospinel

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

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page