fix: Improve state handling to avoid stuck triggered cameras (#2348)

- Related:
https://github.com/dermotduffy/advanced-camera-card/issues/2342
This commit is contained in:
Dermot Duffy
2026-02-15 19:26:56 -08:00
committed by GitHub
parent be61d7fa24
commit b1467dc4bd
11 changed files with 723 additions and 127 deletions
+1
View File
@@ -222,6 +222,7 @@ export class Camera {
protected _stateChangeHandler = (difference: HassStateDifference): void => {
this._eventCallback?.({
cameraID: this.getID(),
id: difference.entityID,
type: isTriggeredState(difference.newState.state) ? 'new' : 'end',
});
};
+1 -1
View File
@@ -471,7 +471,7 @@ export class FrigateCamera extends Camera {
this._eventCallback?.({
cameraID,
id: ev.after.id,
fidelity: 'high',
type: ev.type,
// In cases where there are both clip and snapshot media, ensure to only
+1
View File
@@ -85,6 +85,7 @@ export type PTZInfo = z.infer<typeof ptzInfoSchema>;
const frigateEventChangeBeforeAfterSchema = z.object({
camera: z.string(),
id: z.string(),
snapshot: z
.object({
frame_time: z.number(),
+4
View File
@@ -140,6 +140,10 @@ export interface EngineOptions {
export interface CameraEvent {
cameraID: string;
// Source ID (e.g. entity ID or Frigate event ID), used to determine what has
// triggered/untriggered.
id: string;
type: 'new' | 'update' | 'end';
// When fidelity is `high`, the engine is assumed to provide exact details of