@camstack/addon-provider-tuya 0.2.65 → 0.2.67
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 +31 -5
- package/dist/addon.mjs +31 -5
- package/package.json +1 -1
package/dist/addon.js
CHANGED
|
@@ -8373,7 +8373,8 @@ var CameraSwitchAuthoritySchema = discriminatedUnion("kind", [
|
|
|
8373
8373
|
var CameraSwitchUnavailableReasonSchema = _enum([
|
|
8374
8374
|
"no-provider",
|
|
8375
8375
|
"source-unreachable",
|
|
8376
|
-
"not-configured"
|
|
8376
|
+
"not-configured",
|
|
8377
|
+
"device-disabled"
|
|
8377
8378
|
]);
|
|
8378
8379
|
/**
|
|
8379
8380
|
* One switch, resolved for one camera.
|
|
@@ -24413,12 +24414,20 @@ var BatteryStatusSchema = object({
|
|
|
24413
24414
|
* Charging source. `'dc'` covers wall/USB adapters; `'solar'` is
|
|
24414
24415
|
* Reolink-specific for the Solar Panel 2 accessory (will become
|
|
24415
24416
|
* common on other battery cams). `'none'` means running on battery
|
|
24416
|
-
* alone.
|
|
24417
|
+
* alone — a NEGATIVE the firmware actually reported.
|
|
24418
|
+
*
|
|
24419
|
+
* `'unknown'` is the absence of an answer: the provider has not read the
|
|
24420
|
+
* power fields yet, or the firmware reported neither. Before it existed,
|
|
24421
|
+
* two unreadable fields produced `'none'`, and a camera nobody had reached
|
|
24422
|
+
* was drawn "on battery alone" — the same D315 defect `percentage` closed
|
|
24423
|
+
* by going nullable. Consumers SKIP it (no charger state published, no
|
|
24424
|
+
* glyph, no HomeKit ChargingState) rather than coerce it either way.
|
|
24417
24425
|
*/
|
|
24418
24426
|
charging: _enum([
|
|
24419
24427
|
"dc",
|
|
24420
24428
|
"solar",
|
|
24421
|
-
"none"
|
|
24429
|
+
"none",
|
|
24430
|
+
"unknown"
|
|
24422
24431
|
]),
|
|
24423
24432
|
/**
|
|
24424
24433
|
* True when the camera firmware has gone into low-power mode. Battery
|
|
@@ -24508,7 +24517,7 @@ onStatusChanged: { data: object({
|
|
|
24508
24517
|
kind: "push",
|
|
24509
24518
|
empty: {
|
|
24510
24519
|
percentage: 0,
|
|
24511
|
-
charging: "
|
|
24520
|
+
charging: "unknown",
|
|
24512
24521
|
sleeping: false,
|
|
24513
24522
|
lastUpdated: 0
|
|
24514
24523
|
}
|
|
@@ -33924,13 +33933,30 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
33924
33933
|
async onRestoreDevices(savedDevices) {
|
|
33925
33934
|
const restored = /* @__PURE__ */ new Set();
|
|
33926
33935
|
const failures = [];
|
|
33936
|
+
const liveStableIds = new Set((await this.ctx.kernel.devices.getAll()).map((device) => device.stableId));
|
|
33927
33937
|
const attemptRestore = async (saved) => {
|
|
33928
33938
|
if (restored.has(saved.id)) return;
|
|
33939
|
+
if (liveStableIds.has(saved.stableId)) {
|
|
33940
|
+
this.ctx.logger.debug("Restore row already live — not dialled again", { tags: {
|
|
33941
|
+
deviceId: saved.id,
|
|
33942
|
+
stableId: saved.stableId
|
|
33943
|
+
} });
|
|
33944
|
+
restored.add(saved.id);
|
|
33945
|
+
return;
|
|
33946
|
+
}
|
|
33929
33947
|
const Class = this.deviceClasses[saved.type];
|
|
33930
33948
|
if (!Class) throw new Error(`no device class registered for type "${saved.type}"`);
|
|
33931
33949
|
if (saved.parentDeviceId !== null && !restored.has(saved.parentDeviceId)) throw new Error(`parent device ${saved.parentDeviceId} not restored`);
|
|
33932
33950
|
await this.healSavedConfig(saved, savedDevices);
|
|
33933
|
-
|
|
33951
|
+
try {
|
|
33952
|
+
await this.ctx.kernel.devices.create(saved.stableId, Class, {}, saved.parentDeviceId);
|
|
33953
|
+
} catch (err) {
|
|
33954
|
+
if (!(await this.ctx.kernel.devices.getAll()).some((device) => device.stableId === saved.stableId)) throw err;
|
|
33955
|
+
this.ctx.logger.debug("Restore row came to life during its own dial — kept", { tags: {
|
|
33956
|
+
deviceId: saved.id,
|
|
33957
|
+
stableId: saved.stableId
|
|
33958
|
+
} });
|
|
33959
|
+
}
|
|
33934
33960
|
restored.add(saved.id);
|
|
33935
33961
|
};
|
|
33936
33962
|
const topLevel = savedDevices.filter((saved) => saved.parentDeviceId === null);
|
package/dist/addon.mjs
CHANGED
|
@@ -8372,7 +8372,8 @@ var CameraSwitchAuthoritySchema = discriminatedUnion("kind", [
|
|
|
8372
8372
|
var CameraSwitchUnavailableReasonSchema = _enum([
|
|
8373
8373
|
"no-provider",
|
|
8374
8374
|
"source-unreachable",
|
|
8375
|
-
"not-configured"
|
|
8375
|
+
"not-configured",
|
|
8376
|
+
"device-disabled"
|
|
8376
8377
|
]);
|
|
8377
8378
|
/**
|
|
8378
8379
|
* One switch, resolved for one camera.
|
|
@@ -24412,12 +24413,20 @@ var BatteryStatusSchema = object({
|
|
|
24412
24413
|
* Charging source. `'dc'` covers wall/USB adapters; `'solar'` is
|
|
24413
24414
|
* Reolink-specific for the Solar Panel 2 accessory (will become
|
|
24414
24415
|
* common on other battery cams). `'none'` means running on battery
|
|
24415
|
-
* alone.
|
|
24416
|
+
* alone — a NEGATIVE the firmware actually reported.
|
|
24417
|
+
*
|
|
24418
|
+
* `'unknown'` is the absence of an answer: the provider has not read the
|
|
24419
|
+
* power fields yet, or the firmware reported neither. Before it existed,
|
|
24420
|
+
* two unreadable fields produced `'none'`, and a camera nobody had reached
|
|
24421
|
+
* was drawn "on battery alone" — the same D315 defect `percentage` closed
|
|
24422
|
+
* by going nullable. Consumers SKIP it (no charger state published, no
|
|
24423
|
+
* glyph, no HomeKit ChargingState) rather than coerce it either way.
|
|
24416
24424
|
*/
|
|
24417
24425
|
charging: _enum([
|
|
24418
24426
|
"dc",
|
|
24419
24427
|
"solar",
|
|
24420
|
-
"none"
|
|
24428
|
+
"none",
|
|
24429
|
+
"unknown"
|
|
24421
24430
|
]),
|
|
24422
24431
|
/**
|
|
24423
24432
|
* True when the camera firmware has gone into low-power mode. Battery
|
|
@@ -24507,7 +24516,7 @@ onStatusChanged: { data: object({
|
|
|
24507
24516
|
kind: "push",
|
|
24508
24517
|
empty: {
|
|
24509
24518
|
percentage: 0,
|
|
24510
|
-
charging: "
|
|
24519
|
+
charging: "unknown",
|
|
24511
24520
|
sleeping: false,
|
|
24512
24521
|
lastUpdated: 0
|
|
24513
24522
|
}
|
|
@@ -33923,13 +33932,30 @@ var BaseDeviceProvider = class extends BaseAddon {
|
|
|
33923
33932
|
async onRestoreDevices(savedDevices) {
|
|
33924
33933
|
const restored = /* @__PURE__ */ new Set();
|
|
33925
33934
|
const failures = [];
|
|
33935
|
+
const liveStableIds = new Set((await this.ctx.kernel.devices.getAll()).map((device) => device.stableId));
|
|
33926
33936
|
const attemptRestore = async (saved) => {
|
|
33927
33937
|
if (restored.has(saved.id)) return;
|
|
33938
|
+
if (liveStableIds.has(saved.stableId)) {
|
|
33939
|
+
this.ctx.logger.debug("Restore row already live — not dialled again", { tags: {
|
|
33940
|
+
deviceId: saved.id,
|
|
33941
|
+
stableId: saved.stableId
|
|
33942
|
+
} });
|
|
33943
|
+
restored.add(saved.id);
|
|
33944
|
+
return;
|
|
33945
|
+
}
|
|
33928
33946
|
const Class = this.deviceClasses[saved.type];
|
|
33929
33947
|
if (!Class) throw new Error(`no device class registered for type "${saved.type}"`);
|
|
33930
33948
|
if (saved.parentDeviceId !== null && !restored.has(saved.parentDeviceId)) throw new Error(`parent device ${saved.parentDeviceId} not restored`);
|
|
33931
33949
|
await this.healSavedConfig(saved, savedDevices);
|
|
33932
|
-
|
|
33950
|
+
try {
|
|
33951
|
+
await this.ctx.kernel.devices.create(saved.stableId, Class, {}, saved.parentDeviceId);
|
|
33952
|
+
} catch (err) {
|
|
33953
|
+
if (!(await this.ctx.kernel.devices.getAll()).some((device) => device.stableId === saved.stableId)) throw err;
|
|
33954
|
+
this.ctx.logger.debug("Restore row came to life during its own dial — kept", { tags: {
|
|
33955
|
+
deviceId: saved.id,
|
|
33956
|
+
stableId: saved.stableId
|
|
33957
|
+
} });
|
|
33958
|
+
}
|
|
33933
33959
|
restored.add(saved.id);
|
|
33934
33960
|
};
|
|
33935
33961
|
const topLevel = savedDevices.filter((saved) => saved.parentDeviceId === null);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/addon-provider-tuya",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.67",
|
|
4
4
|
"description": "Tuya / Smart Life device-provider addon for CamStack — account-onboarded (Tuya IoT cloud fetch of device localKeys) + LOCAL DP control via the @apocaliss92/nodetuya encrypted-LAN client, exposing switch / water-heater-family kettle entities",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"camstack",
|