@camstack/addon-provider-reolink 1.2.248 → 1.2.250

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/CHANGELOG.md CHANGED
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.2.250] - 2026-11-20
11
+
12
+ ### Changed
13
+
14
+ - A Reolink battery camera that is being recorded or watched now stays awake: a firmware sleep notification no longer cuts its live stream while a consumer is attached
15
+
16
+ ## [1.2.249] - 2026-11-20
17
+
18
+ ### Changed
19
+
20
+ - Battery cameras report the charge state (charging, full, idle), battery voltage in volts, current and temperature when the firmware sends them
21
+
10
22
  ## [1.2.248] - 2026-11-19
11
23
 
12
24
  ### Changed
package/dist/addon.js CHANGED
@@ -106821,7 +106821,7 @@ var ZodIssueCode = {
106821
106821
  var ZodFirstPartyTypeKind;
106822
106822
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
106823
106823
  //#endregion
106824
- //#region ../types/dist/runtime-capabilities-ql3VRzQu.mjs
106824
+ //#region ../types/dist/runtime-capabilities-C0PIVXwH.mjs
106825
106825
  /**
106826
106826
  * The audio chunk plane's byte format, and the ONE expansion from a coded
106827
106827
  * window to float samples (D455).
@@ -121129,6 +121129,45 @@ var CAP_VOCABULARY_BY_NAME = {
121129
121129
  }
121130
121130
  ],
121131
121131
  icon: "battery-charging"
121132
+ },
121133
+ {
121134
+ kind: "enum",
121135
+ field: "chargeState",
121136
+ label: {
121137
+ en: "Charge state",
121138
+ it: "Stato di carica"
121139
+ },
121140
+ values: [
121141
+ {
121142
+ value: "charging",
121143
+ label: {
121144
+ en: "Charging",
121145
+ it: "In carica"
121146
+ }
121147
+ },
121148
+ {
121149
+ value: "full",
121150
+ label: {
121151
+ en: "Full",
121152
+ it: "Carica completa"
121153
+ }
121154
+ },
121155
+ {
121156
+ value: "idle",
121157
+ label: {
121158
+ en: "Not charging",
121159
+ it: "Non in carica"
121160
+ }
121161
+ },
121162
+ {
121163
+ value: "unknown",
121164
+ label: {
121165
+ en: "Unknown",
121166
+ it: "Sconosciuto"
121167
+ }
121168
+ }
121169
+ ],
121170
+ icon: "battery-charging"
121132
121171
  }
121133
121172
  ],
121134
121173
  events: { onStatusChanged: { notOperatorFacing: "the level / sleeping / charging state triggers each read one field of this change" } },
@@ -122319,6 +122358,24 @@ Object.freeze({
122319
122358
  "path": "voltage",
122320
122359
  "valueType": "number"
122321
122360
  },
122361
+ {
122362
+ "path": "chargeState",
122363
+ "valueType": "enum",
122364
+ "enumValues": [
122365
+ "charging",
122366
+ "full",
122367
+ "idle",
122368
+ "unknown"
122369
+ ]
122370
+ },
122371
+ {
122372
+ "path": "currentMa",
122373
+ "valueType": "number"
122374
+ },
122375
+ {
122376
+ "path": "temperatureC",
122377
+ "valueType": "number"
122378
+ },
122322
122379
  {
122323
122380
  "path": "lastContactAt",
122324
122381
  "valueType": "number"
@@ -124652,7 +124709,7 @@ function sleep(ms) {
124652
124709
  return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
124653
124710
  }
124654
124711
  //#endregion
124655
- //#region ../types/dist/implemented-methods-BUBqZ2a0.mjs
124712
+ //#region ../types/dist/implemented-methods-GRoJIvYs.mjs
124656
124713
  /**
124657
124714
  * The ffmpeg build every CamStack node downloads, per platform and arch.
124658
124715
  *
@@ -125655,6 +125712,19 @@ var HelperSpecSchema = discriminatedUnion("kind", [
125655
125712
  publishedProfiles: array(_enum(GRID_PROFILES)).max(3),
125656
125713
  cells: array(GridCellSpecSchema).max(16)
125657
125714
  }),
125715
+ object({
125716
+ kind: literal("crop"),
125717
+ source: CompositionSourceRefSchema,
125718
+ rect: GridRectSchema,
125719
+ aspect: _enum([
125720
+ "16:9",
125721
+ "4:3",
125722
+ "1:1",
125723
+ "free"
125724
+ ]),
125725
+ fps: number$1().int().min(1).max(60),
125726
+ publishedProfiles: array(_enum(GRID_PROFILES)).max(3)
125727
+ }),
125658
125728
  object({
125659
125729
  kind: literal("terminal"),
125660
125730
  terminalId: string().uuid()
@@ -157240,6 +157310,31 @@ var BatteryStatusSchema = object({
157240
157310
  */
157241
157311
  voltage: number$1().nullable().optional().meta(readingMeta("voltage", { label: "Voltage" })),
157242
157312
  /**
157313
+ * What the CELL is doing, as opposed to {@link charging} (what it is powered
157314
+ * from). `'charging'` takes current, `'full'` is connected and topped up,
157315
+ * `'idle'` is a stopped cell the firmware reported as such (running on the
157316
+ * battery, or an adapter that is not feeding it).
157317
+ *
157318
+ * Absent or `'unknown'` is NOT an answer: the provider has not read the
157319
+ * charge fields. It must never be coerced to `'idle'` (D315) — a camera
157320
+ * nobody reached would be drawn "not charging". Consumers SKIP it.
157321
+ */
157322
+ chargeState: _enum([
157323
+ "charging",
157324
+ "full",
157325
+ "idle",
157326
+ "unknown"
157327
+ ]).optional().meta({ label: "Charge state" }),
157328
+ /**
157329
+ * Battery current in milliamperes, as the firmware reports it (sign is the
157330
+ * firmware's). `null`/absent = not reported. Stored in mA, not the quantity
157331
+ * base (A), so it carries no reading quantity: a quantity would make the UI
157332
+ * convert and print it as amperes.
157333
+ */
157334
+ currentMa: number$1().nullable().optional().meta(readingMeta("none", { label: "Current (mA)" })),
157335
+ /** Battery temperature in °C. `null`/absent = not reported. */
157336
+ temperatureC: number$1().nullable().optional().meta(readingMeta("temperature", { label: "Temperature" })),
157337
+ /**
157243
157338
  * Ms epoch of the last time the device PROVED it was reachable — a
157244
157339
  * completed firmware round-trip, an observed wake, or an inbound push
157245
157340
  * (firmware event, email). `0`/absent = never since this slice was born.
@@ -157399,6 +157494,10 @@ onStatusChanged: {
157399
157494
  voltage: {
157400
157495
  kind: "gauge",
157401
157496
  unit: "V"
157497
+ },
157498
+ temperatureC: {
157499
+ kind: "gauge",
157500
+ unit: "°C"
157402
157501
  }
157403
157502
  } },
157404
157503
  customize: batteryCustomize,
@@ -157451,6 +157550,30 @@ onStatusChanged: {
157451
157550
  }
157452
157551
  ],
157453
157552
  icon: "battery-charging"
157553
+ },
157554
+ {
157555
+ kind: "enum",
157556
+ field: "chargeState",
157557
+ label: t("Charge state", "Stato di carica"),
157558
+ values: [
157559
+ {
157560
+ value: "charging",
157561
+ label: t("Charging", "In carica")
157562
+ },
157563
+ {
157564
+ value: "full",
157565
+ label: t("Full", "Carica completa")
157566
+ },
157567
+ {
157568
+ value: "idle",
157569
+ label: t("Not charging", "Non in carica")
157570
+ },
157571
+ {
157572
+ value: "unknown",
157573
+ label: t("Unknown", "Sconosciuto")
157574
+ }
157575
+ ],
157576
+ icon: "battery-charging"
157454
157577
  }
157455
157578
  ],
157456
157579
  extraEvents: [{
@@ -168251,6 +168374,12 @@ var energySystemCapability = {
168251
168374
  deadband: .05,
168252
168375
  displayName: "Stored energy"
168253
168376
  },
168377
+ "storage.capacityKwh": {
168378
+ kind: "gauge",
168379
+ unit: "kWh",
168380
+ deadband: .1,
168381
+ displayName: "Storage capacity"
168382
+ },
168254
168383
  "storage.powerW": {
168255
168384
  group: "power-flow",
168256
168385
  kind: "gauge",
@@ -216904,7 +217033,7 @@ DeviceFeature.BatteryOperated, DeviceFeature.Sleeps, derived("low-power-sleep",
216904
217033
  "startTalkSession",
216905
217034
  "pushTalkAudio",
216906
217035
  "endTalkSession"
216907
- ]), DeviceFeature.PanTiltZoom, derived("ptz"), DeviceFeature.PtzAutotrack, derived("ptz-autotrack"), DeviceFeature.MotionTrigger, derived("motion-trigger", ["setMotionTrigger"]), DeviceFeature.TimedRun, derived("timed-run", ["runFor"]), DeviceFeature.Switch, DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired, DeviceFeature.ClimateDualSetpoint, DeviceFeature.ClimateHumidity, DeviceFeature.ClimateFanMode, DeviceFeature.ClimatePreset, DeviceFeature.ClimateSwingVertical, DeviceFeature.ClimateSwingHorizontal, DeviceFeature.CoverPositionable, DeviceFeature.CoverTilt, DeviceFeature.CoverStoppable, DeviceFeature.ValvePositionable, DeviceFeature.FanSpeed, DeviceFeature.FanPreset, DeviceFeature.FanDirection, DeviceFeature.FanOscillating, DeviceFeature.LockOpen, DeviceFeature.MediaPlayerSeek, DeviceFeature.MediaPlayerVolume, DeviceFeature.MediaPlayerMute, DeviceFeature.MediaPlayerShuffle, DeviceFeature.MediaPlayerRepeat, DeviceFeature.MediaPlayerSelectSource, DeviceFeature.MediaPlayerPlayMedia, DeviceFeature.MediaPlayerNext, DeviceFeature.MediaPlayerPrevious, DeviceFeature.MediaPlayerStop, DeviceFeature.MediaPlayerVolumeStep, DeviceFeature.MediaPlayerChannelStep, DeviceFeature.MediaPlayerPower, DeviceFeature.PresenceGps, DeviceFeature.NotifierImage, DeviceFeature.NotifierPriority, DeviceFeature.NotifierData, DeviceFeature.NotifierActions, DeviceFeature.NotifierRecipients, DeviceFeature.ScriptVariables, DeviceFeature.AutomationSkipCondition, DeviceFeature.VacuumHasAi, DeviceFeature.MowerHasTargetedMowing, DeviceFeature.Navigation, derived("navigation"), DeviceFeature.NetworkLink, derived("network-link");
217036
+ ]), DeviceFeature.PanTiltZoom, derived("ptz"), DeviceFeature.PtzAutotrack, derived("ptz-autotrack"), DeviceFeature.MotionTrigger, derived("motion-trigger", ["setMotionTrigger"]), DeviceFeature.TimedRun, derived("timed-run", ["runFor"]), DeviceFeature.Switch, DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired, DeviceFeature.ClimateDualSetpoint, DeviceFeature.ClimateHumidity, DeviceFeature.ClimateFanMode, DeviceFeature.ClimatePreset, DeviceFeature.ClimateSwingVertical, DeviceFeature.ClimateSwingHorizontal, DeviceFeature.CoverPositionable, DeviceFeature.CoverTilt, DeviceFeature.CoverStoppable, DeviceFeature.ValvePositionable, derived("valve", ["setPosition"]), DeviceFeature.FanSpeed, DeviceFeature.FanPreset, DeviceFeature.FanDirection, DeviceFeature.FanOscillating, DeviceFeature.LockOpen, DeviceFeature.MediaPlayerSeek, DeviceFeature.MediaPlayerVolume, DeviceFeature.MediaPlayerMute, DeviceFeature.MediaPlayerShuffle, DeviceFeature.MediaPlayerRepeat, DeviceFeature.MediaPlayerSelectSource, DeviceFeature.MediaPlayerPlayMedia, DeviceFeature.MediaPlayerNext, DeviceFeature.MediaPlayerPrevious, DeviceFeature.MediaPlayerStop, DeviceFeature.MediaPlayerVolumeStep, DeviceFeature.MediaPlayerChannelStep, DeviceFeature.MediaPlayerPower, DeviceFeature.PresenceGps, DeviceFeature.NotifierImage, DeviceFeature.NotifierPriority, DeviceFeature.NotifierData, DeviceFeature.NotifierActions, DeviceFeature.NotifierRecipients, DeviceFeature.ScriptVariables, DeviceFeature.AutomationSkipCondition, DeviceFeature.VacuumHasAi, DeviceFeature.MowerHasTargetedMowing, DeviceFeature.Navigation, derived("navigation"), DeviceFeature.NetworkLink, derived("network-link");
216908
217037
  var ALL_FEATURES = Object.values(DeviceFeature);
216909
217038
  new Set(ALL_FEATURES);
216910
217039
  DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher;
@@ -228595,6 +228724,31 @@ function isMeasuredCameraBatteryLevel(level, context) {
228595
228724
  if (context.sleeping) return false;
228596
228725
  return context.charging !== "dc" && context.charging !== "solar";
228597
228726
  }
228727
+ /** What the cell is doing, from `chargeStatus`. Absent is `'unknown'`, never `'idle'` (D315). */
228728
+ function deriveChargeState(chargeStatus) {
228729
+ if (chargeStatus === void 0) return "unknown";
228730
+ switch (chargeStatus.toLowerCase()) {
228731
+ case "charging": return "charging";
228732
+ case "chargecomplete": return "full";
228733
+ case "none": return "idle";
228734
+ default: return "unknown";
228735
+ }
228736
+ }
228737
+ var finite = (n) => typeof n === "number" && Number.isFinite(n);
228738
+ /**
228739
+ * The cell state and the extra readings of one reading, over the previous
228740
+ * belief. A push that does not carry a field keeps what was known, the same
228741
+ * rule `level` and the power source apply, so a level-only push never turns a
228742
+ * known `'charging'` into `'unknown'` or a known temperature into nothing.
228743
+ */
228744
+ function mapBatteryReadings(info, previous) {
228745
+ return {
228746
+ chargeState: info.chargeStatus !== void 0 ? deriveChargeState(info.chargeStatus) : previous.chargeState ?? "unknown",
228747
+ voltage: finite(info.voltage) ? info.voltage / 1e3 : previous.voltage ?? null,
228748
+ currentMa: finite(info.current) ? info.current : previous.currentMa ?? null,
228749
+ temperatureC: finite(info.temperature) ? info.temperature : previous.temperatureC ?? null
228750
+ };
228751
+ }
228598
228752
  /** The settings key, per device. */
228599
228753
  var BATTERY_REFRESH_MINUTES_KEY = "batteryRefreshMinutes";
228600
228754
  /** How often the in-memory check runs. Costs nothing: no I/O unless it fires. */
@@ -230927,6 +231081,16 @@ function decideSleepCommit(input) {
230927
231081
  stampFirstHand: source !== "hub-reconcile"
230928
231082
  };
230929
231083
  }
231084
+ /**
231085
+ * A firmware `sleeping` push is ignored while a consumer (the recorder,
231086
+ * a live view) holds an RFC 4571 server on the camera. Teardown on that
231087
+ * push is what cut a recorded battery camera into 40–110 s gaps: the
231088
+ * broker only re-dialled ~20 s after we closed the stream. With no
231089
+ * consumer the push is acted on exactly as before.
231090
+ */
231091
+ function shouldIgnoreSleepPush(input) {
231092
+ return input.activeStreams > 0;
231093
+ }
230930
231094
  //#endregion
230931
231095
  //#region src/snapshot-wake-gate.ts
230932
231096
  /**
@@ -234640,6 +234804,8 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
234640
234804
  * `sleep-state-decision.ts` for the measurement (D603).
234641
234805
  */
234642
234806
  sleepStateChangedAt = 0;
234807
+ /** True once the 'sleep push ignored' line was logged for the current consumer-attached stretch. */
234808
+ sleepPushIgnoreLogged = false;
234643
234809
  /**
234644
234810
  * Wall-clock ms of the last PROACTIVE wake — one we issued on our own
234645
234811
  * initiative (background snapshot refresh), not because the operator
@@ -235941,7 +236107,8 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
235941
236107
  level: reported !== void 0 && measured ? reported : this.state.battery.level ?? null,
235942
236108
  charging,
235943
236109
  sleeping,
235944
- lastUpdated: Date.now()
236110
+ lastUpdated: Date.now(),
236111
+ ...mapBatteryReadings(info, this.state.battery)
235945
236112
  };
235946
236113
  }
235947
236114
  /**
@@ -236310,6 +236477,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
236310
236477
  ...this.state.battery,
236311
236478
  level: mapped.level,
236312
236479
  charging: mapped.charging,
236480
+ chargeState: mapped.chargeState,
236313
236481
  lastUpdated: Date.now()
236314
236482
  });
236315
236483
  }
@@ -242157,6 +242325,17 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
242157
242325
  return;
242158
242326
  }
242159
242327
  if (event.type === "sleeping") {
242328
+ if (this.isBattery && shouldIgnoreSleepPush({ activeStreams: this.active.size })) {
242329
+ if (!this.sleepPushIgnoreLogged) {
242330
+ this.sleepPushIgnoreLogged = true;
242331
+ this.ctx.logger.info(`sleep push ignored: ${this.active.size} active stream consumer(s)`, {
242332
+ tags: { deviceId: this.id },
242333
+ meta: { activeStreams: this.active.size }
242334
+ });
242335
+ }
242336
+ return;
242337
+ }
242338
+ this.sleepPushIgnoreLogged = false;
242160
242339
  const wasSleeping = this.sleeping;
242161
242340
  if (!this.commitSleepState(true, "simple-event")) return;
242162
242341
  if (!wasSleeping) this.ctx.eventBus.emit(createEvent(EventCategory.DeviceSleeping, eventSource, {
package/dist/addon.mjs CHANGED
@@ -106813,7 +106813,7 @@ var ZodIssueCode = {
106813
106813
  var ZodFirstPartyTypeKind;
106814
106814
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
106815
106815
  //#endregion
106816
- //#region ../types/dist/runtime-capabilities-ql3VRzQu.mjs
106816
+ //#region ../types/dist/runtime-capabilities-C0PIVXwH.mjs
106817
106817
  /**
106818
106818
  * The audio chunk plane's byte format, and the ONE expansion from a coded
106819
106819
  * window to float samples (D455).
@@ -121121,6 +121121,45 @@ var CAP_VOCABULARY_BY_NAME = {
121121
121121
  }
121122
121122
  ],
121123
121123
  icon: "battery-charging"
121124
+ },
121125
+ {
121126
+ kind: "enum",
121127
+ field: "chargeState",
121128
+ label: {
121129
+ en: "Charge state",
121130
+ it: "Stato di carica"
121131
+ },
121132
+ values: [
121133
+ {
121134
+ value: "charging",
121135
+ label: {
121136
+ en: "Charging",
121137
+ it: "In carica"
121138
+ }
121139
+ },
121140
+ {
121141
+ value: "full",
121142
+ label: {
121143
+ en: "Full",
121144
+ it: "Carica completa"
121145
+ }
121146
+ },
121147
+ {
121148
+ value: "idle",
121149
+ label: {
121150
+ en: "Not charging",
121151
+ it: "Non in carica"
121152
+ }
121153
+ },
121154
+ {
121155
+ value: "unknown",
121156
+ label: {
121157
+ en: "Unknown",
121158
+ it: "Sconosciuto"
121159
+ }
121160
+ }
121161
+ ],
121162
+ icon: "battery-charging"
121124
121163
  }
121125
121164
  ],
121126
121165
  events: { onStatusChanged: { notOperatorFacing: "the level / sleeping / charging state triggers each read one field of this change" } },
@@ -122311,6 +122350,24 @@ Object.freeze({
122311
122350
  "path": "voltage",
122312
122351
  "valueType": "number"
122313
122352
  },
122353
+ {
122354
+ "path": "chargeState",
122355
+ "valueType": "enum",
122356
+ "enumValues": [
122357
+ "charging",
122358
+ "full",
122359
+ "idle",
122360
+ "unknown"
122361
+ ]
122362
+ },
122363
+ {
122364
+ "path": "currentMa",
122365
+ "valueType": "number"
122366
+ },
122367
+ {
122368
+ "path": "temperatureC",
122369
+ "valueType": "number"
122370
+ },
122314
122371
  {
122315
122372
  "path": "lastContactAt",
122316
122373
  "valueType": "number"
@@ -124644,7 +124701,7 @@ function sleep(ms) {
124644
124701
  return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
124645
124702
  }
124646
124703
  //#endregion
124647
- //#region ../types/dist/implemented-methods-BUBqZ2a0.mjs
124704
+ //#region ../types/dist/implemented-methods-GRoJIvYs.mjs
124648
124705
  /**
124649
124706
  * The ffmpeg build every CamStack node downloads, per platform and arch.
124650
124707
  *
@@ -125647,6 +125704,19 @@ var HelperSpecSchema = discriminatedUnion("kind", [
125647
125704
  publishedProfiles: array(_enum(GRID_PROFILES)).max(3),
125648
125705
  cells: array(GridCellSpecSchema).max(16)
125649
125706
  }),
125707
+ object({
125708
+ kind: literal("crop"),
125709
+ source: CompositionSourceRefSchema,
125710
+ rect: GridRectSchema,
125711
+ aspect: _enum([
125712
+ "16:9",
125713
+ "4:3",
125714
+ "1:1",
125715
+ "free"
125716
+ ]),
125717
+ fps: number$1().int().min(1).max(60),
125718
+ publishedProfiles: array(_enum(GRID_PROFILES)).max(3)
125719
+ }),
125650
125720
  object({
125651
125721
  kind: literal("terminal"),
125652
125722
  terminalId: string().uuid()
@@ -157232,6 +157302,31 @@ var BatteryStatusSchema = object({
157232
157302
  */
157233
157303
  voltage: number$1().nullable().optional().meta(readingMeta("voltage", { label: "Voltage" })),
157234
157304
  /**
157305
+ * What the CELL is doing, as opposed to {@link charging} (what it is powered
157306
+ * from). `'charging'` takes current, `'full'` is connected and topped up,
157307
+ * `'idle'` is a stopped cell the firmware reported as such (running on the
157308
+ * battery, or an adapter that is not feeding it).
157309
+ *
157310
+ * Absent or `'unknown'` is NOT an answer: the provider has not read the
157311
+ * charge fields. It must never be coerced to `'idle'` (D315) — a camera
157312
+ * nobody reached would be drawn "not charging". Consumers SKIP it.
157313
+ */
157314
+ chargeState: _enum([
157315
+ "charging",
157316
+ "full",
157317
+ "idle",
157318
+ "unknown"
157319
+ ]).optional().meta({ label: "Charge state" }),
157320
+ /**
157321
+ * Battery current in milliamperes, as the firmware reports it (sign is the
157322
+ * firmware's). `null`/absent = not reported. Stored in mA, not the quantity
157323
+ * base (A), so it carries no reading quantity: a quantity would make the UI
157324
+ * convert and print it as amperes.
157325
+ */
157326
+ currentMa: number$1().nullable().optional().meta(readingMeta("none", { label: "Current (mA)" })),
157327
+ /** Battery temperature in °C. `null`/absent = not reported. */
157328
+ temperatureC: number$1().nullable().optional().meta(readingMeta("temperature", { label: "Temperature" })),
157329
+ /**
157235
157330
  * Ms epoch of the last time the device PROVED it was reachable — a
157236
157331
  * completed firmware round-trip, an observed wake, or an inbound push
157237
157332
  * (firmware event, email). `0`/absent = never since this slice was born.
@@ -157391,6 +157486,10 @@ onStatusChanged: {
157391
157486
  voltage: {
157392
157487
  kind: "gauge",
157393
157488
  unit: "V"
157489
+ },
157490
+ temperatureC: {
157491
+ kind: "gauge",
157492
+ unit: "°C"
157394
157493
  }
157395
157494
  } },
157396
157495
  customize: batteryCustomize,
@@ -157443,6 +157542,30 @@ onStatusChanged: {
157443
157542
  }
157444
157543
  ],
157445
157544
  icon: "battery-charging"
157545
+ },
157546
+ {
157547
+ kind: "enum",
157548
+ field: "chargeState",
157549
+ label: t("Charge state", "Stato di carica"),
157550
+ values: [
157551
+ {
157552
+ value: "charging",
157553
+ label: t("Charging", "In carica")
157554
+ },
157555
+ {
157556
+ value: "full",
157557
+ label: t("Full", "Carica completa")
157558
+ },
157559
+ {
157560
+ value: "idle",
157561
+ label: t("Not charging", "Non in carica")
157562
+ },
157563
+ {
157564
+ value: "unknown",
157565
+ label: t("Unknown", "Sconosciuto")
157566
+ }
157567
+ ],
157568
+ icon: "battery-charging"
157446
157569
  }
157447
157570
  ],
157448
157571
  extraEvents: [{
@@ -168243,6 +168366,12 @@ var energySystemCapability = {
168243
168366
  deadband: .05,
168244
168367
  displayName: "Stored energy"
168245
168368
  },
168369
+ "storage.capacityKwh": {
168370
+ kind: "gauge",
168371
+ unit: "kWh",
168372
+ deadband: .1,
168373
+ displayName: "Storage capacity"
168374
+ },
168246
168375
  "storage.powerW": {
168247
168376
  group: "power-flow",
168248
168377
  kind: "gauge",
@@ -216896,7 +217025,7 @@ DeviceFeature.BatteryOperated, DeviceFeature.Sleeps, derived("low-power-sleep",
216896
217025
  "startTalkSession",
216897
217026
  "pushTalkAudio",
216898
217027
  "endTalkSession"
216899
- ]), DeviceFeature.PanTiltZoom, derived("ptz"), DeviceFeature.PtzAutotrack, derived("ptz-autotrack"), DeviceFeature.MotionTrigger, derived("motion-trigger", ["setMotionTrigger"]), DeviceFeature.TimedRun, derived("timed-run", ["runFor"]), DeviceFeature.Switch, DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired, DeviceFeature.ClimateDualSetpoint, DeviceFeature.ClimateHumidity, DeviceFeature.ClimateFanMode, DeviceFeature.ClimatePreset, DeviceFeature.ClimateSwingVertical, DeviceFeature.ClimateSwingHorizontal, DeviceFeature.CoverPositionable, DeviceFeature.CoverTilt, DeviceFeature.CoverStoppable, DeviceFeature.ValvePositionable, DeviceFeature.FanSpeed, DeviceFeature.FanPreset, DeviceFeature.FanDirection, DeviceFeature.FanOscillating, DeviceFeature.LockOpen, DeviceFeature.MediaPlayerSeek, DeviceFeature.MediaPlayerVolume, DeviceFeature.MediaPlayerMute, DeviceFeature.MediaPlayerShuffle, DeviceFeature.MediaPlayerRepeat, DeviceFeature.MediaPlayerSelectSource, DeviceFeature.MediaPlayerPlayMedia, DeviceFeature.MediaPlayerNext, DeviceFeature.MediaPlayerPrevious, DeviceFeature.MediaPlayerStop, DeviceFeature.MediaPlayerVolumeStep, DeviceFeature.MediaPlayerChannelStep, DeviceFeature.MediaPlayerPower, DeviceFeature.PresenceGps, DeviceFeature.NotifierImage, DeviceFeature.NotifierPriority, DeviceFeature.NotifierData, DeviceFeature.NotifierActions, DeviceFeature.NotifierRecipients, DeviceFeature.ScriptVariables, DeviceFeature.AutomationSkipCondition, DeviceFeature.VacuumHasAi, DeviceFeature.MowerHasTargetedMowing, DeviceFeature.Navigation, derived("navigation"), DeviceFeature.NetworkLink, derived("network-link");
217028
+ ]), DeviceFeature.PanTiltZoom, derived("ptz"), DeviceFeature.PtzAutotrack, derived("ptz-autotrack"), DeviceFeature.MotionTrigger, derived("motion-trigger", ["setMotionTrigger"]), DeviceFeature.TimedRun, derived("timed-run", ["runFor"]), DeviceFeature.Switch, DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired, DeviceFeature.ClimateDualSetpoint, DeviceFeature.ClimateHumidity, DeviceFeature.ClimateFanMode, DeviceFeature.ClimatePreset, DeviceFeature.ClimateSwingVertical, DeviceFeature.ClimateSwingHorizontal, DeviceFeature.CoverPositionable, DeviceFeature.CoverTilt, DeviceFeature.CoverStoppable, DeviceFeature.ValvePositionable, derived("valve", ["setPosition"]), DeviceFeature.FanSpeed, DeviceFeature.FanPreset, DeviceFeature.FanDirection, DeviceFeature.FanOscillating, DeviceFeature.LockOpen, DeviceFeature.MediaPlayerSeek, DeviceFeature.MediaPlayerVolume, DeviceFeature.MediaPlayerMute, DeviceFeature.MediaPlayerShuffle, DeviceFeature.MediaPlayerRepeat, DeviceFeature.MediaPlayerSelectSource, DeviceFeature.MediaPlayerPlayMedia, DeviceFeature.MediaPlayerNext, DeviceFeature.MediaPlayerPrevious, DeviceFeature.MediaPlayerStop, DeviceFeature.MediaPlayerVolumeStep, DeviceFeature.MediaPlayerChannelStep, DeviceFeature.MediaPlayerPower, DeviceFeature.PresenceGps, DeviceFeature.NotifierImage, DeviceFeature.NotifierPriority, DeviceFeature.NotifierData, DeviceFeature.NotifierActions, DeviceFeature.NotifierRecipients, DeviceFeature.ScriptVariables, DeviceFeature.AutomationSkipCondition, DeviceFeature.VacuumHasAi, DeviceFeature.MowerHasTargetedMowing, DeviceFeature.Navigation, derived("navigation"), DeviceFeature.NetworkLink, derived("network-link");
216900
217029
  var ALL_FEATURES = Object.values(DeviceFeature);
216901
217030
  new Set(ALL_FEATURES);
216902
217031
  DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher;
@@ -228587,6 +228716,31 @@ function isMeasuredCameraBatteryLevel(level, context) {
228587
228716
  if (context.sleeping) return false;
228588
228717
  return context.charging !== "dc" && context.charging !== "solar";
228589
228718
  }
228719
+ /** What the cell is doing, from `chargeStatus`. Absent is `'unknown'`, never `'idle'` (D315). */
228720
+ function deriveChargeState(chargeStatus) {
228721
+ if (chargeStatus === void 0) return "unknown";
228722
+ switch (chargeStatus.toLowerCase()) {
228723
+ case "charging": return "charging";
228724
+ case "chargecomplete": return "full";
228725
+ case "none": return "idle";
228726
+ default: return "unknown";
228727
+ }
228728
+ }
228729
+ var finite = (n) => typeof n === "number" && Number.isFinite(n);
228730
+ /**
228731
+ * The cell state and the extra readings of one reading, over the previous
228732
+ * belief. A push that does not carry a field keeps what was known, the same
228733
+ * rule `level` and the power source apply, so a level-only push never turns a
228734
+ * known `'charging'` into `'unknown'` or a known temperature into nothing.
228735
+ */
228736
+ function mapBatteryReadings(info, previous) {
228737
+ return {
228738
+ chargeState: info.chargeStatus !== void 0 ? deriveChargeState(info.chargeStatus) : previous.chargeState ?? "unknown",
228739
+ voltage: finite(info.voltage) ? info.voltage / 1e3 : previous.voltage ?? null,
228740
+ currentMa: finite(info.current) ? info.current : previous.currentMa ?? null,
228741
+ temperatureC: finite(info.temperature) ? info.temperature : previous.temperatureC ?? null
228742
+ };
228743
+ }
228590
228744
  /** The settings key, per device. */
228591
228745
  var BATTERY_REFRESH_MINUTES_KEY = "batteryRefreshMinutes";
228592
228746
  /** How often the in-memory check runs. Costs nothing: no I/O unless it fires. */
@@ -230919,6 +231073,16 @@ function decideSleepCommit(input) {
230919
231073
  stampFirstHand: source !== "hub-reconcile"
230920
231074
  };
230921
231075
  }
231076
+ /**
231077
+ * A firmware `sleeping` push is ignored while a consumer (the recorder,
231078
+ * a live view) holds an RFC 4571 server on the camera. Teardown on that
231079
+ * push is what cut a recorded battery camera into 40–110 s gaps: the
231080
+ * broker only re-dialled ~20 s after we closed the stream. With no
231081
+ * consumer the push is acted on exactly as before.
231082
+ */
231083
+ function shouldIgnoreSleepPush(input) {
231084
+ return input.activeStreams > 0;
231085
+ }
230922
231086
  //#endregion
230923
231087
  //#region src/snapshot-wake-gate.ts
230924
231088
  /**
@@ -234632,6 +234796,8 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
234632
234796
  * `sleep-state-decision.ts` for the measurement (D603).
234633
234797
  */
234634
234798
  sleepStateChangedAt = 0;
234799
+ /** True once the 'sleep push ignored' line was logged for the current consumer-attached stretch. */
234800
+ sleepPushIgnoreLogged = false;
234635
234801
  /**
234636
234802
  * Wall-clock ms of the last PROACTIVE wake — one we issued on our own
234637
234803
  * initiative (background snapshot refresh), not because the operator
@@ -235933,7 +236099,8 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
235933
236099
  level: reported !== void 0 && measured ? reported : this.state.battery.level ?? null,
235934
236100
  charging,
235935
236101
  sleeping,
235936
- lastUpdated: Date.now()
236102
+ lastUpdated: Date.now(),
236103
+ ...mapBatteryReadings(info, this.state.battery)
235937
236104
  };
235938
236105
  }
235939
236106
  /**
@@ -236302,6 +236469,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
236302
236469
  ...this.state.battery,
236303
236470
  level: mapped.level,
236304
236471
  charging: mapped.charging,
236472
+ chargeState: mapped.chargeState,
236305
236473
  lastUpdated: Date.now()
236306
236474
  });
236307
236475
  }
@@ -242149,6 +242317,17 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
242149
242317
  return;
242150
242318
  }
242151
242319
  if (event.type === "sleeping") {
242320
+ if (this.isBattery && shouldIgnoreSleepPush({ activeStreams: this.active.size })) {
242321
+ if (!this.sleepPushIgnoreLogged) {
242322
+ this.sleepPushIgnoreLogged = true;
242323
+ this.ctx.logger.info(`sleep push ignored: ${this.active.size} active stream consumer(s)`, {
242324
+ tags: { deviceId: this.id },
242325
+ meta: { activeStreams: this.active.size }
242326
+ });
242327
+ }
242328
+ return;
242329
+ }
242330
+ this.sleepPushIgnoreLogged = false;
242152
242331
  const wasSleeping = this.sleeping;
242153
242332
  if (!this.commitSleepState(true, "simple-event")) return;
242154
242333
  if (!wasSleeping) this.ctx.eventBus.emit(createEvent(EventCategory.DeviceSleeping, eventSource, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-reolink",
3
- "version": "1.2.248",
3
+ "version": "1.2.250",
4
4
  "description": "Reolink camera device provider addon for CamStack — native Baichuan protocol",
5
5
  "keywords": [
6
6
  "camstack",
@@ -96,7 +96,7 @@
96
96
  "werift"
97
97
  ],
98
98
  "requires": {
99
- "server": ">=1.2.913"
99
+ "server": ">=1.2.917"
100
100
  }
101
101
  },
102
102
  "files": [