aiolifx
API for local communication with LIFX devices over a LAN with asyncio.
What it is and what it does
aiolifx wraps the LIFX LAN protocol in an asyncio-friendly Python library, letting you discover and control LIFX lightbulbs on your local network without relying on cloud services. It uses UDP broadcast to find bulbs and then communicates with each via unicast UDP sockets, keeping connections open for the lifetime of the bulb to avoid repeated connection overhead.
The library is built around a discovery task that registers new bulbs as it finds them and an event-driven callback model where you supply methods to handle registration and unregistration. It includes a command-line utility for testing and basic control, and supports both IPv4 and IPv6 connections to bulbs. Dependencies are minimal: async_timeout, bitstring, ifaddr, click, and InquirerPy.
Use it for:
- Build a home automation dashboard that discovers and controls LIFX bulbs on startup without polling
- Create a command-line tool to batch-control lights across your LAN using the included aiolifx CLI
- Integrate LIFX bulbs into an asyncio-based smart home application with callback-driven state updates
- Monitor bulb uptime and WiFi status by passing callback functions to bulb methods
- Implement custom lighting scenes by chaining set_waveform calls with dictionary-based parameters
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
aiolifx is an asyncio-based Python library for discovering and controlling LIFX LED lightbulbs over a local network using UDP communication.
Yes. The package is actively maintained, has no known vulnerabilities, uses a permissive MIT license, and offers low install friction. It solves a real problem—local LIFX control without cloud dependency—with a clean asyncio API. The main caveat is limited testing against bulb models beyond the Original 1000; verify compatibility with your hardware before relying on it in production.
Install
aiolifx on PyPI
pip
pip install aiolifxuv
uv add aiolifxpoetry
poetry add aiolifxInstalling aiolifx
Before you install
Low install friction with a pure-Python wheel distribution. The package is actively maintained with a recent release (80 days ago) and no known vulnerabilities. Dependencies are lightweight and stable.
License in practice
MIT license permits commercial and private use with minimal restrictions, making it straightforward to integrate into most projects.
Quickstart
pip install aiolifx
import asyncio
from aiolifx import LifxDiscovery
class BulbRegistry:
def __init__(self):
self.bulbs = []
def register(self, bulb):
self.bulbs.append(bulb)
def unregister(self, bulb):
self.bulbs = [b for b in self.bulbs if b.mac_addr != bulb.mac_addr]
loop = asyncio.get_event_loop()
registry = BulbRegistry()
discovery = LifxDiscovery(loop, registry)
discovery.start()
loop.run_forever()
Requires Python 3.4 or later. Bulbs must be on the same LAN and reachable via UDP broadcast and unicast.
Verify before relying
- Whether IPv6 support with /48 prefixes is production-ready (documentation notes this is untested)
- Compatibility with LIFX bulb models beyond the Original 1000 (author only tested with one model)
- Current state of the callback-based response handling and whether it covers all bulb commands
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.4) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 5 — async_timeout, bitstring, ifaddr, click, InquirerPy |
| Maintenance | actively maintained — 80 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 78,097/month — #14,470 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: aiolifx-1.2.2-py3-none-any.whl
Keywords: lifx, light, automation
Tags
More Internet packages
Botocore provides low-level, data-driven access…
permissive · top 100 on PyPI
aiobotocoreProvides an async client for AWS services using…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
filelockProvides a platform-independent file locking…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
googleapis-common-protosProvides common Protocol Buffer message…
permissive · top 100 on PyPI
aiolifx-effectsProvides light effects for LIFX smart bulbs via…
permissive · top 15,000 on PyPI
govee-api-laggatControls Govee LED strips and bulbs via the…
permissive · top 15,000 on PyPI
yeelightControl YeeLight WiFi RGB LED bulbs over LAN…
permissive · top 15,000 on PyPI
pywizlightA Python library and CLI tool for discovering…
permissive · top 15,000 on PyPI
aiolifx-themesApplies color themes to LIFX smart lights using…
permissive · top 15,000 on PyPI
flux-ledControls Magic Home and Surp Life WiFi LED…
copyleft · top 15,000 on PyPI
aiohueAsynchronous Python library for controlling…
permissive · top 15,000 on PyPI
elgatoAsynchronous Python client for controlling and…
permissive · top 15,000 on PyPI
pyvesyncAsynchronous Python library to discover,…
permissive · top 15,000 on PyPI
devolo-plc-apiProvides a Python API to communicate with…
copyleft · top 15,000 on PyPI