@camstack/addon-provider-reolink 1.2.255 → 1.2.256
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/addon.js +178 -6
- package/dist/addon.mjs +178 -6
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.2.256] - 2026-11-21
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- The hourly battery refresh no longer retries every 10 minutes when only the snapshot was stale; the window is stamped and the stale snapshot logged
|
|
15
|
+
|
|
10
16
|
## [1.2.255] - 2026-11-20
|
|
11
17
|
|
|
12
18
|
### Changed
|
package/dist/addon.js
CHANGED
|
@@ -127846,7 +127846,12 @@ var TargetKindTextCapsSchema = object({
|
|
|
127846
127846
|
title: boolean(),
|
|
127847
127847
|
body: boolean()
|
|
127848
127848
|
});
|
|
127849
|
-
|
|
127849
|
+
/**
|
|
127850
|
+
* The message fields a rule can author for a target (#483). Derived from a
|
|
127851
|
+
* kind's caps by `deliverableFields` — the ONE reading of the declaration, used
|
|
127852
|
+
* by the dispatcher (drop), the admin rule editor (show) and the viewer.
|
|
127853
|
+
*/
|
|
127854
|
+
var NotificationFieldSchema = _enum([
|
|
127850
127855
|
"title",
|
|
127851
127856
|
"body",
|
|
127852
127857
|
"attachments",
|
|
@@ -153375,6 +153380,7 @@ function macroOnly(macro) {
|
|
|
153375
153380
|
};
|
|
153376
153381
|
}
|
|
153377
153382
|
}
|
|
153383
|
+
var FaultCodesSchema = array(string().min(1)).max(64);
|
|
153378
153384
|
/**
|
|
153379
153385
|
* Hold semantics — "for N seconds" on a leaf of the `when` tree (#498).
|
|
153380
153386
|
*
|
|
@@ -153509,6 +153515,17 @@ var DeviceBecomesLeafSchema = object({
|
|
|
153509
153515
|
path: ["value"]
|
|
153510
153516
|
});
|
|
153511
153517
|
});
|
|
153518
|
+
/**
|
|
153519
|
+
* A matching fault BECOMES active on a device (`device-fault.ts`): the device's
|
|
153520
|
+
* whole fault list is read, not only its principal code. `codes` empty = any
|
|
153521
|
+
* fault. Fires once per appearance; a fault already raised at start only seeds.
|
|
153522
|
+
*/
|
|
153523
|
+
var DeviceFaultRaisedLeafSchema = object({
|
|
153524
|
+
kind: literal("device-fault-raised"),
|
|
153525
|
+
...eventLeafId,
|
|
153526
|
+
deviceId: number$1().int().nonnegative(),
|
|
153527
|
+
codes: FaultCodesSchema
|
|
153528
|
+
});
|
|
153512
153529
|
var DeviceEventLeafSchema = object({
|
|
153513
153530
|
kind: literal("device-event"),
|
|
153514
153531
|
...eventLeafId,
|
|
@@ -153586,6 +153603,12 @@ var StationaryLeafSchema = object({
|
|
|
153586
153603
|
/** `appeared`: it became parked. `departed`: the registry retired it. */
|
|
153587
153604
|
phase: _enum(["appeared", "departed"])
|
|
153588
153605
|
});
|
|
153606
|
+
/** "has a fault": a matching fault is active on the device NOW (its whole fault list). `codes` empty = any. */
|
|
153607
|
+
var DeviceFaultIsLeafSchema = object({
|
|
153608
|
+
kind: literal("device-fault-is"),
|
|
153609
|
+
deviceId: number$1().int().nonnegative(),
|
|
153610
|
+
codes: FaultCodesSchema
|
|
153611
|
+
});
|
|
153589
153612
|
/** "is": one device field compared to one value, NOW. */
|
|
153590
153613
|
var DeviceIsLeafSchema = object({
|
|
153591
153614
|
kind: literal("device-is"),
|
|
@@ -153708,12 +153731,14 @@ var AutomationWhenSchema = lazy(() => discriminatedUnion("kind", [
|
|
|
153708
153731
|
DeviceBecomesLeafSchema,
|
|
153709
153732
|
DeviceEventLeafSchema,
|
|
153710
153733
|
DeviceFiredLeafSchema,
|
|
153734
|
+
DeviceFaultRaisedLeafSchema,
|
|
153711
153735
|
ScheduleLeafSchema,
|
|
153712
153736
|
ManualLeafSchema,
|
|
153713
153737
|
IntervalLeafSchema,
|
|
153714
153738
|
DetectionLeafSchema,
|
|
153715
153739
|
StationaryLeafSchema,
|
|
153716
153740
|
DeviceIsLeafSchema,
|
|
153741
|
+
DeviceFaultIsLeafSchema,
|
|
153717
153742
|
StationaryPresentLeafSchema,
|
|
153718
153743
|
ExpressionLeafSchema,
|
|
153719
153744
|
TimeIsLeafSchema,
|
|
@@ -153723,6 +153748,7 @@ var EVENT_KINDS = new Set([
|
|
|
153723
153748
|
"device-becomes",
|
|
153724
153749
|
"device-event",
|
|
153725
153750
|
"device-fired",
|
|
153751
|
+
"device-fault-raised",
|
|
153726
153752
|
"schedule",
|
|
153727
153753
|
"manual",
|
|
153728
153754
|
"interval",
|
|
@@ -153804,6 +153830,7 @@ var LEAF_WORDS = {
|
|
|
153804
153830
|
"device-becomes": "a device value that becomes",
|
|
153805
153831
|
"device-event": "a device event",
|
|
153806
153832
|
"device-fired": "a device firing an event",
|
|
153833
|
+
"device-fault-raised": "a device fault being raised",
|
|
153807
153834
|
schedule: "a schedule",
|
|
153808
153835
|
manual: "a manual run",
|
|
153809
153836
|
interval: "an interval",
|
|
@@ -154285,6 +154312,86 @@ var AutomationNotifyStepSchema = object({
|
|
|
154285
154312
|
body: string().min(1, "a notification needs a message").max(NOTIFY_BODY_MAX),
|
|
154286
154313
|
...continueOnErrorShape
|
|
154287
154314
|
});
|
|
154315
|
+
var HTTP_URL_MAX = 2e3;
|
|
154316
|
+
var HTTP_BODY_MAX = 16384;
|
|
154317
|
+
var HTTP_HEADER_VALUE_MAX = 1e3;
|
|
154318
|
+
var saveAsSchema = string().regex(SET_VAR_NAME_RE, "a variable name is letters, digits and _, not starting with a digit (max 40)").refine((name) => !RESERVED_RUN_VARS.includes(name), { message: `the names ${RESERVED_RUN_VARS.join(", ")} belong to the run and cannot be used` });
|
|
154319
|
+
var retryUntilSecondsSchema = number$1().int().min(1).max(600, `a retry window is at most 600 s`);
|
|
154320
|
+
/**
|
|
154321
|
+
* Whether a TCP port on a host answers. TCP only: an ICMP echo needs a raw
|
|
154322
|
+
* socket or a `ping` binary with extra privileges, and the hub image ships
|
|
154323
|
+
* neither for its non-root user, so it is not offered.
|
|
154324
|
+
*
|
|
154325
|
+
* Without `expect` the step wants the host REACHABLE. The result
|
|
154326
|
+
* (`{ reachable, rttMs, error }`) goes to the run variable `saveAs`.
|
|
154327
|
+
*/
|
|
154328
|
+
var AutomationProbeStepSchema = object({
|
|
154329
|
+
kind: literal("probe"),
|
|
154330
|
+
...stepEnabledShape,
|
|
154331
|
+
/** A host name or an address; may carry `{{vars.x}}` slots. */
|
|
154332
|
+
host: string().min(1, "a probe needs a host").max(253).regex(/^[^\s/]+$/, "a host has no spaces or slashes"),
|
|
154333
|
+
port: number$1().int().min(1, "a port is 1 to 65535").max(65535, "a port is 1 to 65535"),
|
|
154334
|
+
timeoutSeconds: number$1().int().min(1).max(30),
|
|
154335
|
+
expect: _enum(["reachable", "unreachable"]).optional(),
|
|
154336
|
+
/** Keep probing every {@link REACH_RETRY_INTERVAL_S} s until the expectation holds, for this long. */
|
|
154337
|
+
retryUntilSeconds: retryUntilSecondsSchema.optional(),
|
|
154338
|
+
saveAs: saveAsSchema.optional(),
|
|
154339
|
+
...continueOnErrorShape
|
|
154340
|
+
}).strict();
|
|
154341
|
+
var HTTP_METHODS = [
|
|
154342
|
+
"GET",
|
|
154343
|
+
"POST",
|
|
154344
|
+
"PUT",
|
|
154345
|
+
"PATCH",
|
|
154346
|
+
"DELETE"
|
|
154347
|
+
];
|
|
154348
|
+
/**
|
|
154349
|
+
* What an HTTP request must answer for the step to pass: its status, or a field
|
|
154350
|
+
* of the parsed JSON body, compared the way a device field is.
|
|
154351
|
+
*/
|
|
154352
|
+
var AutomationHttpExpectSchema = object({
|
|
154353
|
+
on: _enum(["status", "json"]),
|
|
154354
|
+
/** A dotted path into the JSON body (`sysInfo.rawUartRemoteAddress`); needed for `json`. */
|
|
154355
|
+
fieldPath: string().min(1).max(200).optional(),
|
|
154356
|
+
operator: AutomationConditionOperatorSchema,
|
|
154357
|
+
value: union([
|
|
154358
|
+
string(),
|
|
154359
|
+
number$1(),
|
|
154360
|
+
boolean()
|
|
154361
|
+
])
|
|
154362
|
+
}).strict().refine((expect) => expect.on !== "json" || expect.fieldPath !== void 0, {
|
|
154363
|
+
message: "a JSON expectation names the field it reads",
|
|
154364
|
+
path: ["fieldPath"]
|
|
154365
|
+
});
|
|
154366
|
+
function isHttpUrl(url) {
|
|
154367
|
+
if (url.includes("{{")) return /^https?:\/\/\S+$/i.test(url);
|
|
154368
|
+
try {
|
|
154369
|
+
const parsed = new URL(url);
|
|
154370
|
+
return parsed.protocol === "http:" || parsed.protocol === "https:";
|
|
154371
|
+
} catch {
|
|
154372
|
+
return false;
|
|
154373
|
+
}
|
|
154374
|
+
}
|
|
154375
|
+
/**
|
|
154376
|
+
* One HTTP request. Without `expect` the step wants a 2xx answer. The result
|
|
154377
|
+
* (`{ status, ok, json, text, error }`) goes to the run variable `saveAs`.
|
|
154378
|
+
* Header values are stored as typed, in plain text: they are in the recipe and
|
|
154379
|
+
* in the generated source, so anyone who can open the automation can read a
|
|
154380
|
+
* token put in one. Header values and bodies are never logged or traced.
|
|
154381
|
+
*/
|
|
154382
|
+
var AutomationHttpRequestStepSchema = object({
|
|
154383
|
+
kind: literal("http-request"),
|
|
154384
|
+
...stepEnabledShape,
|
|
154385
|
+
method: _enum(HTTP_METHODS),
|
|
154386
|
+
url: string().max(HTTP_URL_MAX).refine(isHttpUrl, "the address is an http:// or https:// URL"),
|
|
154387
|
+
headers: record(string().regex(/^[A-Za-z0-9!#$%&'*+.^_`|~-]+$/, "not a valid header name"), string().max(HTTP_HEADER_VALUE_MAX)).refine((headers) => Object.keys(headers).length <= 20, { message: `at most 20 headers` }).optional(),
|
|
154388
|
+
body: string().max(HTTP_BODY_MAX).optional(),
|
|
154389
|
+
timeoutSeconds: number$1().int().min(1).max(60),
|
|
154390
|
+
expect: AutomationHttpExpectSchema.optional(),
|
|
154391
|
+
retryUntilSeconds: retryUntilSecondsSchema.optional(),
|
|
154392
|
+
saveAs: saveAsSchema.optional(),
|
|
154393
|
+
...continueOnErrorShape
|
|
154394
|
+
}).strict();
|
|
154288
154395
|
var AutomationRunActionStepSchema = object({
|
|
154289
154396
|
kind: literal("action"),
|
|
154290
154397
|
...stepEnabledShape,
|
|
@@ -154340,7 +154447,9 @@ var plainStepSchemas = [
|
|
|
154340
154447
|
AutomationStopStepSchema.omit({ if: true }).strict(),
|
|
154341
154448
|
AutomationSetStepSchema.omit({ if: true }).strict(),
|
|
154342
154449
|
AutomationRunActionStepSchema.strict(),
|
|
154343
|
-
AutomationNotifyStepSchema.strict()
|
|
154450
|
+
AutomationNotifyStepSchema.strict(),
|
|
154451
|
+
AutomationProbeStepSchema,
|
|
154452
|
+
AutomationHttpRequestStepSchema
|
|
154344
154453
|
];
|
|
154345
154454
|
/**
|
|
154346
154455
|
* A plain step: a flow step with no condition of its own and no step inside
|
|
@@ -154440,6 +154549,8 @@ var AutomationActionSchema = discriminatedUnion("kind", [
|
|
|
154440
154549
|
AutomationRepeatStepSchema,
|
|
154441
154550
|
AutomationRunActionStepSchema,
|
|
154442
154551
|
AutomationNotifyStepSchema,
|
|
154552
|
+
AutomationProbeStepSchema,
|
|
154553
|
+
AutomationHttpRequestStepSchema,
|
|
154443
154554
|
object({
|
|
154444
154555
|
kind: literal("code"),
|
|
154445
154556
|
...stepEnabledShape,
|
|
@@ -154764,6 +154875,7 @@ var AutomationConditionTraceNodeSchema = object({
|
|
|
154764
154875
|
"not",
|
|
154765
154876
|
"condition",
|
|
154766
154877
|
"device-is",
|
|
154878
|
+
"device-fault-is",
|
|
154767
154879
|
"expression",
|
|
154768
154880
|
"stationary-present",
|
|
154769
154881
|
"time-is",
|
|
@@ -154771,6 +154883,7 @@ var AutomationConditionTraceNodeSchema = object({
|
|
|
154771
154883
|
"device-becomes",
|
|
154772
154884
|
"device-event",
|
|
154773
154885
|
"device-fired",
|
|
154886
|
+
"device-fault-raised",
|
|
154774
154887
|
"schedule",
|
|
154775
154888
|
"interval",
|
|
154776
154889
|
"manual",
|
|
@@ -154829,6 +154942,9 @@ var StepTraceBaseSchema = object({
|
|
|
154829
154942
|
* (D1021): why a sentence says "—" where a number was expected. Bounded.
|
|
154830
154943
|
*/
|
|
154831
154944
|
templates: array(string()).max(20).optional(),
|
|
154945
|
+
/** A probe or an HTTP request: how many tries it made, and what the last one saw (no header, no body). */
|
|
154946
|
+
attempts: number$1().int().optional(),
|
|
154947
|
+
lastAttempt: string().optional(),
|
|
154832
154948
|
/**
|
|
154833
154949
|
* What the step's own `if` read when the step was reached (#472): `true` the
|
|
154834
154950
|
* step ran, `false` its `else` ran (or nothing did), `unknown` a state leaf
|
|
@@ -167547,9 +167663,10 @@ object({
|
|
|
167547
167663
|
/** Longest silence a push integration may keep before the core re-reads it and asks it to resubscribe. */
|
|
167548
167664
|
heartbeatMs: number$1().int().positive().optional(),
|
|
167549
167665
|
/**
|
|
167550
|
-
*
|
|
167551
|
-
*
|
|
167552
|
-
*
|
|
167666
|
+
* Changes on every reconnect of the provider's push subscription; any change
|
|
167667
|
+
* makes the core read every device of the integration once (pushes lost while
|
|
167668
|
+
* it was down; events may be dropped, D8). It need not grow: a provider whose
|
|
167669
|
+
* counter restarts with its process is still understood.
|
|
167553
167670
|
*/
|
|
167554
167671
|
connectionEpoch: number$1().int().nonnegative().optional()
|
|
167555
167672
|
});
|
|
@@ -185253,6 +185370,15 @@ var NcRuleInputSchema = object({
|
|
|
185253
185370
|
*/
|
|
185254
185371
|
askVerdict: boolean().optional(),
|
|
185255
185372
|
/**
|
|
185373
|
+
* An ALERT notification (`alert-critical`, `alert-error`, device attention)
|
|
185374
|
+
* carries the alert's own action — an open-URL button and, for an `invoke`
|
|
185375
|
+
* action, a token-authed button that runs it. Absent and `true` mean ON;
|
|
185376
|
+
* `false` switches it off for this rule. `.optional()`, never `.default()`
|
|
185377
|
+
* (a Zod default does not run on the addon cap path), so a rule authored
|
|
185378
|
+
* before this field keeps the action.
|
|
185379
|
+
*/
|
|
185380
|
+
offerAlertAction: boolean().optional(),
|
|
185381
|
+
/**
|
|
185256
185382
|
* Operator tags (D1054), kept on the rule like a core block's. Absent = no
|
|
185257
185383
|
* tags. `.optional()`, never `.default()`: a partial `updateRule` patch that
|
|
185258
185384
|
* does not name `tags` keeps the stored ones (the store merges), and an
|
|
@@ -221798,6 +221924,14 @@ object({
|
|
|
221798
221924
|
nodeId: string().optional(),
|
|
221799
221925
|
/** The alert's own action link (where the operator acts on it), when it has one. */
|
|
221800
221926
|
actionUrl: string().optional(),
|
|
221927
|
+
/**
|
|
221928
|
+
* The alert's WHOLE action — label, link, navigation and `invoke` — on a
|
|
221929
|
+
* raised episode, so a notification can offer it (an absolute open-URL
|
|
221930
|
+
* button, a token-authed invoke button). `actionUrl` stays for the
|
|
221931
|
+
* `{{actionUrl}}` template variable. Additive: an episode published before
|
|
221932
|
+
* this field has none.
|
|
221933
|
+
*/
|
|
221934
|
+
action: AlertActionSchema.optional(),
|
|
221801
221935
|
/** A device fault episode: every active fault (`metadata.faults`), principal first. */
|
|
221802
221936
|
faults: array(DeviceFaultSchema).optional(),
|
|
221803
221937
|
at: number$1()
|
|
@@ -222864,6 +222998,34 @@ function linkFieldDescriptor(key, target, labels) {
|
|
|
222864
222998
|
...target.kind !== void 0 ? { kind: target.kind } : {}
|
|
222865
222999
|
};
|
|
222866
223000
|
}
|
|
223001
|
+
/** When a member receives: always, inside a schedule, or while an alarm panel is in a state. */
|
|
223002
|
+
var GroupMemberWhenSchema = discriminatedUnion("kind", [
|
|
223003
|
+
object({ kind: literal("always") }),
|
|
223004
|
+
object({
|
|
223005
|
+
kind: literal("schedule"),
|
|
223006
|
+
schedule: NcScheduleSchema
|
|
223007
|
+
}),
|
|
223008
|
+
object({
|
|
223009
|
+
kind: literal("alarm"),
|
|
223010
|
+
deviceId: number$1().int().nonnegative(),
|
|
223011
|
+
states: array(AlarmStateSchema).min(1)
|
|
223012
|
+
})
|
|
223013
|
+
]);
|
|
223014
|
+
object({
|
|
223015
|
+
targetId: string().min(1),
|
|
223016
|
+
enabled: boolean().optional(),
|
|
223017
|
+
when: GroupMemberWhenSchema.optional(),
|
|
223018
|
+
/** Which message fields this member receives. Absent = all of them. */
|
|
223019
|
+
fields: array(NotificationFieldSchema).optional(),
|
|
223020
|
+
/** `{{title}}`, `{{body}}`, `{{priority}}` and any `{{key}}` of the notification's metadata. */
|
|
223021
|
+
templates: object({
|
|
223022
|
+
title: string().optional(),
|
|
223023
|
+
body: string().optional()
|
|
223024
|
+
}).optional(),
|
|
223025
|
+
minPriority: number$1().int().min(1).max(5).optional(),
|
|
223026
|
+
/** At most one delivery per window; a burst becomes one. 0 or absent = no throttle. */
|
|
223027
|
+
throttleSec: number$1().int().nonnegative().optional()
|
|
223028
|
+
});
|
|
222867
223029
|
//#endregion
|
|
222868
223030
|
//#region src/clips/clip-prefetch.ts
|
|
222869
223031
|
/** The longest a device may stay quiet after refusals, whatever its interval. */
|
|
@@ -229600,6 +229762,8 @@ var BATTERY_REFRESH_MINUTES_KEY = "batteryRefreshMinutes";
|
|
|
229600
229762
|
var BATTERY_REFRESH_TICK_MS = 6e4;
|
|
229601
229763
|
/** The least time between two attempts in one window. */
|
|
229602
229764
|
var RETRY_BACKOFF_MS = 10 * 6e4;
|
|
229765
|
+
/** The one refresh step whose failure does not hold the window open. */
|
|
229766
|
+
var SOFT_FAILURE_STEP = "snapshot";
|
|
229603
229767
|
var MAX_WAKE_LEAD_MS = 5 * 6e4;
|
|
229604
229768
|
var STAGGER_SLOTS = 60;
|
|
229605
229769
|
/** The operator's window in ms, or `0` for off. Out-of-range values clamp. */
|
|
@@ -229730,7 +229894,15 @@ var BatteryHourlyRefresh = class {
|
|
|
229730
229894
|
}
|
|
229731
229895
|
});
|
|
229732
229896
|
const outcome = await this.deps.refreshAll();
|
|
229733
|
-
|
|
229897
|
+
const hardFailures = outcome.failed.filter((step) => step !== SOFT_FAILURE_STEP);
|
|
229898
|
+
if (hardFailures.length === 0 && outcome.failed.length > 0) logger.warn("battery hourly refresh: snapshot did not move — window stamped, not retried", {
|
|
229899
|
+
tags: { deviceId },
|
|
229900
|
+
meta: {
|
|
229901
|
+
failed: outcome.failed,
|
|
229902
|
+
attempt: this.attempts
|
|
229903
|
+
}
|
|
229904
|
+
});
|
|
229905
|
+
if (hardFailures.length > 0) {
|
|
229734
229906
|
logger.warn("battery hourly refresh incomplete — not stamped, retried at the next chance", {
|
|
229735
229907
|
tags: { deviceId },
|
|
229736
229908
|
meta: {
|
package/dist/addon.mjs
CHANGED
|
@@ -127838,7 +127838,12 @@ var TargetKindTextCapsSchema = object({
|
|
|
127838
127838
|
title: boolean(),
|
|
127839
127839
|
body: boolean()
|
|
127840
127840
|
});
|
|
127841
|
-
|
|
127841
|
+
/**
|
|
127842
|
+
* The message fields a rule can author for a target (#483). Derived from a
|
|
127843
|
+
* kind's caps by `deliverableFields` — the ONE reading of the declaration, used
|
|
127844
|
+
* by the dispatcher (drop), the admin rule editor (show) and the viewer.
|
|
127845
|
+
*/
|
|
127846
|
+
var NotificationFieldSchema = _enum([
|
|
127842
127847
|
"title",
|
|
127843
127848
|
"body",
|
|
127844
127849
|
"attachments",
|
|
@@ -153367,6 +153372,7 @@ function macroOnly(macro) {
|
|
|
153367
153372
|
};
|
|
153368
153373
|
}
|
|
153369
153374
|
}
|
|
153375
|
+
var FaultCodesSchema = array(string().min(1)).max(64);
|
|
153370
153376
|
/**
|
|
153371
153377
|
* Hold semantics — "for N seconds" on a leaf of the `when` tree (#498).
|
|
153372
153378
|
*
|
|
@@ -153501,6 +153507,17 @@ var DeviceBecomesLeafSchema = object({
|
|
|
153501
153507
|
path: ["value"]
|
|
153502
153508
|
});
|
|
153503
153509
|
});
|
|
153510
|
+
/**
|
|
153511
|
+
* A matching fault BECOMES active on a device (`device-fault.ts`): the device's
|
|
153512
|
+
* whole fault list is read, not only its principal code. `codes` empty = any
|
|
153513
|
+
* fault. Fires once per appearance; a fault already raised at start only seeds.
|
|
153514
|
+
*/
|
|
153515
|
+
var DeviceFaultRaisedLeafSchema = object({
|
|
153516
|
+
kind: literal("device-fault-raised"),
|
|
153517
|
+
...eventLeafId,
|
|
153518
|
+
deviceId: number$1().int().nonnegative(),
|
|
153519
|
+
codes: FaultCodesSchema
|
|
153520
|
+
});
|
|
153504
153521
|
var DeviceEventLeafSchema = object({
|
|
153505
153522
|
kind: literal("device-event"),
|
|
153506
153523
|
...eventLeafId,
|
|
@@ -153578,6 +153595,12 @@ var StationaryLeafSchema = object({
|
|
|
153578
153595
|
/** `appeared`: it became parked. `departed`: the registry retired it. */
|
|
153579
153596
|
phase: _enum(["appeared", "departed"])
|
|
153580
153597
|
});
|
|
153598
|
+
/** "has a fault": a matching fault is active on the device NOW (its whole fault list). `codes` empty = any. */
|
|
153599
|
+
var DeviceFaultIsLeafSchema = object({
|
|
153600
|
+
kind: literal("device-fault-is"),
|
|
153601
|
+
deviceId: number$1().int().nonnegative(),
|
|
153602
|
+
codes: FaultCodesSchema
|
|
153603
|
+
});
|
|
153581
153604
|
/** "is": one device field compared to one value, NOW. */
|
|
153582
153605
|
var DeviceIsLeafSchema = object({
|
|
153583
153606
|
kind: literal("device-is"),
|
|
@@ -153700,12 +153723,14 @@ var AutomationWhenSchema = lazy(() => discriminatedUnion("kind", [
|
|
|
153700
153723
|
DeviceBecomesLeafSchema,
|
|
153701
153724
|
DeviceEventLeafSchema,
|
|
153702
153725
|
DeviceFiredLeafSchema,
|
|
153726
|
+
DeviceFaultRaisedLeafSchema,
|
|
153703
153727
|
ScheduleLeafSchema,
|
|
153704
153728
|
ManualLeafSchema,
|
|
153705
153729
|
IntervalLeafSchema,
|
|
153706
153730
|
DetectionLeafSchema,
|
|
153707
153731
|
StationaryLeafSchema,
|
|
153708
153732
|
DeviceIsLeafSchema,
|
|
153733
|
+
DeviceFaultIsLeafSchema,
|
|
153709
153734
|
StationaryPresentLeafSchema,
|
|
153710
153735
|
ExpressionLeafSchema,
|
|
153711
153736
|
TimeIsLeafSchema,
|
|
@@ -153715,6 +153740,7 @@ var EVENT_KINDS = new Set([
|
|
|
153715
153740
|
"device-becomes",
|
|
153716
153741
|
"device-event",
|
|
153717
153742
|
"device-fired",
|
|
153743
|
+
"device-fault-raised",
|
|
153718
153744
|
"schedule",
|
|
153719
153745
|
"manual",
|
|
153720
153746
|
"interval",
|
|
@@ -153796,6 +153822,7 @@ var LEAF_WORDS = {
|
|
|
153796
153822
|
"device-becomes": "a device value that becomes",
|
|
153797
153823
|
"device-event": "a device event",
|
|
153798
153824
|
"device-fired": "a device firing an event",
|
|
153825
|
+
"device-fault-raised": "a device fault being raised",
|
|
153799
153826
|
schedule: "a schedule",
|
|
153800
153827
|
manual: "a manual run",
|
|
153801
153828
|
interval: "an interval",
|
|
@@ -154277,6 +154304,86 @@ var AutomationNotifyStepSchema = object({
|
|
|
154277
154304
|
body: string().min(1, "a notification needs a message").max(NOTIFY_BODY_MAX),
|
|
154278
154305
|
...continueOnErrorShape
|
|
154279
154306
|
});
|
|
154307
|
+
var HTTP_URL_MAX = 2e3;
|
|
154308
|
+
var HTTP_BODY_MAX = 16384;
|
|
154309
|
+
var HTTP_HEADER_VALUE_MAX = 1e3;
|
|
154310
|
+
var saveAsSchema = string().regex(SET_VAR_NAME_RE, "a variable name is letters, digits and _, not starting with a digit (max 40)").refine((name) => !RESERVED_RUN_VARS.includes(name), { message: `the names ${RESERVED_RUN_VARS.join(", ")} belong to the run and cannot be used` });
|
|
154311
|
+
var retryUntilSecondsSchema = number$1().int().min(1).max(600, `a retry window is at most 600 s`);
|
|
154312
|
+
/**
|
|
154313
|
+
* Whether a TCP port on a host answers. TCP only: an ICMP echo needs a raw
|
|
154314
|
+
* socket or a `ping` binary with extra privileges, and the hub image ships
|
|
154315
|
+
* neither for its non-root user, so it is not offered.
|
|
154316
|
+
*
|
|
154317
|
+
* Without `expect` the step wants the host REACHABLE. The result
|
|
154318
|
+
* (`{ reachable, rttMs, error }`) goes to the run variable `saveAs`.
|
|
154319
|
+
*/
|
|
154320
|
+
var AutomationProbeStepSchema = object({
|
|
154321
|
+
kind: literal("probe"),
|
|
154322
|
+
...stepEnabledShape,
|
|
154323
|
+
/** A host name or an address; may carry `{{vars.x}}` slots. */
|
|
154324
|
+
host: string().min(1, "a probe needs a host").max(253).regex(/^[^\s/]+$/, "a host has no spaces or slashes"),
|
|
154325
|
+
port: number$1().int().min(1, "a port is 1 to 65535").max(65535, "a port is 1 to 65535"),
|
|
154326
|
+
timeoutSeconds: number$1().int().min(1).max(30),
|
|
154327
|
+
expect: _enum(["reachable", "unreachable"]).optional(),
|
|
154328
|
+
/** Keep probing every {@link REACH_RETRY_INTERVAL_S} s until the expectation holds, for this long. */
|
|
154329
|
+
retryUntilSeconds: retryUntilSecondsSchema.optional(),
|
|
154330
|
+
saveAs: saveAsSchema.optional(),
|
|
154331
|
+
...continueOnErrorShape
|
|
154332
|
+
}).strict();
|
|
154333
|
+
var HTTP_METHODS = [
|
|
154334
|
+
"GET",
|
|
154335
|
+
"POST",
|
|
154336
|
+
"PUT",
|
|
154337
|
+
"PATCH",
|
|
154338
|
+
"DELETE"
|
|
154339
|
+
];
|
|
154340
|
+
/**
|
|
154341
|
+
* What an HTTP request must answer for the step to pass: its status, or a field
|
|
154342
|
+
* of the parsed JSON body, compared the way a device field is.
|
|
154343
|
+
*/
|
|
154344
|
+
var AutomationHttpExpectSchema = object({
|
|
154345
|
+
on: _enum(["status", "json"]),
|
|
154346
|
+
/** A dotted path into the JSON body (`sysInfo.rawUartRemoteAddress`); needed for `json`. */
|
|
154347
|
+
fieldPath: string().min(1).max(200).optional(),
|
|
154348
|
+
operator: AutomationConditionOperatorSchema,
|
|
154349
|
+
value: union([
|
|
154350
|
+
string(),
|
|
154351
|
+
number$1(),
|
|
154352
|
+
boolean()
|
|
154353
|
+
])
|
|
154354
|
+
}).strict().refine((expect) => expect.on !== "json" || expect.fieldPath !== void 0, {
|
|
154355
|
+
message: "a JSON expectation names the field it reads",
|
|
154356
|
+
path: ["fieldPath"]
|
|
154357
|
+
});
|
|
154358
|
+
function isHttpUrl(url) {
|
|
154359
|
+
if (url.includes("{{")) return /^https?:\/\/\S+$/i.test(url);
|
|
154360
|
+
try {
|
|
154361
|
+
const parsed = new URL(url);
|
|
154362
|
+
return parsed.protocol === "http:" || parsed.protocol === "https:";
|
|
154363
|
+
} catch {
|
|
154364
|
+
return false;
|
|
154365
|
+
}
|
|
154366
|
+
}
|
|
154367
|
+
/**
|
|
154368
|
+
* One HTTP request. Without `expect` the step wants a 2xx answer. The result
|
|
154369
|
+
* (`{ status, ok, json, text, error }`) goes to the run variable `saveAs`.
|
|
154370
|
+
* Header values are stored as typed, in plain text: they are in the recipe and
|
|
154371
|
+
* in the generated source, so anyone who can open the automation can read a
|
|
154372
|
+
* token put in one. Header values and bodies are never logged or traced.
|
|
154373
|
+
*/
|
|
154374
|
+
var AutomationHttpRequestStepSchema = object({
|
|
154375
|
+
kind: literal("http-request"),
|
|
154376
|
+
...stepEnabledShape,
|
|
154377
|
+
method: _enum(HTTP_METHODS),
|
|
154378
|
+
url: string().max(HTTP_URL_MAX).refine(isHttpUrl, "the address is an http:// or https:// URL"),
|
|
154379
|
+
headers: record(string().regex(/^[A-Za-z0-9!#$%&'*+.^_`|~-]+$/, "not a valid header name"), string().max(HTTP_HEADER_VALUE_MAX)).refine((headers) => Object.keys(headers).length <= 20, { message: `at most 20 headers` }).optional(),
|
|
154380
|
+
body: string().max(HTTP_BODY_MAX).optional(),
|
|
154381
|
+
timeoutSeconds: number$1().int().min(1).max(60),
|
|
154382
|
+
expect: AutomationHttpExpectSchema.optional(),
|
|
154383
|
+
retryUntilSeconds: retryUntilSecondsSchema.optional(),
|
|
154384
|
+
saveAs: saveAsSchema.optional(),
|
|
154385
|
+
...continueOnErrorShape
|
|
154386
|
+
}).strict();
|
|
154280
154387
|
var AutomationRunActionStepSchema = object({
|
|
154281
154388
|
kind: literal("action"),
|
|
154282
154389
|
...stepEnabledShape,
|
|
@@ -154332,7 +154439,9 @@ var plainStepSchemas = [
|
|
|
154332
154439
|
AutomationStopStepSchema.omit({ if: true }).strict(),
|
|
154333
154440
|
AutomationSetStepSchema.omit({ if: true }).strict(),
|
|
154334
154441
|
AutomationRunActionStepSchema.strict(),
|
|
154335
|
-
AutomationNotifyStepSchema.strict()
|
|
154442
|
+
AutomationNotifyStepSchema.strict(),
|
|
154443
|
+
AutomationProbeStepSchema,
|
|
154444
|
+
AutomationHttpRequestStepSchema
|
|
154336
154445
|
];
|
|
154337
154446
|
/**
|
|
154338
154447
|
* A plain step: a flow step with no condition of its own and no step inside
|
|
@@ -154432,6 +154541,8 @@ var AutomationActionSchema = discriminatedUnion("kind", [
|
|
|
154432
154541
|
AutomationRepeatStepSchema,
|
|
154433
154542
|
AutomationRunActionStepSchema,
|
|
154434
154543
|
AutomationNotifyStepSchema,
|
|
154544
|
+
AutomationProbeStepSchema,
|
|
154545
|
+
AutomationHttpRequestStepSchema,
|
|
154435
154546
|
object({
|
|
154436
154547
|
kind: literal("code"),
|
|
154437
154548
|
...stepEnabledShape,
|
|
@@ -154756,6 +154867,7 @@ var AutomationConditionTraceNodeSchema = object({
|
|
|
154756
154867
|
"not",
|
|
154757
154868
|
"condition",
|
|
154758
154869
|
"device-is",
|
|
154870
|
+
"device-fault-is",
|
|
154759
154871
|
"expression",
|
|
154760
154872
|
"stationary-present",
|
|
154761
154873
|
"time-is",
|
|
@@ -154763,6 +154875,7 @@ var AutomationConditionTraceNodeSchema = object({
|
|
|
154763
154875
|
"device-becomes",
|
|
154764
154876
|
"device-event",
|
|
154765
154877
|
"device-fired",
|
|
154878
|
+
"device-fault-raised",
|
|
154766
154879
|
"schedule",
|
|
154767
154880
|
"interval",
|
|
154768
154881
|
"manual",
|
|
@@ -154821,6 +154934,9 @@ var StepTraceBaseSchema = object({
|
|
|
154821
154934
|
* (D1021): why a sentence says "—" where a number was expected. Bounded.
|
|
154822
154935
|
*/
|
|
154823
154936
|
templates: array(string()).max(20).optional(),
|
|
154937
|
+
/** A probe or an HTTP request: how many tries it made, and what the last one saw (no header, no body). */
|
|
154938
|
+
attempts: number$1().int().optional(),
|
|
154939
|
+
lastAttempt: string().optional(),
|
|
154824
154940
|
/**
|
|
154825
154941
|
* What the step's own `if` read when the step was reached (#472): `true` the
|
|
154826
154942
|
* step ran, `false` its `else` ran (or nothing did), `unknown` a state leaf
|
|
@@ -167539,9 +167655,10 @@ object({
|
|
|
167539
167655
|
/** Longest silence a push integration may keep before the core re-reads it and asks it to resubscribe. */
|
|
167540
167656
|
heartbeatMs: number$1().int().positive().optional(),
|
|
167541
167657
|
/**
|
|
167542
|
-
*
|
|
167543
|
-
*
|
|
167544
|
-
*
|
|
167658
|
+
* Changes on every reconnect of the provider's push subscription; any change
|
|
167659
|
+
* makes the core read every device of the integration once (pushes lost while
|
|
167660
|
+
* it was down; events may be dropped, D8). It need not grow: a provider whose
|
|
167661
|
+
* counter restarts with its process is still understood.
|
|
167545
167662
|
*/
|
|
167546
167663
|
connectionEpoch: number$1().int().nonnegative().optional()
|
|
167547
167664
|
});
|
|
@@ -185245,6 +185362,15 @@ var NcRuleInputSchema = object({
|
|
|
185245
185362
|
*/
|
|
185246
185363
|
askVerdict: boolean().optional(),
|
|
185247
185364
|
/**
|
|
185365
|
+
* An ALERT notification (`alert-critical`, `alert-error`, device attention)
|
|
185366
|
+
* carries the alert's own action — an open-URL button and, for an `invoke`
|
|
185367
|
+
* action, a token-authed button that runs it. Absent and `true` mean ON;
|
|
185368
|
+
* `false` switches it off for this rule. `.optional()`, never `.default()`
|
|
185369
|
+
* (a Zod default does not run on the addon cap path), so a rule authored
|
|
185370
|
+
* before this field keeps the action.
|
|
185371
|
+
*/
|
|
185372
|
+
offerAlertAction: boolean().optional(),
|
|
185373
|
+
/**
|
|
185248
185374
|
* Operator tags (D1054), kept on the rule like a core block's. Absent = no
|
|
185249
185375
|
* tags. `.optional()`, never `.default()`: a partial `updateRule` patch that
|
|
185250
185376
|
* does not name `tags` keeps the stored ones (the store merges), and an
|
|
@@ -221790,6 +221916,14 @@ object({
|
|
|
221790
221916
|
nodeId: string().optional(),
|
|
221791
221917
|
/** The alert's own action link (where the operator acts on it), when it has one. */
|
|
221792
221918
|
actionUrl: string().optional(),
|
|
221919
|
+
/**
|
|
221920
|
+
* The alert's WHOLE action — label, link, navigation and `invoke` — on a
|
|
221921
|
+
* raised episode, so a notification can offer it (an absolute open-URL
|
|
221922
|
+
* button, a token-authed invoke button). `actionUrl` stays for the
|
|
221923
|
+
* `{{actionUrl}}` template variable. Additive: an episode published before
|
|
221924
|
+
* this field has none.
|
|
221925
|
+
*/
|
|
221926
|
+
action: AlertActionSchema.optional(),
|
|
221793
221927
|
/** A device fault episode: every active fault (`metadata.faults`), principal first. */
|
|
221794
221928
|
faults: array(DeviceFaultSchema).optional(),
|
|
221795
221929
|
at: number$1()
|
|
@@ -222856,6 +222990,34 @@ function linkFieldDescriptor(key, target, labels) {
|
|
|
222856
222990
|
...target.kind !== void 0 ? { kind: target.kind } : {}
|
|
222857
222991
|
};
|
|
222858
222992
|
}
|
|
222993
|
+
/** When a member receives: always, inside a schedule, or while an alarm panel is in a state. */
|
|
222994
|
+
var GroupMemberWhenSchema = discriminatedUnion("kind", [
|
|
222995
|
+
object({ kind: literal("always") }),
|
|
222996
|
+
object({
|
|
222997
|
+
kind: literal("schedule"),
|
|
222998
|
+
schedule: NcScheduleSchema
|
|
222999
|
+
}),
|
|
223000
|
+
object({
|
|
223001
|
+
kind: literal("alarm"),
|
|
223002
|
+
deviceId: number$1().int().nonnegative(),
|
|
223003
|
+
states: array(AlarmStateSchema).min(1)
|
|
223004
|
+
})
|
|
223005
|
+
]);
|
|
223006
|
+
object({
|
|
223007
|
+
targetId: string().min(1),
|
|
223008
|
+
enabled: boolean().optional(),
|
|
223009
|
+
when: GroupMemberWhenSchema.optional(),
|
|
223010
|
+
/** Which message fields this member receives. Absent = all of them. */
|
|
223011
|
+
fields: array(NotificationFieldSchema).optional(),
|
|
223012
|
+
/** `{{title}}`, `{{body}}`, `{{priority}}` and any `{{key}}` of the notification's metadata. */
|
|
223013
|
+
templates: object({
|
|
223014
|
+
title: string().optional(),
|
|
223015
|
+
body: string().optional()
|
|
223016
|
+
}).optional(),
|
|
223017
|
+
minPriority: number$1().int().min(1).max(5).optional(),
|
|
223018
|
+
/** At most one delivery per window; a burst becomes one. 0 or absent = no throttle. */
|
|
223019
|
+
throttleSec: number$1().int().nonnegative().optional()
|
|
223020
|
+
});
|
|
222859
223021
|
//#endregion
|
|
222860
223022
|
//#region src/clips/clip-prefetch.ts
|
|
222861
223023
|
/** The longest a device may stay quiet after refusals, whatever its interval. */
|
|
@@ -229592,6 +229754,8 @@ var BATTERY_REFRESH_MINUTES_KEY = "batteryRefreshMinutes";
|
|
|
229592
229754
|
var BATTERY_REFRESH_TICK_MS = 6e4;
|
|
229593
229755
|
/** The least time between two attempts in one window. */
|
|
229594
229756
|
var RETRY_BACKOFF_MS = 10 * 6e4;
|
|
229757
|
+
/** The one refresh step whose failure does not hold the window open. */
|
|
229758
|
+
var SOFT_FAILURE_STEP = "snapshot";
|
|
229595
229759
|
var MAX_WAKE_LEAD_MS = 5 * 6e4;
|
|
229596
229760
|
var STAGGER_SLOTS = 60;
|
|
229597
229761
|
/** The operator's window in ms, or `0` for off. Out-of-range values clamp. */
|
|
@@ -229722,7 +229886,15 @@ var BatteryHourlyRefresh = class {
|
|
|
229722
229886
|
}
|
|
229723
229887
|
});
|
|
229724
229888
|
const outcome = await this.deps.refreshAll();
|
|
229725
|
-
|
|
229889
|
+
const hardFailures = outcome.failed.filter((step) => step !== SOFT_FAILURE_STEP);
|
|
229890
|
+
if (hardFailures.length === 0 && outcome.failed.length > 0) logger.warn("battery hourly refresh: snapshot did not move — window stamped, not retried", {
|
|
229891
|
+
tags: { deviceId },
|
|
229892
|
+
meta: {
|
|
229893
|
+
failed: outcome.failed,
|
|
229894
|
+
attempt: this.attempts
|
|
229895
|
+
}
|
|
229896
|
+
});
|
|
229897
|
+
if (hardFailures.length > 0) {
|
|
229726
229898
|
logger.warn("battery hourly refresh incomplete — not stamped, retried at the next chance", {
|
|
229727
229899
|
tags: { deviceId },
|
|
229728
229900
|
meta: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/addon-provider-reolink",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.256",
|
|
4
4
|
"description": "Reolink camera device provider addon for CamStack — native Baichuan protocol",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"camstack",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"werift"
|
|
97
97
|
],
|
|
98
98
|
"requires": {
|
|
99
|
-
"server": ">=1.2.
|
|
99
|
+
"server": ">=1.2.927"
|
|
100
100
|
}
|
|
101
101
|
},
|
|
102
102
|
"files": [
|