chore: Enable noImplicitAny across the codebase (#2667)

This commit is contained in:
Dermot Duffy
2026-08-09 13:22:57 -07:00
committed by GitHub
parent 6807fd7690
commit a8ce6acb44
27 changed files with 311 additions and 180 deletions
+2 -6
View File
@@ -5,7 +5,6 @@ import type { PTZAction, PTZActionPhase } from '../../config/schema/actions/cust
import type { CameraConfig } from '../../config/schema/cameras';
import type { Entity, EntityRegistryManager } from '../../ha/registry/entity/types';
import type { HomeAssistant } from '../../ha/types';
import { SEVERITIES } from '../../severity';
import {
PTZMovementType,
type CapabilitiesRaw,
@@ -24,7 +23,7 @@ import {
import { getPTZCapabilitiesFromCameraConfig, mergePTZCapabilities } from '../utils/ptz';
import { getPTZInfo } from './requests';
import {
FRIGATE_SEVERITY_MAP,
CARD_SEVERITY_MAP,
type FrigateEventChange,
type FrigateReviewChange,
type PTZInfo,
@@ -610,10 +609,7 @@ export class FrigateCamera extends Camera<FrigateCameraInitializationOptions> {
const reviewConfig = config.triggers.reviews;
// Map Frigate severity to card severity.
const cardSeverity = SEVERITIES.find(
(key) => FRIGATE_SEVERITY_MAP[key] === review.after.severity,
);
const cardSeverity = CARD_SEVERITY_MAP[review.after.severity];
// Check if this is a description update (GenAI added/changed title or scene)
const isDescriptionUpdate =
+8
View File
@@ -1,5 +1,6 @@
import { z } from 'zod';
import type { Severity } from '../../severity';
import { dayToDate } from '../../utils/basic';
import type {
Engine,
@@ -153,6 +154,13 @@ export const FRIGATE_SEVERITY_MAP = {
export type FrigateReviewSeverity =
(typeof FRIGATE_SEVERITY_MAP)[keyof typeof FRIGATE_SEVERITY_MAP];
// Maps Frigate severity to card severity. Frigate has no equivalent of the
// card's `low` severity.
export const CARD_SEVERITY_MAP = {
alert: 'high',
detection: 'medium',
} as const satisfies Record<FrigateReviewSeverity, Severity>;
// Review data schema (only fields we need for display)
const frigateReviewDataSchema = z.object({
objects: z.string().array().optional(),
+22 -1
View File
@@ -7,6 +7,25 @@ import type { ActionConfig } from '../../config/schema/actions/types';
import type { CameraConfig } from '../../config/schema/cameras';
import { PTZMovementType, type PTZCapabilities } from '../../types';
/**
* Get the action configured for a named PTZ preset.
* @param ptzConfig The camera's PTZ config.
* @param preset The preset name.
* @returns The configured action, or `null` if the preset is not configured.
*/
export const getConfiguredPTZPresetAction = (
ptzConfig: CameraConfig['ptz'],
preset: string,
): ActionConfig | null => {
const presets = ptzConfig.presets;
if (!presets) {
return null;
}
const action = Object.entries(presets).find(([name]) => name === preset)?.[1];
return typeof action === 'object' ? action : null;
};
export const getConfiguredPTZAction = (
cameraConfig: CameraConfig,
action: PTZAction,
@@ -16,7 +35,9 @@ export const getConfiguredPTZAction = (
},
): ActionConfig | ActionConfig[] | null => {
if (action === 'preset') {
return (options?.preset ? cameraConfig.ptz.presets?.[options.preset] : null) ?? null;
return options?.preset
? getConfiguredPTZPresetAction(cameraConfig.ptz, options.preset)
: null;
}
if (options?.phase) {