fix: restore mode clicks and compose seat-aware assistant scenes

This commit is contained in:
vee
2026-09-12 13:33:38 +08:00
parent 76057be044
commit d09b5967f8
28 changed files with 1247 additions and 44 deletions
+53 -3
View File
@@ -647,11 +647,39 @@
"seat.set_cushion_tilt": "坐垫角度",
"seat.set_backrest_recline": "靠背角度",
"seat.set_legrest_height": "腿托高度",
"seat.set_ventilation": "座椅通风",
"seat.set_heating": "座椅加热",
"seat.set_driver_ventilation_native": "座椅通风",
"seat.set_driver_heating_native": "座椅加热",
"seat.set_driver_massage_native": "座椅按摩",
};
label = `${seatLabel}${seatCapabilityLabels[capability] || "座椅"}`;
value = params.position_pct != null
? `${params.position_pct}%${params.angle_deg != null ? `(${params.angle_deg}°)` : ""}`
: motionLabel(params.state || params.mode_id);
if (["seat.set_driver_ventilation_native", "seat.set_driver_heating_native"].includes(capability)) {
// CH1 driver controls encode high as 1 and low as 2; passenger
// comfort levels use a different scale and must not reuse this map.
const level = { 1: "高档", 2: "低档" }[params.level ?? 2] || "档位待确认";
value = params.state === "off" ? "关闭"
: params.state === "on" ? `开启 · ${level}` : "开关状态待确认";
} else if (["seat.set_ventilation", "seat.set_heating"].includes(capability)) {
value = params.state === "off" ? "关闭"
: params.state === "on"
? `开启${params.level != null ? ` · ${params.level}档` : ""}`
: "开关状态待确认";
} else if (capability === "seat.set_driver_massage_native") {
const massageModes = {
wave: "波浪", pulse: "脉冲", stretch: "舒展", slack: "舒缓", relax: "放松",
};
const massageStrengths = { 1: "轻柔", 2: "中等", 3: "较强" };
value = params.action === "off" ? "关闭"
: params.action === "mode"
? (massageModes[params.mode] ? `${massageModes[params.mode]}模式` : "按摩模式待确认")
: params.action === "strength"
? (massageStrengths[params.strength] ? `${massageStrengths[params.strength]}力度` : "按摩力度待确认")
: "按摩动作待确认";
}
icon = "armchair";
order = instructionOrder("座椅", "副驾", "主驾");
} else if (capability === "climate.set_temperature") {
@@ -660,11 +688,21 @@
icon = "thermometer";
order = instructionOrder("空调", "温度");
} else if (domain === "climate") {
const cycleLabels = { internal: "内循环", external: "外循环", auto: "自动循环" };
const climateModeLabels = {
"climate.set_cycle_mode": { internal: "内循环", external: "外循环" },
"climate.set_control_mode": { manual: "手动控制", auto: "自动控制" },
"climate.set_outlet_mode": {
face: "吹面", face_feet: "吹面 / 吹脚", feet: "吹脚",
feet_defrost: "吹脚 / 除霜", defrost: "除霜",
face_feet_defrost: "吹面 / 吹脚 / 除霜", face_defrost: "吹面 / 除霜",
},
};
label = capability === "climate.set_fan_level" ? "空调风量"
: capability === "climate.set_cycle_mode" ? "空调循环" : "空调";
: capability === "climate.set_cycle_mode" ? "空调循环"
: capability === "climate.set_control_mode" ? "空调控制模式"
: capability === "climate.set_outlet_mode" ? "空调出风模式" : "空调";
value = params.level != null ? `${params.level}档`
: params.mode != null ? (cycleLabels[String(params.mode)] || String(params.mode))
: params.mode != null ? (climateModeLabels[capability]?.[String(params.mode)] || String(params.mode))
: motionLabel(params.state);
icon = "fan";
order = instructionOrder("空调", "风量");
@@ -676,6 +714,18 @@
} else if (["interior_light", "ambient_light"].includes(domain)) {
label = domain === "ambient_light" ? "氛围灯" : "室内灯";
value = motionLabel(params.state);
if (capability === "ambient_light.set_brightness_level") {
label = "氛围灯亮度";
value = params.brightness_level != null ? `${params.brightness_level}档` : "亮度档位待确认";
} else if (capability === "ambient_light.set_color_index") {
label = "氛围灯颜色";
value = params.color_index != null ? `色号 ${params.color_index}` : "颜色待确认";
} else if (capability === "ambient_light.set_illumination") {
value = [
params.color_hex != null ? `颜色 ${params.color_hex}` : "颜色待确认",
params.brightness_pct != null ? `亮度 ${params.brightness_pct}%` : "亮度待确认",
].join(" · ");
}
icon = "lightbulb";
order = instructionOrder(label, "灯光");
}