Add profile system for automatic target activation

Profiles monitor running processes and foreground windows to
automatically start/stop targets when conditions are met.
Includes profile engine, platform detector (WMI), REST API,
process browser endpoint, and calibration persistence fix.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-18 15:12:34 +03:00
parent d6cf45c873
commit 29d9b95885
15 changed files with 933 additions and 10 deletions

View File

@@ -691,22 +691,16 @@ class ProcessorManager:
state.device_type, state.device_url, client, state.health,
)
# Auto-sync LED count
# Auto-sync LED count (preserve existing calibration)
reported = state.health.device_led_count
if reported and reported != state.led_count and self._device_store:
old_count = state.led_count
logger.info(
f"Device {device_id} LED count changed: {old_count}{reported}, "
f"updating calibration"
f"Device {device_id} LED count changed: {old_count}{reported}"
)
try:
device = self._device_store.update_device(device_id, led_count=reported)
self._device_store.update_device(device_id, led_count=reported)
state.led_count = reported
state.calibration = device.calibration
# Propagate to WLED processors using this device
for proc in self._processors.values():
if isinstance(proc, WledTargetProcessor) and proc.device_id == device_id:
proc.update_calibration(device.calibration)
except Exception as e:
logger.error(f"Failed to sync LED count for {device_id}: {e}")