skillfed

aiolifx

API for local communication with LIFX devices over a LAN with asyncio.

aiolifx v1.2.2 78.1K downloads/30d#14,470 on PyPI26
Permissive license MIT Active released

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 aiolifx

uv

uv add aiolifx

poetry

poetry add aiolifx

Installing 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

License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3

Tags

lifx bulb control pythonasyncio lifx lightslan light automationlifx device discoveryudp light control librarysmart bulb python apilifx home automation
home-automationasynciolan-networking

More Internet packages