feat: Add 'doorbell' configuration profile (#2511)
This commit is contained in:
committed by
dermotduffy
parent
ef9c9c8d5c
commit
406176eebc
@@ -440,24 +440,27 @@ describe('CameraManager', () => {
|
||||
});
|
||||
|
||||
describe('should fetch entity list when required', () => {
|
||||
it('should fetch with entity based trigger', async () => {
|
||||
const api = createCardAPI();
|
||||
vi.mocked(api.getHASSManager().getHASS).mockReturnValue(createHASS());
|
||||
it.each([['occupancy' as const], ['motion' as const], ['doorbell' as const]])(
|
||||
'should fetch with %s trigger',
|
||||
async (triggerKey) => {
|
||||
const api = createCardAPI();
|
||||
vi.mocked(api.getHASSManager().getHASS).mockReturnValue(createHASS());
|
||||
|
||||
const manager = createCameraManager(api, mock<CameraManagerEngine>(), [
|
||||
{
|
||||
config: createCameraConfig({
|
||||
...baseCameraConfig,
|
||||
triggers: {
|
||||
occupancy: true,
|
||||
},
|
||||
}),
|
||||
},
|
||||
]);
|
||||
const manager = createCameraManager(api, mock<CameraManagerEngine>(), [
|
||||
{
|
||||
config: createCameraConfig({
|
||||
...baseCameraConfig,
|
||||
triggers: {
|
||||
[triggerKey]: true,
|
||||
},
|
||||
}),
|
||||
},
|
||||
]);
|
||||
|
||||
await manager.initializeCamerasFromConfig();
|
||||
expect(api.getEntityRegistryManager().fetchEntityList).toBeCalled();
|
||||
});
|
||||
await manager.initializeCamerasFromConfig();
|
||||
expect(api.getEntityRegistryManager().fetchEntityList).toBeCalled();
|
||||
},
|
||||
);
|
||||
|
||||
it('should skip without entity based trigger', async () => {
|
||||
const api = createCardAPI();
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import { expect, it } from 'vitest';
|
||||
import { DOORBELL_PROFILE } from '../../../src/config/profiles/doorbell';
|
||||
import { setProfiles } from '../../../src/config/profiles/set-profiles';
|
||||
import { advancedCameraCardConfigSchema } from '../../../src/config/schema/types';
|
||||
import { createRawConfig } from '../../test-utils';
|
||||
|
||||
it('should contain expected defaults', () => {
|
||||
expect(DOORBELL_PROFILE).toEqual({
|
||||
'cameras_global.triggers.doorbell': true,
|
||||
'view.triggers.actions.interaction_mode': 'all',
|
||||
'view.triggers.actions.trigger': 'call',
|
||||
'view.triggers.actions.untrigger': 'call',
|
||||
'view.triggers.show_trigger_status': true,
|
||||
});
|
||||
});
|
||||
|
||||
it('should be parseable after application', () => {
|
||||
const rawInputConfig = createRawConfig();
|
||||
const parsedConfig = advancedCameraCardConfigSchema.parse(rawInputConfig);
|
||||
|
||||
setProfiles(rawInputConfig, parsedConfig, ['doorbell']);
|
||||
|
||||
// Reparse the config to ensure the profile did not introduce errors.
|
||||
const parseResult = advancedCameraCardConfigSchema.safeParse(parsedConfig);
|
||||
expect(parseResult.success, parseResult.error?.toString()).toBeTruthy();
|
||||
});
|
||||
@@ -8,31 +8,24 @@ it('should contain expected defaults', () => {
|
||||
expect(LOW_PERFORMANCE_PROFILE).toEqual({
|
||||
'cameras_global.image.refresh_seconds': 10,
|
||||
'cameras_global.live_provider': 'image',
|
||||
'cameras_global.triggers.occupancy': false,
|
||||
'live.auto_mute': [],
|
||||
'live.controls.thumbnails.mode': 'none',
|
||||
'live.controls.thumbnails.show_details': false,
|
||||
'live.controls.thumbnails.show_download_control': false,
|
||||
'live.controls.thumbnails.show_favorite_control': false,
|
||||
'live.controls.thumbnails.show_timeline_control': false,
|
||||
'live.controls.timeline.show_recordings': false,
|
||||
'live.draggable': false,
|
||||
'live.lazy_unload': ['unselected', 'hidden'],
|
||||
'live.show_image_during_load': false,
|
||||
'live.transition_effect': 'none',
|
||||
'media_gallery.controls.thumbnails.show_details': false,
|
||||
'media_gallery.controls.thumbnails.show_download_control': false,
|
||||
'media_gallery.controls.thumbnails.show_favorite_control': false,
|
||||
'media_gallery.controls.thumbnails.show_timeline_control': false,
|
||||
'media_viewer.auto_mute': [],
|
||||
'media_viewer.auto_pause': [],
|
||||
'media_viewer.auto_play': [],
|
||||
'media_viewer.controls.next_previous.style': 'chevrons',
|
||||
'media_viewer.controls.thumbnails.mode': 'none',
|
||||
'media_viewer.controls.thumbnails.show_details': false,
|
||||
'media_viewer.controls.thumbnails.show_download_control': false,
|
||||
'media_viewer.controls.thumbnails.show_favorite_control': false,
|
||||
'media_viewer.controls.thumbnails.show_timeline_control': false,
|
||||
'media_viewer.controls.timeline.show_recordings': false,
|
||||
'media_viewer.draggable': false,
|
||||
'media_viewer.snapshot_click_plays_clip': false,
|
||||
@@ -51,9 +44,7 @@ it('should contain expected defaults', () => {
|
||||
'status_bar.style': 'none',
|
||||
'timeline.controls.thumbnails.mode': 'none',
|
||||
'timeline.controls.thumbnails.show_details': false,
|
||||
'timeline.controls.thumbnails.show_download_control': false,
|
||||
'timeline.controls.thumbnails.show_favorite_control': false,
|
||||
'timeline.controls.thumbnails.show_timeline_control': false,
|
||||
'timeline.show_recordings': false,
|
||||
'view.triggers.actions.trigger': 'none',
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user