feat(devices): BLE LED controller support (SP110E/Triones/Zengge/Govee)
Build Android APK / build-android (push) Failing after 1m44s
Lint & Test / test (push) Successful in 4m22s

End-to-end BLE streaming: provider + client + per-protocol wire encoders
with whole-strip averaging, desktop (bleak) and Android (Kotlin BleBridge
via Chaquopy) transports, discovery with protocol-family detection that
auto-fills the UI, throttled not-connected warning + 10 s reconnect
cooldown so a dropped link no longer stalls the pipeline at ~30 s/frame,
and an explicit asyncio.wait_for wrapper around bleak connect() since
the WinRT backend doesn't always honor the timeout kwarg.

Also rewrites server/restart.ps1 to be parameterized (-Port / -Module /
-PythonVersion / timeouts / -Quiet), pick the right interpreter via the
py launcher, pre-flight the target module, poll port readiness on both
shutdown and startup, redirect child stdout/stderr so Start-Process
doesn't hang on inherited Git-Bash handles, and return proper exit codes.

Rolls in concurrent work: Android BLE permissions + launcher icons + ru/zh
resources, Chaquopy-safe value_stream psutil fallback, setup-required
modal, asset-store test coverage, and misc system/config touch-ups.
This commit is contained in:
2026-04-21 14:58:35 +03:00
parent d3a6416a1d
commit 2b5dac2c42
54 changed files with 3412 additions and 174 deletions
+24 -3
View File
@@ -1,5 +1,7 @@
"""Tests for configuration management."""
from pathlib import Path
import pytest
import yaml
@@ -18,10 +20,23 @@ class TestDefaultConfig:
assert config.server.port == 8080
assert config.server.log_level == "INFO"
def test_default_storage_paths(self):
def test_default_storage_paths(self, monkeypatch):
monkeypatch.delenv("LEDGRAB_DATA_DIR", raising=False)
config = Config()
assert config.storage.database_file == "data/ledgrab.db"
def test_data_dir_env_override(self, monkeypatch, tmp_path):
monkeypatch.setenv("LEDGRAB_DATA_DIR", str(tmp_path / "custom"))
# default_data_dir reads the env var, but the module-level default
# was evaluated at import time — so re-import paths() value via the
# helper to confirm the contract.
from importlib import reload
from ledgrab import paths as paths_mod
reload(paths_mod)
assert paths_mod.default_data_dir() == Path(str(tmp_path / "custom"))
def test_default_mqtt_disabled(self):
config = Config()
assert config.mqtt.enabled is False
@@ -71,9 +86,15 @@ class TestServerConfig:
class TestDemoMode:
def test_demo_rewrites_storage_paths(self):
config = Config(demo=True)
assert config.storage.database_file.startswith("data/demo/")
db_path = Path(config.storage.database_file)
assert db_path.parent.name == "demo"
assert db_path.name == "ledgrab.db"
assets_path = Path(config.assets.assets_dir)
assert assets_path.parent.name == "demo"
assert assets_path.name == "assets"
def test_non_demo_keeps_original_paths(self):
def test_non_demo_keeps_original_paths(self, monkeypatch):
monkeypatch.delenv("LEDGRAB_DATA_DIR", raising=False)
config = Config(demo=False)
assert config.storage.database_file == "data/ledgrab.db"