fix: Confirmations should apply to all actions (#1959)
This also refactors how generic HA actions are handled, and improves typing of actions. [skip ci]
This commit is contained in:
@@ -43,12 +43,10 @@ import { ConditionStateManager } from '../src/conditions/state-manager';
|
||||
import {
|
||||
AdvancedCameraCardConfig,
|
||||
CameraConfig,
|
||||
InternalAdvancedCameraCardCustomAction,
|
||||
PerformanceConfig,
|
||||
RawAdvancedCameraCardConfig,
|
||||
advancedCameraCardConfigSchema,
|
||||
cameraConfigSchema,
|
||||
internalAdvancedCameraCardCustomActionSchema,
|
||||
performanceConfigSchema,
|
||||
} from '../src/config/types';
|
||||
import { CurrentUser, HomeAssistant } from '../src/ha/types';
|
||||
@@ -61,16 +59,6 @@ import { ViewMedia, ViewMediaType } from '../src/view/media';
|
||||
import { MediaQueriesResults } from '../src/view/media-queries-results';
|
||||
import { View, ViewParameters } from '../src/view/view';
|
||||
|
||||
export const createAction = (
|
||||
action: Record<string, unknown>,
|
||||
): InternalAdvancedCameraCardCustomAction | null => {
|
||||
const result = internalAdvancedCameraCardCustomActionSchema.safeParse({
|
||||
action: 'custom:advanced-camera-card-action',
|
||||
...action,
|
||||
});
|
||||
return result.success ? result.data : null;
|
||||
};
|
||||
|
||||
export const createCameraConfig = (config?: unknown): CameraConfig => {
|
||||
return cameraConfigSchema.parse(config ?? {});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user