@camstack/addon-provider-amcrest 0.2.113 → 0.2.114

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/addon.js CHANGED
@@ -5367,7 +5367,7 @@ var ZodIssueCode = {
5367
5367
  var ZodFirstPartyTypeKind;
5368
5368
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5369
5369
  //#endregion
5370
- //#region ../types/dist/sleep-B1y0Fo1U.mjs
5370
+ //#region ../types/dist/sleep-vl6nBE8d.mjs
5371
5371
  /**
5372
5372
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5373
5373
  * window to float samples (D455).
@@ -31281,6 +31281,47 @@ var ptzCapability = {
31281
31281
  auth: "admin"
31282
31282
  }),
31283
31283
  /**
31284
+ * Make WHERE THE HEAD IS POINTING RIGHT NOW this camera's home.
31285
+ *
31286
+ * `setHomePreset` takes a preset id, and a preset id is the wrong shape for
31287
+ * the most natural thing an operator does: aim the camera, then say "here".
31288
+ * It is also the only shape a camera whose home is NOT a preset can accept
31289
+ * -- Reolink's home is a guard point, a stored position with no id at all,
31290
+ * and hiding the control for that case (as the UI briefly did) left the one
31291
+ * vendor with a native home unable to set it.
31292
+ *
31293
+ * Each provider does it its own way:
31294
+ * reolink `setGrd` with `needSetPos`, pinning the guard point here
31295
+ * hikvision / amcrest save a preset, then pin it as home
31296
+ * onvif REFUSES -- its home is the PTZ origin and cannot be moved
31297
+ *
31298
+ * A provider that cannot honour it throws rather than silently doing
31299
+ * nothing: an operator who pressed "set home here" and saw no error would
31300
+ * believe it took.
31301
+ */
31302
+ captureHomeHere: method(object({ deviceId: number() }), _void(), {
31303
+ kind: "mutation",
31304
+ auth: "admin"
31305
+ }),
31306
+ /**
31307
+ * How long the camera waits, idle, before returning home on its own --
31308
+ * `null` when it has no such behaviour.
31309
+ *
31310
+ * Reolink's guard point carries one (`timeout`, freely settable in
31311
+ * seconds). It is a real function of the camera that we did not expose at
31312
+ * all, and it belongs next to the home it governs rather than in a vendor
31313
+ * settings page nobody associates with Home.
31314
+ */
31315
+ getHomeReturnSeconds: method(object({ deviceId: number() }), number().int().nullable()),
31316
+ /** Set the idle-return delay. Refused by a camera that has no such timer. */
31317
+ setHomeReturnSeconds: method(object({
31318
+ deviceId: number(),
31319
+ seconds: number().int().min(0).max(3600)
31320
+ }), _void(), {
31321
+ kind: "mutation",
31322
+ auth: "admin"
31323
+ }),
31324
+ /**
31284
31325
  * Pull the current PTZ position. Redundant with the auto-injected
31285
31326
  * `getStatus` method (see `status` below); kept for callers that
31286
31327
  * haven't migrated. Will be folded into `getStatus` in a future
@@ -40941,6 +40982,12 @@ Object.freeze({
40941
40982
  addonId: null,
40942
40983
  access: "create"
40943
40984
  },
40985
+ "ptz.captureHomeHere": {
40986
+ capName: "ptz",
40987
+ capScope: "device",
40988
+ addonId: null,
40989
+ access: "create"
40990
+ },
40944
40991
  "ptz.continuousMove": {
40945
40992
  capName: "ptz",
40946
40993
  capScope: "device",
@@ -40959,6 +41006,12 @@ Object.freeze({
40959
41006
  addonId: null,
40960
41007
  access: "view"
40961
41008
  },
41009
+ "ptz.getHomeReturnSeconds": {
41010
+ capName: "ptz",
41011
+ capScope: "device",
41012
+ addonId: null,
41013
+ access: "view"
41014
+ },
40962
41015
  "ptz.getOptions": {
40963
41016
  capName: "ptz",
40964
41017
  capScope: "device",
@@ -41013,6 +41066,12 @@ Object.freeze({
41013
41066
  addonId: null,
41014
41067
  access: "create"
41015
41068
  },
41069
+ "ptz.setHomeReturnSeconds": {
41070
+ capName: "ptz",
41071
+ capScope: "device",
41072
+ addonId: null,
41073
+ access: "create"
41074
+ },
41016
41075
  "ptz.stop": {
41017
41076
  capName: "ptz",
41018
41077
  capScope: "device",
@@ -44176,6 +44235,11 @@ Object.freeze({
44176
44235
  form: "single",
44177
44236
  optional: false
44178
44237
  }],
44238
+ "ptz.captureHomeHere": [{
44239
+ name: "deviceId",
44240
+ form: "single",
44241
+ optional: false
44242
+ }],
44179
44243
  "ptz.continuousMove": [{
44180
44244
  name: "deviceId",
44181
44245
  form: "single",
@@ -44191,6 +44255,11 @@ Object.freeze({
44191
44255
  form: "single",
44192
44256
  optional: false
44193
44257
  }],
44258
+ "ptz.getHomeReturnSeconds": [{
44259
+ name: "deviceId",
44260
+ form: "single",
44261
+ optional: false
44262
+ }],
44194
44263
  "ptz.getOptions": [{
44195
44264
  name: "deviceId",
44196
44265
  form: "single",
@@ -44236,6 +44305,11 @@ Object.freeze({
44236
44305
  form: "single",
44237
44306
  optional: false
44238
44307
  }],
44308
+ "ptz.setHomeReturnSeconds": [{
44309
+ name: "deviceId",
44310
+ form: "single",
44311
+ optional: false
44312
+ }],
44239
44313
  "ptz.stop": [{
44240
44314
  name: "deviceId",
44241
44315
  form: "single",
@@ -46959,6 +47033,8 @@ var AmcrestCamera = class AmcrestCamera extends BaseDevice {
46959
47033
  * granularity is reported through `getOptions` instead of being hidden
46960
47034
  * behind a 0..1 float.
46961
47035
  */
47036
+ /** Dahua exposes 25 fixed preset slots, 1-based. */
47037
+ static DAHUA_MAX_PRESETS = 25;
46962
47038
  static DAHUA_SPEED_STEPS = 8;
46963
47039
  /**
46964
47040
  * How long one `ptz.move` pulse runs, ms. The DENOMINATOR of "how far did
@@ -47162,6 +47238,27 @@ var AmcrestCamera = class AmcrestCamera extends BaseDevice {
47162
47238
  };
47163
47239
  return this.resolveHomePreset();
47164
47240
  },
47241
+ captureHomeHere: async ({ deviceId }) => {
47242
+ if (deviceId !== this.id) return;
47243
+ const client = this.ensureClient();
47244
+ const ceiling = (await client.getPtzCaps(this.channel))?.maxPresets ?? AmcrestCamera.DAHUA_MAX_PRESETS;
47245
+ const used = new Set((await client.getPtzPresets(this.channel)).map((p) => p.id));
47246
+ let slot = 1;
47247
+ while (used.has(slot) && slot <= ceiling) slot += 1;
47248
+ if (slot > ceiling) throw new Error("No free preset slot on this camera to store a home position — free one first");
47249
+ await client.ptzSetPreset(this.channel, slot, AmcrestCamera.PTZ_CGI_TIMEOUT_MS);
47250
+ await this.config.setAll({ homePresetId: String(slot) });
47251
+ this.ctx.logger.info("amcrest: home pinned to the current position", {
47252
+ tags: { deviceId: this.id },
47253
+ meta: { presetId: slot }
47254
+ });
47255
+ },
47256
+ getHomeReturnSeconds: async () => {
47257
+ return null;
47258
+ },
47259
+ setHomeReturnSeconds: async () => {
47260
+ throw new Error("Amcrest: the idle-return timer is not wired on this driver");
47261
+ },
47165
47262
  setHomePreset: async ({ deviceId, presetId }) => {
47166
47263
  if (deviceId !== this.id) return;
47167
47264
  await this.config.setAll({ homePresetId: presetId ?? "" });
package/dist/addon.mjs CHANGED
@@ -5368,7 +5368,7 @@ var ZodIssueCode = {
5368
5368
  var ZodFirstPartyTypeKind;
5369
5369
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5370
5370
  //#endregion
5371
- //#region ../types/dist/sleep-B1y0Fo1U.mjs
5371
+ //#region ../types/dist/sleep-vl6nBE8d.mjs
5372
5372
  /**
5373
5373
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5374
5374
  * window to float samples (D455).
@@ -31282,6 +31282,47 @@ var ptzCapability = {
31282
31282
  auth: "admin"
31283
31283
  }),
31284
31284
  /**
31285
+ * Make WHERE THE HEAD IS POINTING RIGHT NOW this camera's home.
31286
+ *
31287
+ * `setHomePreset` takes a preset id, and a preset id is the wrong shape for
31288
+ * the most natural thing an operator does: aim the camera, then say "here".
31289
+ * It is also the only shape a camera whose home is NOT a preset can accept
31290
+ * -- Reolink's home is a guard point, a stored position with no id at all,
31291
+ * and hiding the control for that case (as the UI briefly did) left the one
31292
+ * vendor with a native home unable to set it.
31293
+ *
31294
+ * Each provider does it its own way:
31295
+ * reolink `setGrd` with `needSetPos`, pinning the guard point here
31296
+ * hikvision / amcrest save a preset, then pin it as home
31297
+ * onvif REFUSES -- its home is the PTZ origin and cannot be moved
31298
+ *
31299
+ * A provider that cannot honour it throws rather than silently doing
31300
+ * nothing: an operator who pressed "set home here" and saw no error would
31301
+ * believe it took.
31302
+ */
31303
+ captureHomeHere: method(object({ deviceId: number() }), _void(), {
31304
+ kind: "mutation",
31305
+ auth: "admin"
31306
+ }),
31307
+ /**
31308
+ * How long the camera waits, idle, before returning home on its own --
31309
+ * `null` when it has no such behaviour.
31310
+ *
31311
+ * Reolink's guard point carries one (`timeout`, freely settable in
31312
+ * seconds). It is a real function of the camera that we did not expose at
31313
+ * all, and it belongs next to the home it governs rather than in a vendor
31314
+ * settings page nobody associates with Home.
31315
+ */
31316
+ getHomeReturnSeconds: method(object({ deviceId: number() }), number().int().nullable()),
31317
+ /** Set the idle-return delay. Refused by a camera that has no such timer. */
31318
+ setHomeReturnSeconds: method(object({
31319
+ deviceId: number(),
31320
+ seconds: number().int().min(0).max(3600)
31321
+ }), _void(), {
31322
+ kind: "mutation",
31323
+ auth: "admin"
31324
+ }),
31325
+ /**
31285
31326
  * Pull the current PTZ position. Redundant with the auto-injected
31286
31327
  * `getStatus` method (see `status` below); kept for callers that
31287
31328
  * haven't migrated. Will be folded into `getStatus` in a future
@@ -40942,6 +40983,12 @@ Object.freeze({
40942
40983
  addonId: null,
40943
40984
  access: "create"
40944
40985
  },
40986
+ "ptz.captureHomeHere": {
40987
+ capName: "ptz",
40988
+ capScope: "device",
40989
+ addonId: null,
40990
+ access: "create"
40991
+ },
40945
40992
  "ptz.continuousMove": {
40946
40993
  capName: "ptz",
40947
40994
  capScope: "device",
@@ -40960,6 +41007,12 @@ Object.freeze({
40960
41007
  addonId: null,
40961
41008
  access: "view"
40962
41009
  },
41010
+ "ptz.getHomeReturnSeconds": {
41011
+ capName: "ptz",
41012
+ capScope: "device",
41013
+ addonId: null,
41014
+ access: "view"
41015
+ },
40963
41016
  "ptz.getOptions": {
40964
41017
  capName: "ptz",
40965
41018
  capScope: "device",
@@ -41014,6 +41067,12 @@ Object.freeze({
41014
41067
  addonId: null,
41015
41068
  access: "create"
41016
41069
  },
41070
+ "ptz.setHomeReturnSeconds": {
41071
+ capName: "ptz",
41072
+ capScope: "device",
41073
+ addonId: null,
41074
+ access: "create"
41075
+ },
41017
41076
  "ptz.stop": {
41018
41077
  capName: "ptz",
41019
41078
  capScope: "device",
@@ -44177,6 +44236,11 @@ Object.freeze({
44177
44236
  form: "single",
44178
44237
  optional: false
44179
44238
  }],
44239
+ "ptz.captureHomeHere": [{
44240
+ name: "deviceId",
44241
+ form: "single",
44242
+ optional: false
44243
+ }],
44180
44244
  "ptz.continuousMove": [{
44181
44245
  name: "deviceId",
44182
44246
  form: "single",
@@ -44192,6 +44256,11 @@ Object.freeze({
44192
44256
  form: "single",
44193
44257
  optional: false
44194
44258
  }],
44259
+ "ptz.getHomeReturnSeconds": [{
44260
+ name: "deviceId",
44261
+ form: "single",
44262
+ optional: false
44263
+ }],
44195
44264
  "ptz.getOptions": [{
44196
44265
  name: "deviceId",
44197
44266
  form: "single",
@@ -44237,6 +44306,11 @@ Object.freeze({
44237
44306
  form: "single",
44238
44307
  optional: false
44239
44308
  }],
44309
+ "ptz.setHomeReturnSeconds": [{
44310
+ name: "deviceId",
44311
+ form: "single",
44312
+ optional: false
44313
+ }],
44240
44314
  "ptz.stop": [{
44241
44315
  name: "deviceId",
44242
44316
  form: "single",
@@ -46960,6 +47034,8 @@ var AmcrestCamera = class AmcrestCamera extends BaseDevice {
46960
47034
  * granularity is reported through `getOptions` instead of being hidden
46961
47035
  * behind a 0..1 float.
46962
47036
  */
47037
+ /** Dahua exposes 25 fixed preset slots, 1-based. */
47038
+ static DAHUA_MAX_PRESETS = 25;
46963
47039
  static DAHUA_SPEED_STEPS = 8;
46964
47040
  /**
46965
47041
  * How long one `ptz.move` pulse runs, ms. The DENOMINATOR of "how far did
@@ -47163,6 +47239,27 @@ var AmcrestCamera = class AmcrestCamera extends BaseDevice {
47163
47239
  };
47164
47240
  return this.resolveHomePreset();
47165
47241
  },
47242
+ captureHomeHere: async ({ deviceId }) => {
47243
+ if (deviceId !== this.id) return;
47244
+ const client = this.ensureClient();
47245
+ const ceiling = (await client.getPtzCaps(this.channel))?.maxPresets ?? AmcrestCamera.DAHUA_MAX_PRESETS;
47246
+ const used = new Set((await client.getPtzPresets(this.channel)).map((p) => p.id));
47247
+ let slot = 1;
47248
+ while (used.has(slot) && slot <= ceiling) slot += 1;
47249
+ if (slot > ceiling) throw new Error("No free preset slot on this camera to store a home position — free one first");
47250
+ await client.ptzSetPreset(this.channel, slot, AmcrestCamera.PTZ_CGI_TIMEOUT_MS);
47251
+ await this.config.setAll({ homePresetId: String(slot) });
47252
+ this.ctx.logger.info("amcrest: home pinned to the current position", {
47253
+ tags: { deviceId: this.id },
47254
+ meta: { presetId: slot }
47255
+ });
47256
+ },
47257
+ getHomeReturnSeconds: async () => {
47258
+ return null;
47259
+ },
47260
+ setHomeReturnSeconds: async () => {
47261
+ throw new Error("Amcrest: the idle-return timer is not wired on this driver");
47262
+ },
47166
47263
  setHomePreset: async ({ deviceId, presetId }) => {
47167
47264
  if (deviceId !== this.id) return;
47168
47265
  await this.config.setAll({ homePresetId: presetId ?? "" });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-amcrest",
3
- "version": "0.2.113",
3
+ "version": "0.2.114",
4
4
  "description": "Amcrest/Dahua camera device provider addon for CamStack — Dahua CGI over HTTP(S) with digest auth (snapshot, RTSP catalog, PTZ, image/day-night config)",
5
5
  "keywords": [
6
6
  "camstack",