@camstack/addon-provider-homematic 1.2.210 → 1.2.211
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/.bundle-modules.json +4 -4
- package/dist/_stub.js +107 -61
- package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_provider_homematic_page-DqBsgmV2.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_provider_homematic_page-D5at7Q9l.mjs} +4 -4
- package/dist/_virtual_mf___mfe_internal__addon_provider_homematic_page__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-BHT2wfZN.mjs +26 -0
- package/dist/addon.js +363 -17
- package/dist/addon.mjs +363 -17
- package/dist/{hostInit-Veh_hTYB.mjs → hostInit-UNRy49MK.mjs} +3 -3
- package/dist/remoteEntry.js +1 -1
- package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_provider_homematic_page__remoteEntry_js-B6NDlkw9.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_provider_homematic_page__remoteEntry_js-BSgPYGJt.mjs} +1 -1
- package/dist/widgets/_stub.js +9 -2
- package/dist/widgets/{_virtual_mf-localSharedImportMap___mfe_internal__addon_provider_homematic_widgets-D4FsZKYN.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_provider_homematic_widgets-CTToHFHm.mjs} +2 -2
- package/dist/widgets/_virtual_mf___mfe_internal__addon_provider_homematic_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-BxH-K-yr.mjs +26 -0
- package/dist/widgets/{hostInit-xLDLUgao.mjs → hostInit-D-2FhaC8.mjs} +2 -2
- package/dist/widgets/remoteEntry.js +1 -1
- package/package.json +3 -3
- package/dist/_virtual_mf___mfe_internal__addon_provider_homematic_page__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-BkwWlzBp.mjs +0 -26
- package/dist/widgets/_virtual_mf___mfe_internal__addon_provider_homematic_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-dFo8NWrS.mjs +0 -26
package/dist/addon.js
CHANGED
|
@@ -51915,6 +51915,7 @@ function macroOnly(macro) {
|
|
|
51915
51915
|
};
|
|
51916
51916
|
}
|
|
51917
51917
|
}
|
|
51918
|
+
var FaultCodesSchema = array(string().min(1)).max(64);
|
|
51918
51919
|
/**
|
|
51919
51920
|
* Hold semantics — "for N seconds" on a leaf of the `when` tree (#498).
|
|
51920
51921
|
*
|
|
@@ -52049,6 +52050,17 @@ var DeviceBecomesLeafSchema = object({
|
|
|
52049
52050
|
path: ["value"]
|
|
52050
52051
|
});
|
|
52051
52052
|
});
|
|
52053
|
+
/**
|
|
52054
|
+
* A matching fault BECOMES active on a device (`device-fault.ts`): the device's
|
|
52055
|
+
* whole fault list is read, not only its principal code. `codes` empty = any
|
|
52056
|
+
* fault. Fires once per appearance; a fault already raised at start only seeds.
|
|
52057
|
+
*/
|
|
52058
|
+
var DeviceFaultRaisedLeafSchema = object({
|
|
52059
|
+
kind: literal("device-fault-raised"),
|
|
52060
|
+
...eventLeafId,
|
|
52061
|
+
deviceId: number$1().int().nonnegative(),
|
|
52062
|
+
codes: FaultCodesSchema
|
|
52063
|
+
});
|
|
52052
52064
|
var DeviceEventLeafSchema = object({
|
|
52053
52065
|
kind: literal("device-event"),
|
|
52054
52066
|
...eventLeafId,
|
|
@@ -52126,6 +52138,12 @@ var StationaryLeafSchema = object({
|
|
|
52126
52138
|
/** `appeared`: it became parked. `departed`: the registry retired it. */
|
|
52127
52139
|
phase: _enum(["appeared", "departed"])
|
|
52128
52140
|
});
|
|
52141
|
+
/** "has a fault": a matching fault is active on the device NOW (its whole fault list). `codes` empty = any. */
|
|
52142
|
+
var DeviceFaultIsLeafSchema = object({
|
|
52143
|
+
kind: literal("device-fault-is"),
|
|
52144
|
+
deviceId: number$1().int().nonnegative(),
|
|
52145
|
+
codes: FaultCodesSchema
|
|
52146
|
+
});
|
|
52129
52147
|
/** "is": one device field compared to one value, NOW. */
|
|
52130
52148
|
var DeviceIsLeafSchema = object({
|
|
52131
52149
|
kind: literal("device-is"),
|
|
@@ -52248,12 +52266,14 @@ var AutomationWhenSchema = lazy(() => discriminatedUnion("kind", [
|
|
|
52248
52266
|
DeviceBecomesLeafSchema,
|
|
52249
52267
|
DeviceEventLeafSchema,
|
|
52250
52268
|
DeviceFiredLeafSchema,
|
|
52269
|
+
DeviceFaultRaisedLeafSchema,
|
|
52251
52270
|
ScheduleLeafSchema,
|
|
52252
52271
|
ManualLeafSchema,
|
|
52253
52272
|
IntervalLeafSchema,
|
|
52254
52273
|
DetectionLeafSchema,
|
|
52255
52274
|
StationaryLeafSchema,
|
|
52256
52275
|
DeviceIsLeafSchema,
|
|
52276
|
+
DeviceFaultIsLeafSchema,
|
|
52257
52277
|
StationaryPresentLeafSchema,
|
|
52258
52278
|
ExpressionLeafSchema,
|
|
52259
52279
|
TimeIsLeafSchema,
|
|
@@ -52263,6 +52283,7 @@ var EVENT_KINDS = new Set([
|
|
|
52263
52283
|
"device-becomes",
|
|
52264
52284
|
"device-event",
|
|
52265
52285
|
"device-fired",
|
|
52286
|
+
"device-fault-raised",
|
|
52266
52287
|
"schedule",
|
|
52267
52288
|
"manual",
|
|
52268
52289
|
"interval",
|
|
@@ -52344,6 +52365,7 @@ var LEAF_WORDS = {
|
|
|
52344
52365
|
"device-becomes": "a device value that becomes",
|
|
52345
52366
|
"device-event": "a device event",
|
|
52346
52367
|
"device-fired": "a device firing an event",
|
|
52368
|
+
"device-fault-raised": "a device fault being raised",
|
|
52347
52369
|
schedule: "a schedule",
|
|
52348
52370
|
manual: "a manual run",
|
|
52349
52371
|
interval: "an interval",
|
|
@@ -52825,6 +52847,86 @@ var AutomationNotifyStepSchema = object({
|
|
|
52825
52847
|
body: string().min(1, "a notification needs a message").max(NOTIFY_BODY_MAX),
|
|
52826
52848
|
...continueOnErrorShape
|
|
52827
52849
|
});
|
|
52850
|
+
var HTTP_URL_MAX = 2e3;
|
|
52851
|
+
var HTTP_BODY_MAX = 16384;
|
|
52852
|
+
var HTTP_HEADER_VALUE_MAX = 1e3;
|
|
52853
|
+
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` });
|
|
52854
|
+
var retryUntilSecondsSchema = number$1().int().min(1).max(600, `a retry window is at most 600 s`);
|
|
52855
|
+
/**
|
|
52856
|
+
* Whether a TCP port on a host answers. TCP only: an ICMP echo needs a raw
|
|
52857
|
+
* socket or a `ping` binary with extra privileges, and the hub image ships
|
|
52858
|
+
* neither for its non-root user, so it is not offered.
|
|
52859
|
+
*
|
|
52860
|
+
* Without `expect` the step wants the host REACHABLE. The result
|
|
52861
|
+
* (`{ reachable, rttMs, error }`) goes to the run variable `saveAs`.
|
|
52862
|
+
*/
|
|
52863
|
+
var AutomationProbeStepSchema = object({
|
|
52864
|
+
kind: literal("probe"),
|
|
52865
|
+
...stepEnabledShape,
|
|
52866
|
+
/** A host name or an address; may carry `{{vars.x}}` slots. */
|
|
52867
|
+
host: string().min(1, "a probe needs a host").max(253).regex(/^[^\s/]+$/, "a host has no spaces or slashes"),
|
|
52868
|
+
port: number$1().int().min(1, "a port is 1 to 65535").max(65535, "a port is 1 to 65535"),
|
|
52869
|
+
timeoutSeconds: number$1().int().min(1).max(30),
|
|
52870
|
+
expect: _enum(["reachable", "unreachable"]).optional(),
|
|
52871
|
+
/** Keep probing every {@link REACH_RETRY_INTERVAL_S} s until the expectation holds, for this long. */
|
|
52872
|
+
retryUntilSeconds: retryUntilSecondsSchema.optional(),
|
|
52873
|
+
saveAs: saveAsSchema.optional(),
|
|
52874
|
+
...continueOnErrorShape
|
|
52875
|
+
}).strict();
|
|
52876
|
+
var HTTP_METHODS = [
|
|
52877
|
+
"GET",
|
|
52878
|
+
"POST",
|
|
52879
|
+
"PUT",
|
|
52880
|
+
"PATCH",
|
|
52881
|
+
"DELETE"
|
|
52882
|
+
];
|
|
52883
|
+
/**
|
|
52884
|
+
* What an HTTP request must answer for the step to pass: its status, or a field
|
|
52885
|
+
* of the parsed JSON body, compared the way a device field is.
|
|
52886
|
+
*/
|
|
52887
|
+
var AutomationHttpExpectSchema = object({
|
|
52888
|
+
on: _enum(["status", "json"]),
|
|
52889
|
+
/** A dotted path into the JSON body (`sysInfo.rawUartRemoteAddress`); needed for `json`. */
|
|
52890
|
+
fieldPath: string().min(1).max(200).optional(),
|
|
52891
|
+
operator: AutomationConditionOperatorSchema,
|
|
52892
|
+
value: union([
|
|
52893
|
+
string(),
|
|
52894
|
+
number$1(),
|
|
52895
|
+
boolean()
|
|
52896
|
+
])
|
|
52897
|
+
}).strict().refine((expect) => expect.on !== "json" || expect.fieldPath !== void 0, {
|
|
52898
|
+
message: "a JSON expectation names the field it reads",
|
|
52899
|
+
path: ["fieldPath"]
|
|
52900
|
+
});
|
|
52901
|
+
function isHttpUrl(url) {
|
|
52902
|
+
if (url.includes("{{")) return /^https?:\/\/\S+$/i.test(url);
|
|
52903
|
+
try {
|
|
52904
|
+
const parsed = new URL(url);
|
|
52905
|
+
return parsed.protocol === "http:" || parsed.protocol === "https:";
|
|
52906
|
+
} catch {
|
|
52907
|
+
return false;
|
|
52908
|
+
}
|
|
52909
|
+
}
|
|
52910
|
+
/**
|
|
52911
|
+
* One HTTP request. Without `expect` the step wants a 2xx answer. The result
|
|
52912
|
+
* (`{ status, ok, json, text, error }`) goes to the run variable `saveAs`.
|
|
52913
|
+
* Header values are stored as typed, in plain text: they are in the recipe and
|
|
52914
|
+
* in the generated source, so anyone who can open the automation can read a
|
|
52915
|
+
* token put in one. Header values and bodies are never logged or traced.
|
|
52916
|
+
*/
|
|
52917
|
+
var AutomationHttpRequestStepSchema = object({
|
|
52918
|
+
kind: literal("http-request"),
|
|
52919
|
+
...stepEnabledShape,
|
|
52920
|
+
method: _enum(HTTP_METHODS),
|
|
52921
|
+
url: string().max(HTTP_URL_MAX).refine(isHttpUrl, "the address is an http:// or https:// URL"),
|
|
52922
|
+
headers: record$1(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(),
|
|
52923
|
+
body: string().max(HTTP_BODY_MAX).optional(),
|
|
52924
|
+
timeoutSeconds: number$1().int().min(1).max(60),
|
|
52925
|
+
expect: AutomationHttpExpectSchema.optional(),
|
|
52926
|
+
retryUntilSeconds: retryUntilSecondsSchema.optional(),
|
|
52927
|
+
saveAs: saveAsSchema.optional(),
|
|
52928
|
+
...continueOnErrorShape
|
|
52929
|
+
}).strict();
|
|
52828
52930
|
var AutomationRunActionStepSchema = object({
|
|
52829
52931
|
kind: literal("action"),
|
|
52830
52932
|
...stepEnabledShape,
|
|
@@ -52880,7 +52982,9 @@ var plainStepSchemas = [
|
|
|
52880
52982
|
AutomationStopStepSchema.omit({ if: true }).strict(),
|
|
52881
52983
|
AutomationSetStepSchema.omit({ if: true }).strict(),
|
|
52882
52984
|
AutomationRunActionStepSchema.strict(),
|
|
52883
|
-
AutomationNotifyStepSchema.strict()
|
|
52985
|
+
AutomationNotifyStepSchema.strict(),
|
|
52986
|
+
AutomationProbeStepSchema,
|
|
52987
|
+
AutomationHttpRequestStepSchema
|
|
52884
52988
|
];
|
|
52885
52989
|
/**
|
|
52886
52990
|
* A plain step: a flow step with no condition of its own and no step inside
|
|
@@ -52980,6 +53084,8 @@ var AutomationActionSchema = discriminatedUnion("kind", [
|
|
|
52980
53084
|
AutomationRepeatStepSchema,
|
|
52981
53085
|
AutomationRunActionStepSchema,
|
|
52982
53086
|
AutomationNotifyStepSchema,
|
|
53087
|
+
AutomationProbeStepSchema,
|
|
53088
|
+
AutomationHttpRequestStepSchema,
|
|
52983
53089
|
object({
|
|
52984
53090
|
kind: literal("code"),
|
|
52985
53091
|
...stepEnabledShape,
|
|
@@ -53304,6 +53410,7 @@ var AutomationConditionTraceNodeSchema = object({
|
|
|
53304
53410
|
"not",
|
|
53305
53411
|
"condition",
|
|
53306
53412
|
"device-is",
|
|
53413
|
+
"device-fault-is",
|
|
53307
53414
|
"expression",
|
|
53308
53415
|
"stationary-present",
|
|
53309
53416
|
"time-is",
|
|
@@ -53311,6 +53418,7 @@ var AutomationConditionTraceNodeSchema = object({
|
|
|
53311
53418
|
"device-becomes",
|
|
53312
53419
|
"device-event",
|
|
53313
53420
|
"device-fired",
|
|
53421
|
+
"device-fault-raised",
|
|
53314
53422
|
"schedule",
|
|
53315
53423
|
"interval",
|
|
53316
53424
|
"manual",
|
|
@@ -53369,6 +53477,9 @@ var StepTraceBaseSchema = object({
|
|
|
53369
53477
|
* (D1021): why a sentence says "—" where a number was expected. Bounded.
|
|
53370
53478
|
*/
|
|
53371
53479
|
templates: array(string()).max(20).optional(),
|
|
53480
|
+
/** A probe or an HTTP request: how many tries it made, and what the last one saw (no header, no body). */
|
|
53481
|
+
attempts: number$1().int().optional(),
|
|
53482
|
+
lastAttempt: string().optional(),
|
|
53372
53483
|
/**
|
|
53373
53484
|
* What the step's own `if` read when the step was reached (#472): `true` the
|
|
53374
53485
|
* step ran, `false` its `else` ran (or nothing did), `unknown` a state leaf
|
|
@@ -121222,8 +121333,14 @@ function truthy(value) {
|
|
|
121222
121333
|
const text = value.trim().toLowerCase();
|
|
121223
121334
|
return text === "true" || text === "1" || text === "on" || text === "yes";
|
|
121224
121335
|
}
|
|
121225
|
-
/**
|
|
121226
|
-
|
|
121336
|
+
/**
|
|
121337
|
+
* WatchDog is part of RaspberryMatic / OpenCCU itself (since 3.59.6): it creates
|
|
121338
|
+
* an alarm system variable named "WatchDog: <alarm>" the first time that alarm
|
|
121339
|
+
* fires. The older "SV WatchDog: <alarm>" spelling is accepted too. The alarm
|
|
121340
|
+
* keys in {@link WATCHDOG_FAULTS} are not verified against real names, so a
|
|
121341
|
+
* WatchDog-prefixed variable that matches no rule is reported to the caller.
|
|
121342
|
+
*/
|
|
121343
|
+
var WATCHDOG_PREFIX = /^(?:sv\s*)?watchdog\s*:\s*/i;
|
|
121227
121344
|
var WATCHDOG_FAULTS = [
|
|
121228
121345
|
{
|
|
121229
121346
|
key: "hb-rf-eth-connection",
|
|
@@ -121266,12 +121383,15 @@ function watchdogRuleOf(name) {
|
|
|
121266
121383
|
* with a value (no snapshot, no credentials, the add-on not installed) is
|
|
121267
121384
|
* UNKNOWN, never "no fault".
|
|
121268
121385
|
*/
|
|
121269
|
-
function watchdogFaultReading(vars, now) {
|
|
121386
|
+
function watchdogFaultReading(vars, now, onUnmatched) {
|
|
121270
121387
|
const faults = [];
|
|
121271
121388
|
let known = 0;
|
|
121272
121389
|
for (const variable of vars) {
|
|
121273
121390
|
const rule = watchdogRuleOf(variable.name);
|
|
121274
|
-
if (rule === null)
|
|
121391
|
+
if (rule === null) {
|
|
121392
|
+
if (onUnmatched !== void 0 && WATCHDOG_PREFIX.test(variable.name.trim())) onUnmatched(variable.name);
|
|
121393
|
+
continue;
|
|
121394
|
+
}
|
|
121275
121395
|
const on = truthy(variable.value);
|
|
121276
121396
|
if (on === null) continue;
|
|
121277
121397
|
known += 1;
|
|
@@ -121280,6 +121400,39 @@ function watchdogFaultReading(vars, now) {
|
|
|
121280
121400
|
if (known === 0) return unknown(now);
|
|
121281
121401
|
return reading(faults, now);
|
|
121282
121402
|
}
|
|
121403
|
+
/** Several HmIP-RF devices went unreachable together (`homematic-radio-unreachable.ts`). */
|
|
121404
|
+
var RADIO_UNREACHABLE_FAULT = {
|
|
121405
|
+
key: "radio-unreachable",
|
|
121406
|
+
severity: "error",
|
|
121407
|
+
words: words("Several radio devices became unreachable", "Più dispositivi radio non raggiungibili")
|
|
121408
|
+
};
|
|
121409
|
+
/** No radio device event for too long (`homematic-radio-silent.ts`). */
|
|
121410
|
+
var RADIO_SILENT_FAULT = {
|
|
121411
|
+
key: "radio-silent",
|
|
121412
|
+
severity: "error",
|
|
121413
|
+
words: words("No radio events received", "Nessun evento radio ricevuto")
|
|
121414
|
+
};
|
|
121415
|
+
/** A reading for one rule: raised, fine, or unknown (`null`). */
|
|
121416
|
+
function ruleReading(rule, active, now) {
|
|
121417
|
+
if (active === null) return unknown(now);
|
|
121418
|
+
return reading(active ? [toFault(rule)] : [], now);
|
|
121419
|
+
}
|
|
121420
|
+
/**
|
|
121421
|
+
* Merge the readings of several sources. A fault from any source is active
|
|
121422
|
+
* (one entry per code); unknown from every source is unknown; a source that
|
|
121423
|
+
* reads "fine" beside one that is unknown is fine.
|
|
121424
|
+
*/
|
|
121425
|
+
function mergeFaultReadings(readings, now) {
|
|
121426
|
+
const byCode = /* @__PURE__ */ new Map();
|
|
121427
|
+
let known = 0;
|
|
121428
|
+
for (const item of readings) {
|
|
121429
|
+
if (item.active === null) continue;
|
|
121430
|
+
known += 1;
|
|
121431
|
+
for (const fault of item.faults ?? []) byCode.set(fault.code, fault);
|
|
121432
|
+
}
|
|
121433
|
+
if (known === 0) return unknown(now);
|
|
121434
|
+
return reading([...byCode.values()], now);
|
|
121435
|
+
}
|
|
121283
121436
|
var MAINTENANCE_FAULTS = [
|
|
121284
121437
|
{
|
|
121285
121438
|
key: "UNREACH",
|
|
@@ -121346,9 +121499,13 @@ function maintenanceFaultReading(values, now) {
|
|
|
121346
121499
|
if (known === 0) return unknown(now);
|
|
121347
121500
|
return reading(faults, now);
|
|
121348
121501
|
}
|
|
121349
|
-
/**
|
|
121350
|
-
function
|
|
121351
|
-
return
|
|
121502
|
+
/** Every fault the gateway can raise: WatchDog's plus the two derived from radio behaviour. */
|
|
121503
|
+
function gatewayFaultTypes() {
|
|
121504
|
+
return [
|
|
121505
|
+
...WATCHDOG_FAULTS,
|
|
121506
|
+
RADIO_UNREACHABLE_FAULT,
|
|
121507
|
+
RADIO_SILENT_FAULT
|
|
121508
|
+
].map(toFault);
|
|
121352
121509
|
}
|
|
121353
121510
|
/**
|
|
121354
121511
|
* The faults a device's MAINTENANCE channel can raise, by their fixed flags.
|
|
@@ -121417,9 +121574,15 @@ function buildCcuFaultHandlers(deps) {
|
|
|
121417
121574
|
});
|
|
121418
121575
|
}
|
|
121419
121576
|
faults.sort((a, b) => a.severity === b.severity ? 0 : a.severity === "error" ? -1 : 1);
|
|
121577
|
+
const reported = deps.gatewayFaults?.(input.integrationId) ?? null;
|
|
121420
121578
|
return {
|
|
121421
121579
|
faults,
|
|
121422
|
-
unreported
|
|
121580
|
+
unreported,
|
|
121581
|
+
gatewayFaults: reported === null ? null : reported.map((fault) => ({
|
|
121582
|
+
code: fault.code,
|
|
121583
|
+
label: fault.label,
|
|
121584
|
+
severity: fault.severity
|
|
121585
|
+
}))
|
|
121423
121586
|
};
|
|
121424
121587
|
} };
|
|
121425
121588
|
}
|
|
@@ -121909,7 +122072,9 @@ var CcuFaultsResultSchema = object({
|
|
|
121909
122072
|
faults: array(CcuFaultSchema)
|
|
121910
122073
|
})),
|
|
121911
122074
|
/** Devices whose service flags the CCU has not reported: unknown, never "no fault". */
|
|
121912
|
-
unreported: array(string())
|
|
122075
|
+
unreported: array(string()),
|
|
122076
|
+
/** What the gateway (the CCU box and its radio) reports: WatchDog, mass unreachable, radio silence. `null` is unknown (never read, or no source answered), never "none". */
|
|
122077
|
+
gatewayFaults: array(CcuFaultSchema).nullable().default(null)
|
|
121913
122078
|
});
|
|
121914
122079
|
//#endregion
|
|
121915
122080
|
//#region src/ccu/ccu-heating-actions.ts
|
|
@@ -147921,10 +148086,32 @@ var HmFacadeResolver = class {
|
|
|
147921
148086
|
#sessions = /* @__PURE__ */ new Map();
|
|
147922
148087
|
/** Per-integration state-change fan-out (connect, disconnect, error). */
|
|
147923
148088
|
#snapshotSubs = /* @__PURE__ */ new Map();
|
|
148089
|
+
/** Per-integration stamps of the real radio events (`radio-silent`). */
|
|
148090
|
+
#radioActivity = /* @__PURE__ */ new Map();
|
|
148091
|
+
/** The faults the gateway device last published, for the CCU page's overview. */
|
|
148092
|
+
#gatewayFaults = /* @__PURE__ */ new Map();
|
|
148093
|
+
/** Publish the radio-event tracker of an integration (a fresh one per facade). */
|
|
148094
|
+
setRadioActivity(integrationId, tracker) {
|
|
148095
|
+
if (tracker === null) this.#radioActivity.delete(integrationId);
|
|
148096
|
+
else this.#radioActivity.set(integrationId, tracker);
|
|
148097
|
+
}
|
|
148098
|
+
radioActivity(integrationId) {
|
|
148099
|
+
return this.#radioActivity.get(integrationId) ?? null;
|
|
148100
|
+
}
|
|
148101
|
+
/** The gateway device records what it published; read by the overview, never the other way. */
|
|
148102
|
+
setGatewayFaults(integrationId, faults) {
|
|
148103
|
+
this.#gatewayFaults.set(integrationId, faults);
|
|
148104
|
+
}
|
|
148105
|
+
/** `null` is unknown: nothing was published yet, or the last reading had no answering source. */
|
|
148106
|
+
gatewayFaults(integrationId) {
|
|
148107
|
+
return this.#gatewayFaults.get(integrationId) ?? null;
|
|
148108
|
+
}
|
|
147924
148109
|
/** Publish or remove the facade for an integration id. `null` removes the entry. */
|
|
147925
148110
|
set(integrationId, facade) {
|
|
147926
148111
|
if (facade === null) {
|
|
147927
148112
|
this.#facades.delete(integrationId);
|
|
148113
|
+
this.#radioActivity.delete(integrationId);
|
|
148114
|
+
this.#gatewayFaults.delete(integrationId);
|
|
147928
148115
|
return;
|
|
147929
148116
|
}
|
|
147930
148117
|
this.#facades.set(integrationId, facade);
|
|
@@ -147973,6 +148160,8 @@ var HmFacadeResolver = class {
|
|
|
147973
148160
|
clear() {
|
|
147974
148161
|
clearCcuCallLimiters();
|
|
147975
148162
|
this.#facades.clear();
|
|
148163
|
+
this.#radioActivity.clear();
|
|
148164
|
+
this.#gatewayFaults.clear();
|
|
147976
148165
|
this.#sessions.clear();
|
|
147977
148166
|
this.#snapshotSubs.clear();
|
|
147978
148167
|
clearStoredKeyLinkStates();
|
|
@@ -150632,6 +150821,59 @@ function buildConnectionFormSchema() {
|
|
|
150632
150821
|
] };
|
|
150633
150822
|
}
|
|
150634
150823
|
//#endregion
|
|
150824
|
+
//#region src/homematic-radio-interface.ts
|
|
150825
|
+
/** The radio interface a data-point id belongs to, or `null`. */
|
|
150826
|
+
function radioInterfaceOfDataPointId(id) {
|
|
150827
|
+
const owner = (id.split(":")[0] ?? "").toLowerCase();
|
|
150828
|
+
if (owner.endsWith("-hmip-rf")) return "HmIP-RF";
|
|
150829
|
+
if (owner.endsWith("-bidcos-rf")) return "BidCos-RF";
|
|
150830
|
+
return null;
|
|
150831
|
+
}
|
|
150832
|
+
/** The radio interface of a device (all its data points share one), or `null` when it has none. */
|
|
150833
|
+
function radioInterfaceOfDevice(device) {
|
|
150834
|
+
for (const channel of device.channels) for (const point of channel.dataPoints) return radioInterfaceOfDataPointId(point.id);
|
|
150835
|
+
return null;
|
|
150836
|
+
}
|
|
150837
|
+
/** … each with an UNREACH start inside one window of this length. */
|
|
150838
|
+
var RADIO_UNREACHABLE_WINDOW_MS = 10 * 6e4;
|
|
150839
|
+
function unreachOf(device) {
|
|
150840
|
+
const point = maintenanceChannel(device)?.dataPoints.find((p) => p.parameter === "UNREACH");
|
|
150841
|
+
return typeof point?.value === "boolean" ? point.value : null;
|
|
150842
|
+
}
|
|
150843
|
+
/** The most UNREACH starts that fall inside any one window. */
|
|
150844
|
+
function largestCluster(starts) {
|
|
150845
|
+
const sorted = [...starts].sort((a, b) => a - b);
|
|
150846
|
+
let best = 0;
|
|
150847
|
+
let low = 0;
|
|
150848
|
+
for (let high = 0; high < sorted.length; high += 1) {
|
|
150849
|
+
while ((sorted[high] ?? 0) - (sorted[low] ?? 0) > RADIO_UNREACHABLE_WINDOW_MS) low += 1;
|
|
150850
|
+
best = Math.max(best, high - low + 1);
|
|
150851
|
+
}
|
|
150852
|
+
return best;
|
|
150853
|
+
}
|
|
150854
|
+
/**
|
|
150855
|
+
* Active when several HmIP-RF devices became UNREACH close together: enough of
|
|
150856
|
+
* them AND enough of the interface. A device whose UNREACH start the CCU did not
|
|
150857
|
+
* stamp cannot be placed in a window and is not counted. The population is the
|
|
150858
|
+
* HmIP-RF devices whose flag was read; none read is UNKNOWN, never "fine".
|
|
150859
|
+
*/
|
|
150860
|
+
function radioUnreachableReading(devices, messages, now) {
|
|
150861
|
+
const starts = [];
|
|
150862
|
+
let population = 0;
|
|
150863
|
+
for (const device of devices) {
|
|
150864
|
+
if (radioInterfaceOfDevice(device) !== "HmIP-RF") continue;
|
|
150865
|
+
const unreach = unreachOf(device);
|
|
150866
|
+
if (unreach === null) continue;
|
|
150867
|
+
population += 1;
|
|
150868
|
+
if (!unreach) continue;
|
|
150869
|
+
const since = faultSince(device.address, "UNREACH", messages);
|
|
150870
|
+
if (since !== null) starts.push(since);
|
|
150871
|
+
}
|
|
150872
|
+
if (population === 0) return ruleReading(RADIO_UNREACHABLE_FAULT, null, now);
|
|
150873
|
+
const clustered = largestCluster(starts);
|
|
150874
|
+
return ruleReading(RADIO_UNREACHABLE_FAULT, clustered >= 3 && clustered / population >= .25, now);
|
|
150875
|
+
}
|
|
150876
|
+
//#endregion
|
|
150635
150877
|
//#region src/homematic-gateway-metadata.ts
|
|
150636
150878
|
/** What the CCU box is known by, as device metadata (a CCU announces no model or firmware over XML-RPC). */
|
|
150637
150879
|
function gatewayMetadataPatch(input) {
|
|
@@ -150681,9 +150923,10 @@ function registerHomematicStateRefresh(target) {
|
|
|
150681
150923
|
*
|
|
150682
150924
|
* - `device-admin-link`, the CCU's own WebUI.
|
|
150683
150925
|
*
|
|
150684
|
-
* - `error`, the
|
|
150685
|
-
*
|
|
150686
|
-
*
|
|
150926
|
+
* - `error`, the merge of every fault source (`homematic-fault-mapping.ts`): the
|
|
150927
|
+
* CCU's built-in WatchDog alarm variables, several HmIP-RF devices unreachable
|
|
150928
|
+
* together, and radio silence. Read by the core's `device-state-refresh` (D1062), because
|
|
150929
|
+
* the CCU pushes no event for them.
|
|
150687
150930
|
*
|
|
150688
150931
|
* There is no `reboot` and no `update`: nodehomematic has no call that restarts
|
|
150689
150932
|
* the CCU, and its firmware call installs an update on a radio DEVICE by its
|
|
@@ -150700,13 +150943,15 @@ var HomematicGatewayDevice = class extends BaseDevice {
|
|
|
150700
150943
|
lastMetadataKey = "";
|
|
150701
150944
|
polling = false;
|
|
150702
150945
|
warnedReadFailure = false;
|
|
150946
|
+
warnedSources = /* @__PURE__ */ new Set();
|
|
150947
|
+
seenUnmatchedWatchdog = /* @__PURE__ */ new Set();
|
|
150703
150948
|
constructor(ctx) {
|
|
150704
150949
|
const cfg = homematicGatewayDeviceSchema.parse(ctx.persistedConfig ?? {});
|
|
150705
150950
|
super(ctx, homematicGatewayDeviceSchema, { type: DeviceType.Gateway });
|
|
150706
150951
|
this.integrationId = cfg.integrationId;
|
|
150707
150952
|
this.online = this.sessionUp();
|
|
150708
150953
|
this.registerAdminLinkCap();
|
|
150709
|
-
this.declareFaultTypes(
|
|
150954
|
+
this.declareFaultTypes(gatewayFaultTypes());
|
|
150710
150955
|
this.registerErrorCap();
|
|
150711
150956
|
registerHomematicStateRefresh({
|
|
150712
150957
|
ctx,
|
|
@@ -150755,11 +151000,56 @@ var HomematicGatewayDevice = class extends BaseDevice {
|
|
|
150755
151000
|
}
|
|
150756
151001
|
async readFaultsFrom(facade) {
|
|
150757
151002
|
await facade.refreshHub();
|
|
150758
|
-
const
|
|
150759
|
-
|
|
151003
|
+
const now = Date.now();
|
|
151004
|
+
const reading = mergeFaultReadings([
|
|
151005
|
+
watchdogFaultReading(facade.systemVariables(), now, (name) => this.noteUnmatchedWatchdog(name)),
|
|
151006
|
+
await this.readRadioUnreachable(facade, now),
|
|
151007
|
+
this.readRadioSilent(facade, now)
|
|
151008
|
+
], now);
|
|
151009
|
+
if (reading.active === null) this.ctx.logger.debug("Homematic gateway: no WatchDog system variable and no other fault source readable, faults stay unknown", { tags: { deviceId: this.id } });
|
|
151010
|
+
homematicFacades.setGatewayFaults(this.integrationId, reading.active === null ? null : reading.faults ?? []);
|
|
150760
151011
|
this.warnedReadFailure = false;
|
|
150761
151012
|
await this.publishError(reading);
|
|
150762
151013
|
}
|
|
151014
|
+
/** A WatchDog variable no rule knows: logged once per name so the real names get learned. */
|
|
151015
|
+
noteUnmatchedWatchdog(name) {
|
|
151016
|
+
if (this.seenUnmatchedWatchdog.has(name)) return;
|
|
151017
|
+
this.seenUnmatchedWatchdog.add(name);
|
|
151018
|
+
this.ctx.logger.debug("Homematic gateway: WatchDog variable matches no fault rule", {
|
|
151019
|
+
tags: { deviceId: this.id },
|
|
151020
|
+
meta: { variable: name }
|
|
151021
|
+
});
|
|
151022
|
+
}
|
|
151023
|
+
/** A source that cannot be read is unknown; the first failure is a warning, the repeats debug. */
|
|
151024
|
+
noteSourceFailure(source, error) {
|
|
151025
|
+
const log = this.warnedSources.has(source) ? this.ctx.logger.debug : this.ctx.logger.warn;
|
|
151026
|
+
this.warnedSources.add(source);
|
|
151027
|
+
log.call(this.ctx.logger, `Homematic gateway: ${source} unreadable, that source stays unknown`, {
|
|
151028
|
+
tags: { deviceId: this.id },
|
|
151029
|
+
meta: { error }
|
|
151030
|
+
});
|
|
151031
|
+
}
|
|
151032
|
+
/** Several HmIP-RF devices unreachable together; needs the service messages for the start times. */
|
|
151033
|
+
async readRadioUnreachable(facade, now) {
|
|
151034
|
+
try {
|
|
151035
|
+
const messages = await facade.serviceMessages();
|
|
151036
|
+
return radioUnreachableReading(facade.devices(), messages, now);
|
|
151037
|
+
} catch (err) {
|
|
151038
|
+
this.noteSourceFailure("radio unreachable check", errMsg(err));
|
|
151039
|
+
return ruleReading(RADIO_UNREACHABLE_FAULT, null, now);
|
|
151040
|
+
}
|
|
151041
|
+
}
|
|
151042
|
+
/** No real radio event for too long, from the stamps the registry's event listener keeps. */
|
|
151043
|
+
readRadioSilent(facade, now) {
|
|
151044
|
+
const tracker = homematicFacades.radioActivity(this.integrationId);
|
|
151045
|
+
if (tracker === null) return ruleReading(RADIO_SILENT_FAULT, null, now);
|
|
151046
|
+
try {
|
|
151047
|
+
return tracker.reading(facade.devices(), now);
|
|
151048
|
+
} catch (err) {
|
|
151049
|
+
this.noteSourceFailure("radio silence check", errMsg(err));
|
|
151050
|
+
return ruleReading(RADIO_SILENT_FAULT, null, now);
|
|
151051
|
+
}
|
|
151052
|
+
}
|
|
150763
151053
|
/**
|
|
150764
151054
|
* Read the faults when the CCU announced a new snapshot (it just reconnected
|
|
150765
151055
|
* or changed). A read that fails changes nothing (the previous reading
|
|
@@ -151691,6 +151981,58 @@ function isConnectionArg(arg) {
|
|
|
151691
151981
|
return typeof arg === "object" && arg !== null && "interfaceId" in arg && "state" in arg && typeof arg["state"] === "string";
|
|
151692
151982
|
}
|
|
151693
151983
|
//#endregion
|
|
151984
|
+
//#region src/homematic-radio-silent.ts
|
|
151985
|
+
/**
|
|
151986
|
+
* Feed a tracker from the library's `valueChanged`. The event's `ts` is epoch
|
|
151987
|
+
* milliseconds (the library stamps `Date.now()`), the unit the tracker keeps;
|
|
151988
|
+
* it is passed through untouched. Returns the unsubscribe function.
|
|
151989
|
+
*/
|
|
151990
|
+
function attachRadioActivity(source, tracker) {
|
|
151991
|
+
return source.on("valueChanged", (event) => tracker.record(event.dpId, event.ts));
|
|
151992
|
+
}
|
|
151993
|
+
/**
|
|
151994
|
+
* Stamps the REAL device datapoint events of each radio interface (fed from the
|
|
151995
|
+
* library's `valueChanged`). A connection ping, an interface-level event or a
|
|
151996
|
+
* virtual / group device never passes {@link record}'s interface check, so none
|
|
151997
|
+
* of them keeps the silence alive. The reading rides the core state-refresh tick:
|
|
151998
|
+
* there is no timer here.
|
|
151999
|
+
*/
|
|
152000
|
+
var RadioActivityTracker = class {
|
|
152001
|
+
#lastEventAt = /* @__PURE__ */ new Map();
|
|
152002
|
+
#startedAt;
|
|
152003
|
+
constructor(startedAt) {
|
|
152004
|
+
this.#startedAt = startedAt;
|
|
152005
|
+
}
|
|
152006
|
+
/** Stamp one real device event, named by its data-point id. */
|
|
152007
|
+
record(dataPointId, at) {
|
|
152008
|
+
const radio = radioInterfaceOfDataPointId(dataPointId);
|
|
152009
|
+
if (radio === null) return;
|
|
152010
|
+
if (at > (this.#lastEventAt.get(radio) ?? 0)) this.#lastEventAt.set(radio, at);
|
|
152011
|
+
}
|
|
152012
|
+
/**
|
|
152013
|
+
* Silent when an interface with enough devices has had no event for
|
|
152014
|
+
* {@link RADIO_SILENT_AFTER_MS}. Before the first event the clock runs from
|
|
152015
|
+
* the tracker's start, so it is UNKNOWN until that long has passed.
|
|
152016
|
+
*/
|
|
152017
|
+
reading(devices, now) {
|
|
152018
|
+
const counts = /* @__PURE__ */ new Map();
|
|
152019
|
+
for (const device of devices) {
|
|
152020
|
+
const radio = radioInterfaceOfDevice(device);
|
|
152021
|
+
if (radio !== null) counts.set(radio, (counts.get(radio) ?? 0) + 1);
|
|
152022
|
+
}
|
|
152023
|
+
let judged = false;
|
|
152024
|
+
let silent = false;
|
|
152025
|
+
for (const [radio, count] of counts) {
|
|
152026
|
+
if (count < 5) continue;
|
|
152027
|
+
const last = this.#lastEventAt.get(radio);
|
|
152028
|
+
if (last === void 0 && now - this.#startedAt < 9e5) continue;
|
|
152029
|
+
judged = true;
|
|
152030
|
+
if (now - (last ?? this.#startedAt) >= 9e5) silent = true;
|
|
152031
|
+
}
|
|
152032
|
+
return ruleReading(RADIO_SILENT_FAULT, judged ? silent : null, now);
|
|
152033
|
+
}
|
|
152034
|
+
};
|
|
152035
|
+
//#endregion
|
|
151694
152036
|
//#region src/homematic-client-registry.ts
|
|
151695
152037
|
/**
|
|
151696
152038
|
* Delays (ms) between background retries after a failed `facade.start()` (e.g.
|
|
@@ -151749,6 +152091,9 @@ var HmClientRegistry = class {
|
|
|
151749
152091
|
const raw = new Homematic(toHomematicOptions(config));
|
|
151750
152092
|
this.#facades.set(opts.id, raw);
|
|
151751
152093
|
homematicFacades.set(opts.id, raw);
|
|
152094
|
+
const tracker = new RadioActivityTracker(Date.now());
|
|
152095
|
+
homematicFacades.setRadioActivity(opts.id, tracker);
|
|
152096
|
+
attachRadioActivity(raw, tracker);
|
|
151752
152097
|
return wrapFacade(raw);
|
|
151753
152098
|
}
|
|
151754
152099
|
});
|
|
@@ -152766,7 +153111,8 @@ var HomematicProviderAddon = class extends BaseDeviceProvider {
|
|
|
152766
153111
|
logger: this.ctx.logger,
|
|
152767
153112
|
adoptedAddresses: (integrationId) => this.adoptedCcuAddresses(integrationId),
|
|
152768
153113
|
adoptedNames: (integrationId) => this.adoptedCcuNames(integrationId),
|
|
152769
|
-
ccuChanged: (integrationId) => homematicFacades.emitSnapshot(integrationId)
|
|
153114
|
+
ccuChanged: (integrationId) => homematicFacades.emitSnapshot(integrationId),
|
|
153115
|
+
gatewayFaults: (integrationId) => homematicFacades.gatewayFaults(integrationId)
|
|
152770
153116
|
};
|
|
152771
153117
|
}
|
|
152772
153118
|
async onShutdown() {
|