@camstack/addon-provider-reolink 1.2.236 → 1.2.238
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 +13 -0
- package/dist/addon.js +676 -257
- package/dist/addon.mjs +676 -257
- package/package.json +2 -2
package/dist/addon.js
CHANGED
|
@@ -101498,7 +101498,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
101498
101498
|
return EventCategory;
|
|
101499
101499
|
}({});
|
|
101500
101500
|
//#endregion
|
|
101501
|
-
//#region ../types/dist/composed-stable-id-
|
|
101501
|
+
//#region ../types/dist/composed-stable-id-DFNyOFzz.mjs
|
|
101502
101502
|
/**
|
|
101503
101503
|
import { errMsg } from '@camstack/types'
|
|
101504
101504
|
* Extract a human-readable message from an unknown error value.
|
|
@@ -101511,6 +101511,7 @@ function errMsg$3(err) {
|
|
|
101511
101511
|
}
|
|
101512
101512
|
var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
101513
101513
|
DeviceType["Camera"] = "camera";
|
|
101514
|
+
/** Legacy stored value, read only by the hub-to-integration migrations; no live device carries it. */
|
|
101514
101515
|
DeviceType["Hub"] = "hub";
|
|
101515
101516
|
DeviceType["Light"] = "light";
|
|
101516
101517
|
DeviceType["Siren"] = "siren";
|
|
@@ -106722,7 +106723,7 @@ var ZodIssueCode = {
|
|
|
106722
106723
|
var ZodFirstPartyTypeKind;
|
|
106723
106724
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
106724
106725
|
//#endregion
|
|
106725
|
-
//#region ../types/dist/sleep-
|
|
106726
|
+
//#region ../types/dist/sleep-D_NpiLFP.mjs
|
|
106726
106727
|
/**
|
|
106727
106728
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
106728
106729
|
* window to float samples (D455).
|
|
@@ -114624,10 +114625,6 @@ var CAMERA_CAP_VOCABULARY = {
|
|
|
114624
114625
|
scope: "device",
|
|
114625
114626
|
noun: t("Admin link", "Link di amministrazione")
|
|
114626
114627
|
},
|
|
114627
|
-
"device-discovery": {
|
|
114628
|
-
scope: "device",
|
|
114629
|
-
noun: t("Discovery", "Rilevamento dispositivi")
|
|
114630
|
-
},
|
|
114631
114628
|
"device-extension": {
|
|
114632
114629
|
scope: "device",
|
|
114633
114630
|
noun: t("Device extension", "Estensione del dispositivo")
|
|
@@ -115799,6 +115796,7 @@ var SYSTEM_CAP_VOCABULARY = {
|
|
|
115799
115796
|
backup: system("system backups — run and restored from the Backups page"),
|
|
115800
115797
|
broker: system("message-broker connections — configured, not actuated"),
|
|
115801
115798
|
"calendar-source": system(INTERNAL),
|
|
115799
|
+
"cluster-update": system(CLUSTER),
|
|
115802
115800
|
calendars: system("calendars feed schedules and conditions, not device actions"),
|
|
115803
115801
|
composer: system("device composition — an authoring tool, not an action"),
|
|
115804
115802
|
"core-blocks": system(INTERNAL),
|
|
@@ -116100,6 +116098,7 @@ var CAP_NAMES = Object.freeze([
|
|
|
116100
116098
|
"camera-streams",
|
|
116101
116099
|
"carbon-monoxide",
|
|
116102
116100
|
"climate-control",
|
|
116101
|
+
"cluster-update",
|
|
116103
116102
|
"color",
|
|
116104
116103
|
"composer",
|
|
116105
116104
|
"connectivity",
|
|
@@ -116117,7 +116116,6 @@ var CAP_NAMES = Object.freeze([
|
|
|
116117
116116
|
"device-admin-link",
|
|
116118
116117
|
"device-adoption",
|
|
116119
116118
|
"device-credentials",
|
|
116120
|
-
"device-discovery",
|
|
116121
116119
|
"device-export",
|
|
116122
116120
|
"device-extension",
|
|
116123
116121
|
"device-history",
|
|
@@ -116739,13 +116737,6 @@ Object.freeze({
|
|
|
116739
116737
|
"valueType": "string"
|
|
116740
116738
|
}
|
|
116741
116739
|
],
|
|
116742
|
-
"device-discovery": [{
|
|
116743
|
-
"path": "lastDiscoveryAt",
|
|
116744
|
-
"valueType": "number"
|
|
116745
|
-
}, {
|
|
116746
|
-
"path": "lastError",
|
|
116747
|
-
"valueType": "string"
|
|
116748
|
-
}],
|
|
116749
116740
|
"device-export": [
|
|
116750
116741
|
{
|
|
116751
116742
|
"path": "linkState",
|
|
@@ -118221,7 +118212,7 @@ function sleep(ms) {
|
|
|
118221
118212
|
return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
|
|
118222
118213
|
}
|
|
118223
118214
|
//#endregion
|
|
118224
|
-
//#region ../types/dist/implemented-methods-
|
|
118215
|
+
//#region ../types/dist/implemented-methods-M5aguGon.mjs
|
|
118225
118216
|
/**
|
|
118226
118217
|
* The ffmpeg build every CamStack node downloads, per platform and arch.
|
|
118227
118218
|
*
|
|
@@ -145559,6 +145550,62 @@ var WeekdayKeySchema = _enum([
|
|
|
145559
145550
|
"sat",
|
|
145560
145551
|
"sun"
|
|
145561
145552
|
]);
|
|
145553
|
+
/**
|
|
145554
|
+
* Hold semantics — "for N seconds" on a leaf of the `when` tree (#498).
|
|
145555
|
+
*
|
|
145556
|
+
* ONE primitive, `for: { ms, mode, tolerance? }`, shared by `device-becomes`,
|
|
145557
|
+
* `device-is` and `expression`:
|
|
145558
|
+
*
|
|
145559
|
+
* - `held`: the condition stays true for `ms`;
|
|
145560
|
+
* - `stable`: the value does not move by more than `tolerance` (absolute, in
|
|
145561
|
+
* the field's base unit) for `ms` while the condition holds.
|
|
145562
|
+
*
|
|
145563
|
+
* {@link HoldCore} is the pure state machine (an input observation → a reading).
|
|
145564
|
+
* {@link HoldTracker} keys cores by a leaf path for the STATE leaves the tree
|
|
145565
|
+
* evaluator judges. {@link BecomesWatch} wraps a core with a timer for the
|
|
145566
|
+
* `device-becomes` EVENT leaf: the deadline is armed when the hold starts and
|
|
145567
|
+
* cancelled when it breaks, and the leaf fires ONCE per episode.
|
|
145568
|
+
*
|
|
145569
|
+
* Hold state is memory only. A hold that is already running when the watcher
|
|
145570
|
+
* first looks (a restart) is INHERITED: nobody knows when it began, so it never
|
|
145571
|
+
* fires for that episode and a state leaf reads it as unknown until the window
|
|
145572
|
+
* has elapsed from the moment the watcher started (D49: not-known is not false).
|
|
145573
|
+
*/
|
|
145574
|
+
var HOLD_MAX_MS = 864e5;
|
|
145575
|
+
var HoldModeSchema = _enum(["held", "stable"]);
|
|
145576
|
+
var HoldSpecSchema = object({
|
|
145577
|
+
/** How long the condition (or the value) must hold. */
|
|
145578
|
+
ms: number$1().int().min(1).max(HOLD_MAX_MS),
|
|
145579
|
+
mode: HoldModeSchema,
|
|
145580
|
+
/** `stable` only: the largest move of the value that still counts as unchanged (absolute, base unit). */
|
|
145581
|
+
tolerance: number$1().min(0).optional()
|
|
145582
|
+
});
|
|
145583
|
+
/** What a trace says about a hold. */
|
|
145584
|
+
var HoldTraceSchema = object({
|
|
145585
|
+
phase: _enum([
|
|
145586
|
+
"pending",
|
|
145587
|
+
"cancelled",
|
|
145588
|
+
"fired",
|
|
145589
|
+
"reseeded"
|
|
145590
|
+
]),
|
|
145591
|
+
ms: number$1().int(),
|
|
145592
|
+
mode: HoldModeSchema,
|
|
145593
|
+
/** When the hold started (ms epoch). */
|
|
145594
|
+
since: number$1().optional(),
|
|
145595
|
+
/** When it completes (ms epoch), for a pending hold. */
|
|
145596
|
+
deadline: number$1().optional()
|
|
145597
|
+
});
|
|
145598
|
+
/** The operators a `device-becomes` leaf may carry: a threshold or a range. */
|
|
145599
|
+
var BecomesOperatorSchema = _enum([
|
|
145600
|
+
"eq",
|
|
145601
|
+
"ne",
|
|
145602
|
+
"gt",
|
|
145603
|
+
"gte",
|
|
145604
|
+
"lt",
|
|
145605
|
+
"lte",
|
|
145606
|
+
"between",
|
|
145607
|
+
"outside"
|
|
145608
|
+
]);
|
|
145562
145609
|
/** How a state leaf compares a device field to a value. Derived from the
|
|
145563
145610
|
* field's `kind` in `deviceManager.getWireableFields`, never hand-maintained. */
|
|
145564
145611
|
var AutomationConditionOperatorSchema = _enum([
|
|
@@ -145572,6 +145619,13 @@ var AutomationConditionOperatorSchema = _enum([
|
|
|
145572
145619
|
"in"
|
|
145573
145620
|
]);
|
|
145574
145621
|
/**
|
|
145622
|
+
* The stable name of an event leaf. A path (`when.0.1`) moves when a row is
|
|
145623
|
+
* reordered; the id does not, so a `triggered-by` leaf keeps pointing at the
|
|
145624
|
+
* same row. Optional: a leaf nothing refers to needs none.
|
|
145625
|
+
*/
|
|
145626
|
+
var EVENT_LEAF_ID_RE = /^[A-Za-z0-9_-]{1,40}$/;
|
|
145627
|
+
var eventLeafId = { id: string().regex(EVENT_LEAF_ID_RE).optional() };
|
|
145628
|
+
/**
|
|
145575
145629
|
* D8 compliance, and it is the reason a "becomes" leaf is not merely an event
|
|
145576
145630
|
* subscription: it evaluates against the **state mirror**, which is reconciled,
|
|
145577
145631
|
* and an event only WAKES the evaluation. A dropped event therefore DELAYS a
|
|
@@ -145579,24 +145633,60 @@ var AutomationConditionOperatorSchema = _enum([
|
|
|
145579
145633
|
*/
|
|
145580
145634
|
var DeviceBecomesLeafSchema = object({
|
|
145581
145635
|
kind: literal("device-becomes"),
|
|
145636
|
+
...eventLeafId,
|
|
145582
145637
|
deviceId: number$1().int().nonnegative(),
|
|
145583
145638
|
cap: string().min(1),
|
|
145584
145639
|
fieldPath: string().min(1),
|
|
145585
|
-
/** Fire when the field takes this value. Omit to fire on any change. */
|
|
145640
|
+
/** Fire when the field takes this value. Omit (with no `operator`) to fire on any change. */
|
|
145586
145641
|
becomes: union([
|
|
145587
145642
|
string(),
|
|
145588
145643
|
number$1(),
|
|
145589
145644
|
boolean()
|
|
145590
145645
|
]).optional(),
|
|
145591
|
-
/**
|
|
145646
|
+
/**
|
|
145647
|
+
* A threshold or a range instead of an equality: "crosses above 3000", "enters
|
|
145648
|
+
* 18..24". The leaf fires on the TRANSITION into the predicate, never on a re-report.
|
|
145649
|
+
* `value` is in the field's base unit; `between` / `outside` take `[low, high]`.
|
|
145650
|
+
*/
|
|
145651
|
+
operator: BecomesOperatorSchema.optional(),
|
|
145652
|
+
value: union([
|
|
145653
|
+
number$1(),
|
|
145654
|
+
string(),
|
|
145655
|
+
boolean(),
|
|
145656
|
+
array(number$1()).length(2)
|
|
145657
|
+
]).optional(),
|
|
145658
|
+
/**
|
|
145659
|
+
* Hold: the transition (or, with no predicate, the new value) must stay for
|
|
145660
|
+
* `for.ms` before the leaf fires, ONCE per episode. See `hold.ts`.
|
|
145661
|
+
*/
|
|
145662
|
+
for: HoldSpecSchema.optional(),
|
|
145663
|
+
/** @deprecated every leaf fires on a transition now; read as always on. */
|
|
145592
145664
|
edge: boolean().optional(),
|
|
145593
|
-
/**
|
|
145594
|
-
forMs: number$1().int().min(0).max(
|
|
145665
|
+
/** @deprecated legacy `held` window — read through `holdOf` as `for: { ms, mode: 'held' }`. */
|
|
145666
|
+
forMs: number$1().int().min(0).max(HOLD_MAX_MS).optional(),
|
|
145595
145667
|
/** Collapse a burst into one occurrence. */
|
|
145596
145668
|
debounceMs: number$1().int().min(0).max(6e5).optional()
|
|
145669
|
+
}).superRefine((leaf, ctx) => {
|
|
145670
|
+
if (leaf.becomes !== void 0 && leaf.operator !== void 0) ctx.addIssue({
|
|
145671
|
+
code: "custom",
|
|
145672
|
+
message: "a leaf names `becomes` or `operator`, not both",
|
|
145673
|
+
path: ["operator"]
|
|
145674
|
+
});
|
|
145675
|
+
if (leaf.operator !== void 0 && leaf.value === void 0) ctx.addIssue({
|
|
145676
|
+
code: "custom",
|
|
145677
|
+
message: "an operator needs the value to compare to",
|
|
145678
|
+
path: ["value"]
|
|
145679
|
+
});
|
|
145680
|
+
const range = leaf.operator === "between" || leaf.operator === "outside";
|
|
145681
|
+
if (leaf.operator !== void 0 && range !== Array.isArray(leaf.value)) ctx.addIssue({
|
|
145682
|
+
code: "custom",
|
|
145683
|
+
message: range ? "a range takes [low, high]" : "only a range takes [low, high]",
|
|
145684
|
+
path: ["value"]
|
|
145685
|
+
});
|
|
145597
145686
|
});
|
|
145598
145687
|
var DeviceEventLeafSchema = object({
|
|
145599
145688
|
kind: literal("device-event"),
|
|
145689
|
+
...eventLeafId,
|
|
145600
145690
|
/** An `EventCategory` value. */
|
|
145601
145691
|
category: string().min(1),
|
|
145602
145692
|
deviceId: number$1().int().nonnegative().optional()
|
|
@@ -145609,18 +145699,24 @@ var DeviceEventLeafSchema = object({
|
|
|
145609
145699
|
*/
|
|
145610
145700
|
var ScheduleLeafSchema = object({
|
|
145611
145701
|
kind: literal("schedule"),
|
|
145702
|
+
...eventLeafId,
|
|
145612
145703
|
at: TimeSpecSchema.optional(),
|
|
145613
145704
|
days: array(WeekdayKeySchema).min(1).max(7).optional(),
|
|
145614
145705
|
/** @deprecated legacy cron — new schedules use `at`. */
|
|
145615
145706
|
cron: string().min(1).max(120).optional()
|
|
145616
145707
|
}).refine((leaf) => leaf.at === void 0 !== (leaf.cron === void 0), { message: "a schedule names exactly one of `at` (a time spec) and `cron` (legacy)" }).refine((leaf) => leaf.days === void 0 || leaf.at !== void 0, { message: "`days` goes with `at`; a cron expression carries its own days" });
|
|
145617
|
-
var ManualLeafSchema = object({
|
|
145708
|
+
var ManualLeafSchema = object({
|
|
145709
|
+
kind: literal("manual"),
|
|
145710
|
+
...eventLeafId
|
|
145711
|
+
});
|
|
145618
145712
|
var IntervalLeafSchema = object({
|
|
145619
145713
|
kind: literal("interval"),
|
|
145714
|
+
...eventLeafId,
|
|
145620
145715
|
minutes: number$1().int().min(1).max(1440)
|
|
145621
145716
|
});
|
|
145622
145717
|
var DetectionLeafSchema = object({
|
|
145623
145718
|
kind: literal("detection"),
|
|
145719
|
+
...eventLeafId,
|
|
145624
145720
|
/** One macro class each, optionally narrowed by a label; a track of any listed subject fires. */
|
|
145625
145721
|
subjects: array(DetectionSubjectSchema).min(1),
|
|
145626
145722
|
deviceIds: array(number$1().int().nonnegative()).min(1),
|
|
@@ -145631,6 +145727,7 @@ var DetectionLeafSchema = object({
|
|
|
145631
145727
|
});
|
|
145632
145728
|
var StationaryLeafSchema = object({
|
|
145633
145729
|
kind: literal("stationary"),
|
|
145730
|
+
...eventLeafId,
|
|
145634
145731
|
deviceIds: array(number$1().int().nonnegative()).min(1),
|
|
145635
145732
|
subjects: array(StationarySubjectSchema).min(1).optional(),
|
|
145636
145733
|
zones: array(string().min(1)).min(1).optional(),
|
|
@@ -145658,7 +145755,9 @@ var DeviceIsLeafSchema = object({
|
|
|
145658
145755
|
QuantityValueSchema
|
|
145659
145756
|
]),
|
|
145660
145757
|
/** The unit the person picked for `value` (display only; `value` is in the base unit). */
|
|
145661
|
-
unit: string().min(1).optional()
|
|
145758
|
+
unit: string().min(1).optional(),
|
|
145759
|
+
/** The comparison must hold (`held`) or the value stay put (`stable`) this long. */
|
|
145760
|
+
for: HoldSpecSchema.optional()
|
|
145662
145761
|
});
|
|
145663
145762
|
/**
|
|
145664
145763
|
* True when the camera currently has a PARKED object matching `subjects` in at
|
|
@@ -145674,6 +145773,41 @@ var StationaryPresentLeafSchema = object({
|
|
|
145674
145773
|
minCount: number$1().int().positive().optional()
|
|
145675
145774
|
});
|
|
145676
145775
|
/**
|
|
145776
|
+
* True while the site-local clock is inside a daily window and/or on one of
|
|
145777
|
+
* the named days. `days` names the local day a window STARTS on, so
|
|
145778
|
+
* 22:00-06:00 on weekdays is still inside at 01:00 Saturday. A one-date spec
|
|
145779
|
+
* (`kind: 'date'`) is refused: only a clock time or a sun event makes a window
|
|
145780
|
+
* that repeats every day.
|
|
145781
|
+
*/
|
|
145782
|
+
var TimeIsLeafSchema = object({
|
|
145783
|
+
kind: literal("time-is"),
|
|
145784
|
+
between: object({
|
|
145785
|
+
from: TimeSpecSchema,
|
|
145786
|
+
to: TimeSpecSchema
|
|
145787
|
+
}).optional(),
|
|
145788
|
+
days: array(WeekdayKeySchema).min(1).max(7).optional()
|
|
145789
|
+
}).superRefine((leaf, ctx) => {
|
|
145790
|
+
if (leaf.between === void 0 && leaf.days === void 0) ctx.addIssue({
|
|
145791
|
+
code: "custom",
|
|
145792
|
+
message: "a time-is leaf needs a between window, days, or both"
|
|
145793
|
+
});
|
|
145794
|
+
for (const end of ["from", "to"]) if (leaf.between?.[end].kind === "date") ctx.addIssue({
|
|
145795
|
+
code: "custom",
|
|
145796
|
+
message: "a one-date time cannot bound a daily window: use a clock time or a sun event",
|
|
145797
|
+
path: ["between", end]
|
|
145798
|
+
});
|
|
145799
|
+
});
|
|
145800
|
+
/**
|
|
145801
|
+
* True for the run that one of the named event leaves started. It reads the
|
|
145802
|
+
* run, not a device: in the tree it is judged against the leaf that fired, in
|
|
145803
|
+
* a step guard against the trigger the run carries. A run no event leaf
|
|
145804
|
+
* started (a state-only tree becoming true) is false.
|
|
145805
|
+
*/
|
|
145806
|
+
var TriggeredByLeafSchema = object({
|
|
145807
|
+
kind: literal("triggered-by"),
|
|
145808
|
+
leafIds: array(string().regex(EVENT_LEAF_ID_RE)).min(1).max(20)
|
|
145809
|
+
});
|
|
145810
|
+
/**
|
|
145677
145811
|
* The escape hatch: the bounded expression engine over named device bindings.
|
|
145678
145812
|
* Declared as a plain object so a discriminated union can read `kind`; the
|
|
145679
145813
|
* author-time validation is the SAME function `ExpressionSourceSchema` runs.
|
|
@@ -145681,7 +145815,9 @@ var StationaryPresentLeafSchema = object({
|
|
|
145681
145815
|
var ExpressionLeafSchema = object({
|
|
145682
145816
|
kind: literal("expression"),
|
|
145683
145817
|
expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
|
|
145684
|
-
bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), ExpressionBindingSourceSchema)
|
|
145818
|
+
bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), ExpressionBindingSourceSchema),
|
|
145819
|
+
/** The expression must stay true this long. An expression has no single value, so only `held`. */
|
|
145820
|
+
for: HoldSpecSchema.optional()
|
|
145685
145821
|
}).superRefine((src, ctx) => {
|
|
145686
145822
|
const err = validateExpressionSource(src);
|
|
145687
145823
|
if (err !== null) ctx.addIssue({
|
|
@@ -145689,6 +145825,11 @@ var ExpressionLeafSchema = object({
|
|
|
145689
145825
|
message: err,
|
|
145690
145826
|
path: ["expr"]
|
|
145691
145827
|
});
|
|
145828
|
+
if (src.for?.mode === "stable") ctx.addIssue({
|
|
145829
|
+
code: "custom",
|
|
145830
|
+
message: "an expression is held, not stable: it has no single value to keep still",
|
|
145831
|
+
path: ["for", "mode"]
|
|
145832
|
+
});
|
|
145692
145833
|
});
|
|
145693
145834
|
var AutomationWhenSchema = lazy(() => discriminatedUnion("kind", [
|
|
145694
145835
|
object({
|
|
@@ -145712,7 +145853,9 @@ var AutomationWhenSchema = lazy(() => discriminatedUnion("kind", [
|
|
|
145712
145853
|
StationaryLeafSchema,
|
|
145713
145854
|
DeviceIsLeafSchema,
|
|
145714
145855
|
StationaryPresentLeafSchema,
|
|
145715
|
-
ExpressionLeafSchema
|
|
145856
|
+
ExpressionLeafSchema,
|
|
145857
|
+
TimeIsLeafSchema,
|
|
145858
|
+
TriggeredByLeafSchema
|
|
145716
145859
|
]));
|
|
145717
145860
|
var EVENT_KINDS = new Set([
|
|
145718
145861
|
"device-becomes",
|
|
@@ -145766,6 +145909,28 @@ function hasEventLeaves(node) {
|
|
|
145766
145909
|
});
|
|
145767
145910
|
return found;
|
|
145768
145911
|
}
|
|
145912
|
+
/** The event leaves of the tree that carry an id, in tree order. */
|
|
145913
|
+
function identifiedEventLeaves(when) {
|
|
145914
|
+
const found = [];
|
|
145915
|
+
forEachLeaf(when, (leaf, path) => {
|
|
145916
|
+
if (isEventLeaf(leaf) && leaf.id !== void 0) found.push({
|
|
145917
|
+
id: leaf.id,
|
|
145918
|
+
path,
|
|
145919
|
+
leaf
|
|
145920
|
+
});
|
|
145921
|
+
});
|
|
145922
|
+
return found;
|
|
145923
|
+
}
|
|
145924
|
+
/** Does the tree hold a `triggered-by` leaf? */
|
|
145925
|
+
function hasTriggeredByLeaves(when) {
|
|
145926
|
+
let found = false;
|
|
145927
|
+
forEachLeaf(when, (leaf) => {
|
|
145928
|
+
if (leaf.kind === "triggered-by") found = true;
|
|
145929
|
+
});
|
|
145930
|
+
return found;
|
|
145931
|
+
}
|
|
145932
|
+
/** Why a `triggered-by` leaf is refused outside an automation: there is no trigger row to name. */
|
|
145933
|
+
var TRIGGERED_BY_NEEDS_AUTOMATION = "\"triggered by\" reads which trigger started an automation — an action or a scheduler has no trigger rows, so it could never be true here";
|
|
145769
145934
|
function hasEmptyContainer(node) {
|
|
145770
145935
|
if (isLeaf(node)) return false;
|
|
145771
145936
|
if (node.kind === "not") return hasEmptyContainer(node.child);
|
|
@@ -145824,6 +145989,11 @@ function validateWhenTree(when) {
|
|
|
145824
145989
|
if (depth > 4) return `the rules nest ${depth} levels deep — the limit is 4. "not (any of …)" is the same as "all of (not …)", which is one level shallower`;
|
|
145825
145990
|
const leaves = countWhenLeaves(when);
|
|
145826
145991
|
if (leaves > 32) return `the rules use ${leaves} rows — the limit is 32`;
|
|
145992
|
+
const seen = /* @__PURE__ */ new Set();
|
|
145993
|
+
for (const entry of identifiedEventLeaves(when)) {
|
|
145994
|
+
if (seen.has(entry.id)) return `two trigger rows share the id "${entry.id}" — an id names one row`;
|
|
145995
|
+
seen.add(entry.id);
|
|
145996
|
+
}
|
|
145827
145997
|
const need = eventNeed(when, "when", false);
|
|
145828
145998
|
if ("error" in need) return need.error;
|
|
145829
145999
|
const [first, second] = need.paths;
|
|
@@ -146114,7 +146284,18 @@ var GuardedCapStepSchema = AutomationCapStepBaseSchema.extend(stepGuardShape).re
|
|
|
146114
146284
|
message: "a domain target needs the vocabulary action it applies to (actionId)",
|
|
146115
146285
|
path: ["actionId"]
|
|
146116
146286
|
}).refine((step) => step.else === void 0 || step.if !== void 0, elseNeedsIf);
|
|
146117
|
-
|
|
146287
|
+
/**
|
|
146288
|
+
* A step of a STANDALONE list (an action, a scheduler point, a preset): the
|
|
146289
|
+
* same two step kinds an automation runs, minus a guard that reads the
|
|
146290
|
+
* automation's trigger, which such a list does not have.
|
|
146291
|
+
*/
|
|
146292
|
+
var ActionStepSchema = discriminatedUnion("kind", [GuardedWaitStepSchema, GuardedCapStepSchema]).superRefine((step, ctx) => {
|
|
146293
|
+
if (step.if !== void 0 && hasTriggeredByLeaves(step.if)) ctx.addIssue({
|
|
146294
|
+
code: "custom",
|
|
146295
|
+
message: TRIGGERED_BY_NEEDS_AUTOMATION,
|
|
146296
|
+
path: ["if"]
|
|
146297
|
+
});
|
|
146298
|
+
});
|
|
146118
146299
|
var AutomationActionSchema = discriminatedUnion("kind", [
|
|
146119
146300
|
GuardedWaitStepSchema,
|
|
146120
146301
|
GuardedCapStepSchema,
|
|
@@ -146211,6 +146392,11 @@ var STATIONARY_DESCRIPTIONS = {
|
|
|
146211
146392
|
phase: "appeared or departed",
|
|
146212
146393
|
entryId: "the stopped object"
|
|
146213
146394
|
};
|
|
146395
|
+
var BECOMES_DESCRIPTIONS = {
|
|
146396
|
+
deviceId: "the device that changed",
|
|
146397
|
+
from: "the value before the change, empty when it is not known",
|
|
146398
|
+
to: "the value it changed to"
|
|
146399
|
+
};
|
|
146214
146400
|
function describe$1(descriptions) {
|
|
146215
146401
|
return Object.entries(descriptions).map(([name, description]) => ({
|
|
146216
146402
|
name,
|
|
@@ -146219,6 +146405,10 @@ function describe$1(descriptions) {
|
|
|
146219
146405
|
}
|
|
146220
146406
|
describe$1(DETECTION_DESCRIPTIONS);
|
|
146221
146407
|
describe$1(STATIONARY_DESCRIPTIONS);
|
|
146408
|
+
describe$1(BECOMES_DESCRIPTIONS).map((v) => v.name === "deviceId" ? {
|
|
146409
|
+
...v,
|
|
146410
|
+
hintKey: "becomesDeviceId"
|
|
146411
|
+
} : v);
|
|
146222
146412
|
new Set(Object.values(COCO_TO_MACRO.mapping));
|
|
146223
146413
|
/**
|
|
146224
146414
|
* Schedulers (D983) — an entity that performs actions over the day.
|
|
@@ -146243,6 +146433,13 @@ var SchedulerStateTreeSchema = AutomationWhenSchema.superRefine((when, ctx) => {
|
|
|
146243
146433
|
});
|
|
146244
146434
|
return;
|
|
146245
146435
|
}
|
|
146436
|
+
if (hasTriggeredByLeaves(when)) {
|
|
146437
|
+
ctx.addIssue({
|
|
146438
|
+
code: "custom",
|
|
146439
|
+
message: TRIGGERED_BY_NEEDS_AUTOMATION
|
|
146440
|
+
});
|
|
146441
|
+
return;
|
|
146442
|
+
}
|
|
146246
146443
|
const problem = validateWhenTree(when);
|
|
146247
146444
|
if (problem !== null) ctx.addIssue({
|
|
146248
146445
|
code: "custom",
|
|
@@ -146448,7 +146645,9 @@ var AutomationTriggerTraceSchema = object({
|
|
|
146448
146645
|
/** Why an event was rejected ("class person not in [dog]") or what fired. */
|
|
146449
146646
|
reason: string(),
|
|
146450
146647
|
/** deviceId, className, trackId, score … — only what the trigger exposes. */
|
|
146451
|
-
vars: record(string(), TraceValueSchema)
|
|
146648
|
+
vars: record(string(), TraceValueSchema),
|
|
146649
|
+
/** A hold (`for`) this occurrence went through: pending, cancelled, fired or re-seeded. */
|
|
146650
|
+
hold: HoldTraceSchema.optional()
|
|
146452
146651
|
});
|
|
146453
146652
|
var AutomationConditionTraceNodeSchema = object({
|
|
146454
146653
|
/** `when` for the root, `when.<i>` for its i-th child, … (`conditions…` on an old trace). */
|
|
@@ -146461,6 +146660,8 @@ var AutomationConditionTraceNodeSchema = object({
|
|
|
146461
146660
|
"device-is",
|
|
146462
146661
|
"expression",
|
|
146463
146662
|
"stationary-present",
|
|
146663
|
+
"time-is",
|
|
146664
|
+
"triggered-by",
|
|
146464
146665
|
"device-becomes",
|
|
146465
146666
|
"device-event",
|
|
146466
146667
|
"schedule",
|
|
@@ -146794,7 +146995,7 @@ object({
|
|
|
146794
146995
|
* is irrelevant; the array is treated as a set by consumers. */
|
|
146795
146996
|
hiddenChildIds: array(number$1()).readonly()
|
|
146796
146997
|
});
|
|
146797
|
-
DeviceType.Camera, DeviceType.
|
|
146998
|
+
DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Cover, DeviceType.Lock, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Generic, method(object({
|
|
146798
146999
|
deviceId: number$1().int().nonnegative(),
|
|
146799
147000
|
childDeviceId: number$1().int().nonnegative(),
|
|
146800
147001
|
hidden: boolean()
|
|
@@ -150965,6 +151166,140 @@ var climateControlCapability = {
|
|
|
150965
151166
|
} }
|
|
150966
151167
|
};
|
|
150967
151168
|
/**
|
|
151169
|
+
* cluster-update — the ONE flow that brings the whole cluster to a release
|
|
151170
|
+
* (planning#493). Hub-provided (`server-provided`), hub-only: the hub runs
|
|
151171
|
+
* the sequence itself, so the admin UI, the MCP and the CLI all start the same
|
|
151172
|
+
* job and read the same report instead of each driving their own loop.
|
|
151173
|
+
*
|
|
151174
|
+
* 1. backup (`backup.trigger`) — skipped only when the caller says so
|
|
151175
|
+
* 2. the hub's server closure (`applyServerUpdate`); the hub restarts and the
|
|
151176
|
+
* job RESUMES on the new boot, verified against the hub's running version
|
|
151177
|
+
* 3. every online agent behind the target, one at a time, verified: runs the
|
|
151178
|
+
* target, settled, online, and its capabilities registered (D848) — an
|
|
151179
|
+
* agent that comes back capless is a FAILED step, never a done one
|
|
151180
|
+
* 4. every stale addon on the hub (`addons.updatePackage`); agents follow by
|
|
151181
|
+
* reconciliation, which is verified, never pushed
|
|
151182
|
+
*
|
|
151183
|
+
* The job stops on the first failed step with a typed reason (D877). Its state
|
|
151184
|
+
* is durable on the hub and read by RPC (`getClusterUpdateJob`) — events are
|
|
151185
|
+
* telemetry and never carry it (D8, D11).
|
|
151186
|
+
*/
|
|
151187
|
+
/** The steps, in the order they run. */
|
|
151188
|
+
var ClusterUpdateStepKindSchema = _enum([
|
|
151189
|
+
"backup",
|
|
151190
|
+
"hub-server",
|
|
151191
|
+
"agent-server",
|
|
151192
|
+
"addons"
|
|
151193
|
+
]);
|
|
151194
|
+
/**
|
|
151195
|
+
* - `pending` — not reached yet.
|
|
151196
|
+
* - `running` — in progress (for `hub-server`: possibly across the restart).
|
|
151197
|
+
* - `ok` — done AND verified.
|
|
151198
|
+
* - `failed` — did not land; `reason` + `detail` say why. Stops the job.
|
|
151199
|
+
* - `skipped` — not run: nothing to do, opted out, the node is offline, or a
|
|
151200
|
+
* step before it failed. `detail` says which.
|
|
151201
|
+
*/
|
|
151202
|
+
var ClusterUpdateStepStatusSchema = _enum([
|
|
151203
|
+
"pending",
|
|
151204
|
+
"running",
|
|
151205
|
+
"ok",
|
|
151206
|
+
"failed",
|
|
151207
|
+
"skipped"
|
|
151208
|
+
]);
|
|
151209
|
+
/**
|
|
151210
|
+
* Why a step (and with it the job) failed. Stable, greppable; `detail` carries
|
|
151211
|
+
* the prose.
|
|
151212
|
+
*/
|
|
151213
|
+
var ClusterUpdateFailureReasonSchema = _enum([
|
|
151214
|
+
"backup-unavailable",
|
|
151215
|
+
"backup-failed",
|
|
151216
|
+
"server-refused",
|
|
151217
|
+
"server-not-on-target",
|
|
151218
|
+
"node-capless",
|
|
151219
|
+
"status-unreadable",
|
|
151220
|
+
"addon-update-failed",
|
|
151221
|
+
"addons-not-converged",
|
|
151222
|
+
"interrupted"
|
|
151223
|
+
]);
|
|
151224
|
+
var ClusterUpdateStepSchema = object({
|
|
151225
|
+
kind: ClusterUpdateStepKindSchema,
|
|
151226
|
+
/** The node the step acts on; absent for `backup` and `addons`. */
|
|
151227
|
+
nodeId: string().optional(),
|
|
151228
|
+
status: ClusterUpdateStepStatusSchema,
|
|
151229
|
+
/** One line for the operator: what happened, or why not. */
|
|
151230
|
+
detail: string(),
|
|
151231
|
+
reason: ClusterUpdateFailureReasonSchema.optional(),
|
|
151232
|
+
/** `hub-server` / `agent-server`: the version the node ran before. */
|
|
151233
|
+
fromVersion: string().nullable().optional(),
|
|
151234
|
+
/** `addons`: the packages this step updates, `name from -> to`. */
|
|
151235
|
+
packages: array(string()).readonly().optional(),
|
|
151236
|
+
startedAt: number$1().optional(),
|
|
151237
|
+
finishedAt: number$1().optional()
|
|
151238
|
+
});
|
|
151239
|
+
var ClusterUpdateJobStateSchema = _enum([
|
|
151240
|
+
"running",
|
|
151241
|
+
"succeeded",
|
|
151242
|
+
"failed"
|
|
151243
|
+
]);
|
|
151244
|
+
var ClusterUpdateJobSchema = object({
|
|
151245
|
+
id: string(),
|
|
151246
|
+
state: ClusterUpdateJobStateSchema,
|
|
151247
|
+
/** The server version every node is brought to. */
|
|
151248
|
+
targetVersion: string(),
|
|
151249
|
+
/** Who started it (the user name, or `system`). */
|
|
151250
|
+
requestedBy: string(),
|
|
151251
|
+
startedAt: number$1(),
|
|
151252
|
+
finishedAt: number$1().optional(),
|
|
151253
|
+
/** Every step, in run order; later steps stay `pending` while it runs. */
|
|
151254
|
+
steps: array(ClusterUpdateStepSchema).readonly(),
|
|
151255
|
+
/** On `failed`: the step that stopped it (`nodeId` or the step kind). */
|
|
151256
|
+
stoppedAt: string().optional(),
|
|
151257
|
+
reason: ClusterUpdateFailureReasonSchema.optional(),
|
|
151258
|
+
/** Agents offline when the plan was read: never touched. */
|
|
151259
|
+
skippedOffline: array(string()).readonly()
|
|
151260
|
+
});
|
|
151261
|
+
var ClusterUpdateOptionsSchema = object({
|
|
151262
|
+
/** Explicit server target; omitted = the hub's latest registry check. */
|
|
151263
|
+
version: string().optional(),
|
|
151264
|
+
/** Update the addons too (default true). */
|
|
151265
|
+
addons: boolean().optional(),
|
|
151266
|
+
/**
|
|
151267
|
+
* Back up before touching anything (default true). `false` is an explicit
|
|
151268
|
+
* operator opt-out; a missing backup provider is otherwise a failure.
|
|
151269
|
+
*/
|
|
151270
|
+
backup: boolean().optional()
|
|
151271
|
+
});
|
|
151272
|
+
/** Why a plan cannot start. */
|
|
151273
|
+
var ClusterUpdateBlockerSchema = _enum([
|
|
151274
|
+
"no-target",
|
|
151275
|
+
"node-busy",
|
|
151276
|
+
"job-running",
|
|
151277
|
+
"nothing-to-do",
|
|
151278
|
+
"status-unreadable"
|
|
151279
|
+
]);
|
|
151280
|
+
var ClusterUpdatePlanSchema = object({
|
|
151281
|
+
/** `null` when no target could be resolved (`blocker: 'no-target'`). */
|
|
151282
|
+
targetVersion: string().nullable(),
|
|
151283
|
+
/** The steps the job WOULD run, all `pending` (or `skipped` with a reason). */
|
|
151284
|
+
steps: array(ClusterUpdateStepSchema).readonly(),
|
|
151285
|
+
skippedOffline: array(string()).readonly(),
|
|
151286
|
+
/** `null` = the plan can start. */
|
|
151287
|
+
blocker: ClusterUpdateBlockerSchema.nullable(),
|
|
151288
|
+
/** Prose for `blocker`. */
|
|
151289
|
+
blockerDetail: string().nullable()
|
|
151290
|
+
});
|
|
151291
|
+
var StartClusterUpdateResultSchema = object({
|
|
151292
|
+
accepted: boolean(),
|
|
151293
|
+
/** The job to follow with `getClusterUpdateJob`; `null` when refused. */
|
|
151294
|
+
jobId: string().nullable(),
|
|
151295
|
+
blocker: ClusterUpdateBlockerSchema.nullable(),
|
|
151296
|
+
message: string()
|
|
151297
|
+
});
|
|
151298
|
+
method(ClusterUpdateOptionsSchema, ClusterUpdatePlanSchema, { auth: "admin" }), method(ClusterUpdateOptionsSchema, StartClusterUpdateResultSchema, {
|
|
151299
|
+
kind: "mutation",
|
|
151300
|
+
auth: "admin"
|
|
151301
|
+
}), method(object({ jobId: string().optional() }), ClusterUpdateJobSchema.nullable(), { auth: "admin" });
|
|
151302
|
+
/**
|
|
150968
151303
|
* Color-light cap. Coexists with `switch` (on/off) and `brightness`
|
|
150969
151304
|
* (level) on the same device — `switch` toggles the bulb, `brightness`
|
|
150970
151305
|
* sets the dim level, this cap sets the chromaticity.
|
|
@@ -152295,7 +152630,7 @@ var mediaPlayerCapability = {
|
|
|
152295
152630
|
isMuted: { kind: "boolean" }
|
|
152296
152631
|
} }
|
|
152297
152632
|
};
|
|
152298
|
-
DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, DeviceType.EventEmitter, DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Heater, DeviceType.Dryer, DeviceType.Gateway, DeviceType.HeatPump, DeviceType.Camera, DeviceType.Fan, DeviceType.Lock, DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Gateway, DeviceType.
|
|
152633
|
+
DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, DeviceType.EventEmitter, DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Heater, DeviceType.Dryer, DeviceType.Gateway, DeviceType.HeatPump, DeviceType.Camera, DeviceType.Fan, DeviceType.Lock, DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Gateway, DeviceType.Camera, DeviceType.Sensor, DeviceType.MediaPlayer, DeviceType.Vacuum, DeviceType.Generic, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.PetFountain, DeviceType.Fan, DeviceType.Humidifier, DeviceType.Climate, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.MediaPlayer;
|
|
152299
152634
|
var NUMBER = {
|
|
152300
152635
|
kind: "fixed",
|
|
152301
152636
|
result: ["number"]
|
|
@@ -153788,27 +154123,35 @@ var deviceAdminLinkCapability = {
|
|
|
153788
154123
|
getAdminLink: method(object({ deviceId: number$1().int().nonnegative() }), DeviceAdminLinkSchema.nullable(), { auth: "admin" }) }
|
|
153789
154124
|
};
|
|
153790
154125
|
/**
|
|
153791
|
-
* device-
|
|
153792
|
-
*
|
|
153793
|
-
*
|
|
153794
|
-
*
|
|
153795
|
-
*
|
|
153796
|
-
*
|
|
153797
|
-
*
|
|
153798
|
-
*
|
|
153799
|
-
*
|
|
153800
|
-
*
|
|
153801
|
-
*
|
|
153802
|
-
*
|
|
153803
|
-
*
|
|
153804
|
-
*
|
|
153805
|
-
*
|
|
153806
|
-
*
|
|
153807
|
-
*
|
|
153808
|
-
|
|
153809
|
-
|
|
153810
|
-
*
|
|
153811
|
-
*
|
|
154126
|
+
* `device-adoption` — generic discovery + adoption surface,
|
|
154127
|
+
* system-scoped collection (one provider per integration addon), routed
|
|
154128
|
+
* by explicit `{ addonId }` on direct `deviceAdoption.*` calls — the same
|
|
154129
|
+
* pin model as `connection-test`. The admin UI keeps using
|
|
154130
|
+
* `deviceManager.adoption*` (which already threads `addonId`). The de-HA-ified
|
|
154131
|
+
* successor to `ha-discovery`:
|
|
154132
|
+
* keyed by `integrationId` (the addon resolves integrationId → broker
|
|
154133
|
+
* internally) rather than a connection-specific `brokerId`, and it
|
|
154134
|
+
* OWNS the shared `DiscoveredChildDevice` candidate type
|
|
154135
|
+
* (declared below) so a single shared adoption modal renders any integration's
|
|
154136
|
+
* candidate tree.
|
|
154137
|
+
*
|
|
154138
|
+
* UI flow (Integrations page → integration detail):
|
|
154139
|
+
* 1. `listCandidates({integrationId, page, pageSize, filter})` →
|
|
154140
|
+
* paginated candidate list, each row collapsed.
|
|
154141
|
+
* 2. User expands a row → `getCandidate({integrationId,
|
|
154142
|
+
* childNativeId})` returns the single candidate (with its nested
|
|
154143
|
+
* `children`) for the accordion render.
|
|
154144
|
+
* 3. User clicks "Adopt" on one or more candidates →
|
|
154145
|
+
* `adopt({integrationId, childNativeIds, perCandidate?})`
|
|
154146
|
+
* materialises one parent CamStack device per candidate plus its
|
|
154147
|
+
* accessory children. `perCandidate[childNativeId]` carries an
|
|
154148
|
+
* optional display-name override + a `hiddenChildIds` pre-hide set
|
|
154149
|
+
* (the parent's `accessories.hiddenChildIds` gates UI visibility).
|
|
154150
|
+
* 4. User clicks "Release" → `release({integrationId, camDeviceId})`
|
|
154151
|
+
* removes the parent + every child from the kernel registry.
|
|
154152
|
+
*/
|
|
154153
|
+
/**
|
|
154154
|
+
* Status enum for a discovered device. Generic enough for
|
|
153812
154155
|
* battery cams, awake cams, and unreachable cams alike.
|
|
153813
154156
|
*/
|
|
153814
154157
|
var DiscoveredChildStatusSchema = _enum([
|
|
@@ -153825,12 +154168,12 @@ var DiscoveredChildDeviceSchema = lazy(() => object({
|
|
|
153825
154168
|
/** DeviceType the child should be created with on adopt. */
|
|
153826
154169
|
type: _enum(DeviceType),
|
|
153827
154170
|
status: DiscoveredChildStatusSchema,
|
|
153828
|
-
/** Free-form integration-specific metadata surfaced in the
|
|
154171
|
+
/** Free-form integration-specific metadata surfaced in the adoption modal. */
|
|
153829
154172
|
metadata: object({
|
|
153830
154173
|
model: string().optional(),
|
|
153831
154174
|
serialNumber: string().optional(),
|
|
153832
154175
|
uid: string().optional(),
|
|
153833
|
-
/** Reolink: 0-based channel index inside the parent NVR
|
|
154176
|
+
/** Reolink: 0-based channel index inside the parent NVR. */
|
|
153834
154177
|
rtspChannel: number$1().int().nonnegative().optional(),
|
|
153835
154178
|
isBattery: boolean().optional(),
|
|
153836
154179
|
isDoorbell: boolean().optional(),
|
|
@@ -153846,137 +154189,24 @@ var DiscoveredChildDeviceSchema = lazy(() => object({
|
|
|
153846
154189
|
}).default({}),
|
|
153847
154190
|
/**
|
|
153848
154191
|
* `true` when the framework already created a child device for this
|
|
153849
|
-
* `childNativeId` under the current parent. The
|
|
154192
|
+
* `childNativeId` under the current parent. The adoption modal uses it to
|
|
153850
154193
|
* gate the Add/Remove button and surface the existing `deviceId`.
|
|
153851
154194
|
*/
|
|
153852
154195
|
alreadyAdopted: boolean(),
|
|
153853
154196
|
/** When `alreadyAdopted=true`, the framework-assigned child device id. */
|
|
153854
154197
|
adoptedDeviceId: number$1().int().nonnegative().nullable(),
|
|
153855
|
-
/** Capability names the candidate advertises — integrations populate,
|
|
154198
|
+
/** Capability names the candidate advertises — integrations populate, flat enumerations omit. */
|
|
153856
154199
|
capabilities: array(string()).readonly().optional(),
|
|
153857
|
-
/** Feature flags the candidate advertises — integrations populate,
|
|
154200
|
+
/** Feature flags the candidate advertises — integrations populate, flat enumerations omit. */
|
|
153858
154201
|
features: array(string()).readonly().optional(),
|
|
153859
154202
|
/** Upstream-system identity + rendering hints for the candidate. */
|
|
153860
154203
|
sourceInfo: SourceInfoSchema.optional(),
|
|
153861
|
-
/** Nested entity-children for accordion preview — integrations populate,
|
|
154204
|
+
/** Nested entity-children for accordion preview — integrations populate, flat enumerations omit. */
|
|
153862
154205
|
children: array(DiscoveredChildDeviceSchema).readonly().optional(),
|
|
153863
154206
|
/** `childNativeId` of the gateway candidate in the same list this device sits behind. */
|
|
153864
154207
|
parentStableId: string().optional()
|
|
153865
154208
|
}));
|
|
153866
154209
|
/**
|
|
153867
|
-
* Status block — populated by the integration after each
|
|
153868
|
-
* `refreshDiscovery` (or push-driven update). The runtime-state slice
|
|
153869
|
-
* is what the panel reads via the per-device proxy; `getStatus`
|
|
153870
|
-
* returns the same payload via the codegen'd auto-injection.
|
|
153871
|
-
*/
|
|
153872
|
-
var DeviceDiscoveryStatusSchema = object({
|
|
153873
|
-
discovered: array(DiscoveredChildDeviceSchema),
|
|
153874
|
-
/** Wall-clock ms of the last successful enumeration. */
|
|
153875
|
-
lastDiscoveryAt: number$1().int().nonnegative().nullable(),
|
|
153876
|
-
/** Last error surfaced from the source (rendered as a banner). */
|
|
153877
|
-
lastError: string().nullable()
|
|
153878
|
-
});
|
|
153879
|
-
var deviceDiscoveryCapability = {
|
|
153880
|
-
name: "device-discovery",
|
|
153881
|
-
scope: "device",
|
|
153882
|
-
deviceNative: true,
|
|
153883
|
-
mode: "singleton",
|
|
153884
|
-
deviceTypes: [DeviceType.Hub],
|
|
153885
|
-
status: {
|
|
153886
|
-
schema: DeviceDiscoveryStatusSchema,
|
|
153887
|
-
kind: "poll"
|
|
153888
|
-
},
|
|
153889
|
-
runtimeState: DeviceDiscoveryStatusSchema.extend({ lastFetchedAt: number$1().int().nonnegative() }),
|
|
153890
|
-
/**
|
|
153891
|
-
* Runtime-state durability: **session** — 5.7 KB of scan output on the largest device, fully re-derivable by re-scanning.
|
|
153892
|
-
*
|
|
153893
|
-
* See `RuntimeStateDurability`. Enforced by
|
|
153894
|
-
* `scripts/check-runtime-state-durability.ts`.
|
|
153895
|
-
*/
|
|
153896
|
-
durability: "session",
|
|
153897
|
-
/**
|
|
153898
|
-
* History (D850): none — inventory.
|
|
153899
|
-
*/
|
|
153900
|
-
history: "none",
|
|
153901
|
-
methods: {
|
|
153902
|
-
/**
|
|
153903
|
-
* Snapshot of the current `discovered` list. Returns the
|
|
153904
|
-
* runtime-state cache — call `refreshDiscovery` first if a
|
|
153905
|
-
* fresh round-trip to the source is required.
|
|
153906
|
-
*/
|
|
153907
|
-
listDiscovered: method(object({ deviceId: number$1().int().nonnegative() }), array(DiscoveredChildDeviceSchema).readonly()),
|
|
153908
|
-
/**
|
|
153909
|
-
* Force the integration to re-enumerate and update the
|
|
153910
|
-
* runtime-state slice. Returns the freshly-enumerated list (also
|
|
153911
|
-
* available via `listDiscovered` post-call).
|
|
153912
|
-
*/
|
|
153913
|
-
refreshDiscovery: method(object({ deviceId: number$1().int().nonnegative() }), array(DiscoveredChildDeviceSchema).readonly(), {
|
|
153914
|
-
kind: "mutation",
|
|
153915
|
-
auth: "admin"
|
|
153916
|
-
}),
|
|
153917
|
-
/**
|
|
153918
|
-
* Promote a discovered entry to a real child device. The framework
|
|
153919
|
-
* creates the child via `kernel.devices.create()` with
|
|
153920
|
-
* `parentDeviceId = parent.id` and seeds the child's config from
|
|
153921
|
-
* `childInitialConfig` (driver-defined; usually carries channel +
|
|
153922
|
-
* uid + parent reference). Returns the kernel-assigned numeric id.
|
|
153923
|
-
*/
|
|
153924
|
-
adoptDevice: method(object({
|
|
153925
|
-
deviceId: number$1().int().nonnegative(),
|
|
153926
|
-
childNativeId: string(),
|
|
153927
|
-
/** Optional override for the child's display name. */
|
|
153928
|
-
name: string().optional()
|
|
153929
|
-
}), object({
|
|
153930
|
-
deviceId: number$1().int().nonnegative(),
|
|
153931
|
-
stableId: string()
|
|
153932
|
-
}), {
|
|
153933
|
-
kind: "mutation",
|
|
153934
|
-
auth: "admin"
|
|
153935
|
-
}),
|
|
153936
|
-
/**
|
|
153937
|
-
* Inverse of `adoptDevice`: removes the child device from the
|
|
153938
|
-
* kernel registry. The discovered entry remains in the
|
|
153939
|
-
* enumeration (status updates resume) so the operator can re-adopt
|
|
153940
|
-
* it later without a fresh refresh.
|
|
153941
|
-
*/
|
|
153942
|
-
releaseDevice: method(object({
|
|
153943
|
-
deviceId: number$1().int().nonnegative(),
|
|
153944
|
-
childDeviceId: number$1().int().nonnegative()
|
|
153945
|
-
}), _void(), {
|
|
153946
|
-
kind: "mutation",
|
|
153947
|
-
auth: "admin"
|
|
153948
|
-
})
|
|
153949
|
-
}
|
|
153950
|
-
};
|
|
153951
|
-
/**
|
|
153952
|
-
* `device-adoption` — generic discovery + adoption surface,
|
|
153953
|
-
* system-scoped collection (one provider per integration addon), routed
|
|
153954
|
-
* by explicit `{ addonId }` on direct `deviceAdoption.*` calls — the same
|
|
153955
|
-
* pin model as `connection-test`. The admin UI keeps using
|
|
153956
|
-
* `deviceManager.adoption*` (which already threads `addonId`). The de-HA-ified
|
|
153957
|
-
* successor to `ha-discovery`:
|
|
153958
|
-
* keyed by `integrationId` (the addon resolves integrationId → broker
|
|
153959
|
-
* internally) rather than a connection-specific `brokerId`, and it
|
|
153960
|
-
* REUSES the shared `DiscoveredChildDevice` candidate type from
|
|
153961
|
-
* `device-discovery.cap.ts` so a single shared adoption panel renders
|
|
153962
|
-
* any integration's candidate tree.
|
|
153963
|
-
*
|
|
153964
|
-
* UI flow (Integrations page → integration detail):
|
|
153965
|
-
* 1. `listCandidates({integrationId, page, pageSize, filter})` →
|
|
153966
|
-
* paginated candidate list, each row collapsed.
|
|
153967
|
-
* 2. User expands a row → `getCandidate({integrationId,
|
|
153968
|
-
* childNativeId})` returns the single candidate (with its nested
|
|
153969
|
-
* `children`) for the accordion render.
|
|
153970
|
-
* 3. User clicks "Adopt" on one or more candidates →
|
|
153971
|
-
* `adopt({integrationId, childNativeIds, perCandidate?})`
|
|
153972
|
-
* materialises one parent CamStack device per candidate plus its
|
|
153973
|
-
* accessory children. `perCandidate[childNativeId]` carries an
|
|
153974
|
-
* optional display-name override + a `hiddenChildIds` pre-hide set
|
|
153975
|
-
* (the parent's `accessories.hiddenChildIds` gates UI visibility).
|
|
153976
|
-
* 4. User clicks "Release" → `release({integrationId, camDeviceId})`
|
|
153977
|
-
* removes the parent + every child from the kernel registry.
|
|
153978
|
-
*/
|
|
153979
|
-
/**
|
|
153980
154210
|
* Provider-declared discovery *granularity* filter (the keystone of the
|
|
153981
154211
|
* single-entity-import design). A provider advertises which discovery
|
|
153982
154212
|
* granularities it supports via `listCandidateFilters`; the operator picks
|
|
@@ -154437,6 +154667,90 @@ var SiteZoneSchema = object({
|
|
|
154437
154667
|
* the ones that most want grouping. */
|
|
154438
154668
|
locationKeys: array(string())
|
|
154439
154669
|
});
|
|
154670
|
+
var DeviceSearchRequiresSchema = object({
|
|
154671
|
+
/** Capability names the field wants a value of. */
|
|
154672
|
+
caps: array(string()).readonly(),
|
|
154673
|
+
/** `any` (default): a device with one of them is compatible. `all`: it must hold every one. */
|
|
154674
|
+
mode: _enum(["any", "all"]).optional()
|
|
154675
|
+
});
|
|
154676
|
+
var DeviceSearchFiltersSchema = object({
|
|
154677
|
+
locations: array(string()).readonly().optional(),
|
|
154678
|
+
integrationIds: array(string()).readonly().optional(),
|
|
154679
|
+
types: array(string()).readonly().optional()
|
|
154680
|
+
});
|
|
154681
|
+
var DeviceSearchInputSchema = object({
|
|
154682
|
+
/** Matches name, location, type, integration (id and label) and id. Case-insensitive. */
|
|
154683
|
+
text: string().optional(),
|
|
154684
|
+
requires: DeviceSearchRequiresSchema.optional(),
|
|
154685
|
+
filters: DeviceSearchFiltersSchema.optional(),
|
|
154686
|
+
/** List the devices that do not provide the required cap too (greyed, not pickable). */
|
|
154687
|
+
includeIncompatible: boolean().optional(),
|
|
154688
|
+
/** The device the field belongs to: its location drives `suggested`. */
|
|
154689
|
+
contextDeviceId: number$1().optional(),
|
|
154690
|
+
/**
|
|
154691
|
+
* Resolve exactly these devices, regardless of every filter, so a picked
|
|
154692
|
+
* value can be rendered. When given, `items` is these devices in the order
|
|
154693
|
+
* asked (no paging, `nextCursor` null) and the ones that do not exist are
|
|
154694
|
+
* listed in `missingIds`.
|
|
154695
|
+
*/
|
|
154696
|
+
ids: array(number$1()).readonly().optional(),
|
|
154697
|
+
cursor: string().nullable().optional(),
|
|
154698
|
+
limit: number$1().int().min(1).max(200).optional()
|
|
154699
|
+
});
|
|
154700
|
+
var DeviceValueOptionSchema = object({
|
|
154701
|
+
cap: string(),
|
|
154702
|
+
/** Status-schema field path inside the cap (same paths as `getWireableFields`). */
|
|
154703
|
+
path: string(),
|
|
154704
|
+
label: string(),
|
|
154705
|
+
/** The current value as text; `null` when it is unknown or the read FAILED — never `0`. */
|
|
154706
|
+
reading: string().nullable(),
|
|
154707
|
+
unit: string().nullable().optional(),
|
|
154708
|
+
/** The field's measured quantity, when the cap declares one, so a client can format the reading. */
|
|
154709
|
+
quantity: ReadingQuantitySchema.optional()
|
|
154710
|
+
});
|
|
154711
|
+
var DeviceSearchItemSchema = object({
|
|
154712
|
+
id: number$1(),
|
|
154713
|
+
name: string(),
|
|
154714
|
+
type: _enum(DeviceType),
|
|
154715
|
+
location: string().nullable(),
|
|
154716
|
+
integrationId: string().nullable(),
|
|
154717
|
+
integrationLabel: string().nullable(),
|
|
154718
|
+
online: boolean().nullable(),
|
|
154719
|
+
disabled: boolean(),
|
|
154720
|
+
compatible: boolean(),
|
|
154721
|
+
/** Only the required caps' fields; empty when nothing was required or the device is incompatible. */
|
|
154722
|
+
values: array(DeviceValueOptionSchema).readonly()
|
|
154723
|
+
});
|
|
154724
|
+
var DeviceSearchFacetValueSchema = object({
|
|
154725
|
+
value: string(),
|
|
154726
|
+
count: number$1()
|
|
154727
|
+
});
|
|
154728
|
+
var DeviceSearchFacetIntegrationSchema = object({
|
|
154729
|
+
id: string(),
|
|
154730
|
+
label: string(),
|
|
154731
|
+
count: number$1()
|
|
154732
|
+
});
|
|
154733
|
+
var DeviceSearchFacetsSchema = object({
|
|
154734
|
+
locations: array(DeviceSearchFacetValueSchema).readonly(),
|
|
154735
|
+
integrations: array(DeviceSearchFacetIntegrationSchema).readonly(),
|
|
154736
|
+
types: array(DeviceSearchFacetValueSchema).readonly()
|
|
154737
|
+
});
|
|
154738
|
+
var DeviceSearchResultSchema = object({
|
|
154739
|
+
items: array(DeviceSearchItemSchema).readonly(),
|
|
154740
|
+
nextCursor: string().nullable(),
|
|
154741
|
+
/** Devices listed by this query across all pages (filters + text applied; incompatible counted only when `includeIncompatible`). */
|
|
154742
|
+
total: number$1(),
|
|
154743
|
+
/** Compatible devices after filters + text. */
|
|
154744
|
+
compatibleTotal: number$1(),
|
|
154745
|
+
/** Every device the caller's fleet holds, before anything is applied. */
|
|
154746
|
+
fleetTotal: number$1(),
|
|
154747
|
+
/** Incompatible devices after filters + text — the K of "show the K that don't". */
|
|
154748
|
+
hiddenIncompatible: number$1(),
|
|
154749
|
+
facets: DeviceSearchFacetsSchema,
|
|
154750
|
+
/** Same location as `contextDeviceId`; first page only. */
|
|
154751
|
+
suggested: array(DeviceSearchItemSchema).readonly(),
|
|
154752
|
+
missingIds: array(number$1()).readonly()
|
|
154753
|
+
});
|
|
154440
154754
|
var ProviderStatusSchema = object({
|
|
154441
154755
|
connected: boolean(),
|
|
154442
154756
|
deviceCount: number$1(),
|
|
@@ -154922,6 +155236,9 @@ var DeviceInfoSchema = object({
|
|
|
154922
155236
|
* named accordion sections (with optional intra-section order). See
|
|
154923
155237
|
* `DeviceMeta.childLayout`. Absent ⇒ no layout declared. */
|
|
154924
155238
|
childLayout: array(ChildLayoutEntrySchema).readonly().optional(),
|
|
155239
|
+
/** The children a container stands for, most preferred first, by accessory
|
|
155240
|
+
* `childKey`. Provider-declared. See `DeviceMeta.primaryChildPreference`. */
|
|
155241
|
+
primaryChildPreference: array(string()).readonly().optional(),
|
|
154925
155242
|
/** Operator-authored per-device display override. See `DeviceMeta.display`. */
|
|
154926
155243
|
display: DeviceDisplayOverrideSchema.optional()
|
|
154927
155244
|
});
|
|
@@ -155070,6 +155387,9 @@ var DeviceMetaSchema = object({
|
|
|
155070
155387
|
* accordion sections (with optional intra-section order). See
|
|
155071
155388
|
* `DeviceMeta.childLayout`. Absent ⇒ no layout declared. */
|
|
155072
155389
|
childLayout: array(ChildLayoutEntrySchema).readonly().optional(),
|
|
155390
|
+
/** The children a container stands for, most preferred first, by accessory
|
|
155391
|
+
* `childKey`. Provider-declared. See `DeviceMeta.primaryChildPreference`. */
|
|
155392
|
+
primaryChildPreference: array(string()).readonly().optional(),
|
|
155073
155393
|
/** Semantic role string (`DeviceRole`) — propagated from the spawn pre-seed.
|
|
155074
155394
|
* Optional: only present for accessory children that carry a known role. */
|
|
155075
155395
|
role: string().nullable().optional(),
|
|
@@ -155285,6 +155605,12 @@ method(object({
|
|
|
155285
155605
|
}), _void(), {
|
|
155286
155606
|
kind: "mutation",
|
|
155287
155607
|
auth: "admin"
|
|
155608
|
+
}), method(object({
|
|
155609
|
+
deviceId: number$1(),
|
|
155610
|
+
primaryChildPreference: array(string()).readonly()
|
|
155611
|
+
}), _void(), {
|
|
155612
|
+
kind: "mutation",
|
|
155613
|
+
auth: "admin"
|
|
155288
155614
|
}), method(object({
|
|
155289
155615
|
deviceId: number$1(),
|
|
155290
155616
|
display: DeviceDisplayOverrideSchema.nullable()
|
|
@@ -155422,7 +155748,7 @@ method(object({
|
|
|
155422
155748
|
* it answers today and the caller filters as it already does.
|
|
155423
155749
|
*/
|
|
155424
155750
|
deviceIds: array(number$1()).optional()
|
|
155425
|
-
}), array(DeviceInfoSchema), { role: "viewer" }), method(object({ deviceId: number$1() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number$1() }), array(DeviceInfoSchema), { role: "viewer" }), method(object({ parentDeviceIds: array(number$1()).max(256) }), record(string(), array(DeviceInfoSchema))), method(object({ deviceId: number$1() }), object({
|
|
155751
|
+
}), array(DeviceInfoSchema), { role: "viewer" }), method(DeviceSearchInputSchema, DeviceSearchResultSchema, { role: "viewer" }), method(object({ deviceId: number$1() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number$1() }), array(DeviceInfoSchema), { role: "viewer" }), method(object({ parentDeviceIds: array(number$1()).max(256) }), record(string(), array(DeviceInfoSchema))), method(object({ deviceId: number$1() }), object({
|
|
155426
155752
|
mode: LinkedDevicesModeSchema,
|
|
155427
155753
|
devices: array(LinkedDeviceSchema)
|
|
155428
155754
|
}), { role: "viewer" }), method(object({ deviceIds: array(number$1()) }), array(LinkedDevicesForDeviceSchema), { role: "viewer" }), method(object({ deviceId: number$1() }), array(StreamSourceEntrySchema$1)), method(object({ deviceId: number$1() }), array(ConfigEntrySchema)), method(object({ deviceId: number$1() }), ConfigUISchemaOutput), method(object({
|
|
@@ -159095,13 +159421,11 @@ var HeroConfirmSchema = _enum([
|
|
|
159095
159421
|
"press"
|
|
159096
159422
|
]);
|
|
159097
159423
|
var HeroActionSchema = object({
|
|
159098
|
-
/** Unique within the model; the `gated` list and the specs name it. */
|
|
159099
159424
|
id: string(),
|
|
159100
159425
|
label: HeroTextSchema,
|
|
159101
159426
|
icon: IconKeySchema,
|
|
159102
159427
|
call: HeroCallSchema,
|
|
159103
159428
|
emphasis: _enum(["primary", "normal"]),
|
|
159104
|
-
/** Ask before running it. */
|
|
159105
159429
|
confirm: HeroConfirmSchema.nullable()
|
|
159106
159430
|
});
|
|
159107
159431
|
var HeroControlSchema = discriminatedUnion("kind", [
|
|
@@ -159152,6 +159476,8 @@ var HeroPillSchema = object({
|
|
|
159152
159476
|
});
|
|
159153
159477
|
var HeroRowSchema = object({
|
|
159154
159478
|
id: HeroRowIdSchema,
|
|
159479
|
+
/** `scene`: the row's action and slider controls are drawn on the scene. Absent: an ordinary row. */
|
|
159480
|
+
placement: _enum(["row", "scene"]).optional(),
|
|
159155
159481
|
/** The row's own name when the kind's label would not tell rows of one kind apart (a circuit's label). */
|
|
159156
159482
|
label: HeroTextSchema.optional(),
|
|
159157
159483
|
/** A group header drawn above the row when it differs from the previous row's ("System"). */
|
|
@@ -159182,9 +159508,16 @@ var HeroBadgeSchema = object({
|
|
|
159182
159508
|
value: number$1().nullable(),
|
|
159183
159509
|
label: HeroTextSchema
|
|
159184
159510
|
});
|
|
159185
|
-
var HeroRemoteSlotSchema = object({
|
|
159186
|
-
/** Saved commands; `null` = not known yet (the button still shows). */
|
|
159187
|
-
commands: number$1().int().nullable()
|
|
159511
|
+
var HeroRemoteSlotSchema = object({
|
|
159512
|
+
/** Saved commands; `null` = not known yet (the button still shows). */
|
|
159513
|
+
commands: number$1().int().nullable(),
|
|
159514
|
+
/**
|
|
159515
|
+
* The control a list row draws as the "open the remote" icon. Recognised by its id
|
|
159516
|
+
* ({@link REMOTE_OPEN_ACTION_ID}); it changes no state, so a client opens the remote
|
|
159517
|
+
* instead of running `call`. Absent on a model from an older server.
|
|
159518
|
+
*/
|
|
159519
|
+
open: HeroActionSchema.optional()
|
|
159520
|
+
});
|
|
159188
159521
|
var HeroConsumablesSlotSchema = object({
|
|
159189
159522
|
items: array(object({
|
|
159190
159523
|
key: string(),
|
|
@@ -159352,6 +159685,8 @@ var HeroModelSchema = object({
|
|
|
159352
159685
|
* the FIRST row that has any (a later row's control is never promoted). When
|
|
159353
159686
|
* the model lists that part in `gated`, the row has no inline control: the
|
|
159354
159687
|
* projection never falls through to another control the caller could use.
|
|
159688
|
+
* - a climate or thermostat row's primary is its `climate.mode` control (no power
|
|
159689
|
+
* toggle: "off" is a mode); when the model gates it the rule above applies as before;
|
|
159355
159690
|
* - a timed run, when the model carries the slot, sits beside that primary:
|
|
159356
159691
|
* Run while idle, Stop while armed. Gating the slot hides the control.
|
|
159357
159692
|
* - the status line is the head (what plays, else the state) plus at most
|
|
@@ -159359,6 +159694,13 @@ var HeroModelSchema = object({
|
|
|
159359
159694
|
* time left on an armed timed run;
|
|
159360
159695
|
* - the trailing fact is the first of power, battery, consumables.
|
|
159361
159696
|
*
|
|
159697
|
+
* - `extras` are the further inline controls of the types that carry more than one
|
|
159698
|
+
* ({@link ROW_EXTRAS_BY_TYPE}): climate setpoint, a robot's return to base,
|
|
159699
|
+
* a player's volume and remote. Each is a control the model already has, named by id,
|
|
159700
|
+
* in that order and at most {@link ROW_EXTRAS_MAX}; one the model lacks, or lists in
|
|
159701
|
+
* `gated`, is absent, and the one `primary` already is never repeats. Empty = the
|
|
159702
|
+
* row of an older server: `primary` alone.
|
|
159703
|
+
*
|
|
159362
159704
|
* `projectDeviceRow` is pure and computes nothing: it selects from a
|
|
159363
159705
|
* {@link HeroModel}. A row that needed a value the hero lacks would mean the
|
|
159364
159706
|
* model is missing it, so the fix goes in the model.
|
|
@@ -159390,8 +159732,16 @@ var HeroRowModelSchema = object({
|
|
|
159390
159732
|
* while armed. `null` when there is no slot, or the caller may not act.
|
|
159391
159733
|
*/
|
|
159392
159734
|
timedRun: HeroRowTimedRunSchema.nullable(),
|
|
159735
|
+
/**
|
|
159736
|
+
* The further inline controls after `primary`, in order (see the header). The remote
|
|
159737
|
+
* is an `action` with id `remote.open`: the client opens the remote, it does not run
|
|
159738
|
+
* the call. Absent or empty = `primary` alone.
|
|
159739
|
+
*/
|
|
159740
|
+
extras: array(HeroControlSchema).max(2).optional(),
|
|
159393
159741
|
trailing: HeroFactSchema.nullable()
|
|
159394
159742
|
});
|
|
159743
|
+
DeviceType.Climate, DeviceType.Thermostat;
|
|
159744
|
+
DeviceType.Climate, DeviceType.Thermostat, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer;
|
|
159395
159745
|
/**
|
|
159396
159746
|
* hero-layout — what a device's hero says (D1023). Read-only: the FIXED
|
|
159397
159747
|
* layouts live in `@camstack/types` and nothing here stores or edits one.
|
|
@@ -170982,13 +171332,23 @@ var NcRuleTargetSchema = object({
|
|
|
170982
171332
|
*/
|
|
170983
171333
|
params: record(string(), unknown()).optional()
|
|
170984
171334
|
});
|
|
171335
|
+
/** Which picture kind one target receives (#487). */
|
|
171336
|
+
var NcTargetAttachmentSchema = _enum([
|
|
171337
|
+
"none",
|
|
171338
|
+
"image",
|
|
171339
|
+
"clip",
|
|
171340
|
+
"gif"
|
|
171341
|
+
]);
|
|
170985
171342
|
var NcTargetOverrideSchema = object({
|
|
170986
171343
|
template: object({
|
|
170987
171344
|
title: string().max(500).optional(),
|
|
170988
171345
|
body: string().max(2e3).optional()
|
|
170989
171346
|
}).optional(),
|
|
170990
171347
|
schedule: NcScheduleSchema.optional(),
|
|
170991
|
-
priority: number$1().int().min(1).max(5).optional()
|
|
171348
|
+
priority: number$1().int().min(1).max(5).optional(),
|
|
171349
|
+
attachment: NcTargetAttachmentSchema.optional(),
|
|
171350
|
+
/** `false` = no buttons for this target; `true` is the same as absent. */
|
|
171351
|
+
actions: boolean().optional()
|
|
170992
171352
|
});
|
|
170993
171353
|
/** Per-target settings keyed by target id (#487). */
|
|
170994
171354
|
var NcTargetOverridesSchema = record(string(), NcTargetOverrideSchema);
|
|
@@ -173225,9 +173585,13 @@ var petFeederCapability = {
|
|
|
173225
173585
|
*/
|
|
173226
173586
|
durability: "session",
|
|
173227
173587
|
/**
|
|
173228
|
-
* History (D850): recorded series.
|
|
173588
|
+
* History (D850): recorded series. `feeding` / `eating` are the meals the
|
|
173589
|
+
* device hero's "Meals" button names — change-only booleans, so a dispense
|
|
173590
|
+
* or a pet at the bowl is one span on the history.
|
|
173229
173591
|
*/
|
|
173230
173592
|
history: { fields: {
|
|
173593
|
+
feeding: { kind: "boolean" },
|
|
173594
|
+
eating: { kind: "boolean" },
|
|
173231
173595
|
foodLevel: { kind: "gauge" },
|
|
173232
173596
|
bowlFood: { kind: "gauge" },
|
|
173233
173597
|
food1: { kind: "gauge" },
|
|
@@ -175020,7 +175384,6 @@ var PowerSourceStateSchema = object({
|
|
|
175020
175384
|
});
|
|
175021
175385
|
var POWER_SOURCE_DEVICE_TYPES = [
|
|
175022
175386
|
DeviceType.Gateway,
|
|
175023
|
-
DeviceType.Hub,
|
|
175024
175387
|
DeviceType.Camera,
|
|
175025
175388
|
DeviceType.Sensor,
|
|
175026
175389
|
DeviceType.MediaPlayer,
|
|
@@ -175072,18 +175435,18 @@ var powerSourceCapability = {
|
|
|
175072
175435
|
mode: "singleton",
|
|
175073
175436
|
deviceTypes: POWER_SOURCE_DEVICE_TYPES,
|
|
175074
175437
|
methods: {
|
|
175075
|
-
getStatus: systemMethod(deviceInput$1, PowerSourceInfoSchema, { auth: "
|
|
175438
|
+
getStatus: systemMethod(deviceInput$1, PowerSourceInfoSchema, { auth: "protected" }),
|
|
175076
175439
|
powerOn: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
|
|
175077
175440
|
kind: "mutation",
|
|
175078
|
-
auth: "
|
|
175441
|
+
auth: "protected"
|
|
175079
175442
|
}),
|
|
175080
175443
|
powerOff: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
|
|
175081
175444
|
kind: "mutation",
|
|
175082
|
-
auth: "
|
|
175445
|
+
auth: "protected"
|
|
175083
175446
|
}),
|
|
175084
175447
|
forceRestart: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
|
|
175085
175448
|
kind: "mutation",
|
|
175086
|
-
auth: "
|
|
175449
|
+
auth: "protected"
|
|
175087
175450
|
})
|
|
175088
175451
|
},
|
|
175089
175452
|
runtimeState: PowerSourceStateSchema,
|
|
@@ -185829,7 +186192,6 @@ var DEVICE_LOCAL_STATE_CAPS = {
|
|
|
185829
186192
|
control: controlCapability,
|
|
185830
186193
|
cover: coverCapability,
|
|
185831
186194
|
dayNight: dayNightCapability,
|
|
185832
|
-
deviceDiscovery: deviceDiscoveryCapability,
|
|
185833
186195
|
deviceStatus: deviceStatusCapability,
|
|
185834
186196
|
dishwasher: dishwasherCapability,
|
|
185835
186197
|
doNotDisturb: doNotDisturbCapability,
|
|
@@ -191008,6 +191370,27 @@ Object.freeze({
|
|
|
191008
191370
|
access: "create",
|
|
191009
191371
|
role: "viewer"
|
|
191010
191372
|
},
|
|
191373
|
+
"clusterUpdate.getClusterUpdateJob": {
|
|
191374
|
+
capName: "cluster-update",
|
|
191375
|
+
capScope: "system",
|
|
191376
|
+
addonId: null,
|
|
191377
|
+
access: "view",
|
|
191378
|
+
role: "admin"
|
|
191379
|
+
},
|
|
191380
|
+
"clusterUpdate.previewClusterUpdate": {
|
|
191381
|
+
capName: "cluster-update",
|
|
191382
|
+
capScope: "system",
|
|
191383
|
+
addonId: null,
|
|
191384
|
+
access: "view",
|
|
191385
|
+
role: "admin"
|
|
191386
|
+
},
|
|
191387
|
+
"clusterUpdate.startClusterUpdate": {
|
|
191388
|
+
capName: "cluster-update",
|
|
191389
|
+
capScope: "system",
|
|
191390
|
+
addonId: null,
|
|
191391
|
+
access: "create",
|
|
191392
|
+
role: "admin"
|
|
191393
|
+
},
|
|
191011
191394
|
"color.getStatus": {
|
|
191012
191395
|
capName: "color",
|
|
191013
191396
|
capScope: "device",
|
|
@@ -191610,41 +191993,6 @@ Object.freeze({
|
|
|
191610
191993
|
access: "create",
|
|
191611
191994
|
role: "admin"
|
|
191612
191995
|
},
|
|
191613
|
-
"deviceDiscovery.adoptDevice": {
|
|
191614
|
-
capName: "device-discovery",
|
|
191615
|
-
capScope: "device",
|
|
191616
|
-
addonId: null,
|
|
191617
|
-
access: "create",
|
|
191618
|
-
role: "admin"
|
|
191619
|
-
},
|
|
191620
|
-
"deviceDiscovery.getStatus": {
|
|
191621
|
-
capName: "device-discovery",
|
|
191622
|
-
capScope: "device",
|
|
191623
|
-
addonId: null,
|
|
191624
|
-
access: "view",
|
|
191625
|
-
role: "viewer"
|
|
191626
|
-
},
|
|
191627
|
-
"deviceDiscovery.listDiscovered": {
|
|
191628
|
-
capName: "device-discovery",
|
|
191629
|
-
capScope: "device",
|
|
191630
|
-
addonId: null,
|
|
191631
|
-
access: "view",
|
|
191632
|
-
role: "viewer"
|
|
191633
|
-
},
|
|
191634
|
-
"deviceDiscovery.refreshDiscovery": {
|
|
191635
|
-
capName: "device-discovery",
|
|
191636
|
-
capScope: "device",
|
|
191637
|
-
addonId: null,
|
|
191638
|
-
access: "create",
|
|
191639
|
-
role: "admin"
|
|
191640
|
-
},
|
|
191641
|
-
"deviceDiscovery.releaseDevice": {
|
|
191642
|
-
capName: "device-discovery",
|
|
191643
|
-
capScope: "device",
|
|
191644
|
-
addonId: null,
|
|
191645
|
-
access: "create",
|
|
191646
|
-
role: "admin"
|
|
191647
|
-
},
|
|
191648
191996
|
"deviceExport.applyDeviceSettingsPatch": {
|
|
191649
191997
|
capName: "device-export",
|
|
191650
191998
|
capScope: "system",
|
|
@@ -192380,6 +192728,13 @@ Object.freeze({
|
|
|
192380
192728
|
access: "create",
|
|
192381
192729
|
role: "admin"
|
|
192382
192730
|
},
|
|
192731
|
+
"deviceManager.search": {
|
|
192732
|
+
capName: "device-manager",
|
|
192733
|
+
capScope: "system",
|
|
192734
|
+
addonId: null,
|
|
192735
|
+
access: "view",
|
|
192736
|
+
role: "viewer"
|
|
192737
|
+
},
|
|
192383
192738
|
"deviceManager.setAlias": {
|
|
192384
192739
|
capName: "device-manager",
|
|
192385
192740
|
capScope: "system",
|
|
@@ -192471,6 +192826,13 @@ Object.freeze({
|
|
|
192471
192826
|
access: "create",
|
|
192472
192827
|
role: "admin"
|
|
192473
192828
|
},
|
|
192829
|
+
"deviceManager.setPrimaryChildPreference": {
|
|
192830
|
+
capName: "device-manager",
|
|
192831
|
+
capScope: "system",
|
|
192832
|
+
addonId: null,
|
|
192833
|
+
access: "create",
|
|
192834
|
+
role: "admin"
|
|
192835
|
+
},
|
|
192474
192836
|
"deviceManager.setRole": {
|
|
192475
192837
|
capName: "device-manager",
|
|
192476
192838
|
capScope: "system",
|
|
@@ -197110,28 +197472,28 @@ Object.freeze({
|
|
|
197110
197472
|
capScope: "device",
|
|
197111
197473
|
addonId: null,
|
|
197112
197474
|
access: "create",
|
|
197113
|
-
role: "
|
|
197475
|
+
role: "viewer"
|
|
197114
197476
|
},
|
|
197115
197477
|
"powerSource.getStatus": {
|
|
197116
197478
|
capName: "power-source",
|
|
197117
197479
|
capScope: "device",
|
|
197118
197480
|
addonId: null,
|
|
197119
197481
|
access: "view",
|
|
197120
|
-
role: "
|
|
197482
|
+
role: "viewer"
|
|
197121
197483
|
},
|
|
197122
197484
|
"powerSource.powerOff": {
|
|
197123
197485
|
capName: "power-source",
|
|
197124
197486
|
capScope: "device",
|
|
197125
197487
|
addonId: null,
|
|
197126
197488
|
access: "create",
|
|
197127
|
-
role: "
|
|
197489
|
+
role: "viewer"
|
|
197128
197490
|
},
|
|
197129
197491
|
"powerSource.powerOn": {
|
|
197130
197492
|
capName: "power-source",
|
|
197131
197493
|
capScope: "device",
|
|
197132
197494
|
addonId: null,
|
|
197133
197495
|
access: "create",
|
|
197134
|
-
role: "
|
|
197496
|
+
role: "viewer"
|
|
197135
197497
|
},
|
|
197136
197498
|
"presence.getStatus": {
|
|
197137
197499
|
capName: "presence",
|
|
@@ -200840,35 +201202,6 @@ Object.freeze({
|
|
|
200840
201202
|
form: "single",
|
|
200841
201203
|
optional: false
|
|
200842
201204
|
}],
|
|
200843
|
-
"deviceDiscovery.adoptDevice": [{
|
|
200844
|
-
name: "deviceId",
|
|
200845
|
-
form: "single",
|
|
200846
|
-
optional: false
|
|
200847
|
-
}],
|
|
200848
|
-
"deviceDiscovery.getStatus": [{
|
|
200849
|
-
name: "deviceId",
|
|
200850
|
-
form: "single",
|
|
200851
|
-
optional: false
|
|
200852
|
-
}],
|
|
200853
|
-
"deviceDiscovery.listDiscovered": [{
|
|
200854
|
-
name: "deviceId",
|
|
200855
|
-
form: "single",
|
|
200856
|
-
optional: false
|
|
200857
|
-
}],
|
|
200858
|
-
"deviceDiscovery.refreshDiscovery": [{
|
|
200859
|
-
name: "deviceId",
|
|
200860
|
-
form: "single",
|
|
200861
|
-
optional: false
|
|
200862
|
-
}],
|
|
200863
|
-
"deviceDiscovery.releaseDevice": [{
|
|
200864
|
-
name: "childDeviceId",
|
|
200865
|
-
form: "single",
|
|
200866
|
-
optional: false
|
|
200867
|
-
}, {
|
|
200868
|
-
name: "deviceId",
|
|
200869
|
-
form: "single",
|
|
200870
|
-
optional: false
|
|
200871
|
-
}],
|
|
200872
201205
|
"deviceExport.applyDeviceSettingsPatch": [{
|
|
200873
201206
|
name: "deviceId",
|
|
200874
201207
|
form: "single",
|
|
@@ -201147,6 +201480,11 @@ Object.freeze({
|
|
|
201147
201480
|
form: "single",
|
|
201148
201481
|
optional: false
|
|
201149
201482
|
}],
|
|
201483
|
+
"deviceManager.setPrimaryChildPreference": [{
|
|
201484
|
+
name: "deviceId",
|
|
201485
|
+
form: "single",
|
|
201486
|
+
optional: false
|
|
201487
|
+
}],
|
|
201150
201488
|
"deviceManager.setRole": [{
|
|
201151
201489
|
name: "deviceId",
|
|
201152
201490
|
form: "single",
|
|
@@ -204615,7 +204953,9 @@ var TimelapseRuleInputSchema = object({
|
|
|
204615
204953
|
/** Classes the notification counts — see {@link ReportClassesField}. */
|
|
204616
204954
|
reportClasses: ReportClassesField.optional(),
|
|
204617
204955
|
/** Canonical notification priority ordinal (1..5); per-target overridable. */
|
|
204618
|
-
priority: PriorityField.default(3)
|
|
204956
|
+
priority: PriorityField.default(3),
|
|
204957
|
+
/** Per-target settings keyed by target id (D1032) — absent = every target follows the rule. */
|
|
204958
|
+
targetOverrides: NcTargetOverridesSchema.optional()
|
|
204619
204959
|
});
|
|
204620
204960
|
object({
|
|
204621
204961
|
name: NameField.optional(),
|
|
@@ -204631,7 +204971,9 @@ object({
|
|
|
204631
204971
|
previewText: PreviewTextField.optional(),
|
|
204632
204972
|
previewMode: PreviewModeField.optional(),
|
|
204633
204973
|
reportClasses: ReportClassesField.optional(),
|
|
204634
|
-
priority: PriorityField.optional()
|
|
204974
|
+
priority: PriorityField.optional(),
|
|
204975
|
+
/** Per-target settings keyed by target id (D1032) — absent = every target follows the rule. */
|
|
204976
|
+
targetOverrides: NcTargetOverridesSchema.optional()
|
|
204635
204977
|
});
|
|
204636
204978
|
TimelapseRuleInputSchema.extend({
|
|
204637
204979
|
id: string(),
|
|
@@ -212894,6 +213236,20 @@ var UnmappedCodeLedger = class {
|
|
|
212894
213236
|
return true;
|
|
212895
213237
|
}
|
|
212896
213238
|
};
|
|
213239
|
+
/**
|
|
213240
|
+
* Whether a hub per-channel battery level is a MEASUREMENT (D393). The hub's cached read of a
|
|
213241
|
+
* channel that is asleep reports `0` — and so does a read taken while the cell is on an adapter
|
|
213242
|
+
* (a powered camera at 0% is not a reading, it is a placeholder). Both are UNMEASURED: the caller
|
|
213243
|
+
* keeps the last real level. A `0` from an awake, unpowered channel is a genuine empty cell and
|
|
213244
|
+
* passes, as does every non-zero level.
|
|
213245
|
+
*/
|
|
213246
|
+
function isMeasuredHubBatteryLevel(level, context) {
|
|
213247
|
+
if (typeof level !== "number") return false;
|
|
213248
|
+
if (level !== 0) return true;
|
|
213249
|
+
if (context.sleeping) return false;
|
|
213250
|
+
const { chargeStatus, adapterStatus } = context.power;
|
|
213251
|
+
return !(adapterStatus !== void 0 && adapterStatus !== "none" || chargeStatus === "charging" || chargeStatus === "chargeComplete");
|
|
213252
|
+
}
|
|
212897
213253
|
//#endregion
|
|
212898
213254
|
//#region src/hub-channel-reconcile.ts
|
|
212899
213255
|
/**
|
|
@@ -212989,6 +213345,19 @@ var HUB_DISCOVERY_REFRESH_TIMEOUT_MS = 8e3;
|
|
|
212989
213345
|
var HUB_CHILD_SLEEP_RECONCILE_MS = 6e4;
|
|
212990
213346
|
var HUB_RECONNECT_BASE_MS = 2e3;
|
|
212991
213347
|
var HUB_RECONNECT_MAX_MS = 3e4;
|
|
213348
|
+
/**
|
|
213349
|
+
* Threshold for marking an adopted child offline when missing from consecutive refreshes.
|
|
213350
|
+
* 10 minutes covers ~3 default refresh cycles + transient firmware latency without
|
|
213351
|
+
* false-flagging battery cams that take a few cycles to wake into the list.
|
|
213352
|
+
*/
|
|
213353
|
+
var HUB_MISSING_OFFLINE_MS = 10 * 6e4;
|
|
213354
|
+
/**
|
|
213355
|
+
* Longer grace for a child flagged asleep that drops off a non-empty hub list. A sleeping battery
|
|
213356
|
+
* camera may vanish from the summary for hours, but `battery.sleeping` is a persisted slice: a
|
|
213357
|
+
* camera that died or was unplugged while flagged asleep must still go offline eventually.
|
|
213358
|
+
* Measured from the last time the hub actually LISTED the child.
|
|
213359
|
+
*/
|
|
213360
|
+
var SLEEPING_MISSING_OFFLINE_MS = 360 * 6e4;
|
|
212992
213361
|
var UNROUTED_LOG_THROTTLE_MS = 6e4;
|
|
212993
213362
|
/**
|
|
212994
213363
|
* ONE Reolink NVR / Home Hub: a single Baichuan control + event socket fronting N channels,
|
|
@@ -213021,6 +213390,10 @@ var ReolinkHubSession = class {
|
|
|
213021
213390
|
#refreshInFlight = null;
|
|
213022
213391
|
/** Wall-clock ms of the last refresh that listed each child (by device id). */
|
|
213023
213392
|
#childLastSeenAt = /* @__PURE__ */ new Map();
|
|
213393
|
+
/** The empty-list warning fired and the list has not been non-empty since. */
|
|
213394
|
+
#emptyListWarned = false;
|
|
213395
|
+
/** Children THIS session marked offline for being missing from the list (the only ones it may restore). */
|
|
213396
|
+
#offlineByMissing = /* @__PURE__ */ new Set();
|
|
213024
213397
|
/** Channels the last good refresh listed but nobody adopted: their pushes are expected drops. */
|
|
213025
213398
|
#knownUnadoptedChannels = /* @__PURE__ */ new Set();
|
|
213026
213399
|
#unroutedLoggedAt = /* @__PURE__ */ new Map();
|
|
@@ -213319,13 +213692,25 @@ var ReolinkHubSession = class {
|
|
|
213319
213692
|
*/
|
|
213320
213693
|
reconcileChildOnline(channels) {
|
|
213321
213694
|
const now = this.#now();
|
|
213695
|
+
const cameras = this.#deps.children().filter((c) => c.channel !== void 0 && c.type === DeviceType.Camera);
|
|
213696
|
+
if (channels.length === 0 && cameras.length > 0) {
|
|
213697
|
+
if (!this.#emptyListWarned) {
|
|
213698
|
+
this.#emptyListWarned = true;
|
|
213699
|
+
this.#logger.warn("Reolink hub: channel list came back empty with adopted children — online state left unchanged", {
|
|
213700
|
+
tags: { integrationId: this.integrationId },
|
|
213701
|
+
meta: { adopted: cameras.length }
|
|
213702
|
+
});
|
|
213703
|
+
}
|
|
213704
|
+
return;
|
|
213705
|
+
}
|
|
213706
|
+
if (channels.length > 0) this.#emptyListWarned = false;
|
|
213322
213707
|
const listed = new Set(channels.map((c) => c.channel));
|
|
213323
|
-
for (const child of
|
|
213708
|
+
for (const child of cameras) {
|
|
213324
213709
|
const ch = child.channel;
|
|
213325
213710
|
if (ch === void 0) continue;
|
|
213326
|
-
if (child.type !== DeviceType.Camera) continue;
|
|
213327
213711
|
if (listed.has(ch)) {
|
|
213328
213712
|
this.#childLastSeenAt.set(child.id, now);
|
|
213713
|
+
this.#offlineByMissing.delete(child.id);
|
|
213329
213714
|
if (!child.online) {
|
|
213330
213715
|
child.markOnline(true);
|
|
213331
213716
|
this.#logger.info("Reolink hub: adopted child back online", {
|
|
@@ -213338,10 +213723,28 @@ var ReolinkHubSession = class {
|
|
|
213338
213723
|
}
|
|
213339
213724
|
continue;
|
|
213340
213725
|
}
|
|
213341
|
-
|
|
213342
|
-
|
|
213343
|
-
|
|
213726
|
+
let lastSeen = this.#childLastSeenAt.get(child.id);
|
|
213727
|
+
if (lastSeen === void 0) {
|
|
213728
|
+
lastSeen = now;
|
|
213729
|
+
this.#childLastSeenAt.set(child.id, now);
|
|
213730
|
+
}
|
|
213731
|
+
if (child.sleeping && !child.online && this.#offlineByMissing.has(child.id) && now - lastSeen < 216e5) {
|
|
213732
|
+
this.#offlineByMissing.delete(child.id);
|
|
213733
|
+
child.markOnline(true);
|
|
213734
|
+
this.#logger.info("Reolink hub: sleeping child restored to online", {
|
|
213735
|
+
tags: {
|
|
213736
|
+
deviceId: child.id,
|
|
213737
|
+
deviceName: child.name
|
|
213738
|
+
},
|
|
213739
|
+
meta: { channel: ch }
|
|
213740
|
+
});
|
|
213741
|
+
continue;
|
|
213742
|
+
}
|
|
213743
|
+
const graceMs = child.sleeping ? SLEEPING_MISSING_OFFLINE_MS : HUB_MISSING_OFFLINE_MS;
|
|
213744
|
+
const missingMs = now - lastSeen;
|
|
213745
|
+
if (missingMs >= graceMs && child.online) {
|
|
213344
213746
|
child.markOnline(false);
|
|
213747
|
+
this.#offlineByMissing.add(child.id);
|
|
213345
213748
|
this.#logger.warn("Reolink hub: adopted child marked offline (missing from the hub list)", {
|
|
213346
213749
|
tags: {
|
|
213347
213750
|
deviceId: child.id,
|
|
@@ -213410,8 +213813,21 @@ var ReolinkHubSession = class {
|
|
|
213410
213813
|
}
|
|
213411
213814
|
});
|
|
213412
213815
|
}
|
|
213816
|
+
const measured = isMeasuredHubBatteryLevel(info.batteryLevel, {
|
|
213817
|
+
sleeping: child.sleeping,
|
|
213818
|
+
power: power.fields
|
|
213819
|
+
});
|
|
213820
|
+
if (info.batteryLevel === 0) this.#logger.info("Reolink hub: battery entry reporting 0", {
|
|
213821
|
+
tags: { deviceId: child.id },
|
|
213822
|
+
meta: {
|
|
213823
|
+
channel: Number(chKey),
|
|
213824
|
+
sleeping: child.sleeping,
|
|
213825
|
+
measured,
|
|
213826
|
+
raw: info
|
|
213827
|
+
}
|
|
213828
|
+
});
|
|
213413
213829
|
child.applyHubBatteryInfo({
|
|
213414
|
-
batteryPercent: info.batteryLevel,
|
|
213830
|
+
...measured ? { batteryPercent: info.batteryLevel } : {},
|
|
213415
213831
|
...power.fields
|
|
213416
213832
|
});
|
|
213417
213833
|
}
|
|
@@ -217463,6 +217879,9 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
|
|
|
217463
217879
|
get online() {
|
|
217464
217880
|
return camera.online;
|
|
217465
217881
|
},
|
|
217882
|
+
get sleeping() {
|
|
217883
|
+
return camera.sleeping;
|
|
217884
|
+
},
|
|
217466
217885
|
get debugGeneral() {
|
|
217467
217886
|
return camera.config.get("debugGeneral") === true;
|
|
217468
217887
|
},
|