@camstack/addon-provider-reolink 1.2.251 → 1.2.252
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 +387 -150
- package/dist/addon.mjs +387 -150
- package/i18n/en.json +16 -1
- package/i18n/it.json +16 -1
- 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.252] - 2026-11-20
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Battery cameras get a Power source section: read whether the camera runs on the adapter or the battery, and switch between wired and battery power (dry-run first, read back after; only switch to wired power when the adapter meets the camera's spec).
|
|
15
|
+
|
|
10
16
|
## [1.2.251] - 2026-11-20
|
|
11
17
|
|
|
12
18
|
### Fixed
|
package/dist/addon.js
CHANGED
|
@@ -129610,6 +129610,16 @@ var RecordingBandTriggersSchema = RecordingTriggersSchema;
|
|
|
129610
129610
|
* question to answer as a continuous one.
|
|
129611
129611
|
*/
|
|
129612
129612
|
var RecordingBandAudioSchema = _enum(["on", "muted"]);
|
|
129613
|
+
/**
|
|
129614
|
+
* A battery condition on a band: the band covers a charge level only when
|
|
129615
|
+
* `min <= level < max` (half-open; a missing bound is unbounded). OPTIONAL —
|
|
129616
|
+
* an absent key means "any charge", which is what every config written before
|
|
129617
|
+
* it meant. A band WITH a condition is never met while the charge is unknown.
|
|
129618
|
+
*/
|
|
129619
|
+
var RecordingBandBatterySchema = object({
|
|
129620
|
+
min: number$1().min(0).max(100).optional(),
|
|
129621
|
+
max: number$1().min(0).max(100).optional()
|
|
129622
|
+
});
|
|
129613
129623
|
var RecordingBandSchema = object({
|
|
129614
129624
|
days: array(RecordingWeekdaySchema),
|
|
129615
129625
|
start: string().regex(HHMM),
|
|
@@ -129621,6 +129631,7 @@ var RecordingBandSchema = object({
|
|
|
129621
129631
|
* missing must keep meaning what it meant. See {@link RecordingBandAudioSchema}.
|
|
129622
129632
|
*/
|
|
129623
129633
|
audio: RecordingBandAudioSchema.optional(),
|
|
129634
|
+
battery: RecordingBandBatterySchema.optional(),
|
|
129624
129635
|
triggers: RecordingBandTriggersSchema.optional(),
|
|
129625
129636
|
/**
|
|
129626
129637
|
* RETIRED (D381). A band no longer carries a pre-buffer of its own.
|
|
@@ -162525,7 +162536,7 @@ var HISTORY_PRIMARY = {
|
|
|
162525
162536
|
}
|
|
162526
162537
|
};
|
|
162527
162538
|
DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired;
|
|
162528
|
-
var PowerSourceRefusalReasonSchema = _enum([
|
|
162539
|
+
var PowerSourceRefusalReasonSchema$1 = _enum([
|
|
162529
162540
|
"no-power-source",
|
|
162530
162541
|
"switch-missing",
|
|
162531
162542
|
"switch-offline",
|
|
@@ -162540,7 +162551,7 @@ var PowerSourceRefusalReasonSchema = _enum([
|
|
|
162540
162551
|
]);
|
|
162541
162552
|
var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
|
|
162542
162553
|
accepted: literal(false),
|
|
162543
|
-
reason: PowerSourceRefusalReasonSchema,
|
|
162554
|
+
reason: PowerSourceRefusalReasonSchema$1,
|
|
162544
162555
|
/** One line for the operator, naming the switch. */
|
|
162545
162556
|
message: string()
|
|
162546
162557
|
})]);
|
|
@@ -228571,46 +228582,6 @@ var IntercomFailureReport = class {
|
|
|
228571
228582
|
/** The process-wide instance every camera in this addon notes into. */
|
|
228572
228583
|
var intercomFailureReport = new IntercomFailureReport();
|
|
228573
228584
|
//#endregion
|
|
228574
|
-
//#region src/clips/clip-time-zone.ts
|
|
228575
|
-
function isUsableTimeZone(timeZone) {
|
|
228576
|
-
try {
|
|
228577
|
-
new Intl.DateTimeFormat("en-US", { timeZone });
|
|
228578
|
-
return true;
|
|
228579
|
-
} catch {
|
|
228580
|
-
return false;
|
|
228581
|
-
}
|
|
228582
|
-
}
|
|
228583
|
-
/**
|
|
228584
|
-
* @param candidate the zone the process reports
|
|
228585
|
-
* @param cameraZone a zone derived from the camera's reported UTC offset, if any
|
|
228586
|
-
*/
|
|
228587
|
-
function resolveClipTimeZone(candidate, cameraZone) {
|
|
228588
|
-
if (isUsableTimeZone(candidate)) return { timeZone: candidate };
|
|
228589
|
-
if (cameraZone !== void 0 && isUsableTimeZone(cameraZone)) return {
|
|
228590
|
-
timeZone: cameraZone,
|
|
228591
|
-
rejected: candidate
|
|
228592
|
-
};
|
|
228593
|
-
return {
|
|
228594
|
-
timeZone: "UTC",
|
|
228595
|
-
rejected: candidate
|
|
228596
|
-
};
|
|
228597
|
-
}
|
|
228598
|
-
/** Resolve and, when the candidate was refused, warn ONCE per `warned` holder. */
|
|
228599
|
-
function resolveClipTimeZoneOnce(candidate, cameraZone, logger, deviceId, warned) {
|
|
228600
|
-
const res = resolveClipTimeZone(candidate, cameraZone);
|
|
228601
|
-
if (res.rejected !== void 0 && !warned.done) {
|
|
228602
|
-
warned.done = true;
|
|
228603
|
-
logger.warn("clip catalog: the process time zone is not usable, using a fallback", {
|
|
228604
|
-
tags: { deviceId },
|
|
228605
|
-
meta: {
|
|
228606
|
-
rejectedTimeZone: res.rejected,
|
|
228607
|
-
fallbackTimeZone: res.timeZone
|
|
228608
|
-
}
|
|
228609
|
-
});
|
|
228610
|
-
}
|
|
228611
|
-
return res.timeZone;
|
|
228612
|
-
}
|
|
228613
|
-
//#endregion
|
|
228614
228585
|
//#region src/baichuan-webhook-shared.ts
|
|
228615
228586
|
/** The data-plane prefix this addon serves the camera push on: `/addon/<addonId>/webhook/<stableId>`. */
|
|
228616
228587
|
var BAICHUAN_WEBHOOK_PREFIX = "webhook";
|
|
@@ -229010,6 +228981,46 @@ async function refreshSnapshotCacheOnce(input) {
|
|
|
229010
228981
|
return true;
|
|
229011
228982
|
}
|
|
229012
228983
|
//#endregion
|
|
228984
|
+
//#region src/clips/clip-time-zone.ts
|
|
228985
|
+
function isUsableTimeZone(timeZone) {
|
|
228986
|
+
try {
|
|
228987
|
+
new Intl.DateTimeFormat("en-US", { timeZone });
|
|
228988
|
+
return true;
|
|
228989
|
+
} catch {
|
|
228990
|
+
return false;
|
|
228991
|
+
}
|
|
228992
|
+
}
|
|
228993
|
+
/**
|
|
228994
|
+
* @param candidate the zone the process reports
|
|
228995
|
+
* @param cameraZone a zone derived from the camera's reported UTC offset, if any
|
|
228996
|
+
*/
|
|
228997
|
+
function resolveClipTimeZone(candidate, cameraZone) {
|
|
228998
|
+
if (isUsableTimeZone(candidate)) return { timeZone: candidate };
|
|
228999
|
+
if (cameraZone !== void 0 && isUsableTimeZone(cameraZone)) return {
|
|
229000
|
+
timeZone: cameraZone,
|
|
229001
|
+
rejected: candidate
|
|
229002
|
+
};
|
|
229003
|
+
return {
|
|
229004
|
+
timeZone: "UTC",
|
|
229005
|
+
rejected: candidate
|
|
229006
|
+
};
|
|
229007
|
+
}
|
|
229008
|
+
/** Resolve and, when the candidate was refused, warn ONCE per `warned` holder. */
|
|
229009
|
+
function resolveClipTimeZoneOnce(candidate, cameraZone, logger, deviceId, warned) {
|
|
229010
|
+
const res = resolveClipTimeZone(candidate, cameraZone);
|
|
229011
|
+
if (res.rejected !== void 0 && !warned.done) {
|
|
229012
|
+
warned.done = true;
|
|
229013
|
+
logger.warn("clip catalog: the process time zone is not usable, using a fallback", {
|
|
229014
|
+
tags: { deviceId },
|
|
229015
|
+
meta: {
|
|
229016
|
+
rejectedTimeZone: res.rejected,
|
|
229017
|
+
fallbackTimeZone: res.timeZone
|
|
229018
|
+
}
|
|
229019
|
+
});
|
|
229020
|
+
}
|
|
229021
|
+
return res.timeZone;
|
|
229022
|
+
}
|
|
229023
|
+
//#endregion
|
|
229013
229024
|
//#region src/day-night-mapping.ts
|
|
229014
229025
|
/**
|
|
229015
229026
|
* Maps between the vendor-neutral `day-night` cap's `DayNightMode` and
|
|
@@ -229112,6 +229123,114 @@ function deriveReolinkCameraFeatures(inputs) {
|
|
|
229112
229123
|
return out;
|
|
229113
229124
|
}
|
|
229114
229125
|
//#endregion
|
|
229126
|
+
//#region src/hub-child-settings.ts
|
|
229127
|
+
/**
|
|
229128
|
+
* A camera adopted under an NVR / Home Hub dials through the integration's session: the address
|
|
229129
|
+
* and the credentials belong to the integration, never to the camera. These are the per-camera
|
|
229130
|
+
* keys a hub child must refuse to change.
|
|
229131
|
+
*/
|
|
229132
|
+
var HUB_CHILD_CONNECTION_KEYS = [
|
|
229133
|
+
"host",
|
|
229134
|
+
"port",
|
|
229135
|
+
"username",
|
|
229136
|
+
"password"
|
|
229137
|
+
];
|
|
229138
|
+
/**
|
|
229139
|
+
* Sections that act on the hub itself (no channel in the call) or on the per-camera connection,
|
|
229140
|
+
* hidden for a hub child:
|
|
229141
|
+
* - `connection`: the per-camera address and credentials (the integration owns them);
|
|
229142
|
+
* - `network-ports`: `setPortConfig` rewrites the NVR's own service ports;
|
|
229143
|
+
* - `time-ntp`: `setNtp` / `setSystemGeneral` / `setDst` rewrite the NVR's clock.
|
|
229144
|
+
*/
|
|
229145
|
+
var HUB_CHILD_HIDDEN_SECTION_IDS = [
|
|
229146
|
+
"connection",
|
|
229147
|
+
"network-ports",
|
|
229148
|
+
"time-ntp"
|
|
229149
|
+
];
|
|
229150
|
+
/** Thrown by `applySettingsPatch` for a refused hub-child patch; carries the typed reason. */
|
|
229151
|
+
var HubChildPatchRefusedError = class extends Error {
|
|
229152
|
+
refusal;
|
|
229153
|
+
constructor(refusal) {
|
|
229154
|
+
super(describeRefusal(refusal));
|
|
229155
|
+
this.refusal = refusal;
|
|
229156
|
+
this.name = "HubChildPatchRefusedError";
|
|
229157
|
+
}
|
|
229158
|
+
};
|
|
229159
|
+
function describeRefusal(refusal) {
|
|
229160
|
+
switch (refusal.reason) {
|
|
229161
|
+
case "connection-owned-by-integration": return `This camera is connected through its NVR / Home Hub integration: ${refusal.keys.join(", ")} can only be changed on the integration`;
|
|
229162
|
+
case "channel-not-an-integer": return `The hub channel must be a whole number, got ${String(refusal.value)}`;
|
|
229163
|
+
case "channel-out-of-range": return `Channel ${refusal.value} is not one of the hub's channels (${refusal.channels.join(", ")})`;
|
|
229164
|
+
}
|
|
229165
|
+
}
|
|
229166
|
+
/**
|
|
229167
|
+
* Judge a settings patch against the hub-child rules. `channels` is the hub's last good channel
|
|
229168
|
+
* list (empty when unknown — then only the integer rule applies).
|
|
229169
|
+
*/
|
|
229170
|
+
function judgeHubChildPatch(patch, channels) {
|
|
229171
|
+
const touched = HUB_CHILD_CONNECTION_KEYS.filter((k) => patch[k] !== void 0);
|
|
229172
|
+
if (touched.length > 0) return {
|
|
229173
|
+
reason: "connection-owned-by-integration",
|
|
229174
|
+
keys: touched
|
|
229175
|
+
};
|
|
229176
|
+
if (patch["channel"] === void 0) return null;
|
|
229177
|
+
const value = patch["channel"];
|
|
229178
|
+
if (typeof value !== "number" || !Number.isInteger(value) || value < 0) return {
|
|
229179
|
+
reason: "channel-not-an-integer",
|
|
229180
|
+
value
|
|
229181
|
+
};
|
|
229182
|
+
if (channels.length > 0 && !channels.includes(value)) return {
|
|
229183
|
+
reason: "channel-out-of-range",
|
|
229184
|
+
value,
|
|
229185
|
+
channels
|
|
229186
|
+
};
|
|
229187
|
+
return null;
|
|
229188
|
+
}
|
|
229189
|
+
/** What a hub child shows before its session has read the hub's channel list. */
|
|
229190
|
+
var EMPTY_HUB_CHANNEL_SNAPSHOT = {
|
|
229191
|
+
channels: [],
|
|
229192
|
+
lastRefreshAt: null,
|
|
229193
|
+
lastError: null
|
|
229194
|
+
};
|
|
229195
|
+
/** The hub-child "Hub" section: which hub, and the one editable connection field, the channel. */
|
|
229196
|
+
function buildHubChildSection(snapshot) {
|
|
229197
|
+
return {
|
|
229198
|
+
id: "hub",
|
|
229199
|
+
tab: "general",
|
|
229200
|
+
title: "Hub",
|
|
229201
|
+
titleKey: "provider-reolink:schema.s_hub.title",
|
|
229202
|
+
description: "This camera is connected through its NVR / Home Hub. Address and credentials belong to that integration; the channel is kept in line with the hub automatically.",
|
|
229203
|
+
descriptionKey: "provider-reolink:schema.s_hub.description",
|
|
229204
|
+
columns: 2,
|
|
229205
|
+
fields: [{
|
|
229206
|
+
type: "text",
|
|
229207
|
+
key: "hubName",
|
|
229208
|
+
label: "Connected to",
|
|
229209
|
+
labelKey: "provider-reolink:schema.s_hub.hubName.label",
|
|
229210
|
+
disabled: true
|
|
229211
|
+
}, {
|
|
229212
|
+
type: "number",
|
|
229213
|
+
key: "channel",
|
|
229214
|
+
label: "Hub channel",
|
|
229215
|
+
labelKey: "provider-reolink:schema.s_hub.channel.label",
|
|
229216
|
+
min: 0,
|
|
229217
|
+
...snapshot.channels.length > 0 ? { max: Math.max(...snapshot.channels.map((c) => c.channel)) } : {},
|
|
229218
|
+
step: 1
|
|
229219
|
+
}]
|
|
229220
|
+
};
|
|
229221
|
+
}
|
|
229222
|
+
/** Replace the connection/hub-acting sections of a standalone schema with the Hub section. */
|
|
229223
|
+
function applyHubChildSections(sections, snapshot) {
|
|
229224
|
+
const kept = sections.filter((s) => !HUB_CHILD_HIDDEN_SECTION_IDS.includes(s.id));
|
|
229225
|
+
const at = kept.findIndex((s) => s.id === "driver-refresh");
|
|
229226
|
+
const hub = buildHubChildSection(snapshot);
|
|
229227
|
+
return at < 0 ? [hub, ...kept] : [
|
|
229228
|
+
...kept.slice(0, at + 1),
|
|
229229
|
+
hub,
|
|
229230
|
+
...kept.slice(at + 1)
|
|
229231
|
+
];
|
|
229232
|
+
}
|
|
229233
|
+
//#endregion
|
|
229115
229234
|
//#region src/image-settings-mapping.ts
|
|
229116
229235
|
/**
|
|
229117
229236
|
* Reolink's `InputAdvanceCfg.Exposure.mode` (Baichuan cmdId 25/26, via
|
|
@@ -230898,114 +231017,6 @@ function registerHubChildStateRefresh(target) {
|
|
|
230898
231017
|
}, { stateRefresh: hubChildRefreshPolicy(integrationId) });
|
|
230899
231018
|
}
|
|
230900
231019
|
//#endregion
|
|
230901
|
-
//#region src/hub-child-settings.ts
|
|
230902
|
-
/**
|
|
230903
|
-
* A camera adopted under an NVR / Home Hub dials through the integration's session: the address
|
|
230904
|
-
* and the credentials belong to the integration, never to the camera. These are the per-camera
|
|
230905
|
-
* keys a hub child must refuse to change.
|
|
230906
|
-
*/
|
|
230907
|
-
var HUB_CHILD_CONNECTION_KEYS = [
|
|
230908
|
-
"host",
|
|
230909
|
-
"port",
|
|
230910
|
-
"username",
|
|
230911
|
-
"password"
|
|
230912
|
-
];
|
|
230913
|
-
/**
|
|
230914
|
-
* Sections that act on the hub itself (no channel in the call) or on the per-camera connection,
|
|
230915
|
-
* hidden for a hub child:
|
|
230916
|
-
* - `connection`: the per-camera address and credentials (the integration owns them);
|
|
230917
|
-
* - `network-ports`: `setPortConfig` rewrites the NVR's own service ports;
|
|
230918
|
-
* - `time-ntp`: `setNtp` / `setSystemGeneral` / `setDst` rewrite the NVR's clock.
|
|
230919
|
-
*/
|
|
230920
|
-
var HUB_CHILD_HIDDEN_SECTION_IDS = [
|
|
230921
|
-
"connection",
|
|
230922
|
-
"network-ports",
|
|
230923
|
-
"time-ntp"
|
|
230924
|
-
];
|
|
230925
|
-
/** Thrown by `applySettingsPatch` for a refused hub-child patch; carries the typed reason. */
|
|
230926
|
-
var HubChildPatchRefusedError = class extends Error {
|
|
230927
|
-
refusal;
|
|
230928
|
-
constructor(refusal) {
|
|
230929
|
-
super(describeRefusal(refusal));
|
|
230930
|
-
this.refusal = refusal;
|
|
230931
|
-
this.name = "HubChildPatchRefusedError";
|
|
230932
|
-
}
|
|
230933
|
-
};
|
|
230934
|
-
function describeRefusal(refusal) {
|
|
230935
|
-
switch (refusal.reason) {
|
|
230936
|
-
case "connection-owned-by-integration": return `This camera is connected through its NVR / Home Hub integration: ${refusal.keys.join(", ")} can only be changed on the integration`;
|
|
230937
|
-
case "channel-not-an-integer": return `The hub channel must be a whole number, got ${String(refusal.value)}`;
|
|
230938
|
-
case "channel-out-of-range": return `Channel ${refusal.value} is not one of the hub's channels (${refusal.channels.join(", ")})`;
|
|
230939
|
-
}
|
|
230940
|
-
}
|
|
230941
|
-
/**
|
|
230942
|
-
* Judge a settings patch against the hub-child rules. `channels` is the hub's last good channel
|
|
230943
|
-
* list (empty when unknown — then only the integer rule applies).
|
|
230944
|
-
*/
|
|
230945
|
-
function judgeHubChildPatch(patch, channels) {
|
|
230946
|
-
const touched = HUB_CHILD_CONNECTION_KEYS.filter((k) => patch[k] !== void 0);
|
|
230947
|
-
if (touched.length > 0) return {
|
|
230948
|
-
reason: "connection-owned-by-integration",
|
|
230949
|
-
keys: touched
|
|
230950
|
-
};
|
|
230951
|
-
if (patch["channel"] === void 0) return null;
|
|
230952
|
-
const value = patch["channel"];
|
|
230953
|
-
if (typeof value !== "number" || !Number.isInteger(value) || value < 0) return {
|
|
230954
|
-
reason: "channel-not-an-integer",
|
|
230955
|
-
value
|
|
230956
|
-
};
|
|
230957
|
-
if (channels.length > 0 && !channels.includes(value)) return {
|
|
230958
|
-
reason: "channel-out-of-range",
|
|
230959
|
-
value,
|
|
230960
|
-
channels
|
|
230961
|
-
};
|
|
230962
|
-
return null;
|
|
230963
|
-
}
|
|
230964
|
-
/** What a hub child shows before its session has read the hub's channel list. */
|
|
230965
|
-
var EMPTY_HUB_CHANNEL_SNAPSHOT = {
|
|
230966
|
-
channels: [],
|
|
230967
|
-
lastRefreshAt: null,
|
|
230968
|
-
lastError: null
|
|
230969
|
-
};
|
|
230970
|
-
/** The hub-child "Hub" section: which hub, and the one editable connection field, the channel. */
|
|
230971
|
-
function buildHubChildSection(snapshot) {
|
|
230972
|
-
return {
|
|
230973
|
-
id: "hub",
|
|
230974
|
-
tab: "general",
|
|
230975
|
-
title: "Hub",
|
|
230976
|
-
titleKey: "provider-reolink:schema.s_hub.title",
|
|
230977
|
-
description: "This camera is connected through its NVR / Home Hub. Address and credentials belong to that integration; the channel is kept in line with the hub automatically.",
|
|
230978
|
-
descriptionKey: "provider-reolink:schema.s_hub.description",
|
|
230979
|
-
columns: 2,
|
|
230980
|
-
fields: [{
|
|
230981
|
-
type: "text",
|
|
230982
|
-
key: "hubName",
|
|
230983
|
-
label: "Connected to",
|
|
230984
|
-
labelKey: "provider-reolink:schema.s_hub.hubName.label",
|
|
230985
|
-
disabled: true
|
|
230986
|
-
}, {
|
|
230987
|
-
type: "number",
|
|
230988
|
-
key: "channel",
|
|
230989
|
-
label: "Hub channel",
|
|
230990
|
-
labelKey: "provider-reolink:schema.s_hub.channel.label",
|
|
230991
|
-
min: 0,
|
|
230992
|
-
...snapshot.channels.length > 0 ? { max: Math.max(...snapshot.channels.map((c) => c.channel)) } : {},
|
|
230993
|
-
step: 1
|
|
230994
|
-
}]
|
|
230995
|
-
};
|
|
230996
|
-
}
|
|
230997
|
-
/** Replace the connection/hub-acting sections of a standalone schema with the Hub section. */
|
|
230998
|
-
function applyHubChildSections(sections, snapshot) {
|
|
230999
|
-
const kept = sections.filter((s) => !HUB_CHILD_HIDDEN_SECTION_IDS.includes(s.id));
|
|
231000
|
-
const at = kept.findIndex((s) => s.id === "driver-refresh");
|
|
231001
|
-
const hub = buildHubChildSection(snapshot);
|
|
231002
|
-
return at < 0 ? [hub, ...kept] : [
|
|
231003
|
-
...kept.slice(0, at + 1),
|
|
231004
|
-
hub,
|
|
231005
|
-
...kept.slice(at + 1)
|
|
231006
|
-
];
|
|
231007
|
-
}
|
|
231008
|
-
//#endregion
|
|
231009
231020
|
//#region src/sleep-state-decision.ts
|
|
231010
231021
|
/**
|
|
231011
231022
|
* Hysteresis is ASYMMETRIC, because the two directions have very different
|
|
@@ -233633,6 +233644,160 @@ function buildSupportedNativeClasses(aiDetectTypes, isSupportedClass) {
|
|
|
233633
233644
|
}
|
|
233634
233645
|
return classes;
|
|
233635
233646
|
}
|
|
233647
|
+
var PowerSourceModeSchema = _enum(["adapter", "battery"]);
|
|
233648
|
+
/** What a read says: a mode, or `unknown` when the read failed or the firmware is silent. */
|
|
233649
|
+
var PowerSourceReadingSchema = _enum([
|
|
233650
|
+
"adapter",
|
|
233651
|
+
"battery",
|
|
233652
|
+
"unknown"
|
|
233653
|
+
]);
|
|
233654
|
+
var ReadPowerSourceResultSchema = object({ source: PowerSourceReadingSchema });
|
|
233655
|
+
/** The device (or this code) declined before any real write was sent. */
|
|
233656
|
+
var PowerSourceRefusalReasonSchema = _enum(["dry-run-refused", "dry-run-failed"]);
|
|
233657
|
+
var SwitchPowerSourceResultSchema = discriminatedUnion("outcome", [
|
|
233658
|
+
object({
|
|
233659
|
+
outcome: literal("refused"),
|
|
233660
|
+
mode: PowerSourceModeSchema,
|
|
233661
|
+
reason: PowerSourceRefusalReasonSchema,
|
|
233662
|
+
before: PowerSourceReadingSchema
|
|
233663
|
+
}),
|
|
233664
|
+
object({
|
|
233665
|
+
outcome: literal("sent"),
|
|
233666
|
+
mode: PowerSourceModeSchema,
|
|
233667
|
+
/** The firmware accepted the command. NOT proof it took effect. */
|
|
233668
|
+
accepted: boolean(),
|
|
233669
|
+
before: PowerSourceReadingSchema,
|
|
233670
|
+
after: PowerSourceReadingSchema,
|
|
233671
|
+
/** True only when the read-back after the write equals the requested mode. */
|
|
233672
|
+
applied: boolean()
|
|
233673
|
+
}),
|
|
233674
|
+
object({
|
|
233675
|
+
outcome: literal("failed"),
|
|
233676
|
+
mode: PowerSourceModeSchema,
|
|
233677
|
+
/** The real write threw. It was sent once and is not retried. */
|
|
233678
|
+
error: string(),
|
|
233679
|
+
before: PowerSourceReadingSchema
|
|
233680
|
+
})
|
|
233681
|
+
]);
|
|
233682
|
+
function errorMessage(error) {
|
|
233683
|
+
return error instanceof Error ? error.message : String(error);
|
|
233684
|
+
}
|
|
233685
|
+
/** Read the power source; a failed or silent read is `unknown`. */
|
|
233686
|
+
async function readPowerSource(target) {
|
|
233687
|
+
const { api, channel, deviceId, logger } = target;
|
|
233688
|
+
try {
|
|
233689
|
+
const mode = await api.getPowerSource(channel);
|
|
233690
|
+
if (mode === void 0) {
|
|
233691
|
+
logger.info("power source: the firmware does not report it", {
|
|
233692
|
+
tags: { deviceId },
|
|
233693
|
+
meta: { channel }
|
|
233694
|
+
});
|
|
233695
|
+
return "unknown";
|
|
233696
|
+
}
|
|
233697
|
+
return mode;
|
|
233698
|
+
} catch (error) {
|
|
233699
|
+
logger.warn("power source: read failed, reporting unknown", {
|
|
233700
|
+
tags: { deviceId },
|
|
233701
|
+
meta: {
|
|
233702
|
+
channel,
|
|
233703
|
+
error: errorMessage(error)
|
|
233704
|
+
}
|
|
233705
|
+
});
|
|
233706
|
+
return "unknown";
|
|
233707
|
+
}
|
|
233708
|
+
}
|
|
233709
|
+
/**
|
|
233710
|
+
* Switch the power source: read, dry run, one real write, read back.
|
|
233711
|
+
* The write is sent at most once and never retried.
|
|
233712
|
+
*/
|
|
233713
|
+
async function switchPowerSourceTo(target, mode) {
|
|
233714
|
+
const { api, channel, deviceId, logger } = target;
|
|
233715
|
+
const before = await readPowerSource(target);
|
|
233716
|
+
logger.info("power source: switch requested", {
|
|
233717
|
+
tags: { deviceId },
|
|
233718
|
+
meta: {
|
|
233719
|
+
mode,
|
|
233720
|
+
before,
|
|
233721
|
+
channel
|
|
233722
|
+
}
|
|
233723
|
+
});
|
|
233724
|
+
let supported;
|
|
233725
|
+
try {
|
|
233726
|
+
supported = await api.probePowerSourceSwitchSupport(mode, { channel });
|
|
233727
|
+
} catch (error) {
|
|
233728
|
+
logger.warn("power source: dry run failed, no switch sent", {
|
|
233729
|
+
tags: { deviceId },
|
|
233730
|
+
meta: {
|
|
233731
|
+
mode,
|
|
233732
|
+
error: errorMessage(error)
|
|
233733
|
+
}
|
|
233734
|
+
});
|
|
233735
|
+
return {
|
|
233736
|
+
outcome: "refused",
|
|
233737
|
+
mode,
|
|
233738
|
+
reason: "dry-run-failed",
|
|
233739
|
+
before
|
|
233740
|
+
};
|
|
233741
|
+
}
|
|
233742
|
+
if (!supported) {
|
|
233743
|
+
logger.warn("power source: the device refused the dry run, no switch sent", {
|
|
233744
|
+
tags: { deviceId },
|
|
233745
|
+
meta: {
|
|
233746
|
+
mode,
|
|
233747
|
+
before
|
|
233748
|
+
}
|
|
233749
|
+
});
|
|
233750
|
+
return {
|
|
233751
|
+
outcome: "refused",
|
|
233752
|
+
mode,
|
|
233753
|
+
reason: "dry-run-refused",
|
|
233754
|
+
before
|
|
233755
|
+
};
|
|
233756
|
+
}
|
|
233757
|
+
let result;
|
|
233758
|
+
try {
|
|
233759
|
+
result = await api.switchPowerSource(mode, { channel });
|
|
233760
|
+
} catch (error) {
|
|
233761
|
+
logger.error("power source: the switch threw; it is not retried", {
|
|
233762
|
+
tags: { deviceId },
|
|
233763
|
+
meta: {
|
|
233764
|
+
mode,
|
|
233765
|
+
error: errorMessage(error)
|
|
233766
|
+
}
|
|
233767
|
+
});
|
|
233768
|
+
return {
|
|
233769
|
+
outcome: "failed",
|
|
233770
|
+
mode,
|
|
233771
|
+
error: errorMessage(error),
|
|
233772
|
+
before
|
|
233773
|
+
};
|
|
233774
|
+
}
|
|
233775
|
+
const after = await readPowerSource(target);
|
|
233776
|
+
const applied = result.accepted && after === mode;
|
|
233777
|
+
const meta = {
|
|
233778
|
+
mode,
|
|
233779
|
+
before,
|
|
233780
|
+
after,
|
|
233781
|
+
accepted: result.accepted,
|
|
233782
|
+
rspCode: result.rspCode
|
|
233783
|
+
};
|
|
233784
|
+
if (applied) logger.info("power source: switched", {
|
|
233785
|
+
tags: { deviceId },
|
|
233786
|
+
meta
|
|
233787
|
+
});
|
|
233788
|
+
else logger.warn("power source: the switch was sent but the read-back does not show it", {
|
|
233789
|
+
tags: { deviceId },
|
|
233790
|
+
meta
|
|
233791
|
+
});
|
|
233792
|
+
return {
|
|
233793
|
+
outcome: "sent",
|
|
233794
|
+
mode,
|
|
233795
|
+
accepted: result.accepted,
|
|
233796
|
+
before,
|
|
233797
|
+
after,
|
|
233798
|
+
applied
|
|
233799
|
+
};
|
|
233800
|
+
}
|
|
233636
233801
|
//#endregion
|
|
233637
233802
|
//#region src/ptz-zoom.ts
|
|
233638
233803
|
/**
|
|
@@ -234622,6 +234787,8 @@ var RefreshSettingsResultSchema = object({
|
|
|
234622
234787
|
capsWarmed: number$1(),
|
|
234623
234788
|
capsTotal: number$1()
|
|
234624
234789
|
});
|
|
234790
|
+
/** The two switch actions, one implementation each way. */
|
|
234791
|
+
var POWER_SWITCH_ACTIONS = [["switch-to-wired-power", "adapter"], ["switch-to-battery-power", "battery"]];
|
|
234625
234792
|
/** The uid out of a device's metadata bag, or nothing. Never a cast. */
|
|
234626
234793
|
function metaUid(metadata) {
|
|
234627
234794
|
if (metadata === null) return void 0;
|
|
@@ -236007,6 +236174,16 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
236007
236174
|
capsTotal
|
|
236008
236175
|
};
|
|
236009
236176
|
});
|
|
236177
|
+
if (this.isBattery) {
|
|
236178
|
+
this.registerDeviceAction("read-power-source", deviceCustomAction(unknown(), ReadPowerSourceResultSchema, { kind: "mutation" }), async () => {
|
|
236179
|
+
await this.wakeIfSleeping();
|
|
236180
|
+
return { source: await readPowerSource(await this.powerSourceTarget()) };
|
|
236181
|
+
});
|
|
236182
|
+
for (const [action, mode] of POWER_SWITCH_ACTIONS) this.registerDeviceAction(action, deviceCustomAction(unknown(), SwitchPowerSourceResultSchema, { kind: "mutation" }), async () => {
|
|
236183
|
+
await this.wakeIfSleeping();
|
|
236184
|
+
return switchPowerSourceTo(await this.powerSourceTarget(), mode);
|
|
236185
|
+
});
|
|
236186
|
+
}
|
|
236010
236187
|
this.registerDeviceAction("refresh-sessions", deviceCustomAction(unknown(), _void(), { kind: "mutation" }), async () => {
|
|
236011
236188
|
await this.refreshSessionsSnapshot();
|
|
236012
236189
|
});
|
|
@@ -236546,6 +236723,65 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
236546
236723
|
autoRefreshes: !this.isBattery
|
|
236547
236724
|
});
|
|
236548
236725
|
}
|
|
236726
|
+
/** The hub API for a child, the camera's own otherwise, plus the channel to address. */
|
|
236727
|
+
async powerSourceTarget() {
|
|
236728
|
+
return {
|
|
236729
|
+
api: await this.ensureApi(),
|
|
236730
|
+
channel: this.getChannel(),
|
|
236731
|
+
deviceId: this.id,
|
|
236732
|
+
logger: this.ctx.logger
|
|
236733
|
+
};
|
|
236734
|
+
}
|
|
236735
|
+
/**
|
|
236736
|
+
* Battery-cam power-source section (General tab): read the source, switch to
|
|
236737
|
+
* wired or back to battery. Returns `[]` for a wired-only camera. The buttons
|
|
236738
|
+
* dispatch the `read-power-source` / `switch-to-*-power` device actions.
|
|
236739
|
+
*/
|
|
236740
|
+
buildPowerSourceSection() {
|
|
236741
|
+
if (!this.isBattery) return [];
|
|
236742
|
+
const switchMessage = "Switch {outcome} · before: {before} · after: {after} · applied: {applied}";
|
|
236743
|
+
return [{
|
|
236744
|
+
id: "power-source",
|
|
236745
|
+
tab: "general",
|
|
236746
|
+
title: "Power source",
|
|
236747
|
+
titleKey: "provider-reolink:schema.s_power-source.title",
|
|
236748
|
+
description: "Only switch to wired power when the adapter meets the camera's spec.",
|
|
236749
|
+
descriptionKey: "provider-reolink:schema.s_power-source.description",
|
|
236750
|
+
columns: 1,
|
|
236751
|
+
fields: [
|
|
236752
|
+
{
|
|
236753
|
+
type: "device-action-button",
|
|
236754
|
+
key: "_readPowerSource",
|
|
236755
|
+
label: "Power source",
|
|
236756
|
+
labelKey: "provider-reolink:schema.s_power-source._readPowerSource.label",
|
|
236757
|
+
buttonLabel: "Read power source",
|
|
236758
|
+
action: "read-power-source",
|
|
236759
|
+
variant: "default",
|
|
236760
|
+
successMessage: "Power source: {source}"
|
|
236761
|
+
},
|
|
236762
|
+
{
|
|
236763
|
+
type: "device-action-button",
|
|
236764
|
+
key: "_switchToWiredPower",
|
|
236765
|
+
label: "Wired power",
|
|
236766
|
+
labelKey: "provider-reolink:schema.s_power-source._switchToWiredPower.label",
|
|
236767
|
+
buttonLabel: "Switch to wired power",
|
|
236768
|
+
action: "switch-to-wired-power",
|
|
236769
|
+
variant: "default",
|
|
236770
|
+
successMessage: switchMessage
|
|
236771
|
+
},
|
|
236772
|
+
{
|
|
236773
|
+
type: "device-action-button",
|
|
236774
|
+
key: "_switchToBatteryPower",
|
|
236775
|
+
label: "Battery power",
|
|
236776
|
+
labelKey: "provider-reolink:schema.s_power-source._switchToBatteryPower.label",
|
|
236777
|
+
buttonLabel: "Switch to battery power",
|
|
236778
|
+
action: "switch-to-battery-power",
|
|
236779
|
+
variant: "default",
|
|
236780
|
+
successMessage: switchMessage
|
|
236781
|
+
}
|
|
236782
|
+
]
|
|
236783
|
+
}];
|
|
236784
|
+
}
|
|
236549
236785
|
/**
|
|
236550
236786
|
* Battery-cam Email Push auto-configure section. Returns `[]` for any
|
|
236551
236787
|
* camera that wouldn't benefit (wired cams keep a live socket for
|
|
@@ -241458,6 +241694,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
241458
241694
|
}),
|
|
241459
241695
|
...this.buildSessionsTabSections(),
|
|
241460
241696
|
...this.buildEmailPushSection(),
|
|
241697
|
+
...this.buildPowerSourceSection(),
|
|
241461
241698
|
...this.buildEmailTabSections(),
|
|
241462
241699
|
...buildClipRefreshDeviceSection({
|
|
241463
241700
|
isHubChild: this.isHubChild(),
|
package/dist/addon.mjs
CHANGED
|
@@ -129602,6 +129602,16 @@ var RecordingBandTriggersSchema = RecordingTriggersSchema;
|
|
|
129602
129602
|
* question to answer as a continuous one.
|
|
129603
129603
|
*/
|
|
129604
129604
|
var RecordingBandAudioSchema = _enum(["on", "muted"]);
|
|
129605
|
+
/**
|
|
129606
|
+
* A battery condition on a band: the band covers a charge level only when
|
|
129607
|
+
* `min <= level < max` (half-open; a missing bound is unbounded). OPTIONAL —
|
|
129608
|
+
* an absent key means "any charge", which is what every config written before
|
|
129609
|
+
* it meant. A band WITH a condition is never met while the charge is unknown.
|
|
129610
|
+
*/
|
|
129611
|
+
var RecordingBandBatterySchema = object({
|
|
129612
|
+
min: number$1().min(0).max(100).optional(),
|
|
129613
|
+
max: number$1().min(0).max(100).optional()
|
|
129614
|
+
});
|
|
129605
129615
|
var RecordingBandSchema = object({
|
|
129606
129616
|
days: array(RecordingWeekdaySchema),
|
|
129607
129617
|
start: string().regex(HHMM),
|
|
@@ -129613,6 +129623,7 @@ var RecordingBandSchema = object({
|
|
|
129613
129623
|
* missing must keep meaning what it meant. See {@link RecordingBandAudioSchema}.
|
|
129614
129624
|
*/
|
|
129615
129625
|
audio: RecordingBandAudioSchema.optional(),
|
|
129626
|
+
battery: RecordingBandBatterySchema.optional(),
|
|
129616
129627
|
triggers: RecordingBandTriggersSchema.optional(),
|
|
129617
129628
|
/**
|
|
129618
129629
|
* RETIRED (D381). A band no longer carries a pre-buffer of its own.
|
|
@@ -162517,7 +162528,7 @@ var HISTORY_PRIMARY = {
|
|
|
162517
162528
|
}
|
|
162518
162529
|
};
|
|
162519
162530
|
DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired;
|
|
162520
|
-
var PowerSourceRefusalReasonSchema = _enum([
|
|
162531
|
+
var PowerSourceRefusalReasonSchema$1 = _enum([
|
|
162521
162532
|
"no-power-source",
|
|
162522
162533
|
"switch-missing",
|
|
162523
162534
|
"switch-offline",
|
|
@@ -162532,7 +162543,7 @@ var PowerSourceRefusalReasonSchema = _enum([
|
|
|
162532
162543
|
]);
|
|
162533
162544
|
var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
|
|
162534
162545
|
accepted: literal(false),
|
|
162535
|
-
reason: PowerSourceRefusalReasonSchema,
|
|
162546
|
+
reason: PowerSourceRefusalReasonSchema$1,
|
|
162536
162547
|
/** One line for the operator, naming the switch. */
|
|
162537
162548
|
message: string()
|
|
162538
162549
|
})]);
|
|
@@ -228563,46 +228574,6 @@ var IntercomFailureReport = class {
|
|
|
228563
228574
|
/** The process-wide instance every camera in this addon notes into. */
|
|
228564
228575
|
var intercomFailureReport = new IntercomFailureReport();
|
|
228565
228576
|
//#endregion
|
|
228566
|
-
//#region src/clips/clip-time-zone.ts
|
|
228567
|
-
function isUsableTimeZone(timeZone) {
|
|
228568
|
-
try {
|
|
228569
|
-
new Intl.DateTimeFormat("en-US", { timeZone });
|
|
228570
|
-
return true;
|
|
228571
|
-
} catch {
|
|
228572
|
-
return false;
|
|
228573
|
-
}
|
|
228574
|
-
}
|
|
228575
|
-
/**
|
|
228576
|
-
* @param candidate the zone the process reports
|
|
228577
|
-
* @param cameraZone a zone derived from the camera's reported UTC offset, if any
|
|
228578
|
-
*/
|
|
228579
|
-
function resolveClipTimeZone(candidate, cameraZone) {
|
|
228580
|
-
if (isUsableTimeZone(candidate)) return { timeZone: candidate };
|
|
228581
|
-
if (cameraZone !== void 0 && isUsableTimeZone(cameraZone)) return {
|
|
228582
|
-
timeZone: cameraZone,
|
|
228583
|
-
rejected: candidate
|
|
228584
|
-
};
|
|
228585
|
-
return {
|
|
228586
|
-
timeZone: "UTC",
|
|
228587
|
-
rejected: candidate
|
|
228588
|
-
};
|
|
228589
|
-
}
|
|
228590
|
-
/** Resolve and, when the candidate was refused, warn ONCE per `warned` holder. */
|
|
228591
|
-
function resolveClipTimeZoneOnce(candidate, cameraZone, logger, deviceId, warned) {
|
|
228592
|
-
const res = resolveClipTimeZone(candidate, cameraZone);
|
|
228593
|
-
if (res.rejected !== void 0 && !warned.done) {
|
|
228594
|
-
warned.done = true;
|
|
228595
|
-
logger.warn("clip catalog: the process time zone is not usable, using a fallback", {
|
|
228596
|
-
tags: { deviceId },
|
|
228597
|
-
meta: {
|
|
228598
|
-
rejectedTimeZone: res.rejected,
|
|
228599
|
-
fallbackTimeZone: res.timeZone
|
|
228600
|
-
}
|
|
228601
|
-
});
|
|
228602
|
-
}
|
|
228603
|
-
return res.timeZone;
|
|
228604
|
-
}
|
|
228605
|
-
//#endregion
|
|
228606
228577
|
//#region src/baichuan-webhook-shared.ts
|
|
228607
228578
|
/** The data-plane prefix this addon serves the camera push on: `/addon/<addonId>/webhook/<stableId>`. */
|
|
228608
228579
|
var BAICHUAN_WEBHOOK_PREFIX = "webhook";
|
|
@@ -229002,6 +228973,46 @@ async function refreshSnapshotCacheOnce(input) {
|
|
|
229002
228973
|
return true;
|
|
229003
228974
|
}
|
|
229004
228975
|
//#endregion
|
|
228976
|
+
//#region src/clips/clip-time-zone.ts
|
|
228977
|
+
function isUsableTimeZone(timeZone) {
|
|
228978
|
+
try {
|
|
228979
|
+
new Intl.DateTimeFormat("en-US", { timeZone });
|
|
228980
|
+
return true;
|
|
228981
|
+
} catch {
|
|
228982
|
+
return false;
|
|
228983
|
+
}
|
|
228984
|
+
}
|
|
228985
|
+
/**
|
|
228986
|
+
* @param candidate the zone the process reports
|
|
228987
|
+
* @param cameraZone a zone derived from the camera's reported UTC offset, if any
|
|
228988
|
+
*/
|
|
228989
|
+
function resolveClipTimeZone(candidate, cameraZone) {
|
|
228990
|
+
if (isUsableTimeZone(candidate)) return { timeZone: candidate };
|
|
228991
|
+
if (cameraZone !== void 0 && isUsableTimeZone(cameraZone)) return {
|
|
228992
|
+
timeZone: cameraZone,
|
|
228993
|
+
rejected: candidate
|
|
228994
|
+
};
|
|
228995
|
+
return {
|
|
228996
|
+
timeZone: "UTC",
|
|
228997
|
+
rejected: candidate
|
|
228998
|
+
};
|
|
228999
|
+
}
|
|
229000
|
+
/** Resolve and, when the candidate was refused, warn ONCE per `warned` holder. */
|
|
229001
|
+
function resolveClipTimeZoneOnce(candidate, cameraZone, logger, deviceId, warned) {
|
|
229002
|
+
const res = resolveClipTimeZone(candidate, cameraZone);
|
|
229003
|
+
if (res.rejected !== void 0 && !warned.done) {
|
|
229004
|
+
warned.done = true;
|
|
229005
|
+
logger.warn("clip catalog: the process time zone is not usable, using a fallback", {
|
|
229006
|
+
tags: { deviceId },
|
|
229007
|
+
meta: {
|
|
229008
|
+
rejectedTimeZone: res.rejected,
|
|
229009
|
+
fallbackTimeZone: res.timeZone
|
|
229010
|
+
}
|
|
229011
|
+
});
|
|
229012
|
+
}
|
|
229013
|
+
return res.timeZone;
|
|
229014
|
+
}
|
|
229015
|
+
//#endregion
|
|
229005
229016
|
//#region src/day-night-mapping.ts
|
|
229006
229017
|
/**
|
|
229007
229018
|
* Maps between the vendor-neutral `day-night` cap's `DayNightMode` and
|
|
@@ -229104,6 +229115,114 @@ function deriveReolinkCameraFeatures(inputs) {
|
|
|
229104
229115
|
return out;
|
|
229105
229116
|
}
|
|
229106
229117
|
//#endregion
|
|
229118
|
+
//#region src/hub-child-settings.ts
|
|
229119
|
+
/**
|
|
229120
|
+
* A camera adopted under an NVR / Home Hub dials through the integration's session: the address
|
|
229121
|
+
* and the credentials belong to the integration, never to the camera. These are the per-camera
|
|
229122
|
+
* keys a hub child must refuse to change.
|
|
229123
|
+
*/
|
|
229124
|
+
var HUB_CHILD_CONNECTION_KEYS = [
|
|
229125
|
+
"host",
|
|
229126
|
+
"port",
|
|
229127
|
+
"username",
|
|
229128
|
+
"password"
|
|
229129
|
+
];
|
|
229130
|
+
/**
|
|
229131
|
+
* Sections that act on the hub itself (no channel in the call) or on the per-camera connection,
|
|
229132
|
+
* hidden for a hub child:
|
|
229133
|
+
* - `connection`: the per-camera address and credentials (the integration owns them);
|
|
229134
|
+
* - `network-ports`: `setPortConfig` rewrites the NVR's own service ports;
|
|
229135
|
+
* - `time-ntp`: `setNtp` / `setSystemGeneral` / `setDst` rewrite the NVR's clock.
|
|
229136
|
+
*/
|
|
229137
|
+
var HUB_CHILD_HIDDEN_SECTION_IDS = [
|
|
229138
|
+
"connection",
|
|
229139
|
+
"network-ports",
|
|
229140
|
+
"time-ntp"
|
|
229141
|
+
];
|
|
229142
|
+
/** Thrown by `applySettingsPatch` for a refused hub-child patch; carries the typed reason. */
|
|
229143
|
+
var HubChildPatchRefusedError = class extends Error {
|
|
229144
|
+
refusal;
|
|
229145
|
+
constructor(refusal) {
|
|
229146
|
+
super(describeRefusal(refusal));
|
|
229147
|
+
this.refusal = refusal;
|
|
229148
|
+
this.name = "HubChildPatchRefusedError";
|
|
229149
|
+
}
|
|
229150
|
+
};
|
|
229151
|
+
function describeRefusal(refusal) {
|
|
229152
|
+
switch (refusal.reason) {
|
|
229153
|
+
case "connection-owned-by-integration": return `This camera is connected through its NVR / Home Hub integration: ${refusal.keys.join(", ")} can only be changed on the integration`;
|
|
229154
|
+
case "channel-not-an-integer": return `The hub channel must be a whole number, got ${String(refusal.value)}`;
|
|
229155
|
+
case "channel-out-of-range": return `Channel ${refusal.value} is not one of the hub's channels (${refusal.channels.join(", ")})`;
|
|
229156
|
+
}
|
|
229157
|
+
}
|
|
229158
|
+
/**
|
|
229159
|
+
* Judge a settings patch against the hub-child rules. `channels` is the hub's last good channel
|
|
229160
|
+
* list (empty when unknown — then only the integer rule applies).
|
|
229161
|
+
*/
|
|
229162
|
+
function judgeHubChildPatch(patch, channels) {
|
|
229163
|
+
const touched = HUB_CHILD_CONNECTION_KEYS.filter((k) => patch[k] !== void 0);
|
|
229164
|
+
if (touched.length > 0) return {
|
|
229165
|
+
reason: "connection-owned-by-integration",
|
|
229166
|
+
keys: touched
|
|
229167
|
+
};
|
|
229168
|
+
if (patch["channel"] === void 0) return null;
|
|
229169
|
+
const value = patch["channel"];
|
|
229170
|
+
if (typeof value !== "number" || !Number.isInteger(value) || value < 0) return {
|
|
229171
|
+
reason: "channel-not-an-integer",
|
|
229172
|
+
value
|
|
229173
|
+
};
|
|
229174
|
+
if (channels.length > 0 && !channels.includes(value)) return {
|
|
229175
|
+
reason: "channel-out-of-range",
|
|
229176
|
+
value,
|
|
229177
|
+
channels
|
|
229178
|
+
};
|
|
229179
|
+
return null;
|
|
229180
|
+
}
|
|
229181
|
+
/** What a hub child shows before its session has read the hub's channel list. */
|
|
229182
|
+
var EMPTY_HUB_CHANNEL_SNAPSHOT = {
|
|
229183
|
+
channels: [],
|
|
229184
|
+
lastRefreshAt: null,
|
|
229185
|
+
lastError: null
|
|
229186
|
+
};
|
|
229187
|
+
/** The hub-child "Hub" section: which hub, and the one editable connection field, the channel. */
|
|
229188
|
+
function buildHubChildSection(snapshot) {
|
|
229189
|
+
return {
|
|
229190
|
+
id: "hub",
|
|
229191
|
+
tab: "general",
|
|
229192
|
+
title: "Hub",
|
|
229193
|
+
titleKey: "provider-reolink:schema.s_hub.title",
|
|
229194
|
+
description: "This camera is connected through its NVR / Home Hub. Address and credentials belong to that integration; the channel is kept in line with the hub automatically.",
|
|
229195
|
+
descriptionKey: "provider-reolink:schema.s_hub.description",
|
|
229196
|
+
columns: 2,
|
|
229197
|
+
fields: [{
|
|
229198
|
+
type: "text",
|
|
229199
|
+
key: "hubName",
|
|
229200
|
+
label: "Connected to",
|
|
229201
|
+
labelKey: "provider-reolink:schema.s_hub.hubName.label",
|
|
229202
|
+
disabled: true
|
|
229203
|
+
}, {
|
|
229204
|
+
type: "number",
|
|
229205
|
+
key: "channel",
|
|
229206
|
+
label: "Hub channel",
|
|
229207
|
+
labelKey: "provider-reolink:schema.s_hub.channel.label",
|
|
229208
|
+
min: 0,
|
|
229209
|
+
...snapshot.channels.length > 0 ? { max: Math.max(...snapshot.channels.map((c) => c.channel)) } : {},
|
|
229210
|
+
step: 1
|
|
229211
|
+
}]
|
|
229212
|
+
};
|
|
229213
|
+
}
|
|
229214
|
+
/** Replace the connection/hub-acting sections of a standalone schema with the Hub section. */
|
|
229215
|
+
function applyHubChildSections(sections, snapshot) {
|
|
229216
|
+
const kept = sections.filter((s) => !HUB_CHILD_HIDDEN_SECTION_IDS.includes(s.id));
|
|
229217
|
+
const at = kept.findIndex((s) => s.id === "driver-refresh");
|
|
229218
|
+
const hub = buildHubChildSection(snapshot);
|
|
229219
|
+
return at < 0 ? [hub, ...kept] : [
|
|
229220
|
+
...kept.slice(0, at + 1),
|
|
229221
|
+
hub,
|
|
229222
|
+
...kept.slice(at + 1)
|
|
229223
|
+
];
|
|
229224
|
+
}
|
|
229225
|
+
//#endregion
|
|
229107
229226
|
//#region src/image-settings-mapping.ts
|
|
229108
229227
|
/**
|
|
229109
229228
|
* Reolink's `InputAdvanceCfg.Exposure.mode` (Baichuan cmdId 25/26, via
|
|
@@ -230890,114 +231009,6 @@ function registerHubChildStateRefresh(target) {
|
|
|
230890
231009
|
}, { stateRefresh: hubChildRefreshPolicy(integrationId) });
|
|
230891
231010
|
}
|
|
230892
231011
|
//#endregion
|
|
230893
|
-
//#region src/hub-child-settings.ts
|
|
230894
|
-
/**
|
|
230895
|
-
* A camera adopted under an NVR / Home Hub dials through the integration's session: the address
|
|
230896
|
-
* and the credentials belong to the integration, never to the camera. These are the per-camera
|
|
230897
|
-
* keys a hub child must refuse to change.
|
|
230898
|
-
*/
|
|
230899
|
-
var HUB_CHILD_CONNECTION_KEYS = [
|
|
230900
|
-
"host",
|
|
230901
|
-
"port",
|
|
230902
|
-
"username",
|
|
230903
|
-
"password"
|
|
230904
|
-
];
|
|
230905
|
-
/**
|
|
230906
|
-
* Sections that act on the hub itself (no channel in the call) or on the per-camera connection,
|
|
230907
|
-
* hidden for a hub child:
|
|
230908
|
-
* - `connection`: the per-camera address and credentials (the integration owns them);
|
|
230909
|
-
* - `network-ports`: `setPortConfig` rewrites the NVR's own service ports;
|
|
230910
|
-
* - `time-ntp`: `setNtp` / `setSystemGeneral` / `setDst` rewrite the NVR's clock.
|
|
230911
|
-
*/
|
|
230912
|
-
var HUB_CHILD_HIDDEN_SECTION_IDS = [
|
|
230913
|
-
"connection",
|
|
230914
|
-
"network-ports",
|
|
230915
|
-
"time-ntp"
|
|
230916
|
-
];
|
|
230917
|
-
/** Thrown by `applySettingsPatch` for a refused hub-child patch; carries the typed reason. */
|
|
230918
|
-
var HubChildPatchRefusedError = class extends Error {
|
|
230919
|
-
refusal;
|
|
230920
|
-
constructor(refusal) {
|
|
230921
|
-
super(describeRefusal(refusal));
|
|
230922
|
-
this.refusal = refusal;
|
|
230923
|
-
this.name = "HubChildPatchRefusedError";
|
|
230924
|
-
}
|
|
230925
|
-
};
|
|
230926
|
-
function describeRefusal(refusal) {
|
|
230927
|
-
switch (refusal.reason) {
|
|
230928
|
-
case "connection-owned-by-integration": return `This camera is connected through its NVR / Home Hub integration: ${refusal.keys.join(", ")} can only be changed on the integration`;
|
|
230929
|
-
case "channel-not-an-integer": return `The hub channel must be a whole number, got ${String(refusal.value)}`;
|
|
230930
|
-
case "channel-out-of-range": return `Channel ${refusal.value} is not one of the hub's channels (${refusal.channels.join(", ")})`;
|
|
230931
|
-
}
|
|
230932
|
-
}
|
|
230933
|
-
/**
|
|
230934
|
-
* Judge a settings patch against the hub-child rules. `channels` is the hub's last good channel
|
|
230935
|
-
* list (empty when unknown — then only the integer rule applies).
|
|
230936
|
-
*/
|
|
230937
|
-
function judgeHubChildPatch(patch, channels) {
|
|
230938
|
-
const touched = HUB_CHILD_CONNECTION_KEYS.filter((k) => patch[k] !== void 0);
|
|
230939
|
-
if (touched.length > 0) return {
|
|
230940
|
-
reason: "connection-owned-by-integration",
|
|
230941
|
-
keys: touched
|
|
230942
|
-
};
|
|
230943
|
-
if (patch["channel"] === void 0) return null;
|
|
230944
|
-
const value = patch["channel"];
|
|
230945
|
-
if (typeof value !== "number" || !Number.isInteger(value) || value < 0) return {
|
|
230946
|
-
reason: "channel-not-an-integer",
|
|
230947
|
-
value
|
|
230948
|
-
};
|
|
230949
|
-
if (channels.length > 0 && !channels.includes(value)) return {
|
|
230950
|
-
reason: "channel-out-of-range",
|
|
230951
|
-
value,
|
|
230952
|
-
channels
|
|
230953
|
-
};
|
|
230954
|
-
return null;
|
|
230955
|
-
}
|
|
230956
|
-
/** What a hub child shows before its session has read the hub's channel list. */
|
|
230957
|
-
var EMPTY_HUB_CHANNEL_SNAPSHOT = {
|
|
230958
|
-
channels: [],
|
|
230959
|
-
lastRefreshAt: null,
|
|
230960
|
-
lastError: null
|
|
230961
|
-
};
|
|
230962
|
-
/** The hub-child "Hub" section: which hub, and the one editable connection field, the channel. */
|
|
230963
|
-
function buildHubChildSection(snapshot) {
|
|
230964
|
-
return {
|
|
230965
|
-
id: "hub",
|
|
230966
|
-
tab: "general",
|
|
230967
|
-
title: "Hub",
|
|
230968
|
-
titleKey: "provider-reolink:schema.s_hub.title",
|
|
230969
|
-
description: "This camera is connected through its NVR / Home Hub. Address and credentials belong to that integration; the channel is kept in line with the hub automatically.",
|
|
230970
|
-
descriptionKey: "provider-reolink:schema.s_hub.description",
|
|
230971
|
-
columns: 2,
|
|
230972
|
-
fields: [{
|
|
230973
|
-
type: "text",
|
|
230974
|
-
key: "hubName",
|
|
230975
|
-
label: "Connected to",
|
|
230976
|
-
labelKey: "provider-reolink:schema.s_hub.hubName.label",
|
|
230977
|
-
disabled: true
|
|
230978
|
-
}, {
|
|
230979
|
-
type: "number",
|
|
230980
|
-
key: "channel",
|
|
230981
|
-
label: "Hub channel",
|
|
230982
|
-
labelKey: "provider-reolink:schema.s_hub.channel.label",
|
|
230983
|
-
min: 0,
|
|
230984
|
-
...snapshot.channels.length > 0 ? { max: Math.max(...snapshot.channels.map((c) => c.channel)) } : {},
|
|
230985
|
-
step: 1
|
|
230986
|
-
}]
|
|
230987
|
-
};
|
|
230988
|
-
}
|
|
230989
|
-
/** Replace the connection/hub-acting sections of a standalone schema with the Hub section. */
|
|
230990
|
-
function applyHubChildSections(sections, snapshot) {
|
|
230991
|
-
const kept = sections.filter((s) => !HUB_CHILD_HIDDEN_SECTION_IDS.includes(s.id));
|
|
230992
|
-
const at = kept.findIndex((s) => s.id === "driver-refresh");
|
|
230993
|
-
const hub = buildHubChildSection(snapshot);
|
|
230994
|
-
return at < 0 ? [hub, ...kept] : [
|
|
230995
|
-
...kept.slice(0, at + 1),
|
|
230996
|
-
hub,
|
|
230997
|
-
...kept.slice(at + 1)
|
|
230998
|
-
];
|
|
230999
|
-
}
|
|
231000
|
-
//#endregion
|
|
231001
231012
|
//#region src/sleep-state-decision.ts
|
|
231002
231013
|
/**
|
|
231003
231014
|
* Hysteresis is ASYMMETRIC, because the two directions have very different
|
|
@@ -233625,6 +233636,160 @@ function buildSupportedNativeClasses(aiDetectTypes, isSupportedClass) {
|
|
|
233625
233636
|
}
|
|
233626
233637
|
return classes;
|
|
233627
233638
|
}
|
|
233639
|
+
var PowerSourceModeSchema = _enum(["adapter", "battery"]);
|
|
233640
|
+
/** What a read says: a mode, or `unknown` when the read failed or the firmware is silent. */
|
|
233641
|
+
var PowerSourceReadingSchema = _enum([
|
|
233642
|
+
"adapter",
|
|
233643
|
+
"battery",
|
|
233644
|
+
"unknown"
|
|
233645
|
+
]);
|
|
233646
|
+
var ReadPowerSourceResultSchema = object({ source: PowerSourceReadingSchema });
|
|
233647
|
+
/** The device (or this code) declined before any real write was sent. */
|
|
233648
|
+
var PowerSourceRefusalReasonSchema = _enum(["dry-run-refused", "dry-run-failed"]);
|
|
233649
|
+
var SwitchPowerSourceResultSchema = discriminatedUnion("outcome", [
|
|
233650
|
+
object({
|
|
233651
|
+
outcome: literal("refused"),
|
|
233652
|
+
mode: PowerSourceModeSchema,
|
|
233653
|
+
reason: PowerSourceRefusalReasonSchema,
|
|
233654
|
+
before: PowerSourceReadingSchema
|
|
233655
|
+
}),
|
|
233656
|
+
object({
|
|
233657
|
+
outcome: literal("sent"),
|
|
233658
|
+
mode: PowerSourceModeSchema,
|
|
233659
|
+
/** The firmware accepted the command. NOT proof it took effect. */
|
|
233660
|
+
accepted: boolean(),
|
|
233661
|
+
before: PowerSourceReadingSchema,
|
|
233662
|
+
after: PowerSourceReadingSchema,
|
|
233663
|
+
/** True only when the read-back after the write equals the requested mode. */
|
|
233664
|
+
applied: boolean()
|
|
233665
|
+
}),
|
|
233666
|
+
object({
|
|
233667
|
+
outcome: literal("failed"),
|
|
233668
|
+
mode: PowerSourceModeSchema,
|
|
233669
|
+
/** The real write threw. It was sent once and is not retried. */
|
|
233670
|
+
error: string(),
|
|
233671
|
+
before: PowerSourceReadingSchema
|
|
233672
|
+
})
|
|
233673
|
+
]);
|
|
233674
|
+
function errorMessage(error) {
|
|
233675
|
+
return error instanceof Error ? error.message : String(error);
|
|
233676
|
+
}
|
|
233677
|
+
/** Read the power source; a failed or silent read is `unknown`. */
|
|
233678
|
+
async function readPowerSource(target) {
|
|
233679
|
+
const { api, channel, deviceId, logger } = target;
|
|
233680
|
+
try {
|
|
233681
|
+
const mode = await api.getPowerSource(channel);
|
|
233682
|
+
if (mode === void 0) {
|
|
233683
|
+
logger.info("power source: the firmware does not report it", {
|
|
233684
|
+
tags: { deviceId },
|
|
233685
|
+
meta: { channel }
|
|
233686
|
+
});
|
|
233687
|
+
return "unknown";
|
|
233688
|
+
}
|
|
233689
|
+
return mode;
|
|
233690
|
+
} catch (error) {
|
|
233691
|
+
logger.warn("power source: read failed, reporting unknown", {
|
|
233692
|
+
tags: { deviceId },
|
|
233693
|
+
meta: {
|
|
233694
|
+
channel,
|
|
233695
|
+
error: errorMessage(error)
|
|
233696
|
+
}
|
|
233697
|
+
});
|
|
233698
|
+
return "unknown";
|
|
233699
|
+
}
|
|
233700
|
+
}
|
|
233701
|
+
/**
|
|
233702
|
+
* Switch the power source: read, dry run, one real write, read back.
|
|
233703
|
+
* The write is sent at most once and never retried.
|
|
233704
|
+
*/
|
|
233705
|
+
async function switchPowerSourceTo(target, mode) {
|
|
233706
|
+
const { api, channel, deviceId, logger } = target;
|
|
233707
|
+
const before = await readPowerSource(target);
|
|
233708
|
+
logger.info("power source: switch requested", {
|
|
233709
|
+
tags: { deviceId },
|
|
233710
|
+
meta: {
|
|
233711
|
+
mode,
|
|
233712
|
+
before,
|
|
233713
|
+
channel
|
|
233714
|
+
}
|
|
233715
|
+
});
|
|
233716
|
+
let supported;
|
|
233717
|
+
try {
|
|
233718
|
+
supported = await api.probePowerSourceSwitchSupport(mode, { channel });
|
|
233719
|
+
} catch (error) {
|
|
233720
|
+
logger.warn("power source: dry run failed, no switch sent", {
|
|
233721
|
+
tags: { deviceId },
|
|
233722
|
+
meta: {
|
|
233723
|
+
mode,
|
|
233724
|
+
error: errorMessage(error)
|
|
233725
|
+
}
|
|
233726
|
+
});
|
|
233727
|
+
return {
|
|
233728
|
+
outcome: "refused",
|
|
233729
|
+
mode,
|
|
233730
|
+
reason: "dry-run-failed",
|
|
233731
|
+
before
|
|
233732
|
+
};
|
|
233733
|
+
}
|
|
233734
|
+
if (!supported) {
|
|
233735
|
+
logger.warn("power source: the device refused the dry run, no switch sent", {
|
|
233736
|
+
tags: { deviceId },
|
|
233737
|
+
meta: {
|
|
233738
|
+
mode,
|
|
233739
|
+
before
|
|
233740
|
+
}
|
|
233741
|
+
});
|
|
233742
|
+
return {
|
|
233743
|
+
outcome: "refused",
|
|
233744
|
+
mode,
|
|
233745
|
+
reason: "dry-run-refused",
|
|
233746
|
+
before
|
|
233747
|
+
};
|
|
233748
|
+
}
|
|
233749
|
+
let result;
|
|
233750
|
+
try {
|
|
233751
|
+
result = await api.switchPowerSource(mode, { channel });
|
|
233752
|
+
} catch (error) {
|
|
233753
|
+
logger.error("power source: the switch threw; it is not retried", {
|
|
233754
|
+
tags: { deviceId },
|
|
233755
|
+
meta: {
|
|
233756
|
+
mode,
|
|
233757
|
+
error: errorMessage(error)
|
|
233758
|
+
}
|
|
233759
|
+
});
|
|
233760
|
+
return {
|
|
233761
|
+
outcome: "failed",
|
|
233762
|
+
mode,
|
|
233763
|
+
error: errorMessage(error),
|
|
233764
|
+
before
|
|
233765
|
+
};
|
|
233766
|
+
}
|
|
233767
|
+
const after = await readPowerSource(target);
|
|
233768
|
+
const applied = result.accepted && after === mode;
|
|
233769
|
+
const meta = {
|
|
233770
|
+
mode,
|
|
233771
|
+
before,
|
|
233772
|
+
after,
|
|
233773
|
+
accepted: result.accepted,
|
|
233774
|
+
rspCode: result.rspCode
|
|
233775
|
+
};
|
|
233776
|
+
if (applied) logger.info("power source: switched", {
|
|
233777
|
+
tags: { deviceId },
|
|
233778
|
+
meta
|
|
233779
|
+
});
|
|
233780
|
+
else logger.warn("power source: the switch was sent but the read-back does not show it", {
|
|
233781
|
+
tags: { deviceId },
|
|
233782
|
+
meta
|
|
233783
|
+
});
|
|
233784
|
+
return {
|
|
233785
|
+
outcome: "sent",
|
|
233786
|
+
mode,
|
|
233787
|
+
accepted: result.accepted,
|
|
233788
|
+
before,
|
|
233789
|
+
after,
|
|
233790
|
+
applied
|
|
233791
|
+
};
|
|
233792
|
+
}
|
|
233628
233793
|
//#endregion
|
|
233629
233794
|
//#region src/ptz-zoom.ts
|
|
233630
233795
|
/**
|
|
@@ -234614,6 +234779,8 @@ var RefreshSettingsResultSchema = object({
|
|
|
234614
234779
|
capsWarmed: number$1(),
|
|
234615
234780
|
capsTotal: number$1()
|
|
234616
234781
|
});
|
|
234782
|
+
/** The two switch actions, one implementation each way. */
|
|
234783
|
+
var POWER_SWITCH_ACTIONS = [["switch-to-wired-power", "adapter"], ["switch-to-battery-power", "battery"]];
|
|
234617
234784
|
/** The uid out of a device's metadata bag, or nothing. Never a cast. */
|
|
234618
234785
|
function metaUid(metadata) {
|
|
234619
234786
|
if (metadata === null) return void 0;
|
|
@@ -235999,6 +236166,16 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
235999
236166
|
capsTotal
|
|
236000
236167
|
};
|
|
236001
236168
|
});
|
|
236169
|
+
if (this.isBattery) {
|
|
236170
|
+
this.registerDeviceAction("read-power-source", deviceCustomAction(unknown(), ReadPowerSourceResultSchema, { kind: "mutation" }), async () => {
|
|
236171
|
+
await this.wakeIfSleeping();
|
|
236172
|
+
return { source: await readPowerSource(await this.powerSourceTarget()) };
|
|
236173
|
+
});
|
|
236174
|
+
for (const [action, mode] of POWER_SWITCH_ACTIONS) this.registerDeviceAction(action, deviceCustomAction(unknown(), SwitchPowerSourceResultSchema, { kind: "mutation" }), async () => {
|
|
236175
|
+
await this.wakeIfSleeping();
|
|
236176
|
+
return switchPowerSourceTo(await this.powerSourceTarget(), mode);
|
|
236177
|
+
});
|
|
236178
|
+
}
|
|
236002
236179
|
this.registerDeviceAction("refresh-sessions", deviceCustomAction(unknown(), _void(), { kind: "mutation" }), async () => {
|
|
236003
236180
|
await this.refreshSessionsSnapshot();
|
|
236004
236181
|
});
|
|
@@ -236538,6 +236715,65 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
236538
236715
|
autoRefreshes: !this.isBattery
|
|
236539
236716
|
});
|
|
236540
236717
|
}
|
|
236718
|
+
/** The hub API for a child, the camera's own otherwise, plus the channel to address. */
|
|
236719
|
+
async powerSourceTarget() {
|
|
236720
|
+
return {
|
|
236721
|
+
api: await this.ensureApi(),
|
|
236722
|
+
channel: this.getChannel(),
|
|
236723
|
+
deviceId: this.id,
|
|
236724
|
+
logger: this.ctx.logger
|
|
236725
|
+
};
|
|
236726
|
+
}
|
|
236727
|
+
/**
|
|
236728
|
+
* Battery-cam power-source section (General tab): read the source, switch to
|
|
236729
|
+
* wired or back to battery. Returns `[]` for a wired-only camera. The buttons
|
|
236730
|
+
* dispatch the `read-power-source` / `switch-to-*-power` device actions.
|
|
236731
|
+
*/
|
|
236732
|
+
buildPowerSourceSection() {
|
|
236733
|
+
if (!this.isBattery) return [];
|
|
236734
|
+
const switchMessage = "Switch {outcome} · before: {before} · after: {after} · applied: {applied}";
|
|
236735
|
+
return [{
|
|
236736
|
+
id: "power-source",
|
|
236737
|
+
tab: "general",
|
|
236738
|
+
title: "Power source",
|
|
236739
|
+
titleKey: "provider-reolink:schema.s_power-source.title",
|
|
236740
|
+
description: "Only switch to wired power when the adapter meets the camera's spec.",
|
|
236741
|
+
descriptionKey: "provider-reolink:schema.s_power-source.description",
|
|
236742
|
+
columns: 1,
|
|
236743
|
+
fields: [
|
|
236744
|
+
{
|
|
236745
|
+
type: "device-action-button",
|
|
236746
|
+
key: "_readPowerSource",
|
|
236747
|
+
label: "Power source",
|
|
236748
|
+
labelKey: "provider-reolink:schema.s_power-source._readPowerSource.label",
|
|
236749
|
+
buttonLabel: "Read power source",
|
|
236750
|
+
action: "read-power-source",
|
|
236751
|
+
variant: "default",
|
|
236752
|
+
successMessage: "Power source: {source}"
|
|
236753
|
+
},
|
|
236754
|
+
{
|
|
236755
|
+
type: "device-action-button",
|
|
236756
|
+
key: "_switchToWiredPower",
|
|
236757
|
+
label: "Wired power",
|
|
236758
|
+
labelKey: "provider-reolink:schema.s_power-source._switchToWiredPower.label",
|
|
236759
|
+
buttonLabel: "Switch to wired power",
|
|
236760
|
+
action: "switch-to-wired-power",
|
|
236761
|
+
variant: "default",
|
|
236762
|
+
successMessage: switchMessage
|
|
236763
|
+
},
|
|
236764
|
+
{
|
|
236765
|
+
type: "device-action-button",
|
|
236766
|
+
key: "_switchToBatteryPower",
|
|
236767
|
+
label: "Battery power",
|
|
236768
|
+
labelKey: "provider-reolink:schema.s_power-source._switchToBatteryPower.label",
|
|
236769
|
+
buttonLabel: "Switch to battery power",
|
|
236770
|
+
action: "switch-to-battery-power",
|
|
236771
|
+
variant: "default",
|
|
236772
|
+
successMessage: switchMessage
|
|
236773
|
+
}
|
|
236774
|
+
]
|
|
236775
|
+
}];
|
|
236776
|
+
}
|
|
236541
236777
|
/**
|
|
236542
236778
|
* Battery-cam Email Push auto-configure section. Returns `[]` for any
|
|
236543
236779
|
* camera that wouldn't benefit (wired cams keep a live socket for
|
|
@@ -241450,6 +241686,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
241450
241686
|
}),
|
|
241451
241687
|
...this.buildSessionsTabSections(),
|
|
241452
241688
|
...this.buildEmailPushSection(),
|
|
241689
|
+
...this.buildPowerSourceSection(),
|
|
241453
241690
|
...this.buildEmailTabSections(),
|
|
241454
241691
|
...buildClipRefreshDeviceSection({
|
|
241455
241692
|
isHubChild: this.isHubChild(),
|
package/i18n/en.json
CHANGED
|
@@ -208,5 +208,20 @@
|
|
|
208
208
|
"schema.s_hub.title": "Hub",
|
|
209
209
|
"schema.s_hub.description": "This camera is connected through its NVR / Home Hub. Address and credentials belong to that integration; the channel is kept in line with the hub automatically.",
|
|
210
210
|
"schema.s_hub.hubName.label": "Connected to",
|
|
211
|
-
"schema.s_hub.channel.label": "Hub channel"
|
|
211
|
+
"schema.s_hub.channel.label": "Hub channel",
|
|
212
|
+
"schema": {
|
|
213
|
+
"s_power-source": {
|
|
214
|
+
"title": "Power source",
|
|
215
|
+
"description": "Only switch to wired power when the adapter meets the camera's spec.",
|
|
216
|
+
"_readPowerSource": {
|
|
217
|
+
"label": "Power source"
|
|
218
|
+
},
|
|
219
|
+
"_switchToWiredPower": {
|
|
220
|
+
"label": "Wired power"
|
|
221
|
+
},
|
|
222
|
+
"_switchToBatteryPower": {
|
|
223
|
+
"label": "Battery power"
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
212
227
|
}
|
package/i18n/it.json
CHANGED
|
@@ -208,5 +208,20 @@
|
|
|
208
208
|
"schema.s_hub.title": "Hub",
|
|
209
209
|
"schema.s_hub.description": "Questa telecamera è collegata tramite il suo NVR / Home Hub. Indirizzo e credenziali appartengono a quell'integrazione; il canale resta allineato all'hub in automatico.",
|
|
210
210
|
"schema.s_hub.hubName.label": "Collegata a",
|
|
211
|
-
"schema.s_hub.channel.label": "Canale dell'hub"
|
|
211
|
+
"schema.s_hub.channel.label": "Canale dell'hub",
|
|
212
|
+
"schema": {
|
|
213
|
+
"s_power-source": {
|
|
214
|
+
"title": "Sorgente di alimentazione",
|
|
215
|
+
"description": "Passa all'alimentazione cablata solo se l'alimentatore rispetta le specifiche della telecamera.",
|
|
216
|
+
"_readPowerSource": {
|
|
217
|
+
"label": "Sorgente di alimentazione"
|
|
218
|
+
},
|
|
219
|
+
"_switchToWiredPower": {
|
|
220
|
+
"label": "Alimentazione cablata"
|
|
221
|
+
},
|
|
222
|
+
"_switchToBatteryPower": {
|
|
223
|
+
"label": "Alimentazione a batteria"
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
212
227
|
}
|
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.252",
|
|
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.918"
|
|
100
100
|
}
|
|
101
101
|
},
|
|
102
102
|
"files": [
|