@camstack/addon-provider-reolink 1.2.34 → 1.2.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/addon.js +43 -7
- package/dist/addon.mjs +43 -7
- package/package.json +1 -1
package/dist/addon.js
CHANGED
|
@@ -230953,8 +230953,6 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
230953
230953
|
});
|
|
230954
230954
|
this.ctx.eventBus.emit(createEvent(EventCategory.BatteryOnWakeStarted, this.eventSource(), { deviceId: this.id }));
|
|
230955
230955
|
const channel = this.getChannel();
|
|
230956
|
-
const isHubChild = this.isHubChild();
|
|
230957
|
-
const wakeTimeoutMs = isHubChild ? Math.max(timeoutMs, 2e4) : timeoutMs;
|
|
230958
230956
|
try {
|
|
230959
230957
|
await Promise.race([(async () => {
|
|
230960
230958
|
await api.wakeUp(channel, {
|
|
@@ -230962,11 +230960,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
230962
230960
|
attempts: 2
|
|
230963
230961
|
});
|
|
230964
230962
|
await sleep$1(1500);
|
|
230965
|
-
|
|
230966
|
-
const dialId = buildCamStreamId("native", channel, "main", 1);
|
|
230967
|
-
await Promise.race([this.ensureRfc4571Server(dialId, channel, "main"), sleep$1(1e4)]);
|
|
230968
|
-
}
|
|
230969
|
-
})(), new Promise((_, rej) => setTimeout(() => rej(/* @__PURE__ */ new Error("wakeForStream timeout")), wakeTimeoutMs))]);
|
|
230963
|
+
})(), new Promise((_, rej) => setTimeout(() => rej(/* @__PURE__ */ new Error("wakeForStream timeout")), timeoutMs))]);
|
|
230970
230964
|
const CONFIRM_TIMEOUT_MS = 1e4;
|
|
230971
230965
|
const CONFIRM_POLL_MS = 1e3;
|
|
230972
230966
|
const confirmDeadline = Date.now() + CONFIRM_TIMEOUT_MS;
|
|
@@ -233632,8 +233626,50 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
233632
233626
|
* drained the battery and, by bursting the socket, was itself what starved
|
|
233633
233627
|
* GetEnc.
|
|
233634
233628
|
*/
|
|
233629
|
+
/**
|
|
233630
|
+
* The catalog a SLEEPING hub child can still offer: the parent's RTSP
|
|
233631
|
+
* relay entries, derived from the parent's config (host + credentials +
|
|
233632
|
+
* the Reolink Hub's per-channel relay scheme), with zero contact to the
|
|
233633
|
+
* child. This is the difference between a sleeping hub child being
|
|
233634
|
+
* playable and being a permanent "sleeping" tile: the broker gets a
|
|
233635
|
+
* dialable URL, the relay dial wakes the camera over RF (verified live
|
|
233636
|
+
* against the Home Hub, 2026-08-15), and the catalog never depended on
|
|
233637
|
+
* the child being awake to build.
|
|
233638
|
+
*/
|
|
233639
|
+
async buildHubRelayDescriptors() {
|
|
233640
|
+
if (!this.isHubChild()) return [];
|
|
233641
|
+
const parentId = this.parentDeviceId;
|
|
233642
|
+
if (parentId === null) return [];
|
|
233643
|
+
const cfg = (await this.ctx.devices.getAll()).find((d) => d.id === parentId)?.config.values;
|
|
233644
|
+
const host = cfg?.host;
|
|
233645
|
+
if (typeof host !== "string" || host.length === 0) return [];
|
|
233646
|
+
const user = encodeURIComponent(String(cfg?.username ?? ""));
|
|
233647
|
+
const password = encodeURIComponent(String(cfg?.password ?? ""));
|
|
233648
|
+
const port = typeof cfg?.port === "number" && cfg.port > 0 ? cfg.port : 554;
|
|
233649
|
+
const channel = this.getChannel();
|
|
233650
|
+
const channelCount = this.channelCount();
|
|
233651
|
+
const relayChannel = channel + 1;
|
|
233652
|
+
const out = [];
|
|
233653
|
+
for (const profile of ["main", "sub"]) out.push({
|
|
233654
|
+
camStreamId: buildCamStreamId("rtsp", channel, profile, channelCount),
|
|
233655
|
+
kind: "pull-rtsp",
|
|
233656
|
+
label: `Hub relay (${profile})`,
|
|
233657
|
+
url: `rtsp://${user}:${password}@${host}:${port}/h264Preview_0${relayChannel}_${profile}`,
|
|
233658
|
+
autoEligible: true,
|
|
233659
|
+
deviceFeatures: [...this.features]
|
|
233660
|
+
});
|
|
233661
|
+
return out;
|
|
233662
|
+
}
|
|
233635
233663
|
async buildStreamCatalogUncached() {
|
|
233636
233664
|
if (this.isBattery && this.sleeping) {
|
|
233665
|
+
const relay = await this.buildHubRelayDescriptors().catch(() => []);
|
|
233666
|
+
if (relay.length > 0) {
|
|
233667
|
+
this.ctx.logger.debug("buildStreamCatalog: sleeping hub child — serving hub relay entries", {
|
|
233668
|
+
tags: { deviceId: this.id },
|
|
233669
|
+
meta: { entries: relay.map((r) => r.camStreamId) }
|
|
233670
|
+
});
|
|
233671
|
+
return relay;
|
|
233672
|
+
}
|
|
233637
233673
|
this.ctx.logger.debug("buildStreamCatalog: battery cam sleeping, no cache — deferring to wake", { tags: { deviceId: this.id } });
|
|
233638
233674
|
return [];
|
|
233639
233675
|
}
|
package/dist/addon.mjs
CHANGED
|
@@ -230933,8 +230933,6 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
230933
230933
|
});
|
|
230934
230934
|
this.ctx.eventBus.emit(createEvent(EventCategory.BatteryOnWakeStarted, this.eventSource(), { deviceId: this.id }));
|
|
230935
230935
|
const channel = this.getChannel();
|
|
230936
|
-
const isHubChild = this.isHubChild();
|
|
230937
|
-
const wakeTimeoutMs = isHubChild ? Math.max(timeoutMs, 2e4) : timeoutMs;
|
|
230938
230936
|
try {
|
|
230939
230937
|
await Promise.race([(async () => {
|
|
230940
230938
|
await api.wakeUp(channel, {
|
|
@@ -230942,11 +230940,7 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
230942
230940
|
attempts: 2
|
|
230943
230941
|
});
|
|
230944
230942
|
await sleep$1(1500);
|
|
230945
|
-
|
|
230946
|
-
const dialId = buildCamStreamId("native", channel, "main", 1);
|
|
230947
|
-
await Promise.race([this.ensureRfc4571Server(dialId, channel, "main"), sleep$1(1e4)]);
|
|
230948
|
-
}
|
|
230949
|
-
})(), new Promise((_, rej) => setTimeout(() => rej(/* @__PURE__ */ new Error("wakeForStream timeout")), wakeTimeoutMs))]);
|
|
230943
|
+
})(), new Promise((_, rej) => setTimeout(() => rej(/* @__PURE__ */ new Error("wakeForStream timeout")), timeoutMs))]);
|
|
230950
230944
|
const CONFIRM_TIMEOUT_MS = 1e4;
|
|
230951
230945
|
const CONFIRM_POLL_MS = 1e3;
|
|
230952
230946
|
const confirmDeadline = Date.now() + CONFIRM_TIMEOUT_MS;
|
|
@@ -233612,8 +233606,50 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
233612
233606
|
* drained the battery and, by bursting the socket, was itself what starved
|
|
233613
233607
|
* GetEnc.
|
|
233614
233608
|
*/
|
|
233609
|
+
/**
|
|
233610
|
+
* The catalog a SLEEPING hub child can still offer: the parent's RTSP
|
|
233611
|
+
* relay entries, derived from the parent's config (host + credentials +
|
|
233612
|
+
* the Reolink Hub's per-channel relay scheme), with zero contact to the
|
|
233613
|
+
* child. This is the difference between a sleeping hub child being
|
|
233614
|
+
* playable and being a permanent "sleeping" tile: the broker gets a
|
|
233615
|
+
* dialable URL, the relay dial wakes the camera over RF (verified live
|
|
233616
|
+
* against the Home Hub, 2026-08-15), and the catalog never depended on
|
|
233617
|
+
* the child being awake to build.
|
|
233618
|
+
*/
|
|
233619
|
+
async buildHubRelayDescriptors() {
|
|
233620
|
+
if (!this.isHubChild()) return [];
|
|
233621
|
+
const parentId = this.parentDeviceId;
|
|
233622
|
+
if (parentId === null) return [];
|
|
233623
|
+
const cfg = (await this.ctx.devices.getAll()).find((d) => d.id === parentId)?.config.values;
|
|
233624
|
+
const host = cfg?.host;
|
|
233625
|
+
if (typeof host !== "string" || host.length === 0) return [];
|
|
233626
|
+
const user = encodeURIComponent(String(cfg?.username ?? ""));
|
|
233627
|
+
const password = encodeURIComponent(String(cfg?.password ?? ""));
|
|
233628
|
+
const port = typeof cfg?.port === "number" && cfg.port > 0 ? cfg.port : 554;
|
|
233629
|
+
const channel = this.getChannel();
|
|
233630
|
+
const channelCount = this.channelCount();
|
|
233631
|
+
const relayChannel = channel + 1;
|
|
233632
|
+
const out = [];
|
|
233633
|
+
for (const profile of ["main", "sub"]) out.push({
|
|
233634
|
+
camStreamId: buildCamStreamId("rtsp", channel, profile, channelCount),
|
|
233635
|
+
kind: "pull-rtsp",
|
|
233636
|
+
label: `Hub relay (${profile})`,
|
|
233637
|
+
url: `rtsp://${user}:${password}@${host}:${port}/h264Preview_0${relayChannel}_${profile}`,
|
|
233638
|
+
autoEligible: true,
|
|
233639
|
+
deviceFeatures: [...this.features]
|
|
233640
|
+
});
|
|
233641
|
+
return out;
|
|
233642
|
+
}
|
|
233615
233643
|
async buildStreamCatalogUncached() {
|
|
233616
233644
|
if (this.isBattery && this.sleeping) {
|
|
233645
|
+
const relay = await this.buildHubRelayDescriptors().catch(() => []);
|
|
233646
|
+
if (relay.length > 0) {
|
|
233647
|
+
this.ctx.logger.debug("buildStreamCatalog: sleeping hub child — serving hub relay entries", {
|
|
233648
|
+
tags: { deviceId: this.id },
|
|
233649
|
+
meta: { entries: relay.map((r) => r.camStreamId) }
|
|
233650
|
+
});
|
|
233651
|
+
return relay;
|
|
233652
|
+
}
|
|
233617
233653
|
this.ctx.logger.debug("buildStreamCatalog: battery cam sleeping, no cache — deferring to wake", { tags: { deviceId: this.id } });
|
|
233618
233654
|
return [];
|
|
233619
233655
|
}
|