Skip to content

Commit 1b0f7e3

Browse files
feat: add ptz actions (#33)
1 parent 107816b commit 1b0f7e3

File tree

3 files changed

+305
-211
lines changed

3 files changed

+305
-211
lines changed

actions.js

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,106 @@ export function getActions() {
227227
},
228228
},
229229

230+
ptzPan: {
231+
name: 'Local: Pan Camera',
232+
description: 'Pan camera left (-) or right (+)',
233+
options: [
234+
{
235+
type: 'number',
236+
label: 'Adjustment Amount',
237+
id: 'value',
238+
default: 10,
239+
min: -100,
240+
max: 100,
241+
range: true,
242+
},
243+
],
244+
callback: (action) => {
245+
const decimalValue = action.options.value / 100
246+
this.sendRequest('pan', null, decimalValue, true)
247+
},
248+
},
249+
250+
ptzTilt: {
251+
name: 'Local: Tilt Camera',
252+
description: 'Tilt camera up (-) or down (+)',
253+
options: [
254+
{
255+
type: 'number',
256+
label: 'Adjustment Amount',
257+
id: 'value',
258+
default: 10,
259+
min: -100,
260+
max: 100,
261+
range: true,
262+
},
263+
],
264+
callback: (action) => {
265+
const decimalValue = action.options.value / 100
266+
this.sendRequest('tilt', null, decimalValue)
267+
},
268+
},
269+
270+
ptzZoom: {
271+
name: 'Local: Zoom Camera',
272+
description: 'Zoom camera in (-) or out (+)',
273+
options: [
274+
{
275+
type: 'number',
276+
label: 'Adjustment Amount',
277+
id: 'value',
278+
default: 10,
279+
min: -100,
280+
max: 100,
281+
range: true,
282+
},
283+
],
284+
callback: (action) => {
285+
const decimalValue = action.options.value / 100
286+
this.sendRequest('zoom', null, decimalValue)
287+
},
288+
},
289+
290+
ptzFocus: {
291+
name: 'Local: Focus Camera',
292+
description: 'Focus camera near (-) or far (+)',
293+
options: [
294+
{
295+
type: 'number',
296+
label: 'Adjustment Amount',
297+
id: 'value',
298+
default: 10,
299+
min: -100,
300+
max: 100,
301+
range: true,
302+
},
303+
],
304+
callback: (action) => {
305+
const decimalValue = action.options.value / 100
306+
this.sendRequest('focus', null, decimalValue)
307+
},
308+
},
309+
310+
ptzExposure: {
311+
name: 'Local: Camera Exposure',
312+
description: 'Set camera exposure',
313+
options: [
314+
{
315+
type: 'number',
316+
label: 'Expsoure (0 to 100)',
317+
id: 'value',
318+
default: 50,
319+
min: 0,
320+
max: 100,
321+
range: true,
322+
},
323+
],
324+
callback: (action) => {
325+
const decimalValue = action.options.value / 100
326+
this.sendRequest('exposure', null, decimalValue)
327+
},
328+
},
329+
230330
group: {
231331
name: 'Director: Self in Group',
232332
description: 'Toggle the director of a room in/out of a specified group room',

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vdo-ninja",
3-
"version": "2.3.0",
3+
"version": "2.4.0",
44
"main": "index.js",
55
"type": "module",
66
"scripts": {
@@ -11,21 +11,21 @@
1111
},
1212
"license": "MIT",
1313
"dependencies": {
14-
"@companion-module/base": "~1.11.3",
15-
"ws": "^8.18.0"
14+
"@companion-module/base": "~1.12.0",
15+
"ws": "^8.18.2"
1616
},
1717
"repository": {
1818
"type": "git",
1919
"url": "git+https://github.com/bitfocus/companion-module-vdo-ninja.git"
2020
},
2121
"devDependencies": {
22-
"@companion-module/tools": "^2.1.1",
23-
"eslint": "^9.17.0",
24-
"prettier": "^3.4.2"
22+
"@companion-module/tools": "^2.3.0",
23+
"eslint": "^9.27.0",
24+
"prettier": "^3.5.3"
2525
},
2626
"engines": {
2727
"node": "^22.12"
2828
},
2929
"prettier": "@companion-module/tools/.prettierrc.json",
30-
"packageManager": "yarn@4.5.3"
30+
"packageManager": "yarn@4.9.1"
3131
}

0 commit comments

Comments
 (0)