@camstack/addon-provider-velux 0.2.60 → 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
|
@@ -12756,7 +12756,26 @@ var DiscoveryCandidateSchema = object({
|
|
|
12756
12756
|
* identity ahead of adoption. Rendering metadata (unit, precision)
|
|
12757
12757
|
* flows live through the cap STATUS SLICE after adoption.
|
|
12758
12758
|
*/
|
|
12759
|
-
sourceInfo: SourceInfoSchema.optional()
|
|
12759
|
+
sourceInfo: SourceInfoSchema.optional(),
|
|
12760
|
+
/**
|
|
12761
|
+
* Set when this candidate is a device the provider ALREADY owns.
|
|
12762
|
+
*
|
|
12763
|
+
* A scan cannot generally produce the identity a device was onboarded under
|
|
12764
|
+
* (Reolink keys on `mac-<mac>`, learned at adopt time), so a stableId
|
|
12765
|
+
* comparison never matches and an owned device looks addable. Re-adopting one
|
|
12766
|
+
* overwrites its config with scan-derived values — that is how a Home Hub's
|
|
12767
|
+
* Baichuan port was overwritten with its ONVIF port, taking the hub and its
|
|
12768
|
+
* three child cameras offline for four hours.
|
|
12769
|
+
*
|
|
12770
|
+
* A provider that can recognise its own devices says so here. Absent means
|
|
12771
|
+
* "not recognised", which is not the same as "known to be new" — a provider
|
|
12772
|
+
* that cannot tell simply never sets it.
|
|
12773
|
+
*/
|
|
12774
|
+
alreadyOnboarded: boolean().optional(),
|
|
12775
|
+
/** Numeric id of the device this candidate was matched to. Set with `alreadyOnboarded`. */
|
|
12776
|
+
onboardedDeviceId: number().optional(),
|
|
12777
|
+
/** Operator-facing name of the matched device, so the UI can say WHICH one it is. */
|
|
12778
|
+
onboardedName: string().optional()
|
|
12760
12779
|
});
|
|
12761
12780
|
/**
|
|
12762
12781
|
* Flat device summary returned by `createDevice` / `adoptDiscoveredDevice`.
|
|
@@ -32994,6 +33013,22 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
32994
33013
|
* failed — logged at ERROR with `tags.deviceId` and surfaced via
|
|
32995
33014
|
* `getStatus().error`.
|
|
32996
33015
|
*/
|
|
33016
|
+
/**
|
|
33017
|
+
* Repair a row's PERSISTED config blob immediately before it is restored.
|
|
33018
|
+
* Default: no-op — most providers have nothing to heal.
|
|
33019
|
+
*
|
|
33020
|
+
* This exists because a restored device self-hydrates from the DB: `create()`
|
|
33021
|
+
* passes `{}` and `BaseDevice` parses the stored blob against the device
|
|
33022
|
+
* schema. A blob that lost a REQUIRED field therefore fails restore forever,
|
|
33023
|
+
* and no later pass revisits it — a hub-adopted Reolink camera whose blob had
|
|
33024
|
+
* been emptied failed all four bounded attempts against fields
|
|
33025
|
+
* (`host`, `password`) it inherits from its parent and never dials itself.
|
|
33026
|
+
*
|
|
33027
|
+
* Implementations get every saved row, so a child can read its parent's blob.
|
|
33028
|
+
* A heal that throws is treated like any other restore failure: retried under
|
|
33029
|
+
* the bound, then reported — never swallowed.
|
|
33030
|
+
*/
|
|
33031
|
+
async healSavedConfig(_saved, _allSaved) {}
|
|
32997
33032
|
async onRestoreDevices(savedDevices) {
|
|
32998
33033
|
const restored = /* @__PURE__ */ new Set();
|
|
32999
33034
|
const failures = [];
|
|
@@ -33002,6 +33037,7 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
33002
33037
|
const Class = this.deviceClasses[saved.type];
|
|
33003
33038
|
if (!Class) throw new Error(`no device class registered for type "${saved.type}"`);
|
|
33004
33039
|
if (saved.parentDeviceId !== null && !restored.has(saved.parentDeviceId)) throw new Error(`parent device ${saved.parentDeviceId} not restored`);
|
|
33040
|
+
await this.healSavedConfig(saved, savedDevices);
|
|
33005
33041
|
await this.ctx.kernel.devices.create(saved.stableId, Class, {}, saved.parentDeviceId);
|
|
33006
33042
|
restored.add(saved.id);
|
|
33007
33043
|
};
|
package/dist/addon.mjs
CHANGED
|
@@ -12755,7 +12755,26 @@ var DiscoveryCandidateSchema = object({
|
|
|
12755
12755
|
* identity ahead of adoption. Rendering metadata (unit, precision)
|
|
12756
12756
|
* flows live through the cap STATUS SLICE after adoption.
|
|
12757
12757
|
*/
|
|
12758
|
-
sourceInfo: SourceInfoSchema.optional()
|
|
12758
|
+
sourceInfo: SourceInfoSchema.optional(),
|
|
12759
|
+
/**
|
|
12760
|
+
* Set when this candidate is a device the provider ALREADY owns.
|
|
12761
|
+
*
|
|
12762
|
+
* A scan cannot generally produce the identity a device was onboarded under
|
|
12763
|
+
* (Reolink keys on `mac-<mac>`, learned at adopt time), so a stableId
|
|
12764
|
+
* comparison never matches and an owned device looks addable. Re-adopting one
|
|
12765
|
+
* overwrites its config with scan-derived values — that is how a Home Hub's
|
|
12766
|
+
* Baichuan port was overwritten with its ONVIF port, taking the hub and its
|
|
12767
|
+
* three child cameras offline for four hours.
|
|
12768
|
+
*
|
|
12769
|
+
* A provider that can recognise its own devices says so here. Absent means
|
|
12770
|
+
* "not recognised", which is not the same as "known to be new" — a provider
|
|
12771
|
+
* that cannot tell simply never sets it.
|
|
12772
|
+
*/
|
|
12773
|
+
alreadyOnboarded: boolean().optional(),
|
|
12774
|
+
/** Numeric id of the device this candidate was matched to. Set with `alreadyOnboarded`. */
|
|
12775
|
+
onboardedDeviceId: number().optional(),
|
|
12776
|
+
/** Operator-facing name of the matched device, so the UI can say WHICH one it is. */
|
|
12777
|
+
onboardedName: string().optional()
|
|
12759
12778
|
});
|
|
12760
12779
|
/**
|
|
12761
12780
|
* Flat device summary returned by `createDevice` / `adoptDiscoveredDevice`.
|
|
@@ -32993,6 +33012,22 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
32993
33012
|
* failed — logged at ERROR with `tags.deviceId` and surfaced via
|
|
32994
33013
|
* `getStatus().error`.
|
|
32995
33014
|
*/
|
|
33015
|
+
/**
|
|
33016
|
+
* Repair a row's PERSISTED config blob immediately before it is restored.
|
|
33017
|
+
* Default: no-op — most providers have nothing to heal.
|
|
33018
|
+
*
|
|
33019
|
+
* This exists because a restored device self-hydrates from the DB: `create()`
|
|
33020
|
+
* passes `{}` and `BaseDevice` parses the stored blob against the device
|
|
33021
|
+
* schema. A blob that lost a REQUIRED field therefore fails restore forever,
|
|
33022
|
+
* and no later pass revisits it — a hub-adopted Reolink camera whose blob had
|
|
33023
|
+
* been emptied failed all four bounded attempts against fields
|
|
33024
|
+
* (`host`, `password`) it inherits from its parent and never dials itself.
|
|
33025
|
+
*
|
|
33026
|
+
* Implementations get every saved row, so a child can read its parent's blob.
|
|
33027
|
+
* A heal that throws is treated like any other restore failure: retried under
|
|
33028
|
+
* the bound, then reported — never swallowed.
|
|
33029
|
+
*/
|
|
33030
|
+
async healSavedConfig(_saved, _allSaved) {}
|
|
32996
33031
|
async onRestoreDevices(savedDevices) {
|
|
32997
33032
|
const restored = /* @__PURE__ */ new Set();
|
|
32998
33033
|
const failures = [];
|
|
@@ -33001,6 +33036,7 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
33001
33036
|
const Class = this.deviceClasses[saved.type];
|
|
33002
33037
|
if (!Class) throw new Error(`no device class registered for type "${saved.type}"`);
|
|
33003
33038
|
if (saved.parentDeviceId !== null && !restored.has(saved.parentDeviceId)) throw new Error(`parent device ${saved.parentDeviceId} not restored`);
|
|
33039
|
+
await this.healSavedConfig(saved, savedDevices);
|
|
33004
33040
|
await this.ctx.kernel.devices.create(saved.stableId, Class, {}, saved.parentDeviceId);
|
|
33005
33041
|
restored.add(saved.id);
|
|
33006
33042
|
};
|
package/package.json
CHANGED