Skip to main content

A sans-IO BACnet/IP client library written in Rust with a Python asyncio interface.

Project description

libbacnet

A sans-IO BACnet/IP client library written in Rust with a Python asyncio interface.

Overview

libbacnet implements the BACnet/IP client protocol as a pure state machine (the sans-IO pattern). All protocol logic lives in a Rust Stack type that:

  • receives inputs (Received, Tick, Send),
  • returns outputs (Transmit, Event, Deadline),
  • never touches a socket, spawns a thread, or reads a clock.

A thin Python asyncio layer (BacnetProtocol / BacnetClient) wires the stack to UDP I/O, drives the retry scheduler, and exposes async def methods for each supported service.

Supported services

Service Direction
ReadProperty confirmed request
ReadPropertyMultiple confirmed request
WriteProperty confirmed request
Who-Is / I-Am unconfirmed
WhoIsRouterToNetwork / IAmRouterToNetwork unconfirmed (NPDU)

Segmented responses (ComplexACK with more-follows) are transparently reassembled; large segmented requests are automatically fragmented.

Non-goals (v0.1)

  • MS/TP or other physical layers (BACnet/IP only)
  • Server / device role
  • COV subscriptions, alarms, trend logs
  • BBMD / foreign device registration
  • IPv6

Quick start

import asyncio
from libbacnet import BacnetClient, BacnetAddr, ObjectIdentifier, PropertyIdentifier

async def main():
    async with BacnetClient(local_addr=("0.0.0.0", 47808)) as client:
        # Discover devices (3-second collection window)
        devices = await client.who_is(wait=3.0)
        print(f"Found {len(devices)} device(s)")

        for ev in devices:
            addr = BacnetAddr(ev.src.addr, ev.src.port)
            obj = ObjectIdentifier(object_type=8, instance=ev.message.device_id.instance)

            # Read the device object's description — returns a ReadPropertyResult
            result = await client.read_property(
                addr=addr,
                obj_id=obj,
                prop_id=PropertyIdentifier.DESCRIPTION,
            )
            print(f"  {addr} description: {result.value}")

asyncio.run(main())

See examples/discover_read_write.py for a longer example that performs Who-Is discovery, reads the object list, reads and writes present-value on each object, and then reads all values with read_property_multiple.


Limitations and known constraints

  • BACnet/IP only — MS/TP and other data links are not supported.
  • Client role only — incoming confirmed requests from other devices are silently ignored.
  • IPv4 onlyBacnetAddr stores an IPv4 address; IPv6 BVLC is not implemented.
  • No BBMD — the library sends Original-Unicast-NPDU (0x0A) and Original-Broadcast-NPDU (0x0B) only. Foreign device registration and broadcast distribution are out of scope.
  • Single-threadedStack is not Send + Sync; use it from a single asyncio event loop thread.

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

libbacnet-0.1.0.tar.gz (104.7 kB view details)

Uploaded Source

Built Distributions

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

libbacnet-0.1.0-cp312-abi3-win_amd64.whl (264.5 kB view details)

Uploaded CPython 3.12+Windows x86-64

libbacnet-0.1.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (436.6 kB view details)

Uploaded CPython 3.12+manylinux: glibc 2.17+ x86-64

libbacnet-0.1.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (441.3 kB view details)

Uploaded CPython 3.12+manylinux: glibc 2.17+ ARM64

libbacnet-0.1.0-cp312-abi3-macosx_11_0_arm64.whl (394.1 kB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

libbacnet-0.1.0-cp312-abi3-macosx_10_12_x86_64.whl (397.8 kB view details)

Uploaded CPython 3.12+macOS 10.12+ x86-64

File details

Details for the file libbacnet-0.1.0.tar.gz.

File metadata

  • Download URL: libbacnet-0.1.0.tar.gz
  • Upload date:
  • Size: 104.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for libbacnet-0.1.0.tar.gz
Algorithm Hash digest
SHA256 be586b2201e10e7dd2036705f72cb7fe9230f62c51607963a3652bd4c1c127ba
MD5 b694bc94760789ed1586ac1b83cb4098
BLAKE2b-256 1efd19b7098efda425f70889bb6909d11ea47e927a2b51fe3d9a837d049de05c

See more details on using hashes here.

Provenance

The following attestation bundles were made for libbacnet-0.1.0.tar.gz:

Publisher: release.yml on yujia21/libbacnet

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

File details

Details for the file libbacnet-0.1.0-cp312-abi3-win_amd64.whl.

File metadata

  • Download URL: libbacnet-0.1.0-cp312-abi3-win_amd64.whl
  • Upload date:
  • Size: 264.5 kB
  • Tags: CPython 3.12+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for libbacnet-0.1.0-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 5a0bd88b8dec87d0f188f73af21ec4014f9ce9130a9c074e040618d7d1a5ae49
MD5 866fb961564ef37705d90e293e1edee8
BLAKE2b-256 0c76d7a57088de0dfe41acf1991a4cb9293a7a2ccbd8bb2cd4387fce731e1c88

See more details on using hashes here.

Provenance

The following attestation bundles were made for libbacnet-0.1.0-cp312-abi3-win_amd64.whl:

Publisher: release.yml on yujia21/libbacnet

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

File details

Details for the file libbacnet-0.1.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for libbacnet-0.1.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cdb6d856372b89c9fb97cc72b8cd5fa1f3f0098d2d16e7e2c05cd645cbb8d743
MD5 8106435365cb83a69ac78e32f6864e21
BLAKE2b-256 3fcfa3358fe7d43f7aea2f02474405c83c508620c9be3bfc432f408301eaee96

See more details on using hashes here.

Provenance

The following attestation bundles were made for libbacnet-0.1.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on yujia21/libbacnet

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

File details

Details for the file libbacnet-0.1.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for libbacnet-0.1.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 45f25680e029539261813395585fd591bfa163718c29339a3d4f9675d96a6c9e
MD5 60b671709b1c0537e002ca391813558d
BLAKE2b-256 3ddf4725e0515ce15415a60d4e8e53d88ddb81e8547bd60ccc45e0c3c8c048c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for libbacnet-0.1.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on yujia21/libbacnet

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

File details

Details for the file libbacnet-0.1.0-cp312-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for libbacnet-0.1.0-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 04a5a5b63d9c42f5aff35e715e19af11ecbc3a247a5a5ecbeb7eea403515e32a
MD5 1710da0d8f20560581e8fdbe92b13e56
BLAKE2b-256 075bbe11d2061532a0e9e67beaf3f44b93f4345784e4b9aabf5e6c58c749d338

See more details on using hashes here.

Provenance

The following attestation bundles were made for libbacnet-0.1.0-cp312-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on yujia21/libbacnet

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

File details

Details for the file libbacnet-0.1.0-cp312-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for libbacnet-0.1.0-cp312-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 3a7b37f3369e7544167a7b2b82e54a8429569a764409e2884f42dda0360e91f8
MD5 64d004db32a6c7ac9204efb94a89435a
BLAKE2b-256 1d3aa829295af5c79c33625b2aa65816c03cb93fa20f0617da11686689a61e07

See more details on using hashes here.

Provenance

The following attestation bundles were made for libbacnet-0.1.0-cp312-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on yujia21/libbacnet

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