Fix LPR vehicle message for multiple models (#24119)

* use the camera's model for the lpr vehicle check

`FrigateConfig.model` became `models[]` in the detector refactor, so this didn't compile on 0.19. Each camera has its own detector/model pair now, so the check resolves the camera's scene with `getModelForCamera` instead of looking at every model.

* use camera config model

* fix export test
This commit is contained in:
Josh Hawkins
2026-09-12 07:30:04 -06:00
committed by Nicolas Mowen
parent 98706482f5
commit aaf18b81b2
3 changed files with 7 additions and 8 deletions
@@ -1,3 +1,4 @@
import { getModelForCamera } from "@/utils/modelUtil";
import type { SectionConfigOverrides } from "./types";
const lpr: SectionConfigOverrides = {
@@ -21,12 +22,10 @@ const lpr: SectionConfigOverrides = {
if (ctx.level !== "camera" || !ctx.fullCameraConfig) return false;
if (ctx.fullCameraConfig.type === "lpr") return false;
const tracked = ctx.fullCameraConfig.objects?.track ?? [];
const vehicles = Object.entries(
ctx.fullConfig.model?.attributes_map ?? {},
)
.filter(([, attributes]) => attributes.includes("license_plate"))
.map(([label]) => label);
return !tracked.some((o) => vehicles.includes(o));
const model = getModelForCamera(ctx.fullConfig, ctx.cameraName);
return !tracked.some((o) =>
model?.attributes_map?.[o]?.includes("license_plate"),
);
},
},
],