@camstack/addon-matter-broker 0.1.5 → 0.1.6

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.
Files changed (3) hide show
  1. package/dist/addon.js +113 -25
  2. package/dist/addon.mjs +113 -25
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -10091,15 +10091,18 @@ var humiditySensorCapability = {
10091
10091
  runtimeState: HumiditySensorStatusSchema
10092
10092
  };
10093
10093
  /**
10094
- * Image display cap. Models HA `image.*` entities a single still image
10095
- * exposed by an integration (a snapshot, a chart, a generated picture).
10094
+ * Image display cap. Models a single still image exposed by an integration
10095
+ * a snapshot, a chart, a generated picture, or a robot's cleaning-map render.
10096
10096
  *
10097
- * Read-only: there are no setters. The provider resolves the HA
10098
- * `entity_picture` (a relative, signed-token path) into an ABSOLUTE URL
10099
- * the browser loads directly the token stays in the query string so no
10100
- * auth header is required. The slice carries that URL plus the upstream
10101
- * last-updated timestamp; the image changes when the entity state (a
10102
- * timestamp) changes.
10097
+ * Read-only: there are no setters. The provider resolves whatever upstream
10098
+ * source it has into an ABSOLUTE URL the browser loads directly:
10099
+ * - HA `image.*` entities the `entity_picture` signed-token path
10100
+ * (token stays in the query string, so no auth header is needed);
10101
+ * - a Dreame/robot map the cloud/OSS map-image URL (or an addon
10102
+ * data-plane URL serving the rendered map bytes), exposed as its own
10103
+ * Image child device grouped under the robot's container.
10104
+ * The slice carries that URL plus the upstream last-updated timestamp; the
10105
+ * image changes when the source's last-updated marker changes.
10103
10106
  */
10104
10107
  var ImageStatusSchema = object({
10105
10108
  /** Absolute signed URL the browser loads directly. Null when the
@@ -10125,18 +10128,47 @@ var imageCapability = {
10125
10128
  */
10126
10129
  runtimeState: ImageStatusSchema
10127
10130
  };
10131
+ /**
10132
+ * Robotic lawn-mower cap. Models HA `lawn_mower.*` entities — anything
10133
+ * with a mowing lifecycle plus a dock action.
10134
+ *
10135
+ * Activity follows HA's canonical lawn-mower lifecycle: `idle` /
10136
+ * `mowing` / `paused` / `docked` / `error`. `batteryLevel` (0..100) is
10137
+ * nullable — some mowers don't report a battery percentage.
10138
+ *
10139
+ * `startMowing` begins a mowing run, `pause` halts it in place, and
10140
+ * `dock` sends the mower back to its charging station.
10141
+ */
10142
+ var LawnMowerActivitySchema = _enum([
10143
+ "idle",
10144
+ "mowing",
10145
+ "paused",
10146
+ "docked",
10147
+ "error"
10148
+ ]);
10149
+ /** Severity of the current device/error code — info (status), warning, error. */
10150
+ var DeviceCodeSeveritySchema = _enum([
10151
+ "info",
10152
+ "warning",
10153
+ "error"
10154
+ ]);
10128
10155
  var LawnMowerControlStatusSchema = object({
10129
10156
  /** Lifecycle activity of the mower. */
10130
- activity: _enum([
10131
- "idle",
10132
- "mowing",
10133
- "paused",
10134
- "docked",
10135
- "error"
10136
- ]),
10157
+ activity: LawnMowerActivitySchema,
10137
10158
  /** 0..100 battery percentage. Null when the device has no battery
10138
10159
  * reading. */
10139
10160
  batteryLevel: number().min(0).max(100).nullable(),
10161
+ /** 0..100 mowing-completion percentage of the current task, or null when no
10162
+ * task is active / progress is unavailable. */
10163
+ progressPercent: number().min(0).max(100).nullable(),
10164
+ /** Current device/event code (dynamic — mostly status, sometimes an error),
10165
+ * or null when unknown. */
10166
+ currentCode: number().nullable(),
10167
+ /** Human label for {@link currentCode}, or null when undecodable. */
10168
+ currentCodeLabel: string$2().nullable(),
10169
+ /** Severity of {@link currentCode}. `error` (and often `warning`) warrants UI
10170
+ * attention; `info` is normal status. */
10171
+ severity: DeviceCodeSeveritySchema,
10140
10172
  /** Ms epoch when the slice was last updated. */
10141
10173
  lastChangedAt: number()
10142
10174
  });
@@ -12362,6 +12394,7 @@ var VacuumStateSchema = _enum([
12362
12394
  "paused",
12363
12395
  "returning",
12364
12396
  "docked",
12397
+ "drying",
12365
12398
  "error"
12366
12399
  ]);
12367
12400
  /**
@@ -12400,6 +12433,12 @@ var VacuumControlStatusSchema = object({
12400
12433
  detergent: TankStatusSchema.nullable(),
12401
12434
  /** Dust bin. Null when the hardware has no dust bin. */
12402
12435
  dustBin: TankStatusSchema.nullable(),
12436
+ /** 0..100 cleaning-completion percentage of the current task, or null. */
12437
+ progressPercent: number().min(0).max(100).nullable(),
12438
+ /** Current error code (0 / null = no error). */
12439
+ errorCode: number().nullable(),
12440
+ /** Human label for {@link errorCode}, or null when none / undecodable. */
12441
+ errorLabel: string$2().nullable(),
12403
12442
  /** Ms epoch when the slice was last updated. */
12404
12443
  lastChangedAt: number()
12405
12444
  });
@@ -13366,9 +13405,29 @@ var BaseDevice = class {
13366
13405
  * is open (Reolink writes `hasPtz/hasIntercom`, Hikvision writes
13367
13406
  * `hasSupplementalLight/hasAlarmIo`, etc).
13368
13407
  *
13369
- * Default: no-op (driver had no probe to run).
13370
- */
13371
- async onProbe() {}
13408
+ * Default: nothing to probe mark the device PROBED (set `lastProbedAt`) so
13409
+ * the kernel treats it as ready immediately. A device that derives its shape
13410
+ * from a spec (a container, or an accessory sensor) rather than from a
13411
+ * hardware probe has no probe to "complete"; without stamping `lastProbedAt`
13412
+ * it would look perpetually un-probed — logging "Initial probe did not
13413
+ * complete" on every boot and spinning a pointless retry chain. Drivers that
13414
+ * DO probe override this and write their own `feature-probe` slice (including
13415
+ * `lastProbedAt`) once their probe actually succeeds.
13416
+ */
13417
+ async onProbe() {
13418
+ const base = this.runtimeState.getCapState("feature-probe") ?? {
13419
+ flags: {},
13420
+ deviceType: null,
13421
+ model: null,
13422
+ channelCount: null,
13423
+ lastProbedAt: 0,
13424
+ lastFetchedAt: 0
13425
+ };
13426
+ this.runtimeState.setCapState("feature-probe", {
13427
+ ...base,
13428
+ lastProbedAt: Date.now()
13429
+ });
13430
+ }
13372
13431
  /**
13373
13432
  * Phase 5 — fired after the device + its accessories are registered.
13374
13433
  * Drivers publish streams to the broker, kick off background tasks,
@@ -14830,17 +14889,32 @@ var ReleaseInputSchema = object({
14830
14889
  * the parent cascades into every accessory. */
14831
14890
  camDeviceId: number().int().nonnegative()
14832
14891
  });
14833
- var ResyncInputSchema = object({
14834
- /** Parent CamStack device id of an adopted device. The provider resolves its
14835
- * source (integration/broker + native id) and re-aligns the device's
14836
- * structural spec (type/role/capabilities/units) with the live mapping,
14837
- * rebuilding any child whose class changed while preserving operator edits. */
14838
- camDeviceId: number().int().nonnegative() });
14892
+ var ResyncInputSchema = object({
14893
+ /** Parent CamStack device id of an adopted device. The provider resolves its
14894
+ * source (integration/broker + native id) and re-aligns the device's
14895
+ * structural spec (type/role/capabilities/units) with the live mapping,
14896
+ * rebuilding any child whose class changed while preserving operator edits. */
14897
+ camDeviceId: number().int().nonnegative(),
14898
+ /** "Resync from zero" (#19). When true, the kernel PURGES every accessory
14899
+ * child of `camDeviceId` BEFORE the provider re-derives the device, so the
14900
+ * children are rebuilt fresh from source — correct names, coords, and units —
14901
+ * instead of being preserved by the incremental reconcile. Use to recover from
14902
+ * legacy generic/placeholder names that the normal name-precedence keeps frozen
14903
+ * (the operator's explicit reset). Push-driven integrations (no-op resync)
14904
+ * rebuild on their next snapshot; pull/command integrations rebuild in `resync`.
14905
+ * Operator edits on the PARENT (its name, layout, primary-child pick) survive —
14906
+ * only the children are torn down. Omitted/false ⇒ the normal incremental
14907
+ * re-sync that preserves children. */
14908
+ resetToSource: boolean().optional()
14909
+ });
14839
14910
  var ResyncResultSchema = object({
14840
14911
  /** True when the persisted spec actually changed (children may have been rebuilt). */
14841
14912
  changed: boolean(),
14842
14913
  /** Number of child devices rebuilt into a new class by this re-sync. */
14843
- rebuiltChildren: number().int().nonnegative()
14914
+ rebuiltChildren: number().int().nonnegative(),
14915
+ /** Number of accessory children torn down by a `resetToSource` purge before the
14916
+ * provider re-derived the device. 0/absent for a normal incremental re-sync. */
14917
+ removedChildren: number().int().nonnegative().optional()
14844
14918
  });
14845
14919
  var deviceAdoptionCapability = {
14846
14920
  name: "device-adoption",
@@ -16605,6 +16679,11 @@ var DeviceMetaSchema = object({
16605
16679
  addonId: string$2(),
16606
16680
  type: string$2(),
16607
16681
  name: string$2(),
16682
+ /** True once an operator explicitly renamed the device via `setName`. Drives
16683
+ * reconcile name-precedence (preserve operator name vs adopt fresh provider
16684
+ * name). Absent ⇒ treated as user-named (PRESERVE) for legacy rows. See
16685
+ * `DeviceMeta.userNamed`. */
16686
+ userNamed: boolean().optional(),
16608
16687
  location: string$2().nullable(),
16609
16688
  disabled: boolean(),
16610
16689
  parentDeviceId: number().nullable(),
@@ -16915,6 +16994,9 @@ method(object({
16915
16994
  }), method(ReleaseInputSchema.extend({ addonId: string$2() }), _void(), {
16916
16995
  kind: "mutation",
16917
16996
  auth: "admin"
16997
+ }), method(ResyncInputSchema, ResyncResultSchema, {
16998
+ kind: "mutation",
16999
+ auth: "admin"
16918
17000
  }), method(object({
16919
17001
  deviceId: number(),
16920
17002
  key: string$2(),
@@ -20694,6 +20776,12 @@ Object.freeze({
20694
20776
  addonId: null,
20695
20777
  access: "create"
20696
20778
  },
20779
+ "deviceManager.adoptionResync": {
20780
+ capName: "device-manager",
20781
+ capScope: "system",
20782
+ addonId: null,
20783
+ access: "create"
20784
+ },
20697
20785
  "deviceManager.allocateDeviceId": {
20698
20786
  capName: "device-manager",
20699
20787
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -10089,15 +10089,18 @@ var humiditySensorCapability = {
10089
10089
  runtimeState: HumiditySensorStatusSchema
10090
10090
  };
10091
10091
  /**
10092
- * Image display cap. Models HA `image.*` entities a single still image
10093
- * exposed by an integration (a snapshot, a chart, a generated picture).
10092
+ * Image display cap. Models a single still image exposed by an integration
10093
+ * a snapshot, a chart, a generated picture, or a robot's cleaning-map render.
10094
10094
  *
10095
- * Read-only: there are no setters. The provider resolves the HA
10096
- * `entity_picture` (a relative, signed-token path) into an ABSOLUTE URL
10097
- * the browser loads directly the token stays in the query string so no
10098
- * auth header is required. The slice carries that URL plus the upstream
10099
- * last-updated timestamp; the image changes when the entity state (a
10100
- * timestamp) changes.
10095
+ * Read-only: there are no setters. The provider resolves whatever upstream
10096
+ * source it has into an ABSOLUTE URL the browser loads directly:
10097
+ * - HA `image.*` entities the `entity_picture` signed-token path
10098
+ * (token stays in the query string, so no auth header is needed);
10099
+ * - a Dreame/robot map the cloud/OSS map-image URL (or an addon
10100
+ * data-plane URL serving the rendered map bytes), exposed as its own
10101
+ * Image child device grouped under the robot's container.
10102
+ * The slice carries that URL plus the upstream last-updated timestamp; the
10103
+ * image changes when the source's last-updated marker changes.
10101
10104
  */
10102
10105
  var ImageStatusSchema = object({
10103
10106
  /** Absolute signed URL the browser loads directly. Null when the
@@ -10123,18 +10126,47 @@ var imageCapability = {
10123
10126
  */
10124
10127
  runtimeState: ImageStatusSchema
10125
10128
  };
10129
+ /**
10130
+ * Robotic lawn-mower cap. Models HA `lawn_mower.*` entities — anything
10131
+ * with a mowing lifecycle plus a dock action.
10132
+ *
10133
+ * Activity follows HA's canonical lawn-mower lifecycle: `idle` /
10134
+ * `mowing` / `paused` / `docked` / `error`. `batteryLevel` (0..100) is
10135
+ * nullable — some mowers don't report a battery percentage.
10136
+ *
10137
+ * `startMowing` begins a mowing run, `pause` halts it in place, and
10138
+ * `dock` sends the mower back to its charging station.
10139
+ */
10140
+ var LawnMowerActivitySchema = _enum([
10141
+ "idle",
10142
+ "mowing",
10143
+ "paused",
10144
+ "docked",
10145
+ "error"
10146
+ ]);
10147
+ /** Severity of the current device/error code — info (status), warning, error. */
10148
+ var DeviceCodeSeveritySchema = _enum([
10149
+ "info",
10150
+ "warning",
10151
+ "error"
10152
+ ]);
10126
10153
  var LawnMowerControlStatusSchema = object({
10127
10154
  /** Lifecycle activity of the mower. */
10128
- activity: _enum([
10129
- "idle",
10130
- "mowing",
10131
- "paused",
10132
- "docked",
10133
- "error"
10134
- ]),
10155
+ activity: LawnMowerActivitySchema,
10135
10156
  /** 0..100 battery percentage. Null when the device has no battery
10136
10157
  * reading. */
10137
10158
  batteryLevel: number().min(0).max(100).nullable(),
10159
+ /** 0..100 mowing-completion percentage of the current task, or null when no
10160
+ * task is active / progress is unavailable. */
10161
+ progressPercent: number().min(0).max(100).nullable(),
10162
+ /** Current device/event code (dynamic — mostly status, sometimes an error),
10163
+ * or null when unknown. */
10164
+ currentCode: number().nullable(),
10165
+ /** Human label for {@link currentCode}, or null when undecodable. */
10166
+ currentCodeLabel: string$2().nullable(),
10167
+ /** Severity of {@link currentCode}. `error` (and often `warning`) warrants UI
10168
+ * attention; `info` is normal status. */
10169
+ severity: DeviceCodeSeveritySchema,
10138
10170
  /** Ms epoch when the slice was last updated. */
10139
10171
  lastChangedAt: number()
10140
10172
  });
@@ -12360,6 +12392,7 @@ var VacuumStateSchema = _enum([
12360
12392
  "paused",
12361
12393
  "returning",
12362
12394
  "docked",
12395
+ "drying",
12363
12396
  "error"
12364
12397
  ]);
12365
12398
  /**
@@ -12398,6 +12431,12 @@ var VacuumControlStatusSchema = object({
12398
12431
  detergent: TankStatusSchema.nullable(),
12399
12432
  /** Dust bin. Null when the hardware has no dust bin. */
12400
12433
  dustBin: TankStatusSchema.nullable(),
12434
+ /** 0..100 cleaning-completion percentage of the current task, or null. */
12435
+ progressPercent: number().min(0).max(100).nullable(),
12436
+ /** Current error code (0 / null = no error). */
12437
+ errorCode: number().nullable(),
12438
+ /** Human label for {@link errorCode}, or null when none / undecodable. */
12439
+ errorLabel: string$2().nullable(),
12401
12440
  /** Ms epoch when the slice was last updated. */
12402
12441
  lastChangedAt: number()
12403
12442
  });
@@ -13364,9 +13403,29 @@ var BaseDevice = class {
13364
13403
  * is open (Reolink writes `hasPtz/hasIntercom`, Hikvision writes
13365
13404
  * `hasSupplementalLight/hasAlarmIo`, etc).
13366
13405
  *
13367
- * Default: no-op (driver had no probe to run).
13368
- */
13369
- async onProbe() {}
13406
+ * Default: nothing to probe mark the device PROBED (set `lastProbedAt`) so
13407
+ * the kernel treats it as ready immediately. A device that derives its shape
13408
+ * from a spec (a container, or an accessory sensor) rather than from a
13409
+ * hardware probe has no probe to "complete"; without stamping `lastProbedAt`
13410
+ * it would look perpetually un-probed — logging "Initial probe did not
13411
+ * complete" on every boot and spinning a pointless retry chain. Drivers that
13412
+ * DO probe override this and write their own `feature-probe` slice (including
13413
+ * `lastProbedAt`) once their probe actually succeeds.
13414
+ */
13415
+ async onProbe() {
13416
+ const base = this.runtimeState.getCapState("feature-probe") ?? {
13417
+ flags: {},
13418
+ deviceType: null,
13419
+ model: null,
13420
+ channelCount: null,
13421
+ lastProbedAt: 0,
13422
+ lastFetchedAt: 0
13423
+ };
13424
+ this.runtimeState.setCapState("feature-probe", {
13425
+ ...base,
13426
+ lastProbedAt: Date.now()
13427
+ });
13428
+ }
13370
13429
  /**
13371
13430
  * Phase 5 — fired after the device + its accessories are registered.
13372
13431
  * Drivers publish streams to the broker, kick off background tasks,
@@ -14828,17 +14887,32 @@ var ReleaseInputSchema = object({
14828
14887
  * the parent cascades into every accessory. */
14829
14888
  camDeviceId: number().int().nonnegative()
14830
14889
  });
14831
- var ResyncInputSchema = object({
14832
- /** Parent CamStack device id of an adopted device. The provider resolves its
14833
- * source (integration/broker + native id) and re-aligns the device's
14834
- * structural spec (type/role/capabilities/units) with the live mapping,
14835
- * rebuilding any child whose class changed while preserving operator edits. */
14836
- camDeviceId: number().int().nonnegative() });
14890
+ var ResyncInputSchema = object({
14891
+ /** Parent CamStack device id of an adopted device. The provider resolves its
14892
+ * source (integration/broker + native id) and re-aligns the device's
14893
+ * structural spec (type/role/capabilities/units) with the live mapping,
14894
+ * rebuilding any child whose class changed while preserving operator edits. */
14895
+ camDeviceId: number().int().nonnegative(),
14896
+ /** "Resync from zero" (#19). When true, the kernel PURGES every accessory
14897
+ * child of `camDeviceId` BEFORE the provider re-derives the device, so the
14898
+ * children are rebuilt fresh from source — correct names, coords, and units —
14899
+ * instead of being preserved by the incremental reconcile. Use to recover from
14900
+ * legacy generic/placeholder names that the normal name-precedence keeps frozen
14901
+ * (the operator's explicit reset). Push-driven integrations (no-op resync)
14902
+ * rebuild on their next snapshot; pull/command integrations rebuild in `resync`.
14903
+ * Operator edits on the PARENT (its name, layout, primary-child pick) survive —
14904
+ * only the children are torn down. Omitted/false ⇒ the normal incremental
14905
+ * re-sync that preserves children. */
14906
+ resetToSource: boolean().optional()
14907
+ });
14837
14908
  var ResyncResultSchema = object({
14838
14909
  /** True when the persisted spec actually changed (children may have been rebuilt). */
14839
14910
  changed: boolean(),
14840
14911
  /** Number of child devices rebuilt into a new class by this re-sync. */
14841
- rebuiltChildren: number().int().nonnegative()
14912
+ rebuiltChildren: number().int().nonnegative(),
14913
+ /** Number of accessory children torn down by a `resetToSource` purge before the
14914
+ * provider re-derived the device. 0/absent for a normal incremental re-sync. */
14915
+ removedChildren: number().int().nonnegative().optional()
14842
14916
  });
14843
14917
  var deviceAdoptionCapability = {
14844
14918
  name: "device-adoption",
@@ -16603,6 +16677,11 @@ var DeviceMetaSchema = object({
16603
16677
  addonId: string$2(),
16604
16678
  type: string$2(),
16605
16679
  name: string$2(),
16680
+ /** True once an operator explicitly renamed the device via `setName`. Drives
16681
+ * reconcile name-precedence (preserve operator name vs adopt fresh provider
16682
+ * name). Absent ⇒ treated as user-named (PRESERVE) for legacy rows. See
16683
+ * `DeviceMeta.userNamed`. */
16684
+ userNamed: boolean().optional(),
16606
16685
  location: string$2().nullable(),
16607
16686
  disabled: boolean(),
16608
16687
  parentDeviceId: number().nullable(),
@@ -16913,6 +16992,9 @@ method(object({
16913
16992
  }), method(ReleaseInputSchema.extend({ addonId: string$2() }), _void(), {
16914
16993
  kind: "mutation",
16915
16994
  auth: "admin"
16995
+ }), method(ResyncInputSchema, ResyncResultSchema, {
16996
+ kind: "mutation",
16997
+ auth: "admin"
16916
16998
  }), method(object({
16917
16999
  deviceId: number(),
16918
17000
  key: string$2(),
@@ -20692,6 +20774,12 @@ Object.freeze({
20692
20774
  addonId: null,
20693
20775
  access: "create"
20694
20776
  },
20777
+ "deviceManager.adoptionResync": {
20778
+ capName: "device-manager",
20779
+ capScope: "system",
20780
+ addonId: null,
20781
+ access: "create"
20782
+ },
20695
20783
  "deviceManager.allocateDeviceId": {
20696
20784
  capName: "device-manager",
20697
20785
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-matter-broker",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Matter broker addon for CamStack — owns a Matter fabric (commissioning + the long-lived controller) via the matter.js controller and brokers commissioned Matter nodes into CamStack",
5
5
  "keywords": [
6
6
  "camstack",