Rename profiles to automations across backend and frontend
Rename the "profiles" entity to "automations" throughout the entire codebase for clarity. Updates Python models, storage, API routes/schemas, engine, frontend JS modules, HTML templates, CSS classes, i18n keys (en/ru/zh), dashboard, tutorials, and command palette. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,11 +7,11 @@ from fastapi import APIRouter, Depends, HTTPException
|
||||
|
||||
from wled_controller.api.auth import AuthRequired
|
||||
from wled_controller.api.dependencies import (
|
||||
get_automation_engine,
|
||||
get_automation_store,
|
||||
get_device_store,
|
||||
get_picture_target_store,
|
||||
get_processor_manager,
|
||||
get_profile_engine,
|
||||
get_profile_store,
|
||||
get_scene_preset_store,
|
||||
)
|
||||
from wled_controller.api.schemas.scene_presets import (
|
||||
@@ -28,10 +28,10 @@ from wled_controller.core.scenes.scene_activator import (
|
||||
)
|
||||
from wled_controller.storage import DeviceStore
|
||||
from wled_controller.storage.picture_target_store import PictureTargetStore
|
||||
from wled_controller.storage.profile_store import ProfileStore
|
||||
from wled_controller.storage.automation_store import AutomationStore
|
||||
from wled_controller.storage.scene_preset import ScenePreset
|
||||
from wled_controller.storage.scene_preset_store import ScenePresetStore
|
||||
from wled_controller.core.profiles.profile_engine import ProfileEngine
|
||||
from wled_controller.core.automations.automation_engine import AutomationEngine
|
||||
from wled_controller.utils import get_logger
|
||||
|
||||
logger = get_logger(__name__)
|
||||
@@ -56,10 +56,10 @@ def _preset_to_response(preset: ScenePreset) -> ScenePresetResponse:
|
||||
"device_id": d.device_id,
|
||||
"software_brightness": d.software_brightness,
|
||||
} for d in preset.devices],
|
||||
profiles=[{
|
||||
"profile_id": p.profile_id,
|
||||
"enabled": p.enabled,
|
||||
} for p in preset.profiles],
|
||||
automations=[{
|
||||
"automation_id": a.automation_id,
|
||||
"enabled": a.enabled,
|
||||
} for a in preset.automations],
|
||||
order=preset.order,
|
||||
created_at=preset.created_at,
|
||||
updated_at=preset.updated_at,
|
||||
@@ -80,12 +80,12 @@ async def create_scene_preset(
|
||||
store: ScenePresetStore = Depends(get_scene_preset_store),
|
||||
target_store: PictureTargetStore = Depends(get_picture_target_store),
|
||||
device_store: DeviceStore = Depends(get_device_store),
|
||||
profile_store: ProfileStore = Depends(get_profile_store),
|
||||
automation_store: AutomationStore = Depends(get_automation_store),
|
||||
manager: ProcessorManager = Depends(get_processor_manager),
|
||||
):
|
||||
"""Capture current state as a new scene preset."""
|
||||
targets, devices, profiles = capture_current_snapshot(
|
||||
target_store, device_store, profile_store, manager,
|
||||
targets, devices, automations = capture_current_snapshot(
|
||||
target_store, device_store, automation_store, manager,
|
||||
)
|
||||
|
||||
now = datetime.utcnow()
|
||||
@@ -96,7 +96,7 @@ async def create_scene_preset(
|
||||
color=data.color,
|
||||
targets=targets,
|
||||
devices=devices,
|
||||
profiles=profiles,
|
||||
automations=automations,
|
||||
order=store.count(),
|
||||
created_at=now,
|
||||
updated_at=now,
|
||||
@@ -200,12 +200,12 @@ async def recapture_scene_preset(
|
||||
store: ScenePresetStore = Depends(get_scene_preset_store),
|
||||
target_store: PictureTargetStore = Depends(get_picture_target_store),
|
||||
device_store: DeviceStore = Depends(get_device_store),
|
||||
profile_store: ProfileStore = Depends(get_profile_store),
|
||||
automation_store: AutomationStore = Depends(get_automation_store),
|
||||
manager: ProcessorManager = Depends(get_processor_manager),
|
||||
):
|
||||
"""Re-capture current state into an existing preset (updates snapshot)."""
|
||||
targets, devices, profiles = capture_current_snapshot(
|
||||
target_store, device_store, profile_store, manager,
|
||||
targets, devices, automations = capture_current_snapshot(
|
||||
target_store, device_store, automation_store, manager,
|
||||
)
|
||||
|
||||
new_snapshot = ScenePreset(
|
||||
@@ -213,7 +213,7 @@ async def recapture_scene_preset(
|
||||
name="",
|
||||
targets=targets,
|
||||
devices=devices,
|
||||
profiles=profiles,
|
||||
automations=automations,
|
||||
)
|
||||
|
||||
try:
|
||||
@@ -237,8 +237,8 @@ async def activate_scene_preset(
|
||||
store: ScenePresetStore = Depends(get_scene_preset_store),
|
||||
target_store: PictureTargetStore = Depends(get_picture_target_store),
|
||||
device_store: DeviceStore = Depends(get_device_store),
|
||||
profile_store: ProfileStore = Depends(get_profile_store),
|
||||
engine: ProfileEngine = Depends(get_profile_engine),
|
||||
automation_store: AutomationStore = Depends(get_automation_store),
|
||||
engine: AutomationEngine = Depends(get_automation_engine),
|
||||
manager: ProcessorManager = Depends(get_processor_manager),
|
||||
):
|
||||
"""Activate a scene preset — restore the captured state."""
|
||||
@@ -248,7 +248,7 @@ async def activate_scene_preset(
|
||||
raise HTTPException(status_code=404, detail=str(e))
|
||||
|
||||
status, errors = await apply_scene_state(
|
||||
preset, target_store, device_store, profile_store, engine, manager,
|
||||
preset, target_store, device_store, automation_store, engine, manager,
|
||||
)
|
||||
|
||||
if not errors:
|
||||
|
||||
Reference in New Issue
Block a user