lifx-emulator-core 3.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- lifx_emulator_core-3.0.1/.gitignore +94 -0
- lifx_emulator_core-3.0.1/CHANGELOG.md +27 -0
- lifx_emulator_core-3.0.1/PKG-INFO +99 -0
- lifx_emulator_core-3.0.1/README.md +75 -0
- lifx_emulator_core-3.0.1/pyproject.toml +102 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/__init__.py +31 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/constants.py +33 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/devices/__init__.py +37 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/devices/device.py +395 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/devices/manager.py +256 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/devices/observers.py +139 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/devices/persistence.py +308 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/devices/state_restorer.py +259 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/devices/state_serializer.py +157 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/devices/states.py +381 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/factories/__init__.py +39 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/factories/builder.py +375 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/factories/default_config.py +158 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/factories/factory.py +252 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/factories/firmware_config.py +77 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/factories/serial_generator.py +82 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/handlers/__init__.py +39 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/handlers/base.py +49 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/handlers/device_handlers.py +322 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/handlers/light_handlers.py +503 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/handlers/multizone_handlers.py +249 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/handlers/registry.py +110 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/handlers/tile_handlers.py +488 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/products/__init__.py +28 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/products/generator.py +1079 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/products/registry.py +1530 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/products/specs.py +284 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/products/specs.yml +386 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/protocol/__init__.py +1 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/protocol/base.py +446 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/protocol/const.py +8 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/protocol/generator.py +1384 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/protocol/header.py +159 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/protocol/packets.py +1351 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/protocol/protocol_types.py +817 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/protocol/serializer.py +379 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/repositories/__init__.py +22 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/repositories/device_repository.py +155 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/repositories/storage_backend.py +107 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/scenarios/__init__.py +22 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/scenarios/manager.py +322 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/scenarios/models.py +112 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/scenarios/persistence.py +241 -0
- lifx_emulator_core-3.0.1/src/lifx_emulator/server.py +464 -0
- lifx_emulator_core-3.0.1/tests/conftest.py +238 -0
- lifx_emulator_core-3.0.1/tests/test_async_storage.py +245 -0
- lifx_emulator_core-3.0.1/tests/test_backwards_compatibility.py +943 -0
- lifx_emulator_core-3.0.1/tests/test_device.py +541 -0
- lifx_emulator_core-3.0.1/tests/test_device_edge_cases.py +231 -0
- lifx_emulator_core-3.0.1/tests/test_device_handlers_extended.py +723 -0
- lifx_emulator_core-3.0.1/tests/test_device_manager.py +287 -0
- lifx_emulator_core-3.0.1/tests/test_handler_registry.py +102 -0
- lifx_emulator_core-3.0.1/tests/test_integration.py +462 -0
- lifx_emulator_core-3.0.1/tests/test_light_handlers_extended.py +788 -0
- lifx_emulator_core-3.0.1/tests/test_multizone_handlers_extended.py +560 -0
- lifx_emulator_core-3.0.1/tests/test_observers.py +164 -0
- lifx_emulator_core-3.0.1/tests/test_products_generator.py +1119 -0
- lifx_emulator_core-3.0.1/tests/test_products_specs.py +366 -0
- lifx_emulator_core-3.0.1/tests/test_protocol_generator.py +815 -0
- lifx_emulator_core-3.0.1/tests/test_protocol_types_coverage.py +118 -0
- lifx_emulator_core-3.0.1/tests/test_repositories.py +130 -0
- lifx_emulator_core-3.0.1/tests/test_scenario_manager.py +431 -0
- lifx_emulator_core-3.0.1/tests/test_scenario_persistence.py +271 -0
- lifx_emulator_core-3.0.1/tests/test_serializer.py +459 -0
- lifx_emulator_core-3.0.1/tests/test_server.py +544 -0
- lifx_emulator_core-3.0.1/tests/test_state_restorer.py +270 -0
- lifx_emulator_core-3.0.1/tests/test_switch_devices.py +335 -0
- lifx_emulator_core-3.0.1/tests/test_tile_handlers_extended.py +1265 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
.Python
|
|
7
|
+
|
|
8
|
+
# Distribution / packaging
|
|
9
|
+
build/
|
|
10
|
+
develop-eggs/
|
|
11
|
+
dist/
|
|
12
|
+
downloads/
|
|
13
|
+
eggs/
|
|
14
|
+
.eggs/
|
|
15
|
+
lib/
|
|
16
|
+
lib64/
|
|
17
|
+
parts/
|
|
18
|
+
sdist/
|
|
19
|
+
var/
|
|
20
|
+
wheels/
|
|
21
|
+
pip-wheel-metadata/
|
|
22
|
+
share/python-wheels/
|
|
23
|
+
*.egg-info/
|
|
24
|
+
.installed.cfg
|
|
25
|
+
*.egg
|
|
26
|
+
MANIFEST
|
|
27
|
+
|
|
28
|
+
# Virtual Environments
|
|
29
|
+
.env
|
|
30
|
+
.venv
|
|
31
|
+
env/
|
|
32
|
+
venv/
|
|
33
|
+
ENV/
|
|
34
|
+
env.bak/
|
|
35
|
+
venv.bak/
|
|
36
|
+
.python-version
|
|
37
|
+
|
|
38
|
+
# IDEs
|
|
39
|
+
.vscode/
|
|
40
|
+
.idea/
|
|
41
|
+
*.swp
|
|
42
|
+
*.swo
|
|
43
|
+
*~
|
|
44
|
+
.DS_Store
|
|
45
|
+
|
|
46
|
+
# Testing
|
|
47
|
+
.pytest_cache/
|
|
48
|
+
.coverage
|
|
49
|
+
.coverage.*
|
|
50
|
+
htmlcov/
|
|
51
|
+
.tox/
|
|
52
|
+
.nox/
|
|
53
|
+
coverage.xml
|
|
54
|
+
*.cover
|
|
55
|
+
.hypothesis/
|
|
56
|
+
junit.xml
|
|
57
|
+
|
|
58
|
+
# Type checking
|
|
59
|
+
.mypy_cache/
|
|
60
|
+
.dmypy.json
|
|
61
|
+
dmypy.json
|
|
62
|
+
.pytype/
|
|
63
|
+
pyrightconfig.json
|
|
64
|
+
|
|
65
|
+
# Ruff
|
|
66
|
+
.ruff_cache/
|
|
67
|
+
|
|
68
|
+
# Jupyter Notebook
|
|
69
|
+
.ipynb_checkpoints
|
|
70
|
+
*.ipynb
|
|
71
|
+
|
|
72
|
+
# Documentation
|
|
73
|
+
docs/_build/
|
|
74
|
+
site/
|
|
75
|
+
|
|
76
|
+
# Build artifacts
|
|
77
|
+
*.prof
|
|
78
|
+
*.lprof
|
|
79
|
+
|
|
80
|
+
# OS
|
|
81
|
+
.DS_Store
|
|
82
|
+
Thumbs.db
|
|
83
|
+
.Spotlight-V100
|
|
84
|
+
.Trashes
|
|
85
|
+
|
|
86
|
+
# Temporary files
|
|
87
|
+
*.tmp
|
|
88
|
+
*.bak
|
|
89
|
+
*.log
|
|
90
|
+
.cache/
|
|
91
|
+
|
|
92
|
+
# Local storage
|
|
93
|
+
.notes/
|
|
94
|
+
.claude/settings.local.json
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# CHANGELOG
|
|
2
|
+
|
|
3
|
+
<!-- version list -->
|
|
4
|
+
|
|
5
|
+
## v3.0.1 (2025-11-26)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- Adjust uv build for new monorepo layout
|
|
10
|
+
([`a0d5b7c`](https://github.com/Djelibeybi/lifx-emulator/commit/a0d5b7c1c1ab5659acc8554931f6c441654add05))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## v3.0.0 (2025-11-26)
|
|
14
|
+
|
|
15
|
+
### Refactoring
|
|
16
|
+
|
|
17
|
+
- Split into monorepo with separate library and CLI packages
|
|
18
|
+
([`402fe6e`](https://github.com/Djelibeybi/lifx-emulator/commit/402fe6e6c42e4fb730d076cd4dd0bfe7743b2c57))
|
|
19
|
+
|
|
20
|
+
### Breaking Changes
|
|
21
|
+
|
|
22
|
+
- The project is now split into two packages:
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## v2.4.0 (2025-11-26)
|
|
26
|
+
|
|
27
|
+
- Initial Release
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: lifx-emulator-core
|
|
3
|
+
Version: 3.0.1
|
|
4
|
+
Summary: Core LIFX Emulator library for testing LIFX LAN protocol libraries
|
|
5
|
+
Author-email: Avi Miller <me@dje.li>
|
|
6
|
+
Maintainer-email: Avi Miller <me@dje.li>
|
|
7
|
+
License-Expression: UPL-1.0
|
|
8
|
+
Classifier: Framework :: AsyncIO
|
|
9
|
+
Classifier: Framework :: Pytest
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Natural Language :: English
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
18
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
19
|
+
Classifier: Topic :: Software Development :: Testing
|
|
20
|
+
Classifier: Typing :: Typed
|
|
21
|
+
Requires-Python: >=3.11
|
|
22
|
+
Requires-Dist: pyyaml>=6.0.3
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# lifx-emulator-core
|
|
26
|
+
|
|
27
|
+
Core Python library for emulating LIFX devices using the LAN protocol.
|
|
28
|
+
|
|
29
|
+
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](https://lan.developer.lifx.com) specification.
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install lifx-emulator-core
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Quick Start
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
import asyncio
|
|
41
|
+
from lifx_emulator import EmulatedLifxServer, DeviceManager
|
|
42
|
+
from lifx_emulator.factories import create_color_light
|
|
43
|
+
from lifx_emulator.repositories import DeviceRepository
|
|
44
|
+
|
|
45
|
+
async def main():
|
|
46
|
+
# Create devices
|
|
47
|
+
devices = [
|
|
48
|
+
create_color_light(serial="d073d5000001"),
|
|
49
|
+
create_color_light(serial="d073d5000002"),
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
# Create repository and manager
|
|
53
|
+
repository = DeviceRepository()
|
|
54
|
+
manager = DeviceManager(repository)
|
|
55
|
+
|
|
56
|
+
# Start the emulator server
|
|
57
|
+
server = EmulatedLifxServer(
|
|
58
|
+
devices=devices,
|
|
59
|
+
device_manager=manager,
|
|
60
|
+
bind_address="127.0.0.1",
|
|
61
|
+
port=56700,
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
await server.start()
|
|
65
|
+
print("LIFX Emulator running on 127.0.0.1:56700")
|
|
66
|
+
|
|
67
|
+
# Keep running until interrupted
|
|
68
|
+
try:
|
|
69
|
+
await asyncio.Event().wait()
|
|
70
|
+
finally:
|
|
71
|
+
await server.stop()
|
|
72
|
+
|
|
73
|
+
asyncio.run(main())
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Features
|
|
77
|
+
|
|
78
|
+
- Emulate color lights, multizone strips, tiles, infrared, HEV, and switch devices
|
|
79
|
+
- Full LIFX LAN protocol implementation
|
|
80
|
+
- Persistent device state storage
|
|
81
|
+
- Testing scenarios for simulating edge cases
|
|
82
|
+
- Product registry with 137+ official LIFX products
|
|
83
|
+
|
|
84
|
+
## Documentation
|
|
85
|
+
|
|
86
|
+
Full documentation is available at: **https://djelibeybi.github.io/lifx-emulator**
|
|
87
|
+
|
|
88
|
+
- [Installation Guide](https://djelibeybi.github.io/lifx-emulator/getting-started/installation/)
|
|
89
|
+
- [Quick Start](https://djelibeybi.github.io/lifx-emulator/getting-started/quickstart/)
|
|
90
|
+
- [API Reference](https://djelibeybi.github.io/lifx-emulator/library/)
|
|
91
|
+
- [Architecture](https://djelibeybi.github.io/lifx-emulator/architecture/)
|
|
92
|
+
|
|
93
|
+
## Related Packages
|
|
94
|
+
|
|
95
|
+
- **[lifx-emulator](https://pypi.org/project/lifx-emulator/)**: Standalone CLI tool and HTTP management API built on this library
|
|
96
|
+
|
|
97
|
+
## License
|
|
98
|
+
|
|
99
|
+
[UPL-1.0](https://opensource.org/licenses/UPL)
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# lifx-emulator-core
|
|
2
|
+
|
|
3
|
+
Core Python library for emulating LIFX devices using the LAN protocol.
|
|
4
|
+
|
|
5
|
+
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](https://lan.developer.lifx.com) specification.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install lifx-emulator-core
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
import asyncio
|
|
17
|
+
from lifx_emulator import EmulatedLifxServer, DeviceManager
|
|
18
|
+
from lifx_emulator.factories import create_color_light
|
|
19
|
+
from lifx_emulator.repositories import DeviceRepository
|
|
20
|
+
|
|
21
|
+
async def main():
|
|
22
|
+
# Create devices
|
|
23
|
+
devices = [
|
|
24
|
+
create_color_light(serial="d073d5000001"),
|
|
25
|
+
create_color_light(serial="d073d5000002"),
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
# Create repository and manager
|
|
29
|
+
repository = DeviceRepository()
|
|
30
|
+
manager = DeviceManager(repository)
|
|
31
|
+
|
|
32
|
+
# Start the emulator server
|
|
33
|
+
server = EmulatedLifxServer(
|
|
34
|
+
devices=devices,
|
|
35
|
+
device_manager=manager,
|
|
36
|
+
bind_address="127.0.0.1",
|
|
37
|
+
port=56700,
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
await server.start()
|
|
41
|
+
print("LIFX Emulator running on 127.0.0.1:56700")
|
|
42
|
+
|
|
43
|
+
# Keep running until interrupted
|
|
44
|
+
try:
|
|
45
|
+
await asyncio.Event().wait()
|
|
46
|
+
finally:
|
|
47
|
+
await server.stop()
|
|
48
|
+
|
|
49
|
+
asyncio.run(main())
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Features
|
|
53
|
+
|
|
54
|
+
- Emulate color lights, multizone strips, tiles, infrared, HEV, and switch devices
|
|
55
|
+
- Full LIFX LAN protocol implementation
|
|
56
|
+
- Persistent device state storage
|
|
57
|
+
- Testing scenarios for simulating edge cases
|
|
58
|
+
- Product registry with 137+ official LIFX products
|
|
59
|
+
|
|
60
|
+
## Documentation
|
|
61
|
+
|
|
62
|
+
Full documentation is available at: **https://djelibeybi.github.io/lifx-emulator**
|
|
63
|
+
|
|
64
|
+
- [Installation Guide](https://djelibeybi.github.io/lifx-emulator/getting-started/installation/)
|
|
65
|
+
- [Quick Start](https://djelibeybi.github.io/lifx-emulator/getting-started/quickstart/)
|
|
66
|
+
- [API Reference](https://djelibeybi.github.io/lifx-emulator/library/)
|
|
67
|
+
- [Architecture](https://djelibeybi.github.io/lifx-emulator/architecture/)
|
|
68
|
+
|
|
69
|
+
## Related Packages
|
|
70
|
+
|
|
71
|
+
- **[lifx-emulator](https://pypi.org/project/lifx-emulator/)**: Standalone CLI tool and HTTP management API built on this library
|
|
72
|
+
|
|
73
|
+
## License
|
|
74
|
+
|
|
75
|
+
[UPL-1.0](https://opensource.org/licenses/UPL)
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "lifx-emulator-core"
|
|
3
|
+
version = "3.0.1"
|
|
4
|
+
description = "Core LIFX Emulator library for testing LIFX LAN protocol libraries"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.11"
|
|
7
|
+
dependencies = [
|
|
8
|
+
"pyyaml>=6.0.3",
|
|
9
|
+
]
|
|
10
|
+
license = "UPL-1.0"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "Avi Miller", email = "me@dje.li"}
|
|
14
|
+
]
|
|
15
|
+
maintainers = [
|
|
16
|
+
{name = "Avi Miller", email = "me@dje.li"}
|
|
17
|
+
]
|
|
18
|
+
classifiers = [
|
|
19
|
+
"Framework :: AsyncIO",
|
|
20
|
+
"Framework :: Pytest",
|
|
21
|
+
"Intended Audience :: Developers",
|
|
22
|
+
"Natural Language :: English",
|
|
23
|
+
"Operating System :: OS Independent",
|
|
24
|
+
"Programming Language :: Python :: 3.11",
|
|
25
|
+
"Programming Language :: Python :: 3.12",
|
|
26
|
+
"Programming Language :: Python :: 3.13",
|
|
27
|
+
"Programming Language :: Python :: 3.14",
|
|
28
|
+
"Topic :: Software Development :: Libraries",
|
|
29
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
30
|
+
"Topic :: Software Development :: Testing",
|
|
31
|
+
"Typing :: Typed"
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
[build-system]
|
|
35
|
+
requires = ["hatchling"]
|
|
36
|
+
build-backend = "hatchling.build"
|
|
37
|
+
|
|
38
|
+
[tool.hatch.build.targets.wheel]
|
|
39
|
+
packages = ["src/lifx_emulator"]
|
|
40
|
+
|
|
41
|
+
[tool.pyright]
|
|
42
|
+
typeCheckingMode = "standard"
|
|
43
|
+
pythonVersion = "3.11"
|
|
44
|
+
include = ["src"]
|
|
45
|
+
exclude = ["**/__pycache__"]
|
|
46
|
+
|
|
47
|
+
[tool.pytest.ini_options]
|
|
48
|
+
testpaths = ["tests"]
|
|
49
|
+
pythonpath = ["src"]
|
|
50
|
+
python_files = ["test_*.py"]
|
|
51
|
+
python_classes = ["Test*"]
|
|
52
|
+
python_functions = ["test_*"]
|
|
53
|
+
asyncio_mode = "auto"
|
|
54
|
+
asyncio_default_fixture_loop_scope = "function"
|
|
55
|
+
|
|
56
|
+
[tool.semantic_release]
|
|
57
|
+
commit_parser = "conventional-monorepo"
|
|
58
|
+
commit_message = """\
|
|
59
|
+
chore(release): lifx-emulator-core@{version}`
|
|
60
|
+
|
|
61
|
+
Automatically generated by python-semantic-release
|
|
62
|
+
"""
|
|
63
|
+
tag_format = "core-v{version}"
|
|
64
|
+
version_toml = ["pyproject.toml:project.version"]
|
|
65
|
+
build_command = """
|
|
66
|
+
uv lock --upgrade-package "$PACKAGE_NAME"
|
|
67
|
+
git add ../../uv.lock
|
|
68
|
+
uv build --package lifx-emulator-core --out-dir dist/
|
|
69
|
+
"""
|
|
70
|
+
|
|
71
|
+
[tool.semantic_release.commit_parser_options]
|
|
72
|
+
path_filters = ["."]
|
|
73
|
+
scope_prefix = "core-"
|
|
74
|
+
|
|
75
|
+
[tool.semantic_release.branches.main]
|
|
76
|
+
match = "main"
|
|
77
|
+
prerelease = false
|
|
78
|
+
|
|
79
|
+
[tool.semantic_release.branches.dev]
|
|
80
|
+
match = "(?!main$).*"
|
|
81
|
+
prerelease = true
|
|
82
|
+
prerelease_token = "dev"
|
|
83
|
+
|
|
84
|
+
[tool.semantic_release.changelog]
|
|
85
|
+
# Recommended patterns for conventional commits parser that is scope aware
|
|
86
|
+
exclude_commit_patterns = [
|
|
87
|
+
'''chore(?:\([^)]*?\))?: .+''',
|
|
88
|
+
'''ci(?:\([^)]*?\))?: .+''',
|
|
89
|
+
'''refactor(?:\([^)]*?\))?: .+''',
|
|
90
|
+
'''style(?:\([^)]*?\))?: .+''',
|
|
91
|
+
'''test(?:\([^)]*?\))?: .+''',
|
|
92
|
+
'''build\((?!deps\): .+)''',
|
|
93
|
+
'''Initial [Cc]ommit.*''',
|
|
94
|
+
]
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
[tool.semantic_release.changelog.default_templates]
|
|
98
|
+
changelog_file = "CHANGELOG.md"
|
|
99
|
+
output_format = "md"
|
|
100
|
+
|
|
101
|
+
[tool.semantic_release.remote]
|
|
102
|
+
ignore_token_for_push = true
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""LIFX Emulator
|
|
2
|
+
|
|
3
|
+
A comprehensive LIFX emulator for testing LIFX LAN protocol libraries.
|
|
4
|
+
Implements the binary UDP protocol documented at https://lan.developer.lifx.com
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from importlib.metadata import version as get_version
|
|
8
|
+
|
|
9
|
+
from lifx_emulator.devices import EmulatedLifxDevice
|
|
10
|
+
from lifx_emulator.factories import (
|
|
11
|
+
create_color_light,
|
|
12
|
+
create_color_temperature_light,
|
|
13
|
+
create_hev_light,
|
|
14
|
+
create_infrared_light,
|
|
15
|
+
create_multizone_light,
|
|
16
|
+
create_tile_device,
|
|
17
|
+
)
|
|
18
|
+
from lifx_emulator.server import EmulatedLifxServer
|
|
19
|
+
|
|
20
|
+
__version__ = get_version("lifx-emulator-core")
|
|
21
|
+
|
|
22
|
+
__all__ = [
|
|
23
|
+
"EmulatedLifxServer",
|
|
24
|
+
"EmulatedLifxDevice",
|
|
25
|
+
"create_color_light",
|
|
26
|
+
"create_color_temperature_light",
|
|
27
|
+
"create_hev_light",
|
|
28
|
+
"create_infrared_light",
|
|
29
|
+
"create_multizone_light",
|
|
30
|
+
"create_tile_device",
|
|
31
|
+
]
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""Protocol constants for LIFX LAN Protocol"""
|
|
2
|
+
|
|
3
|
+
from typing import Final
|
|
4
|
+
|
|
5
|
+
# ============================================================================
|
|
6
|
+
# Network Constants
|
|
7
|
+
# ============================================================================
|
|
8
|
+
|
|
9
|
+
# LIFX UDP port for device communication
|
|
10
|
+
LIFX_UDP_PORT: Final[int] = 56700
|
|
11
|
+
|
|
12
|
+
# LIFX Protocol version
|
|
13
|
+
LIFX_PROTOCOL_VERSION: Final[int] = 1024
|
|
14
|
+
|
|
15
|
+
# Header size in bytes
|
|
16
|
+
LIFX_HEADER_SIZE: Final[int] = 36
|
|
17
|
+
|
|
18
|
+
# Backward compatibility alias
|
|
19
|
+
HEADER_SIZE = LIFX_HEADER_SIZE
|
|
20
|
+
|
|
21
|
+
# ============================================================================
|
|
22
|
+
# Official LIFX Repository URLs
|
|
23
|
+
# ============================================================================
|
|
24
|
+
|
|
25
|
+
# Official LIFX protocol specification URL
|
|
26
|
+
PROTOCOL_URL: Final[str] = (
|
|
27
|
+
"https://raw.githubusercontent.com/LIFX/public-protocol/refs/heads/main/protocol.yml"
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
# Official LIFX products specification URL
|
|
31
|
+
PRODUCTS_URL: Final[str] = (
|
|
32
|
+
"https://raw.githubusercontent.com/LIFX/products/refs/heads/master/products.json"
|
|
33
|
+
)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"""Device management module for LIFX emulator.
|
|
2
|
+
|
|
3
|
+
This module contains all device-related functionality including:
|
|
4
|
+
- Device core (EmulatedLifxDevice)
|
|
5
|
+
- Device manager (DeviceManager, IDeviceManager)
|
|
6
|
+
- Device states (DeviceState and related dataclasses)
|
|
7
|
+
- Device persistence (async file storage)
|
|
8
|
+
- State restoration and serialization
|
|
9
|
+
- Device state observers (ActivityObserver, ActivityLogger, PacketEvent, NullObserver)
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from lifx_emulator.devices.device import EmulatedLifxDevice
|
|
13
|
+
from lifx_emulator.devices.manager import DeviceManager, IDeviceManager
|
|
14
|
+
from lifx_emulator.devices.observers import (
|
|
15
|
+
ActivityLogger,
|
|
16
|
+
ActivityObserver,
|
|
17
|
+
NullObserver,
|
|
18
|
+
PacketEvent,
|
|
19
|
+
)
|
|
20
|
+
from lifx_emulator.devices.persistence import (
|
|
21
|
+
DEFAULT_STORAGE_DIR,
|
|
22
|
+
DevicePersistenceAsyncFile,
|
|
23
|
+
)
|
|
24
|
+
from lifx_emulator.devices.states import DeviceState
|
|
25
|
+
|
|
26
|
+
__all__ = [
|
|
27
|
+
"EmulatedLifxDevice",
|
|
28
|
+
"DeviceManager",
|
|
29
|
+
"IDeviceManager",
|
|
30
|
+
"DeviceState",
|
|
31
|
+
"DevicePersistenceAsyncFile",
|
|
32
|
+
"DEFAULT_STORAGE_DIR",
|
|
33
|
+
"ActivityObserver",
|
|
34
|
+
"ActivityLogger",
|
|
35
|
+
"PacketEvent",
|
|
36
|
+
"NullObserver",
|
|
37
|
+
]
|