@camstack/addon-provider-tuya 0.2.65 → 0.2.66

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
@@ -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: "none",
24520
+ charging: "unknown",
24512
24521
  sleeping: false,
24513
24522
  lastUpdated: 0
24514
24523
  }
@@ -33924,8 +33933,17 @@ 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`);
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: "none",
24519
+ charging: "unknown",
24511
24520
  sleeping: false,
24512
24521
  lastUpdated: 0
24513
24522
  }
@@ -33923,8 +33932,17 @@ 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`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-tuya",
3
- "version": "0.2.65",
3
+ "version": "0.2.66",
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",