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:
@@ -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',
|
||||
});
|
||||
};
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user