Add update trigger action.
This commit is contained in:
@@ -82,7 +82,8 @@ export class TriggersManager {
|
||||
|
||||
// If this is a high-fidelity event where we are certain about new media,
|
||||
// don't take action unless it's to change to live (Frigate engine may pump
|
||||
// out events where there's no new media to show).
|
||||
// out events where there's no new media to show). Other trigger actions
|
||||
// (e.g. media, update) do not make sense without having some new media.
|
||||
if (
|
||||
ev.fidelity === 'high' &&
|
||||
!ev.snapshot &&
|
||||
@@ -96,7 +97,19 @@ export class TriggersManager {
|
||||
}
|
||||
|
||||
if (this._hasAllowableInteractionStateForAction()) {
|
||||
if (triggerAction === 'live') {
|
||||
if (triggerAction === 'update') {
|
||||
const view = this._api.getViewManager().getView()?.evolve({
|
||||
// Reset the media queries to catch media to be refetched in the
|
||||
// current view.
|
||||
query: null,
|
||||
queryResults: null,
|
||||
});
|
||||
/* istanbul ignore else: the else path cannot be reached, as the camera
|
||||
cannot be triggered without a view -- @preserve */
|
||||
if (view) {
|
||||
this._api.getViewManager().setView(view.clone());
|
||||
}
|
||||
} else if (triggerAction === 'live') {
|
||||
this._api.getViewManager().setViewByParameters({
|
||||
viewName: 'live',
|
||||
cameraID: ev.cameraID,
|
||||
|
||||
@@ -46,6 +46,7 @@ import {
|
||||
CONF_TIMELINE_CONTROLS_THUMBNAILS_SHOW_FAVORITE_CONTROL,
|
||||
CONF_TIMELINE_CONTROLS_THUMBNAILS_SHOW_TIMELINE_CONTROL,
|
||||
CONF_TIMELINE_SHOW_RECORDINGS,
|
||||
CONF_VIEW_TRIGGERS_ACTIONS_TRIGGER,
|
||||
} from '../../const.js';
|
||||
|
||||
export const LOW_PERFORMANCE_PROFILE = {
|
||||
@@ -134,4 +135,7 @@ export const LOW_PERFORMANCE_PROFILE = {
|
||||
// Refresh the live camera image every 10 seconds (same as stock Home
|
||||
// Assistant Picture Glance).
|
||||
[CONF_CAMERAS_GLOBAL_IMAGE_REFRESH_SECONDS]: 10,
|
||||
|
||||
// No trigger actions.
|
||||
[CONF_VIEW_TRIGGERS_ACTIONS_TRIGGER]: 'none'
|
||||
};
|
||||
|
||||
+8
-9
@@ -1406,7 +1406,7 @@ const viewConfigDefault = {
|
||||
filter_selected_camera: true,
|
||||
actions: {
|
||||
interaction_mode: 'inactive' as const,
|
||||
trigger: 'default' as const,
|
||||
trigger: 'update' as const,
|
||||
untrigger: 'none' as const,
|
||||
},
|
||||
untrigger_seconds: 0,
|
||||
@@ -1415,26 +1415,25 @@ const viewConfigDefault = {
|
||||
};
|
||||
|
||||
export const triggersSchema = z.object({
|
||||
filter_selected_camera: z
|
||||
.boolean()
|
||||
.default(viewConfigDefault.triggers.filter_selected_camera),
|
||||
show_trigger_status: z
|
||||
.boolean()
|
||||
.default(viewConfigDefault.triggers.show_trigger_status),
|
||||
|
||||
actions: z
|
||||
.object({
|
||||
interaction_mode: z
|
||||
.enum(['all', 'inactive', 'active'])
|
||||
.default(viewConfigDefault.triggers.actions.interaction_mode),
|
||||
trigger: z
|
||||
.enum(['live', 'default', 'media', 'none'])
|
||||
.enum(['default', 'live', 'media', 'none', 'update'])
|
||||
.default(viewConfigDefault.triggers.actions.trigger),
|
||||
untrigger: z
|
||||
.enum(['default', 'none'])
|
||||
.default(viewConfigDefault.triggers.actions.untrigger),
|
||||
})
|
||||
.default(viewConfigDefault.triggers.actions),
|
||||
filter_selected_camera: z
|
||||
.boolean()
|
||||
.default(viewConfigDefault.triggers.filter_selected_camera),
|
||||
show_trigger_status: z
|
||||
.boolean()
|
||||
.default(viewConfigDefault.triggers.show_trigger_status),
|
||||
untrigger_seconds: z.number().default(viewConfigDefault.triggers.untrigger_seconds),
|
||||
});
|
||||
export type TriggersOptions = z.infer<typeof triggersSchema>;
|
||||
|
||||
Reference in New Issue
Block a user