Add profile conditions, scene presets, MQTT integration, and Scenes tab

Feature 1 — Profile Conditions: time-of-day, system idle (Win32
GetLastInputInfo), and display state (GUID_CONSOLE_DISPLAY_STATE)
condition types for automatic profile activation.

Feature 2 — Scene Presets: snapshot/restore system that captures target
running states, device brightness, and profile enables. Server-side
capture with 5-step activation order. Dedicated Scenes tab with
CardSection-based card grid, command palette integration, and dashboard
quick-activate section.

Feature 3 — MQTT Integration: MQTTService singleton with aiomqtt,
MQTTLEDClient device provider for pixel output, MQTT profile condition
type with topic/payload matching, and frontend support for MQTT device
type and condition editor.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-28 16:57:42 +03:00
parent bd8d7a019f
commit 2e747b5ece
38 changed files with 2269 additions and 32 deletions

View File

@@ -128,6 +128,9 @@
"device.led_type.hint": "RGB3通道或 RGBW4通道带独立白色",
"device.send_latency": "发送延迟(毫秒):",
"device.send_latency.hint": "每帧模拟网络/串口延迟(毫秒)",
"device.mqtt_topic": "MQTT 主题:",
"device.mqtt_topic.hint": "用于发布像素数据的 MQTT 主题路径(例如 mqtt://ledgrab/device/name",
"device.mqtt_topic.placeholder": "mqtt://ledgrab/device/客厅",
"device.url.hint": "设备的 IP 地址或主机名(例如 http://192.168.1.100",
"device.name": "设备名称:",
"device.name.placeholder": "客厅电视",
@@ -529,6 +532,7 @@
"dashboard.stop_all": "全部停止",
"dashboard.failed": "加载仪表盘失败",
"dashboard.section.profiles": "配置文件",
"dashboard.section.scenes": "场景预设",
"dashboard.targets": "目标",
"dashboard.section.performance": "系统性能",
"dashboard.perf.cpu": "CPU",
@@ -568,6 +572,27 @@
"profiles.condition.application.match_type.topmost": "最前(前台)",
"profiles.condition.application.match_type.topmost_fullscreen": "最前 + 全屏",
"profiles.condition.application.match_type.fullscreen": "全屏",
"profiles.condition.time_of_day": "时段",
"profiles.condition.time_of_day.start_time": "开始时间:",
"profiles.condition.time_of_day.end_time": "结束时间:",
"profiles.condition.time_of_day.overnight_hint": "跨夜时段(如 22:0006:00请将开始时间设为晚于结束时间。",
"profiles.condition.system_idle": "系统空闲",
"profiles.condition.system_idle.idle_minutes": "空闲超时(分钟):",
"profiles.condition.system_idle.mode": "触发模式:",
"profiles.condition.system_idle.when_idle": "空闲时",
"profiles.condition.system_idle.when_active": "活跃时",
"profiles.condition.display_state": "显示器状态",
"profiles.condition.display_state.state": "显示器状态:",
"profiles.condition.display_state.on": "开启",
"profiles.condition.display_state.off": "关闭(休眠)",
"profiles.condition.mqtt": "MQTT",
"profiles.condition.mqtt.topic": "主题:",
"profiles.condition.mqtt.payload": "消息内容:",
"profiles.condition.mqtt.match_mode": "匹配模式:",
"profiles.condition.mqtt.match_mode.exact": "精确匹配",
"profiles.condition.mqtt.match_mode.contains": "包含",
"profiles.condition.mqtt.match_mode.regex": "正则表达式",
"profiles.condition.mqtt.hint": "当 MQTT 主题收到匹配的消息时激活",
"profiles.targets": "目标:",
"profiles.targets.hint": "配置文件激活时要启动的目标",
"profiles.targets.empty": "没有可用的目标",
@@ -586,6 +611,36 @@
"profiles.error.name_required": "名称为必填项",
"profiles.toggle_all.start": "启动所有目标",
"profiles.toggle_all.stop": "停止所有目标",
"scenes.title": "场景",
"scenes.add": "捕获场景",
"scenes.edit": "编辑场景",
"scenes.name": "名称:",
"scenes.name.hint": "此场景预设的描述性名称",
"scenes.description": "描述:",
"scenes.description.hint": "此场景功能的可选描述",
"scenes.color": "卡片颜色:",
"scenes.color.hint": "仪表盘上场景卡片的强调色",
"scenes.capture": "捕获",
"scenes.activate": "激活场景",
"scenes.recapture": "重新捕获当前状态",
"scenes.delete": "删除场景",
"scenes.targets_count": "目标",
"scenes.devices_count": "设备",
"scenes.profiles_count": "配置",
"scenes.captured": "场景已捕获",
"scenes.updated": "场景已更新",
"scenes.activated": "场景已激活",
"scenes.activated_partial": "场景部分激活",
"scenes.errors": "错误",
"scenes.recaptured": "场景已重新捕获",
"scenes.deleted": "场景已删除",
"scenes.recapture_confirm": "将当前状态重新捕获到\"{name}\"中?",
"scenes.delete_confirm": "删除场景\"{name}\"",
"scenes.error.name_required": "名称为必填项",
"scenes.error.save_failed": "保存场景失败",
"scenes.error.activate_failed": "激活场景失败",
"scenes.error.recapture_failed": "重新捕获场景失败",
"scenes.error.delete_failed": "删除场景失败",
"autostart.title": "自动启动目标",
"autostart.toggle.enabled": "自动启动已启用",
"autostart.toggle.disabled": "自动启动已禁用",
@@ -961,6 +1016,7 @@
"search.group.pattern_templates": "图案模板",
"search.group.audio": "音频源",
"search.group.value": "值源",
"search.group.scenes": "场景预设",
"settings.backup.label": "备份配置",
"settings.backup.hint": "将所有配置(设备、目标、流、模板、配置文件)下载为单个 JSON 文件。",
"settings.backup.button": "下载备份",