Python router
Owned B/IP routing between numbered networks. The Python reference lists every group. Each page opens with its main classes, then the other classes, the dictionaries (TypedDict) and the type aliases, in stub order.
BACnetRouter
Section titled “BACnetRouter”Own B/IP forwarding across one to 255 uniquely numbered ports.
This binding has no other transport types or route administration. It uses native RouterOptions defaults, including their permissive wire-control policy. The first asynchronous method binds the object to the running asyncio loop; another loop raises RuntimeError.
Keyword-only application shares the router’s own application entity
(#2071): None (the default) only forwards; "client" gives the whole
entity to one BACnetClient; "client_and_server" splits it
between a BACnetClient and a BACnetServer. Build each with
transport="router", router=router; each takes its share when it
starts, once per router start. Closing the router ends both shares:
their requests then fail with BacnetTransportError, and a restarted
router makes new shares for newly started stacks. The network-control
receiver stays internal.
Successful awaited close/context exit joins router and transport cleanup. Cancellation removes only a waiter: await close to observe the barrier. A cleanup failure raises BacnetRouterCloseError with retained cause details; subsequent close/start calls re-expose the failure without retry. Restart is supported only after successful cleanup. Destruction requests best-effort cleanup on the shared runtime; it is not an awaited cleanup guarantee.
Properties:
application: Optional[Literal["client", "client_and_server"]]: How the router shares its application entity.
BACnetRouter.init
Section titled “BACnetRouter.init”def __init__( self, ports: Sequence[BipRouterPort], *, application: Optional[Literal["client", "client_and_server"]] = None,) -> NoneAn application other than None, "client" or
"client_and_server" raises ValueError.
BACnetRouter.start
Section titled “BACnetRouter.start”def start(self) -> Awaitable[None]Start; duplicate start raises RuntimeError. Native startup errors retain their exception class and errno. An unsuccessful native start finishes rollback before reporting its original error.
BACnetRouter.close
Section titled “BACnetRouter.close”def close(self) -> Awaitable[None]BACnetRouter.aenter
Section titled “BACnetRouter.aenter”def __aenter__(self) -> Awaitable[BACnetRouter]BACnetRouter.aexit
Section titled “BACnetRouter.aexit”def __aexit__( self, exc_type: Any = None, exc_value: Any = None, traceback: Any = None,) -> Awaitable[None]Await cleanup and preserve a context-body exception as primary. A secondary cleanup failure remains observable through later close.
BACnetRouter.ports
Section titled “BACnetRouter.ports”def ports(self) -> Awaitable[list[RouterPortInfo]]Copy actual addresses in input order; raises RuntimeError before start or after close begins. Snapshots survive close.
BACnetRouter.routes
Section titled “BACnetRouter.routes”def routes(self) -> Awaitable[list[RouterRoute]]Copy direct/learned routes; raises RuntimeError before start or after close begins. No lock or wall-clock timestamp is exposed.
BipRouterPort
Section titled “BipRouterPort”Immutable unopened B/IP port configuration; network_number is 1..65534.
Port 0 requests an ephemeral UDP port. Mode is normal unless bbmd or foreign_device is explicitly supplied; supplying both raises ValueError. Bbmd’s default refusal of foreign-device registrations is unchanged. Invalid IPv4 addresses raise ValueError; out-of-range integers raise OverflowError. Construction opens no socket.
Properties:
network_number: intinterface: strport: intbroadcast_address: strmode: Literal["normal", "bbmd", "foreign_device"]
BipRouterPort.init
Section titled “BipRouterPort.init”def __init__( self, network_number: int, *, interface: str = "0.0.0.0", port: int = 47808, broadcast_address: str = "255.255.255.255", bbmd: Bbmd | None = None, foreign_device: ForeignDevice | None = None,) -> NoneRouterPortInfo
Section titled “RouterPortInfo”Frozen owned snapshot of an actual started B/IP port.
Properties:
index: intnetwork_number: intmac: bytesaddress: str
RouterRoute
Section titled “RouterRoute”Frozen copied route; reachability is effective when captured.
Properties:
network_number: intport_index: intis_direct: boolnext_hop: bytes | Nonereachability: Literal["reachable", "busy", "unreachable"]
RouterCleanupFailure
Section titled “RouterCleanupFailure”Frozen cause details from the retained native cleanup outcome.
Properties:
network_number: int | Noneport_index: int | Nonekind: Literal["transport", "worker"]message: strerrno: int | Noneerror_class: ErrorClass | Noneerror_code: ErrorCode | Nonereason: RejectReason | AbortReason | None: A remote Reject’sRejectReasonor Abort’sAbortReason.worker: str | None
Release v0.15.0 ·Build and integrate. Pre-1.0 APIs; partial conformance.Support & limitations