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:
Dermot Duffy
2025-02-06 19:32:32 -08:00
committed by GitHub
parent 43947b49dc
commit cc376a8be1
305 changed files with 4270 additions and 3686 deletions
+21 -21
View File
@@ -4,9 +4,9 @@ import {
conditionalSchema,
customSchema,
dimensionsConfigSchema,
frigateCardConditionSchema,
frigateCardCustomActionsBaseSchema,
frigateCardCustomActionSchema,
advancedCameraCardConditionSchema,
advancedCameraCardCustomActionsBaseSchema,
advancedCameraCardCustomActionSchema,
} from '../../src/config/types';
import { createConfig } from '../test-utils';
@@ -217,10 +217,6 @@ describe('config defaults', () => {
enabled: false,
priority: 50,
},
frigate: {
enabled: true,
priority: 50,
},
fullscreen: {
enabled: true,
priority: 50,
@@ -229,6 +225,10 @@ describe('config defaults', () => {
enabled: false,
priority: 50,
},
iris: {
enabled: true,
priority: 50,
},
live: {
enabled: true,
priority: 50,
@@ -338,7 +338,7 @@ describe('config defaults', () => {
style: 'stack',
window_seconds: 3600,
},
type: 'frigate-hass-card',
type: 'advanced-camera-card',
view: {
camera_select: 'current',
default: 'live',
@@ -416,7 +416,7 @@ it('should transform dimensions.aspect_ratio', () => {
describe('should refine user_agent_re conditions', () => {
it('should successfully parse valid user_agent_re condition', () => {
expect(
frigateCardConditionSchema.parse({
advancedCameraCardConditionSchema.parse({
condition: 'user_agent',
user_agent_re: 'Chrome/',
}),
@@ -428,7 +428,7 @@ describe('should refine user_agent_re conditions', () => {
it('should reject invalid user_agent_re conditions', () => {
expect(() =>
frigateCardConditionSchema.parse({
advancedCameraCardConditionSchema.parse({
condition: 'user_agent',
user_agent_re: '[',
}),
@@ -438,15 +438,15 @@ describe('should refine user_agent_re conditions', () => {
it('should transform action', () => {
expect(
frigateCardCustomActionsBaseSchema.parse({
action: 'custom:frigate-card-action',
advancedCameraCardCustomActionsBaseSchema.parse({
action: 'custom:advanced-camera-card-action',
}),
).toEqual({
action: 'fire-dom-event',
});
});
describe('should convert webrtc card PTZ to Frigate card PTZ', () => {
describe('should convert webrtc card PTZ to Advanced Camera Card PTZ', () => {
describe('relative actions', () => {
it.each([
['left' as const],
@@ -632,29 +632,29 @@ describe('should lazy evaluate schemas', () => {
it('status bar actions', () => {
const input = {
action: 'fire-dom-event',
frigate_card_action: 'status_bar',
advanced_camera_card_action: 'status_bar',
status_bar_action: 'reset',
items: [
{
type: 'custom:frigate-card-status-bar-string',
type: 'custom:advanced-camera-card-status-bar-string',
string: 'Item',
},
],
};
expect(frigateCardCustomActionSchema.parse(input)).toEqual(input);
expect(advancedCameraCardCustomActionSchema.parse(input)).toEqual(input);
});
});
describe('should handle custom frigate elements', () => {
it('should add custom error on frigate entry', () => {
describe('should handle custom advanced camera card elements', () => {
it('should add custom error on advanced camera card element', () => {
const result = customSchema.safeParse({
type: 'custom:frigate-card-foo',
type: 'custom:advanced-camera-card-foo',
});
expect(result.success).toBeFalsy();
if (!result.success) {
expect(result.error.errors[0]).toEqual({
code: 'custom',
message: 'Frigate-card custom elements must match specific schemas',
message: 'advanced-camera-card custom elements must match specific schemas',
fatal: true,
path: ['type'],
});
@@ -669,7 +669,7 @@ describe('should handle custom frigate elements', () => {
});
});
// https://github.com/dermotduffy/frigate-hass-card/issues/1280
// https://github.com/dermotduffy/advanced-camera-card/issues/1280
it('should not require title controls to specify all options', () => {
expect(
createConfig({