Fleet

Multi-tile management.

async omnitiles.fleet.scan(*, timeout=5.0, name_prefix='OmniTile_')[source]

Scan for OmniTile devices and return their descriptors.

Thin wrapper around omnitiles.transport.discover_tiles() that re-exports with the canonical scan name.

Parameters:
  • timeout (float)

  • name_prefix (str)

Return type:

list[TileInfo]

class omnitiles.fleet.TileFleet(tiles)[source]

Bases: object

A collection of Tile instances addressed by name.

TileFleet is an async context manager: it connects every contained tile on __aenter__ and disconnects them on __aexit__. Use discover() to build a fleet from a live BLE scan.

Parameters:

tiles (Iterable[Tile])

async classmethod discover(*, timeout=5.0, name_prefix='OmniTile_')[source]

Scan for tiles and return a fleet wrapping all matches.

The returned fleet is not yet connected — either await fleet.connect_all() or use it as an async context manager.

Parameters:
  • timeout (float)

  • name_prefix (str)

Return type:

TileFleet

property names: list[str]
async connect_all()[source]
Return type:

None

async disconnect_all()[source]
Return type:

None

async broadcast(action)[source]

Run an async action against every tile in parallel.

Example:

await fleet.broadcast(lambda t: t.m1_set_position(128))
Parameters:

action (Callable[[Tile], Awaitable[None]])

Return type:

None