@camstack/addon-import-alexa 0.2.59 → 0.2.61
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 +37 -1
- package/dist/addon.mjs +37 -1
- package/package.json +1 -1
package/dist/addon.js
CHANGED
|
@@ -12999,7 +12999,26 @@ var DiscoveryCandidateSchema = object({
|
|
|
12999
12999
|
* identity ahead of adoption. Rendering metadata (unit, precision)
|
|
13000
13000
|
* flows live through the cap STATUS SLICE after adoption.
|
|
13001
13001
|
*/
|
|
13002
|
-
sourceInfo: SourceInfoSchema.optional()
|
|
13002
|
+
sourceInfo: SourceInfoSchema.optional(),
|
|
13003
|
+
/**
|
|
13004
|
+
* Set when this candidate is a device the provider ALREADY owns.
|
|
13005
|
+
*
|
|
13006
|
+
* A scan cannot generally produce the identity a device was onboarded under
|
|
13007
|
+
* (Reolink keys on `mac-<mac>`, learned at adopt time), so a stableId
|
|
13008
|
+
* comparison never matches and an owned device looks addable. Re-adopting one
|
|
13009
|
+
* overwrites its config with scan-derived values — that is how a Home Hub's
|
|
13010
|
+
* Baichuan port was overwritten with its ONVIF port, taking the hub and its
|
|
13011
|
+
* three child cameras offline for four hours.
|
|
13012
|
+
*
|
|
13013
|
+
* A provider that can recognise its own devices says so here. Absent means
|
|
13014
|
+
* "not recognised", which is not the same as "known to be new" — a provider
|
|
13015
|
+
* that cannot tell simply never sets it.
|
|
13016
|
+
*/
|
|
13017
|
+
alreadyOnboarded: boolean().optional(),
|
|
13018
|
+
/** Numeric id of the device this candidate was matched to. Set with `alreadyOnboarded`. */
|
|
13019
|
+
onboardedDeviceId: number().optional(),
|
|
13020
|
+
/** Operator-facing name of the matched device, so the UI can say WHICH one it is. */
|
|
13021
|
+
onboardedName: string().optional()
|
|
13003
13022
|
});
|
|
13004
13023
|
/**
|
|
13005
13024
|
* Flat device summary returned by `createDevice` / `adoptDiscoveredDevice`.
|
|
@@ -33254,6 +33273,22 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
33254
33273
|
* failed — logged at ERROR with `tags.deviceId` and surfaced via
|
|
33255
33274
|
* `getStatus().error`.
|
|
33256
33275
|
*/
|
|
33276
|
+
/**
|
|
33277
|
+
* Repair a row's PERSISTED config blob immediately before it is restored.
|
|
33278
|
+
* Default: no-op — most providers have nothing to heal.
|
|
33279
|
+
*
|
|
33280
|
+
* This exists because a restored device self-hydrates from the DB: `create()`
|
|
33281
|
+
* passes `{}` and `BaseDevice` parses the stored blob against the device
|
|
33282
|
+
* schema. A blob that lost a REQUIRED field therefore fails restore forever,
|
|
33283
|
+
* and no later pass revisits it — a hub-adopted Reolink camera whose blob had
|
|
33284
|
+
* been emptied failed all four bounded attempts against fields
|
|
33285
|
+
* (`host`, `password`) it inherits from its parent and never dials itself.
|
|
33286
|
+
*
|
|
33287
|
+
* Implementations get every saved row, so a child can read its parent's blob.
|
|
33288
|
+
* A heal that throws is treated like any other restore failure: retried under
|
|
33289
|
+
* the bound, then reported — never swallowed.
|
|
33290
|
+
*/
|
|
33291
|
+
async healSavedConfig(_saved, _allSaved) {}
|
|
33257
33292
|
async onRestoreDevices(savedDevices) {
|
|
33258
33293
|
const restored = /* @__PURE__ */ new Set();
|
|
33259
33294
|
const failures = [];
|
|
@@ -33262,6 +33297,7 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
33262
33297
|
const Class = this.deviceClasses[saved.type];
|
|
33263
33298
|
if (!Class) throw new Error(`no device class registered for type "${saved.type}"`);
|
|
33264
33299
|
if (saved.parentDeviceId !== null && !restored.has(saved.parentDeviceId)) throw new Error(`parent device ${saved.parentDeviceId} not restored`);
|
|
33300
|
+
await this.healSavedConfig(saved, savedDevices);
|
|
33265
33301
|
await this.ctx.kernel.devices.create(saved.stableId, Class, {}, saved.parentDeviceId);
|
|
33266
33302
|
restored.add(saved.id);
|
|
33267
33303
|
};
|
package/dist/addon.mjs
CHANGED
|
@@ -12999,7 +12999,26 @@ var DiscoveryCandidateSchema = object({
|
|
|
12999
12999
|
* identity ahead of adoption. Rendering metadata (unit, precision)
|
|
13000
13000
|
* flows live through the cap STATUS SLICE after adoption.
|
|
13001
13001
|
*/
|
|
13002
|
-
sourceInfo: SourceInfoSchema.optional()
|
|
13002
|
+
sourceInfo: SourceInfoSchema.optional(),
|
|
13003
|
+
/**
|
|
13004
|
+
* Set when this candidate is a device the provider ALREADY owns.
|
|
13005
|
+
*
|
|
13006
|
+
* A scan cannot generally produce the identity a device was onboarded under
|
|
13007
|
+
* (Reolink keys on `mac-<mac>`, learned at adopt time), so a stableId
|
|
13008
|
+
* comparison never matches and an owned device looks addable. Re-adopting one
|
|
13009
|
+
* overwrites its config with scan-derived values — that is how a Home Hub's
|
|
13010
|
+
* Baichuan port was overwritten with its ONVIF port, taking the hub and its
|
|
13011
|
+
* three child cameras offline for four hours.
|
|
13012
|
+
*
|
|
13013
|
+
* A provider that can recognise its own devices says so here. Absent means
|
|
13014
|
+
* "not recognised", which is not the same as "known to be new" — a provider
|
|
13015
|
+
* that cannot tell simply never sets it.
|
|
13016
|
+
*/
|
|
13017
|
+
alreadyOnboarded: boolean().optional(),
|
|
13018
|
+
/** Numeric id of the device this candidate was matched to. Set with `alreadyOnboarded`. */
|
|
13019
|
+
onboardedDeviceId: number().optional(),
|
|
13020
|
+
/** Operator-facing name of the matched device, so the UI can say WHICH one it is. */
|
|
13021
|
+
onboardedName: string().optional()
|
|
13003
13022
|
});
|
|
13004
13023
|
/**
|
|
13005
13024
|
* Flat device summary returned by `createDevice` / `adoptDiscoveredDevice`.
|
|
@@ -33254,6 +33273,22 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
33254
33273
|
* failed — logged at ERROR with `tags.deviceId` and surfaced via
|
|
33255
33274
|
* `getStatus().error`.
|
|
33256
33275
|
*/
|
|
33276
|
+
/**
|
|
33277
|
+
* Repair a row's PERSISTED config blob immediately before it is restored.
|
|
33278
|
+
* Default: no-op — most providers have nothing to heal.
|
|
33279
|
+
*
|
|
33280
|
+
* This exists because a restored device self-hydrates from the DB: `create()`
|
|
33281
|
+
* passes `{}` and `BaseDevice` parses the stored blob against the device
|
|
33282
|
+
* schema. A blob that lost a REQUIRED field therefore fails restore forever,
|
|
33283
|
+
* and no later pass revisits it — a hub-adopted Reolink camera whose blob had
|
|
33284
|
+
* been emptied failed all four bounded attempts against fields
|
|
33285
|
+
* (`host`, `password`) it inherits from its parent and never dials itself.
|
|
33286
|
+
*
|
|
33287
|
+
* Implementations get every saved row, so a child can read its parent's blob.
|
|
33288
|
+
* A heal that throws is treated like any other restore failure: retried under
|
|
33289
|
+
* the bound, then reported — never swallowed.
|
|
33290
|
+
*/
|
|
33291
|
+
async healSavedConfig(_saved, _allSaved) {}
|
|
33257
33292
|
async onRestoreDevices(savedDevices) {
|
|
33258
33293
|
const restored = /* @__PURE__ */ new Set();
|
|
33259
33294
|
const failures = [];
|
|
@@ -33262,6 +33297,7 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
33262
33297
|
const Class = this.deviceClasses[saved.type];
|
|
33263
33298
|
if (!Class) throw new Error(`no device class registered for type "${saved.type}"`);
|
|
33264
33299
|
if (saved.parentDeviceId !== null && !restored.has(saved.parentDeviceId)) throw new Error(`parent device ${saved.parentDeviceId} not restored`);
|
|
33300
|
+
await this.healSavedConfig(saved, savedDevices);
|
|
33265
33301
|
await this.ctx.kernel.devices.create(saved.stableId, Class, {}, saved.parentDeviceId);
|
|
33266
33302
|
restored.add(saved.id);
|
|
33267
33303
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/addon-import-alexa",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.61",
|
|
4
4
|
"description": "Alexa device-import provider for CamStack — imports the smart-home devices in a user's Alexa account via the unofficial alexa-remote2 cookie/token client (the inverse of the Alexa exporter)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"camstack",
|