feat(web): add peripheral card quick controls

This commit is contained in:
Miayui
2026-09-21 16:01:42 +08:00
parent ad0c1f4ed1
commit ba5dfcd6da
14 changed files with 530 additions and 19 deletions
+34
View File
@@ -1403,6 +1403,40 @@ class SelfExtensionTests(unittest.TestCase):
self.assertEqual(operation["domain"], "self_extension")
self.assertTrue(operation["telemetry"]["gateway_acknowledged"])
def test_quick_peripheral_control_reauthorizes_durable_capability(self) -> None:
with TemporaryDirectory() as directory:
service = SelfExtensionService(
SimulationGateway(),
catalog_db_path=Path(directory, "infrared.sqlite3"),
)
service.sync_peripheral_catalog(
[
{
"id": "quick-light-on",
"status": "learned",
"enabled": True,
"device_id": "quick-light",
"device_name": "快捷灯",
"object_names": ["快捷灯"],
"card_uid": "2CC8B103",
"action": "打开",
"action_names": ["打开", "开启"],
"slot": 8,
}
]
)
result = service.execute_quick_peripheral_capability(
"quick-light-on",
conversation_id="conv-quick-light",
)
self.assertTrue(result["success"])
self.assertEqual(result["execution_mode"], "hardware")
self.assertEqual(result["provider_requested"], "web_console_quick_control")
self.assertEqual(result["peripheral"]["slot"], 8)
service.close()
def test_main_peripheral_sequence_executes_validated_actions_and_delays(self) -> None:
service = SelfExtensionService(SimulationGateway())
catalog = [