@camstack/addon-provider-reolink 1.2.238 → 1.2.239
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 +6 -0
- package/dist/addon.js +33 -3
- package/dist/addon.mjs +33 -3
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.2.239] - 2026-11-11
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- A battery camera's own 0% read during a wake refresh, asleep, or on its adapter or panel no longer replaces the real level (no more false low-battery notifications)
|
|
15
|
+
|
|
10
16
|
## [1.2.238] - 2026-11-11
|
|
11
17
|
|
|
12
18
|
### Changed
|
package/dist/addon.js
CHANGED
|
@@ -211899,6 +211899,20 @@ function deriveChargingSource(adapterStatus, chargeStatus) {
|
|
|
211899
211899
|
function reportsPowerSource(info) {
|
|
211900
211900
|
return info.adapterStatus !== void 0 || info.chargeStatus !== void 0;
|
|
211901
211901
|
}
|
|
211902
|
+
/**
|
|
211903
|
+
* Whether a level the CAMERA itself reported (push or direct read) is a
|
|
211904
|
+
* MEASUREMENT (D393). A battery camera answering a read on the way in or out of
|
|
211905
|
+
* sleep, or while on mains or a panel, reports `0` as a placeholder — device
|
|
211906
|
+
* 3628 sat at 100% on its adapter and raised a low-battery notification on
|
|
211907
|
+
* every hourly wake. Those zeros are UNMEASURED: the caller keeps the last real
|
|
211908
|
+
* level. A `0` from an awake camera running on its cell alone (or of unknown
|
|
211909
|
+
* source) is a genuine empty cell and passes, as does every non-zero level.
|
|
211910
|
+
*/
|
|
211911
|
+
function isMeasuredCameraBatteryLevel(level, context) {
|
|
211912
|
+
if (level !== 0) return true;
|
|
211913
|
+
if (context.sleeping) return false;
|
|
211914
|
+
return context.charging !== "dc" && context.charging !== "solar";
|
|
211915
|
+
}
|
|
211902
211916
|
/** The settings key, per device. */
|
|
211903
211917
|
var BATTERY_REFRESH_MINUTES_KEY = "batteryRefreshMinutes";
|
|
211904
211918
|
/** How often the in-memory check runs. Costs nothing: no I/O unless it fires. */
|
|
@@ -218936,10 +218950,26 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
218936
218950
|
* tracker is more reliable.
|
|
218937
218951
|
*/
|
|
218938
218952
|
mapBatteryInfo(info) {
|
|
218953
|
+
const charging = reportsPowerSource(info) ? deriveChargingSource(info.adapterStatus, info.chargeStatus) : this.state.battery.charging ?? "unknown";
|
|
218954
|
+
const sleeping = info.sleeping === true || this.sleeping;
|
|
218955
|
+
const reported = typeof info.batteryPercent === "number" ? Math.max(0, Math.min(100, Math.round(info.batteryPercent))) : void 0;
|
|
218956
|
+
const measured = reported !== void 0 && isMeasuredCameraBatteryLevel(reported, {
|
|
218957
|
+
sleeping,
|
|
218958
|
+
charging
|
|
218959
|
+
});
|
|
218960
|
+
if (reported === 0) this.ctx.logger.info("battery read reporting 0", {
|
|
218961
|
+
tags: { deviceId: this.id },
|
|
218962
|
+
meta: {
|
|
218963
|
+
measured,
|
|
218964
|
+
sleeping,
|
|
218965
|
+
charging,
|
|
218966
|
+
raw: info
|
|
218967
|
+
}
|
|
218968
|
+
});
|
|
218939
218969
|
return {
|
|
218940
|
-
level:
|
|
218941
|
-
charging
|
|
218942
|
-
sleeping
|
|
218970
|
+
level: reported !== void 0 && measured ? reported : this.state.battery.level ?? null,
|
|
218971
|
+
charging,
|
|
218972
|
+
sleeping,
|
|
218943
218973
|
lastUpdated: Date.now()
|
|
218944
218974
|
};
|
|
218945
218975
|
}
|
package/dist/addon.mjs
CHANGED
|
@@ -211891,6 +211891,20 @@ function deriveChargingSource(adapterStatus, chargeStatus) {
|
|
|
211891
211891
|
function reportsPowerSource(info) {
|
|
211892
211892
|
return info.adapterStatus !== void 0 || info.chargeStatus !== void 0;
|
|
211893
211893
|
}
|
|
211894
|
+
/**
|
|
211895
|
+
* Whether a level the CAMERA itself reported (push or direct read) is a
|
|
211896
|
+
* MEASUREMENT (D393). A battery camera answering a read on the way in or out of
|
|
211897
|
+
* sleep, or while on mains or a panel, reports `0` as a placeholder — device
|
|
211898
|
+
* 3628 sat at 100% on its adapter and raised a low-battery notification on
|
|
211899
|
+
* every hourly wake. Those zeros are UNMEASURED: the caller keeps the last real
|
|
211900
|
+
* level. A `0` from an awake camera running on its cell alone (or of unknown
|
|
211901
|
+
* source) is a genuine empty cell and passes, as does every non-zero level.
|
|
211902
|
+
*/
|
|
211903
|
+
function isMeasuredCameraBatteryLevel(level, context) {
|
|
211904
|
+
if (level !== 0) return true;
|
|
211905
|
+
if (context.sleeping) return false;
|
|
211906
|
+
return context.charging !== "dc" && context.charging !== "solar";
|
|
211907
|
+
}
|
|
211894
211908
|
/** The settings key, per device. */
|
|
211895
211909
|
var BATTERY_REFRESH_MINUTES_KEY = "batteryRefreshMinutes";
|
|
211896
211910
|
/** How often the in-memory check runs. Costs nothing: no I/O unless it fires. */
|
|
@@ -218928,10 +218942,26 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
218928
218942
|
* tracker is more reliable.
|
|
218929
218943
|
*/
|
|
218930
218944
|
mapBatteryInfo(info) {
|
|
218945
|
+
const charging = reportsPowerSource(info) ? deriveChargingSource(info.adapterStatus, info.chargeStatus) : this.state.battery.charging ?? "unknown";
|
|
218946
|
+
const sleeping = info.sleeping === true || this.sleeping;
|
|
218947
|
+
const reported = typeof info.batteryPercent === "number" ? Math.max(0, Math.min(100, Math.round(info.batteryPercent))) : void 0;
|
|
218948
|
+
const measured = reported !== void 0 && isMeasuredCameraBatteryLevel(reported, {
|
|
218949
|
+
sleeping,
|
|
218950
|
+
charging
|
|
218951
|
+
});
|
|
218952
|
+
if (reported === 0) this.ctx.logger.info("battery read reporting 0", {
|
|
218953
|
+
tags: { deviceId: this.id },
|
|
218954
|
+
meta: {
|
|
218955
|
+
measured,
|
|
218956
|
+
sleeping,
|
|
218957
|
+
charging,
|
|
218958
|
+
raw: info
|
|
218959
|
+
}
|
|
218960
|
+
});
|
|
218931
218961
|
return {
|
|
218932
|
-
level:
|
|
218933
|
-
charging
|
|
218934
|
-
sleeping
|
|
218962
|
+
level: reported !== void 0 && measured ? reported : this.state.battery.level ?? null,
|
|
218963
|
+
charging,
|
|
218964
|
+
sleeping,
|
|
218935
218965
|
lastUpdated: Date.now()
|
|
218936
218966
|
};
|
|
218937
218967
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/addon-provider-reolink",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.239",
|
|
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.
|
|
99
|
+
"server": ">=1.2.840"
|
|
100
100
|
}
|
|
101
101
|
},
|
|
102
102
|
"files": [
|