feat: Rename the card to advanced-camera-card (#1873)
Whilst the Frigate support in this card is the best among camera engines, the name incorrectly suggests that Frigate is a requirement. Instead, to broaden the appeal, change to more camera agnostic name. This does not suggest any change in priority, role or support for Frigate. This change is likely to be bug prone, due to the size of the rename -- the code contains 1500+ references to "Frigate" most of which make sense to rename, some which do not, all of which needed human assessment. - Closes #1298 BREAKING CHANGE: References to `frigate-card` in all kinds of configuration need to be updated to `advanced-camera-card`. An automated config upgrade should take care of the majority of usecases (click `Edit -> Upgrade -> Save`), though may not be perfect.
This commit is contained in:
@@ -6,17 +6,24 @@ import {
|
||||
FrigateRecordingViewMedia,
|
||||
} from '../../../src/camera-manager/frigate/media';
|
||||
import { FrigateEvent, eventSchema } from '../../../src/camera-manager/frigate/types.js';
|
||||
import { StateWatcher } from '../../../src/card-controller/hass/state-watcher';
|
||||
import { PTZAction } from '../../../src/config/ptz';
|
||||
import {
|
||||
AdvancedCameraCardView,
|
||||
CameraConfig,
|
||||
FrigateCardView,
|
||||
RawFrigateCardConfig,
|
||||
RawAdvancedCameraCardConfig,
|
||||
} from '../../../src/config/types';
|
||||
import {
|
||||
EntityRegistryManager,
|
||||
createEntityRegistryCache,
|
||||
} from '../../../src/utils/ha/registry/entity';
|
||||
import { ViewMedia } from '../../../src/view/media';
|
||||
import { TestViewMedia, createCameraConfig, createHASS } from '../../test-utils';
|
||||
|
||||
const createEngine = (): FrigateCameraManagerEngine => {
|
||||
return new FrigateCameraManagerEngine(
|
||||
new EntityRegistryManager(createEntityRegistryCache()),
|
||||
new StateWatcher(),
|
||||
new RecordingSegmentsCache(),
|
||||
new RequestCache(),
|
||||
);
|
||||
@@ -75,7 +82,9 @@ const createSnapshotMedia = (): FrigateEventViewMedia => {
|
||||
);
|
||||
};
|
||||
|
||||
const createFrigateCameraConfig = (config?: RawFrigateCardConfig): CameraConfig => {
|
||||
const createFrigateCameraConfig = (
|
||||
config?: RawAdvancedCameraCardConfig,
|
||||
): CameraConfig => {
|
||||
return createCameraConfig({
|
||||
frigate: {
|
||||
camera_name: 'camera-1',
|
||||
@@ -345,7 +354,7 @@ describe('getCameraEndpoints', () => {
|
||||
['clips' as const],
|
||||
['snapshot' as const],
|
||||
['snapshots' as const],
|
||||
])('%s', (viewName: FrigateCardView) => {
|
||||
])('%s', (viewName: AdvancedCameraCardView) => {
|
||||
const endpoints = createEngine().getCameraEndpoints(
|
||||
createCameraConfig({
|
||||
frigate: {
|
||||
@@ -369,7 +378,7 @@ describe('getCameraEndpoints', () => {
|
||||
|
||||
it.each([['recording' as const], ['recordings' as const]])(
|
||||
'%s',
|
||||
(viewName: FrigateCardView) => {
|
||||
(viewName: AdvancedCameraCardView) => {
|
||||
const endpoints = createEngine().getCameraEndpoints(
|
||||
createCameraConfig({
|
||||
frigate: {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { mock } from 'vitest-mock-extended';
|
||||
import { GenericCameraManagerEngine } from '../../../src/camera-manager/generic/engine-generic';
|
||||
import { Engine, QueryResultsType, QueryType } from '../../../src/camera-manager/types';
|
||||
import { StateWatcherSubscriptionInterface } from '../../../src/card-controller/hass/state-watcher';
|
||||
import { CameraConfig, RawFrigateCardConfig } from '../../../src/config/types';
|
||||
import { CameraConfig, RawAdvancedCameraCardConfig } from '../../../src/config/types';
|
||||
import {
|
||||
TestViewMedia,
|
||||
createCameraConfig,
|
||||
@@ -16,7 +16,9 @@ const createEngine = (): GenericCameraManagerEngine => {
|
||||
return new GenericCameraManagerEngine(mock<StateWatcherSubscriptionInterface>());
|
||||
};
|
||||
|
||||
const createGenericCameraConfig = (config?: RawFrigateCardConfig): CameraConfig => {
|
||||
const createGenericCameraConfig = (
|
||||
config?: RawAdvancedCameraCardConfig,
|
||||
): CameraConfig => {
|
||||
return createCameraConfig(config);
|
||||
};
|
||||
|
||||
|
||||
@@ -331,7 +331,7 @@ describe('CameraManager', async () => {
|
||||
expect(await manager.initializeCamerasFromConfig()).toBeFalsy();
|
||||
expect(api.getMessageManager().setErrorIfHigherPriority).toBeCalledWith(
|
||||
new Error(
|
||||
'Duplicate Frigate camera id for the following camera, ' +
|
||||
'Duplicate camera id for the following camera, ' +
|
||||
"use the 'id' parameter to uniquely identify cameras",
|
||||
),
|
||||
'Camera initialization failed',
|
||||
@@ -997,7 +997,9 @@ describe('CameraManager', async () => {
|
||||
|
||||
const result: CameraManagerCameraMetadata = {
|
||||
title: 'My Camera',
|
||||
icon: 'mdi:camera',
|
||||
icon: {
|
||||
icon: 'mdi:camera',
|
||||
},
|
||||
};
|
||||
vi.mocked(engine.getCameraMetadata).mockReturnValue(result);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user