Skip to main content

Async Python library for discovering and controlling dLight smart lamps over local Wi-Fi.

Project description

dlight-client

Async Python library for discovering and controlling dLight smart lamps over local Wi-Fi. Pure asyncio. Zero dependencies.

PyPI version Python Versions CI License: MIT Coverage


Install

pip install dlight-client

Python 3.9 – 3.13. No other packages required.

Quick start

import asyncio
from dlightclient import AsyncDLightClient, DLightDevice, discover_devices

async def main():
    devices = await discover_devices()        # UDP broadcast, 3 s window
    info = devices[0]

    async with AsyncDLightClient(persistent=True) as client:
        lamp = DLightDevice(info["ip_address"], info["deviceId"], client)
        await lamp.turn_on()
        await lamp.set_brightness(75)
        await lamp.set_color_temperature(3000) # warm white

asyncio.run(main())

Features

  • Device discovery — UDP broadcast scan; finds all lamps on the local network
  • Persistent connections — connection pool with per-device locking and idle eviction
  • State caching — optimistic updates with automatic rollback on failure
  • Automatic retries — exponential backoff on transient errors (max_retries, retry_backoff)
  • Optional TLS — pass ssl=True or a custom ssl.SSLContext
  • Typed modelsTypedDict classes for DeviceState, DeviceInfo, CommandResult
  • CLIpython -m dlightclient.cli --discover for quick exploration
  • Wi-Fi provisioning — send credentials to a lamp in SoftAP mode

CLI

# Discover all lamps
python -m dlightclient.cli --discover

# Interact with a specific lamp
python -m dlightclient.cli --ip 192.168.1.123 --id DL12345

# Debug with verbose output
python -m dlightclient.cli --ip 192.168.1.123 --id DL12345 -vv

Documentation

Full documentation at https://irishsmurf.github.io/dlight-client/

Getting Started Install, discover, first commands
User Guide Discovery, control, connections, error handling
API Reference Full class and method reference
Architecture Internals for contributors
Contributing Dev setup, testing, PR conventions
Changelog What's changed in each release

Upgrade cadence

Patch releases (1.x.Y) are made as needed for bug fixes and security patches. Minor releases (1.X.0) ship new features and are backwards compatible. Major releases (X.0.0) may include breaking changes and are announced in advance via GitHub Issues.

License

MIT — see LICENSE.

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

dlight_client-2.0.0.tar.gz (42.4 kB view details)

Uploaded Source

Built Distribution

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

dlight_client-2.0.0-py3-none-any.whl (27.9 kB view details)

Uploaded Python 3

File details

Details for the file dlight_client-2.0.0.tar.gz.

File metadata

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

File hashes

Hashes for dlight_client-2.0.0.tar.gz
Algorithm Hash digest
SHA256 9d33741de9514cc1f7ac1e3cbd907093442e980d989b42590703f3347a878fcd
MD5 e49ac88cae9d931951e0d92eded41dd3
BLAKE2b-256 d7ee6f7fa08c09c98f998232a3ff27de30349f248a5bba7845221731e4374b56

See more details on using hashes here.

Provenance

The following attestation bundles were made for dlight_client-2.0.0.tar.gz:

Publisher: python-publish.yml on Irishsmurf/dlight-client

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

File details

Details for the file dlight_client-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: dlight_client-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 27.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dlight_client-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fc0aa6a90bb78606de3fed92cfad7ed7ca465d08e344145694f5396af11ec9c3
MD5 b3ffca5f8ffc8835e8716bccc8fcad8a
BLAKE2b-256 6b59a14158bbf5f96da7f94a07fd5d4b5c964a9302e16e8adad8fe752756a301

See more details on using hashes here.

Provenance

The following attestation bundles were made for dlight_client-2.0.0-py3-none-any.whl:

Publisher: python-publish.yml on Irishsmurf/dlight-client

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