Async Python library for discovering and controlling dLight smart lamps over local Wi-Fi.
Project description
Async Python library for discovering and controlling dLight smart lamps over local Wi-Fi. Pure asyncio. Zero dependencies.
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=Trueor a customssl.SSLContext - Typed models —
TypedDictclasses forDeviceState,DeviceInfo,CommandResult - CLI —
python -m dlightclient.cli --discoverfor 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d33741de9514cc1f7ac1e3cbd907093442e980d989b42590703f3347a878fcd
|
|
| MD5 |
e49ac88cae9d931951e0d92eded41dd3
|
|
| BLAKE2b-256 |
d7ee6f7fa08c09c98f998232a3ff27de30349f248a5bba7845221731e4374b56
|
Provenance
The following attestation bundles were made for dlight_client-2.0.0.tar.gz:
Publisher:
python-publish.yml on Irishsmurf/dlight-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dlight_client-2.0.0.tar.gz -
Subject digest:
9d33741de9514cc1f7ac1e3cbd907093442e980d989b42590703f3347a878fcd - Sigstore transparency entry: 1810451293
- Sigstore integration time:
-
Permalink:
Irishsmurf/dlight-client@f8cedc58142eca2623833f87a188a860605e23a9 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/Irishsmurf
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@f8cedc58142eca2623833f87a188a860605e23a9 -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc0aa6a90bb78606de3fed92cfad7ed7ca465d08e344145694f5396af11ec9c3
|
|
| MD5 |
b3ffca5f8ffc8835e8716bccc8fcad8a
|
|
| BLAKE2b-256 |
6b59a14158bbf5f96da7f94a07fd5d4b5c964a9302e16e8adad8fe752756a301
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dlight_client-2.0.0-py3-none-any.whl -
Subject digest:
fc0aa6a90bb78606de3fed92cfad7ed7ca465d08e344145694f5396af11ec9c3 - Sigstore transparency entry: 1810451367
- Sigstore integration time:
-
Permalink:
Irishsmurf/dlight-client@f8cedc58142eca2623833f87a188a860605e23a9 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/Irishsmurf
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@f8cedc58142eca2623833f87a188a860605e23a9 -
Trigger Event:
release
-
Statement type: