Skip to content

Discovery

UDP broadcast discovery of ComAp controllers on the local network (port 2413).

pycomap.discover async

discover(
    *interfaces: IPv4Interface, timeout: float = 2.0
) -> list[DiscoveryDevice]

Broadcast a discovery probe from each of interfaces and collect replies for timeout seconds.

On a host with multiple NICs on different subnets, a probe sent to the global broadcast address 255.255.255.255 only egresses via whichever interface the OS routes it through, so it may never reach the controller's actual subnet — pass one IPv4Interface per local interface you want to probe from (e.g. IPv4Interface("192.168.1.5/24"), your own address on that subnet) to bind and broadcast on each of them; this module doesn't enumerate network interfaces itself. Pass IPv4Interface("0.0.0.0/0") to fall back to the wildcard bind + global broadcast address on a single-NIC host.

Returns one DiscoveryDevice per distinct replying IP address. Malformed or unrelated UDP traffic on the same port (CRC mismatch, wrong communication object) is silently skipped.

pycomap.discovery.discover_host async

discover_host(
    ip: IPv4Address, timeout: float = 2.0
) -> DiscoveryDevice | None

Send a discovery probe directly (unicast) to a known ip and wait up to timeout seconds for its reply.

Useful when the controller's address is already known, so there's no need to broadcast and no ambiguity about which local interface/subnet to use.

Returns None if ip doesn't reply within timeout.

pycomap.discovery.DiscoveryDevice dataclass

DiscoveryDevice(
    format_version: int,
    device_type: DeviceType,
    serial_number: int,
    firmware_major_minor: int,
    firmware_patch_build: int,
    ip: IPv4Address,
    mac: str,
    comm_port: int,
    access_type: AccessType,
    airgate_identifier: str,
    connected_units: int,
    is_units_list_complete: bool,
    units: list[DiscoveryUnit] = list(),
)

A controller's decoded reply to a discovery probe.

pycomap.discovery.DiscoveryUnit dataclass

DiscoveryUnit(type: int, name: str, serial: str)

A controller unit reachable through the replying gateway device.

pycomap.discovery.DeviceType

Bases: IntEnum

ComAp DiscoveryDevice.DeviceType enum.

pycomap.discovery.AccessType

Bases: IntFlag

ComAp DiscoveryDevice.AccessType flags.