feat: Add out of the box support for Reolink PTZ (#1982)
- Closes: #1964
This commit is contained in:
@@ -258,7 +258,7 @@ describe('ActionsManager', () => {
|
||||
const consoleSpy = vi.spyOn(global.console, 'info').mockReturnValue(undefined);
|
||||
await manager.handleActionExecutionRequestEvent(
|
||||
new CustomEvent('advanced-camera-card:action:execution-request', {
|
||||
detail: { action: createLogAction('Hello, world!') },
|
||||
detail: { actions: createLogAction('Hello, world!') },
|
||||
}),
|
||||
);
|
||||
expect(consoleSpy).toBeCalled();
|
||||
@@ -271,7 +271,7 @@ describe('ActionsManager', () => {
|
||||
const manager = new ActionsManager(api);
|
||||
|
||||
const consoleSpy = vi.spyOn(global.console, 'info').mockReturnValue(undefined);
|
||||
await manager.executeActions(createLogAction('Hello, world!'));
|
||||
await manager.executeActions({ actions: createLogAction('Hello, world!') });
|
||||
expect(consoleSpy).toBeCalled();
|
||||
});
|
||||
|
||||
@@ -280,7 +280,7 @@ describe('ActionsManager', () => {
|
||||
const manager = new ActionsManager(api);
|
||||
|
||||
const consoleSpy = vi.spyOn(global.console, 'info').mockReturnValue(undefined);
|
||||
await manager.executeActions(createLogAction('Hello, world!'));
|
||||
await manager.executeActions({ actions: createLogAction('Hello, world!') });
|
||||
expect(consoleSpy).toBeCalled();
|
||||
});
|
||||
|
||||
@@ -303,10 +303,7 @@ describe('ActionsManager', () => {
|
||||
const config = { entity: 'light.office' };
|
||||
const triggerData = { view: { from: 'previous-view', to: 'view' } };
|
||||
|
||||
await manager.executeActions(action, {
|
||||
config,
|
||||
triggerData,
|
||||
});
|
||||
await manager.executeActions({ actions: action, config, triggerData });
|
||||
|
||||
expect(templateRenderer.renderRecursively).toBeCalledWith(hass, action, {
|
||||
conditionState,
|
||||
@@ -326,7 +323,7 @@ describe('ActionsManager', () => {
|
||||
const api = createCardAPI();
|
||||
const manager = new ActionsManager(api);
|
||||
|
||||
await manager.executeActions({ action: 'none' });
|
||||
await manager.executeActions({ actions: { action: 'none' } });
|
||||
|
||||
expect(handler).toBeCalledWith(expect.objectContaining({ detail: 'success' }));
|
||||
});
|
||||
@@ -340,7 +337,9 @@ describe('ActionsManager', () => {
|
||||
|
||||
vi.stubGlobal('confirm', vi.fn().mockReturnValue(false));
|
||||
|
||||
await manager.executeActions({ action: 'none', confirmation: true });
|
||||
await manager.executeActions({
|
||||
actions: { action: 'none', confirmation: true },
|
||||
});
|
||||
|
||||
expect(handler).toBeCalledWith(expect.objectContaining({ detail: 'warning' }));
|
||||
});
|
||||
@@ -360,16 +359,18 @@ describe('ActionsManager', () => {
|
||||
const manager = new ActionsManager(api);
|
||||
|
||||
const consoleSpy = vi.spyOn(global.console, 'info').mockReturnValue(undefined);
|
||||
const promise = manager.executeActions([
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
advanced_camera_card_action: 'sleep',
|
||||
duration: {
|
||||
m: 1,
|
||||
const promise = manager.executeActions({
|
||||
actions: [
|
||||
{
|
||||
action: 'fire-dom-event',
|
||||
advanced_camera_card_action: 'sleep',
|
||||
duration: {
|
||||
m: 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
createLogAction('Hello, world!'),
|
||||
]);
|
||||
createLogAction('Hello, world!'),
|
||||
],
|
||||
});
|
||||
|
||||
// Stop inflight actions.
|
||||
await manager.uninitialize();
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest';
|
||||
import { Capabilities } from '../../../../src/camera-manager/capabilities';
|
||||
import { PTZAction } from '../../../../src/card-controller/actions/actions/ptz';
|
||||
import { PTZMovementType } from '../../../../src/types';
|
||||
import {
|
||||
createCameraConfig,
|
||||
createCameraManager,
|
||||
@@ -7,7 +9,6 @@ import {
|
||||
createStore,
|
||||
createView,
|
||||
} from '../../../test-utils';
|
||||
import { Capabilities } from '../../../../src/camera-manager/capabilities';
|
||||
|
||||
describe('should handle ptz action', () => {
|
||||
it('should execute simple action', async () => {
|
||||
@@ -20,7 +21,7 @@ describe('should handle ptz action', () => {
|
||||
const store = createStore([
|
||||
{
|
||||
cameraID: 'camera.office',
|
||||
capabilities: new Capabilities({ ptz: { left: ['relative'] } }),
|
||||
capabilities: new Capabilities({ ptz: { left: [PTZMovementType.Relative] } }),
|
||||
},
|
||||
]);
|
||||
vi.mocked(api.getCameraManager).mockReturnValue(createCameraManager(store));
|
||||
@@ -53,7 +54,7 @@ describe('should handle ptz action', () => {
|
||||
const store = createStore([
|
||||
{
|
||||
cameraID: 'camera.office',
|
||||
capabilities: new Capabilities({ ptz: { left: ['relative'] } }),
|
||||
capabilities: new Capabilities({ ptz: { left: [PTZMovementType.Relative] } }),
|
||||
},
|
||||
]);
|
||||
vi.mocked(api.getCameraManager).mockReturnValue(createCameraManager(store));
|
||||
@@ -93,7 +94,7 @@ describe('should handle ptz action', () => {
|
||||
},
|
||||
{
|
||||
cameraID: 'camera.office_hd',
|
||||
capabilities: new Capabilities({ ptz: { left: ['relative'] } }),
|
||||
capabilities: new Capabilities({ ptz: { left: [PTZMovementType.Relative] } }),
|
||||
},
|
||||
]);
|
||||
vi.mocked(api.getCameraManager).mockReturnValue(createCameraManager(store));
|
||||
@@ -210,7 +211,7 @@ describe('should handle ptz action', () => {
|
||||
cameraID: 'camera.office',
|
||||
capabilities: new Capabilities({
|
||||
ptz: {
|
||||
left: ['relative'],
|
||||
left: [PTZMovementType.Relative],
|
||||
presets: [],
|
||||
},
|
||||
}),
|
||||
@@ -281,7 +282,7 @@ describe('should handle ptz action', () => {
|
||||
cameraID: 'camera.office',
|
||||
capabilities: new Capabilities({
|
||||
ptz: {
|
||||
left: ['continuous'],
|
||||
left: [PTZMovementType.Continuous],
|
||||
},
|
||||
}),
|
||||
},
|
||||
@@ -329,7 +330,7 @@ describe('should handle ptz action', () => {
|
||||
cameraID: 'camera.office',
|
||||
capabilities: new Capabilities({
|
||||
ptz: {
|
||||
left: ['continuous'],
|
||||
left: [PTZMovementType.Continuous],
|
||||
},
|
||||
}),
|
||||
},
|
||||
@@ -375,7 +376,7 @@ describe('should handle ptz action', () => {
|
||||
cameraID: 'camera.office',
|
||||
capabilities: new Capabilities({
|
||||
ptz: {
|
||||
left: ['continuous'],
|
||||
left: [PTZMovementType.Continuous],
|
||||
},
|
||||
}),
|
||||
},
|
||||
@@ -419,7 +420,7 @@ describe('should handle ptz action', () => {
|
||||
cameraID: 'camera.office',
|
||||
capabilities: new Capabilities({
|
||||
ptz: {
|
||||
left: ['relative'],
|
||||
left: [PTZMovementType.Relative],
|
||||
},
|
||||
}),
|
||||
},
|
||||
@@ -473,7 +474,7 @@ describe('should handle ptz action', () => {
|
||||
cameraID: 'camera.office',
|
||||
capabilities: new Capabilities({
|
||||
ptz: {
|
||||
left: ['relative'],
|
||||
left: [PTZMovementType.Relative],
|
||||
},
|
||||
}),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user