Skip to content

API Reference

All public names are importable from the top-level dlightclient package:

from dlightclient import (
    AsyncDLightClient,
    DLightDevice,
    discover_devices,
    DLightError,
    DLightConnectionError,
    DLightTimeoutError,
    DLightCommandError,
    DLightResponseError,
)

Public surface

Name Kind Description
AsyncDLightClient class Low-level TCP client. Handles connection pooling, framing, and retries.
DLightDevice class High-level per-device facade with state cache and optimistic updates.
discover_devices() coroutine UDP broadcast scan; returns a list of device dicts.
DLightError exception Base class for all library exceptions.
DLightConnectionError exception TCP connection failed.
DLightTimeoutError exception Operation timed out (subclass of DLightConnectionError).
DLightCommandError exception Device rejected the command.
DLightResponseError exception Unexpected or malformed device response.
DeviceState TypedDict {on, brightness, color} โ€” lamp state.
DeviceInfo TypedDict {deviceId, deviceModel, swVersion, hwVersion, macAddress} โ€” hardware metadata.
CommandResult TypedDict Raw response from a command call.
ColorState TypedDict {temperature} โ€” embedded in DeviceState.

Stability

Names that appear in dlightclient.__all__ are part of the stable public API. Names prefixed with _ (such as _pool, _frame) are private implementation details and may change without notice between minor versions.

Constants (DEFAULT_TCP_PORT, DEFAULT_TIMEOUT, etc.) are exported from dlightclient.constants and are stable.

Version

import dlightclient
print(dlightclient.__version__)   # e.g. "1.6.1"