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.1.0.tar.gz (59.4 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.1.0-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for aiospinel-1.1.0.tar.gz
Algorithm Hash digest
SHA256 6d586e1c102cf413e06c4b969d150b2dfdf18cf4cbf0722eda04cc7ee3c83d65
MD5 ea20558dfff01629ecaf05ba25eb81c6
BLAKE2b-256 a2e89c0412dfde89729dfdcdf832e44a48ca07eebc72c8f35ae50163713f4670

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiospinel-1.1.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.1.0-py3-none-any.whl.

File metadata

  • Download URL: aiospinel-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.4 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ebd6c77e00f674ef3033a13a658a8f57006975bb24d22fe81e6f090d6ce18f87
MD5 9c517723a304c0bc382ce2b0122a1365
BLAKE2b-256 10e9d55f9f3201b90729c3969fd20ccc79e9dd71bcc36d0f6985c9151a4d8398

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiospinel-1.1.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