Skip to main content

Core LIFX Emulator library for testing LIFX LAN protocol libraries

Project description

lifx-emulator-core

Core Python library for emulating LIFX devices using the LAN protocol.

This package provides the embeddable library for creating virtual LIFX devices in your own projects. It implements the binary UDP protocol from the LIFX LAN Protocol specification.

Installation

pip install lifx-emulator-core

Quick Start

import asyncio
from lifx_emulator import EmulatedLifxServer, DeviceManager
from lifx_emulator.factories import create_color_light
from lifx_emulator.repositories import DeviceRepository

async def main():
    # Create devices
    devices = [
        create_color_light(serial="d073d5000001"),
        create_color_light(serial="d073d5000002"),
    ]

    # Create repository and manager
    repository = DeviceRepository()
    manager = DeviceManager(repository)

    # Start the emulator server
    server = EmulatedLifxServer(
        devices=devices,
        device_manager=manager,
        bind_address="127.0.0.1",
        port=56700,
    )

    await server.start()
    print("LIFX Emulator running on 127.0.0.1:56700")

    # Keep running until interrupted
    try:
        await asyncio.Event().wait()
    finally:
        await server.stop()

asyncio.run(main())

Features

  • Emulate color lights, multizone strips, tiles, infrared, HEV, and switch devices
  • Full LIFX LAN protocol implementation
  • Persistent device state storage
  • Testing scenarios for simulating edge cases
  • Product registry with 137+ official LIFX products

Documentation

Full documentation is available at: https://djelibeybi.github.io/lifx-emulator

Related Packages

  • lifx-emulator: Standalone CLI tool and HTTP management API built on this library

License

UPL-1.0

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

lifx_emulator_core-3.6.0.tar.gz (140.2 kB view details)

Uploaded Source

Built Distribution

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

lifx_emulator_core-3.6.0-py3-none-any.whl (103.9 kB view details)

Uploaded Python 3

File details

Details for the file lifx_emulator_core-3.6.0.tar.gz.

File metadata

  • Download URL: lifx_emulator_core-3.6.0.tar.gz
  • Upload date:
  • Size: 140.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lifx_emulator_core-3.6.0.tar.gz
Algorithm Hash digest
SHA256 9cfc7c11573319137a0e7dc82a399a285cd9248855ab48c698e05aaec5af3332
MD5 2e41e1b9fed951192cd548b72864dd60
BLAKE2b-256 95954c93fc1adf362b52c0da78602d07aacd79888b2ccfa3a02cfb81b43b2cc4

See more details on using hashes here.

Provenance

The following attestation bundles were made for lifx_emulator_core-3.6.0.tar.gz:

Publisher: ci.yml on Djelibeybi/lifx-emulator

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

File details

Details for the file lifx_emulator_core-3.6.0-py3-none-any.whl.

File metadata

File hashes

Hashes for lifx_emulator_core-3.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9650ac237dd2b05398bcd14e61cf4483e2850aedf7be2a6687d585363a5ddb9b
MD5 a5aa50767d165aaddf155a1d97e28744
BLAKE2b-256 37e8388012a1ba3bd6ac46c7a7f2f1a8bfbed01f65620678719fee5bbe8b277d

See more details on using hashes here.

Provenance

The following attestation bundles were made for lifx_emulator_core-3.6.0-py3-none-any.whl:

Publisher: ci.yml on Djelibeybi/lifx-emulator

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