Skip to main content

DoHome API

PyPI version Quality assurance

Async Python library for controlling smart LED bulbs and strips that use the DoIt protocol (DoHome app). Communicates with devices over the local network via TCP/UDP — no cloud required.

Features

  • Device discovery via UDP broadcast
  • RGB color and white temperature control
  • Brightness adjustment
  • Built-in light effects (gradients, strobes, jumps)
  • Device info, state reading, and power management
  • Wi-Fi credential provisioning

Installation

pip install dohome-api

Requires Python 3.12+.

Quick Start

import asyncio
from dohome.api import APIClient, discover
from dohome.transport import TCPStream, UDPBroadcast

async def main():
    # Discover devices on the local network
    broadcast = UDPBroadcast()
    devices = await discover(broadcast)
    broadcast.close()

    if not devices:
        print("No devices found")
        return

    # Connect to the first device
    client = APIClient(TCPStream(devices[0]["sta_ip"]))

    await client.set_power(True)
    await client.set_color((255, 0, 0), 128)  # Red at 50% brightness
    await asyncio.sleep(2)
    await client.set_power(False)

asyncio.run(main())

More examples (device info, Wi-Fi setup, state inspection) are available in the examples/ directory.

Provisioning

You can use this library to perform the initial device setup without using the DoHome app.

To do this:

  1. Clone this repository
  2. Install dependencies with make configure command
  3. Set the DOHOME_SSID and DOHOME_PASSWORD environment variables
  4. Connect to the light bulb's access point
  5. Run uv run examples/configure.py

API Reference

Discovery

Function Description
discover(transport) Finds all DoIt devices on the local network

APIClient

Method Description
set_power(is_on) Turn the device on or off
set_color(rgb, brightness) Set RGB color with brightness (0–255)
set_white(kelvin, brightness) Set white temperature (3000–6400 K) with brightness
set_effect(effect) Activate a built-in light effect
get_state() Read current light state
get_device_info() Read device hardware info
get_datetime() / set_datetime(dt) Read or set the device clock
set_wifi_credentials(ssid, password) Provision Wi-Fi credentials
reboot() Reboot the device

License

MIT © Mikhael Khrustik

Metadata

Release files for dohome-api 2.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dohome-api 2.2.1
File Size Uploaded Provenance Actions
dohome_api-2.2.1.tar.gz 54.4 kB Without provenance Details for dohome_api-2.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dohome-api 2.2.1
File Interpreter ABI Platform Actions
dohome_api-2.2.1-py3-none-any.whl Python 3 none any Details for dohome_api-2.2.1-py3-none-any.whl

Total release size: 72.7 kB

Release files / dohome_api-2.2.1.tar.gz

Download URL dohome_api-2.2.1.tar.gz
Size 54.4 kB
Tags Source
SHA-256 checksum
How to use checksums
870dde5be34b8de3a9d35a70984cebfbc2a19e706f28cbd9fbf27157394f0f44
BLAKE2b-256 checksum
How to use checksums
73efd0d2ebd6043880b45f9a83283e1b7c62e0497883c1718525881cf20ecada
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.9

Release files / dohome_api-2.2.1-py3-none-any.whl

Download URL dohome_api-2.2.1-py3-none-any.whl
Size 18.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b54c0638d3c395b04005c385aa54be7e3471fe15cd074e80654108a7d8e89ff6
BLAKE2b-256 checksum
How to use checksums
489cacf0871fc49ced1e4c086e11913781e7dc9f15ad00d290a60dfd0604a5ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.9

Security for dohome-api 2.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page