@riddix/hamh 2.1.0-alpha.862 → 2.1.0-alpha.863
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/backend/cli.js
CHANGED
|
@@ -1767,8 +1767,8 @@ var init_Cancelable = __esm({
|
|
|
1767
1767
|
};
|
|
1768
1768
|
return result;
|
|
1769
1769
|
}
|
|
1770
|
-
static set logger(
|
|
1771
|
-
this.#logger =
|
|
1770
|
+
static set logger(logger255) {
|
|
1771
|
+
this.#logger = logger255;
|
|
1772
1772
|
}
|
|
1773
1773
|
static get logger() {
|
|
1774
1774
|
return this.#logger;
|
|
@@ -3475,13 +3475,13 @@ var init_Logger = __esm({
|
|
|
3475
3475
|
*
|
|
3476
3476
|
* @deprecated use {@link destinations}
|
|
3477
3477
|
*/
|
|
3478
|
-
static addLogger(identifier,
|
|
3478
|
+
static addLogger(identifier, logger255, options) {
|
|
3479
3479
|
if (identifier in this.destinations) {
|
|
3480
3480
|
throw new ImplementationError(`Logger "${identifier}" already exists`);
|
|
3481
3481
|
}
|
|
3482
3482
|
const dest = LogDestination({ name: identifier });
|
|
3483
3483
|
const legacy = adaptDestinationToLegacy(dest);
|
|
3484
|
-
legacy.log =
|
|
3484
|
+
legacy.log = logger255;
|
|
3485
3485
|
if (options?.defaultLogLevel !== void 0) {
|
|
3486
3486
|
legacy.defaultLogLevel = options.defaultLogLevel;
|
|
3487
3487
|
}
|
|
@@ -5687,8 +5687,8 @@ var init_Construction = __esm({
|
|
|
5687
5687
|
}
|
|
5688
5688
|
}
|
|
5689
5689
|
#unhandledError(...args) {
|
|
5690
|
-
const
|
|
5691
|
-
|
|
5690
|
+
const logger255 = Logger.get(this.#subject.constructor.name);
|
|
5691
|
+
logger255.error(...args);
|
|
5692
5692
|
}
|
|
5693
5693
|
#createErrorHandler(name) {
|
|
5694
5694
|
return (e) => {
|
|
@@ -64126,8 +64126,8 @@ var init_NodeSession = __esm({
|
|
|
64126
64126
|
return session?.type === SessionType.Unicast;
|
|
64127
64127
|
}
|
|
64128
64128
|
NodeSession2.is = is;
|
|
64129
|
-
function logNew(
|
|
64130
|
-
|
|
64129
|
+
function logNew(logger255, operation, session, messenger, fabric, peerNodeId) {
|
|
64130
|
+
logger255.info(
|
|
64131
64131
|
session.via,
|
|
64132
64132
|
`${operation} session with`,
|
|
64133
64133
|
Diagnostic.strong(PeerAddress({ fabricIndex: fabric.fabricIndex, nodeId: peerNodeId }).toString()),
|
|
@@ -118041,11 +118041,11 @@ var init_Api = __esm({
|
|
|
118041
118041
|
}
|
|
118042
118042
|
Api2.resourceFor = resourceFor;
|
|
118043
118043
|
function log(level, facility, id, ...message) {
|
|
118044
|
-
let
|
|
118045
|
-
if (!
|
|
118046
|
-
loggers.set(facility,
|
|
118044
|
+
let logger255 = loggers.get(facility);
|
|
118045
|
+
if (!logger255) {
|
|
118046
|
+
loggers.set(facility, logger255 = Logger.get(facility));
|
|
118047
118047
|
}
|
|
118048
|
-
|
|
118048
|
+
logger255[level](Diagnostic.via(id || "(anon)"), message);
|
|
118049
118049
|
}
|
|
118050
118050
|
Api2.log = log;
|
|
118051
118051
|
function logRequest(facility, id, method, target) {
|
|
@@ -132771,6 +132771,14 @@ var init_esm7 = __esm({
|
|
|
132771
132771
|
}
|
|
132772
132772
|
});
|
|
132773
132773
|
|
|
132774
|
+
// ../../node_modules/.pnpm/@matter+main@0.17.9/node_modules/@matter/main/dist/esm/protocol.js
|
|
132775
|
+
var init_protocol3 = __esm({
|
|
132776
|
+
"../../node_modules/.pnpm/@matter+main@0.17.9/node_modules/@matter/main/dist/esm/protocol.js"() {
|
|
132777
|
+
init_nodejs();
|
|
132778
|
+
init_esm4();
|
|
132779
|
+
}
|
|
132780
|
+
});
|
|
132781
|
+
|
|
132774
132782
|
// src/utils/debounce-context.ts
|
|
132775
132783
|
import debounce from "debounce";
|
|
132776
132784
|
var DebounceContext;
|
|
@@ -132850,7 +132858,7 @@ async function withRetry(fn, options = {}) {
|
|
|
132850
132858
|
return await fn();
|
|
132851
132859
|
} catch (error) {
|
|
132852
132860
|
lastError = error;
|
|
132853
|
-
if (attempt === opts.maxAttempts) {
|
|
132861
|
+
if (attempt === opts.maxAttempts || options.shouldRetry?.(error) === false) {
|
|
132854
132862
|
break;
|
|
132855
132863
|
}
|
|
132856
132864
|
const delayMs = Math.min(
|
|
@@ -132914,6 +132922,12 @@ var init_retry = __esm({
|
|
|
132914
132922
|
get isOpen() {
|
|
132915
132923
|
return this.state === "open";
|
|
132916
132924
|
}
|
|
132925
|
+
// Open AND still inside the reset window. Callers that pre-check
|
|
132926
|
+
// availability must use this, not isOpen, or the half-open probe never
|
|
132927
|
+
// happens and the breaker stays latched forever (#446).
|
|
132928
|
+
get isBlocking() {
|
|
132929
|
+
return this.state === "open" && Date.now() - this.lastFailureTime < this.resetTimeoutMs;
|
|
132930
|
+
}
|
|
132917
132931
|
reset() {
|
|
132918
132932
|
this.failures = 0;
|
|
132919
132933
|
this.state = "closed";
|
|
@@ -132950,8 +132964,7 @@ var init_send_ha_message = __esm({
|
|
|
132950
132964
|
});
|
|
132951
132965
|
|
|
132952
132966
|
// src/services/home-assistant/home-assistant-actions.ts
|
|
132953
|
-
|
|
132954
|
-
var defaultConfig, HomeAssistantActions;
|
|
132967
|
+
var TARGET_FAILURE_THRESHOLD, defaultConfig, HomeAssistantActions;
|
|
132955
132968
|
var init_home_assistant_actions = __esm({
|
|
132956
132969
|
"src/services/home-assistant/home-assistant-actions.ts"() {
|
|
132957
132970
|
"use strict";
|
|
@@ -132960,6 +132973,7 @@ var init_home_assistant_actions = __esm({
|
|
|
132960
132973
|
init_retry();
|
|
132961
132974
|
init_send_ha_message();
|
|
132962
132975
|
init_diagnostic_event_bus();
|
|
132976
|
+
TARGET_FAILURE_THRESHOLD = 3;
|
|
132963
132977
|
defaultConfig = {
|
|
132964
132978
|
retryAttempts: 3,
|
|
132965
132979
|
retryBaseDelayMs: 100,
|
|
@@ -132968,10 +132982,10 @@ var init_home_assistant_actions = __esm({
|
|
|
132968
132982
|
circuitBreakerResetMs: 3e4
|
|
132969
132983
|
};
|
|
132970
132984
|
HomeAssistantActions = class extends Service {
|
|
132971
|
-
constructor(
|
|
132985
|
+
constructor(logger255, client, config8) {
|
|
132972
132986
|
super("HomeAssistantActions");
|
|
132973
132987
|
this.client = client;
|
|
132974
|
-
this.log =
|
|
132988
|
+
this.log = logger255.get(this);
|
|
132975
132989
|
this.config = { ...defaultConfig, ...config8 };
|
|
132976
132990
|
this.circuitBreaker = new CircuitBreaker(
|
|
132977
132991
|
this.config.circuitBreakerThreshold,
|
|
@@ -132979,6 +132993,13 @@ var init_home_assistant_actions = __esm({
|
|
|
132979
132993
|
);
|
|
132980
132994
|
}
|
|
132981
132995
|
client;
|
|
132996
|
+
// #446: a Matter command must not report success while HA cannot take the
|
|
132997
|
+
// call. Only the transport counts here: the breaker is app-wide, so ten
|
|
132998
|
+
// failures from one broken entity would otherwise make every device on
|
|
132999
|
+
// every bridge fail.
|
|
133000
|
+
get available() {
|
|
133001
|
+
return this.client.haRunning;
|
|
133002
|
+
}
|
|
132982
133003
|
log;
|
|
132983
133004
|
debounceContext = new DebounceContext(
|
|
132984
133005
|
this.processAction.bind(this)
|
|
@@ -132987,6 +133008,27 @@ var init_home_assistant_actions = __esm({
|
|
|
132987
133008
|
config;
|
|
132988
133009
|
consecutiveFailures = 0;
|
|
132989
133010
|
lastSuccessTime = Date.now();
|
|
133011
|
+
// Per entity, not app wide: the shared breaker would let one broken entity
|
|
133012
|
+
// make every device on every bridge fail (#446).
|
|
133013
|
+
targetFailures = /* @__PURE__ */ new Map();
|
|
133014
|
+
// A target that just failed repeatedly is reported as unavailable, so the
|
|
133015
|
+
// controller sees the failure on that device instead of a false success.
|
|
133016
|
+
isTargetBlocked(entityId) {
|
|
133017
|
+
const entry = this.targetFailures.get(entityId);
|
|
133018
|
+
return entry != null && Date.now() < entry.blockedUntil;
|
|
133019
|
+
}
|
|
133020
|
+
recordTargetResult(entityId, failed) {
|
|
133021
|
+
if (!entityId) return;
|
|
133022
|
+
if (!failed) {
|
|
133023
|
+
this.targetFailures.delete(entityId);
|
|
133024
|
+
return;
|
|
133025
|
+
}
|
|
133026
|
+
const count = (this.targetFailures.get(entityId)?.count ?? 0) + 1;
|
|
133027
|
+
this.targetFailures.set(entityId, {
|
|
133028
|
+
count,
|
|
133029
|
+
blockedUntil: count >= TARGET_FAILURE_THRESHOLD ? Date.now() + this.config.circuitBreakerResetMs : 0
|
|
133030
|
+
});
|
|
133031
|
+
}
|
|
132990
133032
|
processAction(_key, calls) {
|
|
132991
133033
|
const skipTarget = calls[0].target === false;
|
|
132992
133034
|
const entity_id = skipTarget ? void 0 : calls[0].target || calls[0].entityId;
|
|
@@ -132994,7 +133036,9 @@ var init_home_assistant_actions = __esm({
|
|
|
132994
133036
|
const data = Object.assign({}, ...calls.map((c) => c.data));
|
|
132995
133037
|
const [domain, actionName] = action.split(".");
|
|
132996
133038
|
const target = entity_id ? { entity_id } : {};
|
|
132997
|
-
|
|
133039
|
+
const origin = calls[0].entityId;
|
|
133040
|
+
this.callAction(domain, actionName, data, target, false).then(() => this.recordTargetResult(origin, false)).catch((error) => {
|
|
133041
|
+
this.recordTargetResult(origin, true);
|
|
132998
133042
|
const errorMsg = this.formatError(error);
|
|
132999
133043
|
this.log.error(
|
|
133000
133044
|
`Failed to call action '${action}' for entity '${entity_id ?? "(no target)"}': ${errorMsg}`
|
|
@@ -133030,13 +133074,17 @@ var init_home_assistant_actions = __esm({
|
|
|
133030
133074
|
const result = await this.circuitBreaker.execute(
|
|
133031
133075
|
() => withRetry(
|
|
133032
133076
|
async () => {
|
|
133033
|
-
const res = await
|
|
133077
|
+
const res = await sendHaMessage(
|
|
133034
133078
|
this.client.connection,
|
|
133035
|
-
|
|
133036
|
-
|
|
133037
|
-
|
|
133038
|
-
|
|
133039
|
-
|
|
133079
|
+
{
|
|
133080
|
+
type: "call_service",
|
|
133081
|
+
domain,
|
|
133082
|
+
service: action,
|
|
133083
|
+
service_data: data,
|
|
133084
|
+
target,
|
|
133085
|
+
return_response: returnResponse
|
|
133086
|
+
},
|
|
133087
|
+
this.client.messageTimeoutMs
|
|
133040
133088
|
);
|
|
133041
133089
|
return res;
|
|
133042
133090
|
},
|
|
@@ -133044,6 +133092,9 @@ var init_home_assistant_actions = __esm({
|
|
|
133044
133092
|
maxAttempts: this.config.retryAttempts,
|
|
133045
133093
|
baseDelayMs: this.config.retryBaseDelayMs,
|
|
133046
133094
|
maxDelayMs: this.config.retryMaxDelayMs,
|
|
133095
|
+
// A timeout does not mean HA ignored the call, it may have run it.
|
|
133096
|
+
// Repeating a button press or a script would be worse than failing.
|
|
133097
|
+
shouldRetry: (error) => !(error instanceof Error && error.message.includes("timed out")),
|
|
133047
133098
|
onRetry: (attempt, error, delayMs) => {
|
|
133048
133099
|
const errorMsg = this.formatError(error);
|
|
133049
133100
|
this.log.warn(
|
|
@@ -133117,6 +133168,14 @@ var init_home_assistant_actions = __esm({
|
|
|
133117
133168
|
}
|
|
133118
133169
|
});
|
|
133119
133170
|
|
|
133171
|
+
// ../../node_modules/.pnpm/@matter+main@0.17.9/node_modules/@matter/main/dist/esm/types.js
|
|
133172
|
+
var init_types2 = __esm({
|
|
133173
|
+
"../../node_modules/.pnpm/@matter+main@0.17.9/node_modules/@matter/main/dist/esm/types.js"() {
|
|
133174
|
+
init_nodejs();
|
|
133175
|
+
init_esm3();
|
|
133176
|
+
}
|
|
133177
|
+
});
|
|
133178
|
+
|
|
133120
133179
|
// src/utils/async-observable.ts
|
|
133121
133180
|
var AsyncObservable2;
|
|
133122
133181
|
var init_async_observable = __esm({
|
|
@@ -133127,6 +133186,17 @@ var init_async_observable = __esm({
|
|
|
133127
133186
|
}
|
|
133128
133187
|
});
|
|
133129
133188
|
|
|
133189
|
+
// src/utils/transaction-is-offline.ts
|
|
133190
|
+
function transactionIsOffline(context) {
|
|
133191
|
+
return !context || hasLocalActor(context);
|
|
133192
|
+
}
|
|
133193
|
+
var init_transaction_is_offline = __esm({
|
|
133194
|
+
"src/utils/transaction-is-offline.ts"() {
|
|
133195
|
+
"use strict";
|
|
133196
|
+
init_protocol3();
|
|
133197
|
+
}
|
|
133198
|
+
});
|
|
133199
|
+
|
|
133130
133200
|
// src/matter/behaviors/home-assistant-entity-behavior.ts
|
|
133131
133201
|
var home_assistant_entity_behavior_exports = {};
|
|
133132
133202
|
__export(home_assistant_entity_behavior_exports, {
|
|
@@ -133138,8 +133208,10 @@ var init_home_assistant_entity_behavior = __esm({
|
|
|
133138
133208
|
"use strict";
|
|
133139
133209
|
init_dist();
|
|
133140
133210
|
init_esm7();
|
|
133211
|
+
init_types2();
|
|
133141
133212
|
init_home_assistant_actions();
|
|
133142
133213
|
init_async_observable();
|
|
133214
|
+
init_transaction_is_offline();
|
|
133143
133215
|
HomeAssistantEntityBehavior = class extends Behavior {
|
|
133144
133216
|
static id = ClusterId2.homeAssistantEntity;
|
|
133145
133217
|
get entityId() {
|
|
@@ -133154,7 +133226,24 @@ var init_home_assistant_entity_behavior = __esm({
|
|
|
133154
133226
|
get isAvailable() {
|
|
133155
133227
|
return this.entity.state.state !== "unavailable" && this.entity.state.state !== "unknown";
|
|
133156
133228
|
}
|
|
133229
|
+
// #446: fail the command instead of telling the controller it worked while
|
|
133230
|
+
// the call never reaches HA. `=== false` on purpose: test stubs do not
|
|
133231
|
+
// define `available`, and undefined must read as "no opinion".
|
|
133232
|
+
// ponytail: commands only. Attribute writes that fan and thermostat handle
|
|
133233
|
+
// in reactors run as a local actor, so they still go through and rely on HA
|
|
133234
|
+
// state to correct them. Plumb it there too if that shows up in reports.
|
|
133235
|
+
assertAvailable() {
|
|
133236
|
+
const actions = this.env.get(HomeAssistantActions);
|
|
133237
|
+
const blocked = actions.available === false || actions.isTargetBlocked?.(this.entityId) === true;
|
|
133238
|
+
if (blocked && !transactionIsOffline(this.context)) {
|
|
133239
|
+
throw new StatusResponseError(
|
|
133240
|
+
"Home Assistant is not reachable",
|
|
133241
|
+
StatusCode.Failure
|
|
133242
|
+
);
|
|
133243
|
+
}
|
|
133244
|
+
}
|
|
133157
133245
|
callAction(action) {
|
|
133246
|
+
this.assertAvailable();
|
|
133158
133247
|
const actions = this.env.get(HomeAssistantActions);
|
|
133159
133248
|
actions.call(action, this.entityId);
|
|
133160
133249
|
}
|
|
@@ -133317,10 +133406,10 @@ var DiagnosticService = class {
|
|
|
133317
133406
|
};
|
|
133318
133407
|
|
|
133319
133408
|
// src/api/access-log.ts
|
|
133320
|
-
function accessLogger(
|
|
133409
|
+
function accessLogger(logger255) {
|
|
133321
133410
|
return (req, res, next) => {
|
|
133322
133411
|
res.on("finish", () => {
|
|
133323
|
-
|
|
133412
|
+
logger255.debug(
|
|
133324
133413
|
`${req.method} ${decodeURI(req.originalUrl)} ${res.statusCode} ${res.statusMessage} from ${req.socket.remoteAddress}`
|
|
133325
133414
|
);
|
|
133326
133415
|
});
|
|
@@ -138058,7 +138147,7 @@ var WebSocketApi = class {
|
|
|
138058
138147
|
|
|
138059
138148
|
// src/api/web-api.ts
|
|
138060
138149
|
var WebApi = class extends Service {
|
|
138061
|
-
constructor(
|
|
138150
|
+
constructor(logger255, bridgeService, haClient, haRegistry, bridgeStorage, mappingStorage, identityStorage, lockCredentialStorage, settingsStorage, backupService, props) {
|
|
138062
138151
|
super("WebApi");
|
|
138063
138152
|
this.bridgeService = bridgeService;
|
|
138064
138153
|
this.haClient = haClient;
|
|
@@ -138070,8 +138159,8 @@ var WebApi = class extends Service {
|
|
|
138070
138159
|
this.settingsStorage = settingsStorage;
|
|
138071
138160
|
this.backupService = backupService;
|
|
138072
138161
|
this.props = props;
|
|
138073
|
-
this.logger =
|
|
138074
|
-
this.log =
|
|
138162
|
+
this.logger = logger255;
|
|
138163
|
+
this.log = logger255.get(this);
|
|
138075
138164
|
this.accessLogger = accessLogger(this.log.createChild("Access Log"));
|
|
138076
138165
|
this.startTime = Date.now();
|
|
138077
138166
|
this.wsApi = new WebSocketApi(
|
|
@@ -138492,12 +138581,9 @@ var BetterLogger = class _BetterLogger extends Logger {
|
|
|
138492
138581
|
// src/core/app/mdns.ts
|
|
138493
138582
|
init_esm();
|
|
138494
138583
|
init_esm7();
|
|
138584
|
+
init_protocol3();
|
|
138495
138585
|
import * as os5 from "node:os";
|
|
138496
138586
|
|
|
138497
|
-
// ../../node_modules/.pnpm/@matter+main@0.17.9/node_modules/@matter/main/dist/esm/protocol.js
|
|
138498
|
-
init_nodejs();
|
|
138499
|
-
init_esm4();
|
|
138500
|
-
|
|
138501
138587
|
// src/core/app/filtered-network.ts
|
|
138502
138588
|
init_esm6();
|
|
138503
138589
|
function filterAdvertisedIpv6(ipV6) {
|
|
@@ -139273,10 +139359,10 @@ function isTransientConnectError(reason) {
|
|
|
139273
139359
|
return msg.includes("socket hang up") || msg.includes("tls") || msg.includes("TLS");
|
|
139274
139360
|
}
|
|
139275
139361
|
var HomeAssistantClient = class extends Service {
|
|
139276
|
-
constructor(
|
|
139362
|
+
constructor(logger255, options) {
|
|
139277
139363
|
super("HomeAssistantClient");
|
|
139278
139364
|
this.options = options;
|
|
139279
|
-
this.log =
|
|
139365
|
+
this.log = logger255.get(this);
|
|
139280
139366
|
}
|
|
139281
139367
|
options;
|
|
139282
139368
|
static Options = /* @__PURE__ */ Symbol.for("HomeAssistantClientProps");
|
|
@@ -139305,6 +139391,9 @@ var HomeAssistantClient = class extends Service {
|
|
|
139305
139391
|
get accessToken() {
|
|
139306
139392
|
return this.options.accessToken;
|
|
139307
139393
|
}
|
|
139394
|
+
get messageTimeoutMs() {
|
|
139395
|
+
return this.options.messageTimeoutMs;
|
|
139396
|
+
}
|
|
139308
139397
|
async initialize() {
|
|
139309
139398
|
this._connection = await this.createConnection(this.options);
|
|
139310
139399
|
this.watchRunningState(this._connection);
|
|
@@ -139546,6 +139635,9 @@ var HomeAssistantRegistry = class extends Service {
|
|
|
139546
139635
|
get snapshotGeneration() {
|
|
139547
139636
|
return this._snapshotGeneration;
|
|
139548
139637
|
}
|
|
139638
|
+
// Last HA uptime stamp the auto-refresh saw, so a restart between ticks
|
|
139639
|
+
// still drives one reconcile (#438).
|
|
139640
|
+
lastRunningSince = 0;
|
|
139549
139641
|
_devices = {};
|
|
139550
139642
|
get devices() {
|
|
139551
139643
|
return this._devices;
|
|
@@ -139589,8 +139681,11 @@ var HomeAssistantRegistry = class extends Service {
|
|
|
139589
139681
|
}
|
|
139590
139682
|
refreshing = true;
|
|
139591
139683
|
try {
|
|
139684
|
+
const runningSince = this.client.runningSince;
|
|
139685
|
+
const restarted = runningSince !== this.lastRunningSince;
|
|
139592
139686
|
const changed = await this.reload();
|
|
139593
|
-
|
|
139687
|
+
this.lastRunningSince = runningSince;
|
|
139688
|
+
if (changed || restarted) {
|
|
139594
139689
|
await onRefresh();
|
|
139595
139690
|
}
|
|
139596
139691
|
} catch (e) {
|
|
@@ -155126,9 +155221,8 @@ var WindowCoveringDevice = WindowCoveringDeviceDefinition;
|
|
|
155126
155221
|
init_nodejs();
|
|
155127
155222
|
init_esm5();
|
|
155128
155223
|
|
|
155129
|
-
//
|
|
155130
|
-
|
|
155131
|
-
init_esm3();
|
|
155224
|
+
// src/matter/endpoints/server-mode-server-node.ts
|
|
155225
|
+
init_types2();
|
|
155132
155226
|
|
|
155133
155227
|
// src/utils/sanitize-matter-string.ts
|
|
155134
155228
|
function sanitizeMatterString(value) {
|
|
@@ -155312,6 +155406,9 @@ import * as path12 from "node:path";
|
|
|
155312
155406
|
// src/plugins/plugin-device-factory.ts
|
|
155313
155407
|
init_esm();
|
|
155314
155408
|
|
|
155409
|
+
// src/matter/behaviors/identify-server.ts
|
|
155410
|
+
init_esm();
|
|
155411
|
+
|
|
155315
155412
|
// ../../node_modules/.pnpm/@matter+main@0.17.9/node_modules/@matter/main/dist/esm/behaviors.js
|
|
155316
155413
|
init_nodejs();
|
|
155317
155414
|
|
|
@@ -156507,14 +156604,138 @@ init_wi_fi_network_diagnostics2();
|
|
|
156507
156604
|
init_ClientBehavior();
|
|
156508
156605
|
var WiFiNetworkManagementClientConstructor = ClientBehavior(WiFiNetworkManagement3);
|
|
156509
156606
|
|
|
156607
|
+
// ../../node_modules/.pnpm/@matter+main@0.17.9/node_modules/@matter/main/dist/esm/clusters.js
|
|
156608
|
+
init_nodejs();
|
|
156609
|
+
|
|
156610
|
+
// ../../node_modules/.pnpm/@matter+types@0.17.9/node_modules/@matter/types/dist/esm/clusters/index.js
|
|
156611
|
+
init_access_control();
|
|
156612
|
+
init_actions();
|
|
156613
|
+
init_administrator_commissioning();
|
|
156614
|
+
|
|
156615
|
+
// ../../node_modules/.pnpm/@matter+types@0.17.9/node_modules/@matter/types/dist/esm/clusters/alarm-base.js
|
|
156616
|
+
init_ClusterType();
|
|
156617
|
+
init_esm2();
|
|
156618
|
+
var AlarmBase3 = ClusterType(AlarmBase2);
|
|
156619
|
+
|
|
156620
|
+
// ../../node_modules/.pnpm/@matter+types@0.17.9/node_modules/@matter/types/dist/esm/clusters/index.js
|
|
156621
|
+
init_basic_information();
|
|
156622
|
+
init_binding();
|
|
156623
|
+
init_bridged_device_basic_information();
|
|
156624
|
+
init_commissioner_control();
|
|
156625
|
+
|
|
156626
|
+
// ../../node_modules/.pnpm/@matter+types@0.17.9/node_modules/@matter/types/dist/esm/clusters/concentration-measurement.js
|
|
156627
|
+
init_ClusterType();
|
|
156628
|
+
init_esm2();
|
|
156629
|
+
var ConcentrationMeasurement3 = ClusterType(ConcentrationMeasurement2);
|
|
156630
|
+
|
|
156631
|
+
// ../../node_modules/.pnpm/@matter+types@0.17.9/node_modules/@matter/types/dist/esm/clusters/index.js
|
|
156632
|
+
init_descriptor();
|
|
156633
|
+
init_diagnostic_logs();
|
|
156634
|
+
init_ethernet_network_diagnostics();
|
|
156635
|
+
init_general_commissioning();
|
|
156636
|
+
init_general_diagnostics();
|
|
156637
|
+
init_group_key_management();
|
|
156638
|
+
init_groupcast();
|
|
156639
|
+
init_icd_management();
|
|
156640
|
+
init_identify();
|
|
156641
|
+
|
|
156642
|
+
// ../../node_modules/.pnpm/@matter+types@0.17.9/node_modules/@matter/types/dist/esm/clusters/label.js
|
|
156643
|
+
init_ClusterType();
|
|
156644
|
+
init_esm2();
|
|
156645
|
+
var Label3 = ClusterType(Label2);
|
|
156646
|
+
|
|
156647
|
+
// ../../node_modules/.pnpm/@matter+types@0.17.9/node_modules/@matter/types/dist/esm/clusters/index.js
|
|
156648
|
+
init_localization_configuration();
|
|
156649
|
+
init_network_commissioning();
|
|
156650
|
+
init_operational_credentials();
|
|
156651
|
+
init_ota_software_update_provider();
|
|
156652
|
+
init_ota_software_update_requestor();
|
|
156653
|
+
init_power_source();
|
|
156654
|
+
init_power_source_configuration();
|
|
156655
|
+
|
|
156656
|
+
// ../../node_modules/.pnpm/@matter+types@0.17.9/node_modules/@matter/types/dist/esm/clusters/resource-monitoring.js
|
|
156657
|
+
init_ClusterType();
|
|
156658
|
+
init_esm2();
|
|
156659
|
+
var ResourceMonitoring3 = ClusterType(ResourceMonitoring2);
|
|
156660
|
+
|
|
156661
|
+
// ../../node_modules/.pnpm/@matter+types@0.17.9/node_modules/@matter/types/dist/esm/clusters/index.js
|
|
156662
|
+
init_software_diagnostics();
|
|
156663
|
+
init_thread_network_diagnostics();
|
|
156664
|
+
init_time_format_localization();
|
|
156665
|
+
init_time_synchronization();
|
|
156666
|
+
init_tls_certificate_management();
|
|
156667
|
+
init_tls_client_management();
|
|
156668
|
+
init_unit_localization();
|
|
156669
|
+
|
|
156670
|
+
// ../../node_modules/.pnpm/@matter+types@0.17.9/node_modules/@matter/types/dist/esm/clusters/web-rtc-transport-definitions.js
|
|
156671
|
+
init_ClusterType();
|
|
156672
|
+
init_esm2();
|
|
156673
|
+
var WebRtcTransportDefinitions3 = ClusterType(WebRtcTransportDefinitions2);
|
|
156674
|
+
|
|
156675
|
+
// ../../node_modules/.pnpm/@matter+types@0.17.9/node_modules/@matter/types/dist/esm/clusters/index.js
|
|
156676
|
+
init_wi_fi_network_diagnostics();
|
|
156677
|
+
|
|
156510
156678
|
// src/matter/behaviors/identify-server.ts
|
|
156679
|
+
init_home_assistant_entity_behavior();
|
|
156680
|
+
var logger198 = Logger.get("IdentifyServer");
|
|
156681
|
+
var IDENTIFY_BUTTON_SUFFIXES = ["_identify", "_locate", "_find_me"];
|
|
156511
156682
|
var IdentifyServer2 = class extends IdentifyServer {
|
|
156683
|
+
identify(request) {
|
|
156684
|
+
if (request.identifyTime > 0) {
|
|
156685
|
+
this.identifyInHomeAssistant("identify");
|
|
156686
|
+
}
|
|
156687
|
+
return super.identify(request);
|
|
156688
|
+
}
|
|
156689
|
+
triggerEffect(effect) {
|
|
156690
|
+
if (effect.effectIdentifier !== Identify3.EffectIdentifier.StopEffect && effect.effectIdentifier !== Identify3.EffectIdentifier.FinishEffect) {
|
|
156691
|
+
this.identifyInHomeAssistant("triggerEffect");
|
|
156692
|
+
}
|
|
156693
|
+
return super.triggerEffect(effect);
|
|
156694
|
+
}
|
|
156695
|
+
identifyInHomeAssistant(source) {
|
|
156696
|
+
if (!this.agent.has(HomeAssistantEntityBehavior)) return;
|
|
156697
|
+
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
156698
|
+
const target = this.findIdentifyEntity(homeAssistant);
|
|
156699
|
+
if (!target) {
|
|
156700
|
+
logger198.debug(
|
|
156701
|
+
`${source} for ${homeAssistant.entityId}, no identify entity on this device`
|
|
156702
|
+
);
|
|
156703
|
+
return;
|
|
156704
|
+
}
|
|
156705
|
+
logger198.info(
|
|
156706
|
+
`${source} \u2192 button.press ${target} for ${homeAssistant.entityId}`
|
|
156707
|
+
);
|
|
156708
|
+
homeAssistant.callAction({ action: "button.press", target });
|
|
156709
|
+
}
|
|
156710
|
+
// Searches the FULL registry: an identify button rarely matches the bridge
|
|
156711
|
+
// filter, same reason the battery and problem lookups do it.
|
|
156712
|
+
findIdentifyEntity(homeAssistant) {
|
|
156713
|
+
const deviceId = homeAssistant.entity.registry?.device_id;
|
|
156714
|
+
if (!deviceId) return void 0;
|
|
156715
|
+
const registry3 = this.env.maybeGet(HomeAssistantRegistry);
|
|
156716
|
+
if (!registry3) return void 0;
|
|
156717
|
+
let byName;
|
|
156718
|
+
for (const entity of Object.values(registry3.entities)) {
|
|
156719
|
+
if (entity.device_id !== deviceId) continue;
|
|
156720
|
+
if (entity.disabled_by != null) continue;
|
|
156721
|
+
if (!entity.entity_id.startsWith("button.")) continue;
|
|
156722
|
+
const deviceClass = registry3.states[entity.entity_id]?.attributes?.device_class;
|
|
156723
|
+
if (deviceClass === "identify") return entity.entity_id;
|
|
156724
|
+
const uniqueId = entity.unique_id ?? "";
|
|
156725
|
+
if (byName == null && IDENTIFY_BUTTON_SUFFIXES.some(
|
|
156726
|
+
(s) => entity.entity_id.endsWith(s) || uniqueId.endsWith(s)
|
|
156727
|
+
)) {
|
|
156728
|
+
byName = entity.entity_id;
|
|
156729
|
+
}
|
|
156730
|
+
}
|
|
156731
|
+
return byName;
|
|
156732
|
+
}
|
|
156512
156733
|
};
|
|
156513
156734
|
|
|
156514
156735
|
// src/matter/endpoints/validate-endpoint-type.ts
|
|
156515
156736
|
init_esm();
|
|
156516
156737
|
init_esm7();
|
|
156517
|
-
var
|
|
156738
|
+
var logger199 = Logger.get("EndpointValidation");
|
|
156518
156739
|
function toCamelCase(name) {
|
|
156519
156740
|
return name.charAt(0).toLowerCase() + name.slice(1);
|
|
156520
156741
|
}
|
|
@@ -156544,12 +156765,12 @@ function validateEndpointType(endpointType, entityId) {
|
|
|
156544
156765
|
}
|
|
156545
156766
|
const prefix = entityId ? `[${entityId}] ` : "";
|
|
156546
156767
|
if (missingMandatory.length > 0) {
|
|
156547
|
-
|
|
156768
|
+
logger199.warn(
|
|
156548
156769
|
`${prefix}${deviceTypeModel.name} (0x${endpointType.deviceType.toString(16)}): missing mandatory clusters: ${missingMandatory.join(", ")}`
|
|
156549
156770
|
);
|
|
156550
156771
|
}
|
|
156551
156772
|
if (availableOptional.length > 0) {
|
|
156552
|
-
|
|
156773
|
+
logger199.debug(
|
|
156553
156774
|
`${prefix}${deviceTypeModel.name} (0x${endpointType.deviceType.toString(16)}): optional clusters not used: ${availableOptional.join(", ")}`
|
|
156554
156775
|
);
|
|
156555
156776
|
}
|
|
@@ -156673,7 +156894,7 @@ var BridgeDataProvider = class extends Service {
|
|
|
156673
156894
|
|
|
156674
156895
|
// src/utils/apply-patch-state.ts
|
|
156675
156896
|
init_esm();
|
|
156676
|
-
var
|
|
156897
|
+
var logger200 = Logger.get("ApplyPatchState");
|
|
156677
156898
|
function applyPatchState(state, patch, options) {
|
|
156678
156899
|
return applyPatch(state, patch, options?.force);
|
|
156679
156900
|
}
|
|
@@ -156700,23 +156921,23 @@ function applyPatch(state, patch, force = false) {
|
|
|
156700
156921
|
if (errorMessage.includes(
|
|
156701
156922
|
"Endpoint storage inaccessible because endpoint is not a node and is not owned by another endpoint"
|
|
156702
156923
|
)) {
|
|
156703
|
-
|
|
156924
|
+
logger200.debug(
|
|
156704
156925
|
`Suppressed endpoint storage error, patch not applied: ${JSON.stringify(actualPatch)}`
|
|
156705
156926
|
);
|
|
156706
156927
|
return actualPatch;
|
|
156707
156928
|
}
|
|
156708
156929
|
if (errorMessage.includes("synchronous-transaction-conflict")) {
|
|
156709
|
-
|
|
156930
|
+
logger200.warn(
|
|
156710
156931
|
`Transaction conflict, state update DROPPED: ${JSON.stringify(actualPatch)}`
|
|
156711
156932
|
);
|
|
156712
156933
|
return actualPatch;
|
|
156713
156934
|
}
|
|
156714
156935
|
failedKeys.push(key);
|
|
156715
|
-
|
|
156936
|
+
logger200.warn(`Failed to set property '${key}': ${errorMessage}`);
|
|
156716
156937
|
}
|
|
156717
156938
|
}
|
|
156718
156939
|
if (failedKeys.length > 0) {
|
|
156719
|
-
|
|
156940
|
+
logger200.warn(
|
|
156720
156941
|
`${failedKeys.length} properties failed to update: [${failedKeys.join(", ")}]`
|
|
156721
156942
|
);
|
|
156722
156943
|
}
|
|
@@ -156786,7 +157007,7 @@ function truncate(maxLength, value) {
|
|
|
156786
157007
|
}
|
|
156787
157008
|
|
|
156788
157009
|
// src/plugins/plugin-device-factory.ts
|
|
156789
|
-
var
|
|
157010
|
+
var logger201 = Logger.get("PluginDeviceFactory");
|
|
156790
157011
|
var deviceTypeMap = {
|
|
156791
157012
|
on_off_light: () => OnOffLightDevice.with(
|
|
156792
157013
|
IdentifyServer2,
|
|
@@ -156892,7 +157113,7 @@ var deviceTypeMap = {
|
|
|
156892
157113
|
function createPluginEndpointType(deviceType) {
|
|
156893
157114
|
const factory = deviceTypeMap[deviceType];
|
|
156894
157115
|
if (!factory) {
|
|
156895
|
-
|
|
157116
|
+
logger201.warn(`Unsupported plugin device type: "${deviceType}"`);
|
|
156896
157117
|
return void 0;
|
|
156897
157118
|
}
|
|
156898
157119
|
const endpoint = factory();
|
|
@@ -156905,7 +157126,7 @@ function getSupportedPluginDeviceTypes() {
|
|
|
156905
157126
|
|
|
156906
157127
|
// src/plugins/safe-plugin-runner.ts
|
|
156907
157128
|
init_esm();
|
|
156908
|
-
var
|
|
157129
|
+
var logger202 = Logger.get("SafePluginRunner");
|
|
156909
157130
|
var DEFAULT_TIMEOUT_MS = 1e4;
|
|
156910
157131
|
var CIRCUIT_BREAKER_THRESHOLD = 3;
|
|
156911
157132
|
var SafePluginRunner = class {
|
|
@@ -156938,7 +157159,7 @@ var SafePluginRunner = class {
|
|
|
156938
157159
|
async run(pluginName, operation, fn, timeoutMs = DEFAULT_TIMEOUT_MS) {
|
|
156939
157160
|
const state = this.getState(pluginName);
|
|
156940
157161
|
if (state.disabled) {
|
|
156941
|
-
|
|
157162
|
+
logger202.debug(
|
|
156942
157163
|
`Plugin "${pluginName}" is disabled (circuit breaker open), skipping ${operation}`
|
|
156943
157164
|
);
|
|
156944
157165
|
return void 0;
|
|
@@ -156956,13 +157177,13 @@ var SafePluginRunner = class {
|
|
|
156956
157177
|
timeout.clear();
|
|
156957
157178
|
state.failures++;
|
|
156958
157179
|
state.lastError = error instanceof Error ? error.message : String(error);
|
|
156959
|
-
|
|
157180
|
+
logger202.error(
|
|
156960
157181
|
`Plugin "${pluginName}" failed during ${operation} (failure ${state.failures}/${CIRCUIT_BREAKER_THRESHOLD}): ${state.lastError}`
|
|
156961
157182
|
);
|
|
156962
157183
|
if (state.failures >= CIRCUIT_BREAKER_THRESHOLD) {
|
|
156963
157184
|
state.disabled = true;
|
|
156964
157185
|
state.disabledAt = Date.now();
|
|
156965
|
-
|
|
157186
|
+
logger202.error(
|
|
156966
157187
|
`Plugin "${pluginName}" DISABLED after ${CIRCUIT_BREAKER_THRESHOLD} consecutive failures. Last error: ${state.lastError}`
|
|
156967
157188
|
);
|
|
156968
157189
|
}
|
|
@@ -156985,7 +157206,7 @@ var SafePluginRunner = class {
|
|
|
156985
157206
|
return result;
|
|
156986
157207
|
} catch (error) {
|
|
156987
157208
|
timeout.clear();
|
|
156988
|
-
|
|
157209
|
+
logger202.error(
|
|
156989
157210
|
`Plugin "${pluginName}" failed during ${operation}: ${error instanceof Error ? error.message : String(error)}`
|
|
156990
157211
|
);
|
|
156991
157212
|
return void 0;
|
|
@@ -157006,13 +157227,13 @@ var SafePluginRunner = class {
|
|
|
157006
157227
|
} catch (error) {
|
|
157007
157228
|
state.failures++;
|
|
157008
157229
|
state.lastError = error instanceof Error ? error.message : String(error);
|
|
157009
|
-
|
|
157230
|
+
logger202.error(
|
|
157010
157231
|
`Plugin "${pluginName}" failed during ${operation} (sync, failure ${state.failures}/${CIRCUIT_BREAKER_THRESHOLD}): ${state.lastError}`
|
|
157011
157232
|
);
|
|
157012
157233
|
if (state.failures >= CIRCUIT_BREAKER_THRESHOLD) {
|
|
157013
157234
|
state.disabled = true;
|
|
157014
157235
|
state.disabledAt = Date.now();
|
|
157015
|
-
|
|
157236
|
+
logger202.error(
|
|
157016
157237
|
`Plugin "${pluginName}" DISABLED after ${CIRCUIT_BREAKER_THRESHOLD} consecutive failures.`
|
|
157017
157238
|
);
|
|
157018
157239
|
}
|
|
@@ -157038,7 +157259,7 @@ var SafePluginRunner = class {
|
|
|
157038
157259
|
};
|
|
157039
157260
|
|
|
157040
157261
|
// src/plugins/plugin-manager.ts
|
|
157041
|
-
var
|
|
157262
|
+
var logger203 = Logger.get("PluginManager");
|
|
157042
157263
|
var PLUGIN_API_VERSION = 1;
|
|
157043
157264
|
var MAX_PLUGIN_DEVICE_ID_LENGTH = 100;
|
|
157044
157265
|
var LEGACY_ENABLED_KEY = "__enabled";
|
|
@@ -157133,7 +157354,7 @@ var PluginManager = class {
|
|
|
157133
157354
|
throw new Error(`Plugin at ${packagePath} package.json missing "main"`);
|
|
157134
157355
|
}
|
|
157135
157356
|
if (manifest.hamhPluginApiVersion != null && manifest.hamhPluginApiVersion !== PLUGIN_API_VERSION) {
|
|
157136
|
-
|
|
157357
|
+
logger203.warn(
|
|
157137
157358
|
`Plugin "${manifest.name}" declares API version ${manifest.hamhPluginApiVersion}, current is ${PLUGIN_API_VERSION}. It may not work correctly.`
|
|
157138
157359
|
);
|
|
157139
157360
|
}
|
|
@@ -157164,7 +157385,7 @@ var PluginManager = class {
|
|
|
157164
157385
|
};
|
|
157165
157386
|
await this.register(plugin, metadata);
|
|
157166
157387
|
} catch (e) {
|
|
157167
|
-
|
|
157388
|
+
logger203.error(`Failed to load external plugin from ${packagePath}:`, e);
|
|
157168
157389
|
throw e;
|
|
157169
157390
|
}
|
|
157170
157391
|
}
|
|
@@ -157189,7 +157410,7 @@ var PluginManager = class {
|
|
|
157189
157410
|
}
|
|
157190
157411
|
if (enabled === false) {
|
|
157191
157412
|
metadata.enabled = false;
|
|
157192
|
-
|
|
157413
|
+
logger203.info(`Plugin "${plugin.name}" stays disabled (persisted)`);
|
|
157193
157414
|
}
|
|
157194
157415
|
const devices = /* @__PURE__ */ new Map();
|
|
157195
157416
|
const pluginLogger = Logger.get(`Plugin:${plugin.name}`);
|
|
@@ -157277,7 +157498,7 @@ var PluginManager = class {
|
|
|
157277
157498
|
}),
|
|
157278
157499
|
suspending: false
|
|
157279
157500
|
});
|
|
157280
|
-
|
|
157501
|
+
logger203.info(
|
|
157281
157502
|
`Registered plugin: ${plugin.name} v${plugin.version} (${metadata.source})`
|
|
157282
157503
|
);
|
|
157283
157504
|
}
|
|
@@ -157302,13 +157523,13 @@ var PluginManager = class {
|
|
|
157302
157523
|
async startPlugin(name, instance) {
|
|
157303
157524
|
if (!instance.metadata.enabled) return;
|
|
157304
157525
|
if (this.runner.isDisabled(name)) {
|
|
157305
|
-
|
|
157526
|
+
logger203.warn(
|
|
157306
157527
|
`Plugin "${name}" is disabled (circuit breaker), skipping start`
|
|
157307
157528
|
);
|
|
157308
157529
|
instance.metadata.enabled = false;
|
|
157309
157530
|
return;
|
|
157310
157531
|
}
|
|
157311
|
-
|
|
157532
|
+
logger203.info(`Starting plugin: ${name}`);
|
|
157312
157533
|
const epoch = ++instance.epoch;
|
|
157313
157534
|
await this.runner.run(
|
|
157314
157535
|
name,
|
|
@@ -157367,7 +157588,7 @@ var PluginManager = class {
|
|
|
157367
157588
|
storage2.flush();
|
|
157368
157589
|
}
|
|
157369
157590
|
instance.started = false;
|
|
157370
|
-
|
|
157591
|
+
logger203.info(`Plugin "${name}" shut down`);
|
|
157371
157592
|
});
|
|
157372
157593
|
}
|
|
157373
157594
|
this.instances.clear();
|
|
@@ -157463,13 +157684,13 @@ var PluginManager = class {
|
|
|
157463
157684
|
instance.metadata.config = pending;
|
|
157464
157685
|
instance.pendingConfig = void 0;
|
|
157465
157686
|
} catch (e) {
|
|
157466
|
-
|
|
157687
|
+
logger203.warn(
|
|
157467
157688
|
`Failed to persist the parked config for "${pluginName}", it stays parked:`,
|
|
157468
157689
|
e
|
|
157469
157690
|
);
|
|
157470
157691
|
}
|
|
157471
157692
|
}
|
|
157472
|
-
|
|
157693
|
+
logger203.info(`Starting plugin: ${pluginName}`);
|
|
157473
157694
|
const epoch = ++instance.epoch;
|
|
157474
157695
|
await this.runner.run(
|
|
157475
157696
|
pluginName,
|
|
@@ -157502,7 +157723,7 @@ var PluginManager = class {
|
|
|
157502
157723
|
return JSON.parse(fs10.readFileSync(this.stateFile, "utf-8"));
|
|
157503
157724
|
}
|
|
157504
157725
|
} catch (e) {
|
|
157505
|
-
|
|
157726
|
+
logger203.warn(`Failed to read the plugin state file:`, e);
|
|
157506
157727
|
}
|
|
157507
157728
|
return {};
|
|
157508
157729
|
}
|
|
@@ -157513,7 +157734,7 @@ var PluginManager = class {
|
|
|
157513
157734
|
fs10.mkdirSync(path12.dirname(this.stateFile), { recursive: true });
|
|
157514
157735
|
fs10.writeFileSync(this.stateFile, JSON.stringify(state, null, 2));
|
|
157515
157736
|
} catch (e) {
|
|
157516
|
-
|
|
157737
|
+
logger203.warn(
|
|
157517
157738
|
`Failed to persist enabled=${enabled} for "${pluginName}":`,
|
|
157518
157739
|
e
|
|
157519
157740
|
);
|
|
@@ -157547,7 +157768,7 @@ var PluginManager = class {
|
|
|
157547
157768
|
if (instance.plugin.onConfigChanged) {
|
|
157548
157769
|
if (!instance.metadata.enabled) {
|
|
157549
157770
|
instance.pendingConfig = config8;
|
|
157550
|
-
|
|
157771
|
+
logger203.info(
|
|
157551
157772
|
`Plugin "${pluginName}" is disabled, the config applies on enable`
|
|
157552
157773
|
);
|
|
157553
157774
|
} else {
|
|
@@ -157567,6 +157788,7 @@ var PluginManager = class {
|
|
|
157567
157788
|
init_dist();
|
|
157568
157789
|
init_esm7();
|
|
157569
157790
|
import * as os9 from "node:os";
|
|
157791
|
+
init_protocol3();
|
|
157570
157792
|
|
|
157571
157793
|
// src/utils/json/create-bridge-server-config.ts
|
|
157572
157794
|
import crypto5 from "node:crypto";
|
|
@@ -157823,6 +158045,7 @@ var SecondaryNetworkInterfaceEndpointDefinition = MutableEndpoint({
|
|
|
157823
158045
|
Object.freeze(SecondaryNetworkInterfaceEndpointDefinition);
|
|
157824
158046
|
|
|
157825
158047
|
// src/utils/json/create-bridge-server-config.ts
|
|
158048
|
+
init_types2();
|
|
157826
158049
|
function createBridgeServerConfig(data, options) {
|
|
157827
158050
|
return {
|
|
157828
158051
|
type: ServerNode.RootEndpoint,
|
|
@@ -157919,6 +158142,7 @@ async function runMdnsAddressWatchTick(deps) {
|
|
|
157919
158142
|
}
|
|
157920
158143
|
|
|
157921
158144
|
// src/utils/ensure-commissioning-config.ts
|
|
158145
|
+
init_protocol3();
|
|
157922
158146
|
var ServerNodeConfigProvider = class extends CommissioningConfigProvider {
|
|
157923
158147
|
#node;
|
|
157924
158148
|
constructor(node) {
|
|
@@ -158112,11 +158336,11 @@ var AUTO_FORCE_SYNC_INTERVAL_MS = 9e4;
|
|
|
158112
158336
|
var SHUTDOWN_SESSION_CLOSE_TIMEOUT_MS = 2500;
|
|
158113
158337
|
var MDNS_ADDRESS_CHECK_INTERVAL_MS = 6e4;
|
|
158114
158338
|
var Bridge = class {
|
|
158115
|
-
constructor(env,
|
|
158339
|
+
constructor(env, logger255, dataProvider, endpointManager, serverOptions) {
|
|
158116
158340
|
this.dataProvider = dataProvider;
|
|
158117
158341
|
this.endpointManager = endpointManager;
|
|
158118
158342
|
this.serverOptions = serverOptions;
|
|
158119
|
-
this.log =
|
|
158343
|
+
this.log = logger255.get(`Bridge / ${dataProvider.id}`);
|
|
158120
158344
|
this.server = new BridgeServerNode(
|
|
158121
158345
|
env,
|
|
158122
158346
|
this.dataProvider,
|
|
@@ -159403,77 +159627,6 @@ var EntityStateProvider = class extends Service {
|
|
|
159403
159627
|
}
|
|
159404
159628
|
};
|
|
159405
159629
|
|
|
159406
|
-
// ../../node_modules/.pnpm/@matter+main@0.17.9/node_modules/@matter/main/dist/esm/clusters.js
|
|
159407
|
-
init_nodejs();
|
|
159408
|
-
|
|
159409
|
-
// ../../node_modules/.pnpm/@matter+types@0.17.9/node_modules/@matter/types/dist/esm/clusters/index.js
|
|
159410
|
-
init_access_control();
|
|
159411
|
-
init_actions();
|
|
159412
|
-
init_administrator_commissioning();
|
|
159413
|
-
|
|
159414
|
-
// ../../node_modules/.pnpm/@matter+types@0.17.9/node_modules/@matter/types/dist/esm/clusters/alarm-base.js
|
|
159415
|
-
init_ClusterType();
|
|
159416
|
-
init_esm2();
|
|
159417
|
-
var AlarmBase3 = ClusterType(AlarmBase2);
|
|
159418
|
-
|
|
159419
|
-
// ../../node_modules/.pnpm/@matter+types@0.17.9/node_modules/@matter/types/dist/esm/clusters/index.js
|
|
159420
|
-
init_basic_information();
|
|
159421
|
-
init_binding();
|
|
159422
|
-
init_bridged_device_basic_information();
|
|
159423
|
-
init_commissioner_control();
|
|
159424
|
-
|
|
159425
|
-
// ../../node_modules/.pnpm/@matter+types@0.17.9/node_modules/@matter/types/dist/esm/clusters/concentration-measurement.js
|
|
159426
|
-
init_ClusterType();
|
|
159427
|
-
init_esm2();
|
|
159428
|
-
var ConcentrationMeasurement3 = ClusterType(ConcentrationMeasurement2);
|
|
159429
|
-
|
|
159430
|
-
// ../../node_modules/.pnpm/@matter+types@0.17.9/node_modules/@matter/types/dist/esm/clusters/index.js
|
|
159431
|
-
init_descriptor();
|
|
159432
|
-
init_diagnostic_logs();
|
|
159433
|
-
init_ethernet_network_diagnostics();
|
|
159434
|
-
init_general_commissioning();
|
|
159435
|
-
init_general_diagnostics();
|
|
159436
|
-
init_group_key_management();
|
|
159437
|
-
init_groupcast();
|
|
159438
|
-
init_icd_management();
|
|
159439
|
-
init_identify();
|
|
159440
|
-
|
|
159441
|
-
// ../../node_modules/.pnpm/@matter+types@0.17.9/node_modules/@matter/types/dist/esm/clusters/label.js
|
|
159442
|
-
init_ClusterType();
|
|
159443
|
-
init_esm2();
|
|
159444
|
-
var Label3 = ClusterType(Label2);
|
|
159445
|
-
|
|
159446
|
-
// ../../node_modules/.pnpm/@matter+types@0.17.9/node_modules/@matter/types/dist/esm/clusters/index.js
|
|
159447
|
-
init_localization_configuration();
|
|
159448
|
-
init_network_commissioning();
|
|
159449
|
-
init_operational_credentials();
|
|
159450
|
-
init_ota_software_update_provider();
|
|
159451
|
-
init_ota_software_update_requestor();
|
|
159452
|
-
init_power_source();
|
|
159453
|
-
init_power_source_configuration();
|
|
159454
|
-
|
|
159455
|
-
// ../../node_modules/.pnpm/@matter+types@0.17.9/node_modules/@matter/types/dist/esm/clusters/resource-monitoring.js
|
|
159456
|
-
init_ClusterType();
|
|
159457
|
-
init_esm2();
|
|
159458
|
-
var ResourceMonitoring3 = ClusterType(ResourceMonitoring2);
|
|
159459
|
-
|
|
159460
|
-
// ../../node_modules/.pnpm/@matter+types@0.17.9/node_modules/@matter/types/dist/esm/clusters/index.js
|
|
159461
|
-
init_software_diagnostics();
|
|
159462
|
-
init_thread_network_diagnostics();
|
|
159463
|
-
init_time_format_localization();
|
|
159464
|
-
init_time_synchronization();
|
|
159465
|
-
init_tls_certificate_management();
|
|
159466
|
-
init_tls_client_management();
|
|
159467
|
-
init_unit_localization();
|
|
159468
|
-
|
|
159469
|
-
// ../../node_modules/.pnpm/@matter+types@0.17.9/node_modules/@matter/types/dist/esm/clusters/web-rtc-transport-definitions.js
|
|
159470
|
-
init_ClusterType();
|
|
159471
|
-
init_esm2();
|
|
159472
|
-
var WebRtcTransportDefinitions3 = ClusterType(WebRtcTransportDefinitions2);
|
|
159473
|
-
|
|
159474
|
-
// ../../node_modules/.pnpm/@matter+types@0.17.9/node_modules/@matter/types/dist/esm/clusters/index.js
|
|
159475
|
-
init_wi_fi_network_diagnostics();
|
|
159476
|
-
|
|
159477
159630
|
// src/utils/converters/fan-mode.ts
|
|
159478
159631
|
var FanMode = class _FanMode {
|
|
159479
159632
|
constructor(mode, sequence) {
|
|
@@ -159662,7 +159815,7 @@ init_esm();
|
|
|
159662
159815
|
init_esm7();
|
|
159663
159816
|
import crypto6 from "node:crypto";
|
|
159664
159817
|
init_home_assistant_entity_behavior();
|
|
159665
|
-
var
|
|
159818
|
+
var logger204 = Logger.get("BasicInformationServer");
|
|
159666
159819
|
var appliedUniqueIds = /* @__PURE__ */ new Map();
|
|
159667
159820
|
var BasicInformationServer2 = class extends BridgedDeviceBasicInformationServer {
|
|
159668
159821
|
async initialize() {
|
|
@@ -159708,7 +159861,7 @@ var BasicInformationServer2 = class extends BridgedDeviceBasicInformationServer
|
|
|
159708
159861
|
// records keyed on it can be shed (#385).
|
|
159709
159862
|
uniqueId: this.frozenUniqueId(anchor)
|
|
159710
159863
|
});
|
|
159711
|
-
|
|
159864
|
+
logger204.debug(
|
|
159712
159865
|
`[${entity.entity_id}] basicInfo vendor=${this.state.vendorName} product=${this.state.productName} label=${this.state.productLabel} serial=${this.state.serialNumber} node=${this.state.nodeLabel} uniqueId=${this.state.uniqueId}`
|
|
159713
159866
|
);
|
|
159714
159867
|
}
|
|
@@ -159738,7 +159891,7 @@ function isValidVendorId(value) {
|
|
|
159738
159891
|
// src/matter/behaviors/electrical-energy-measurement-server.ts
|
|
159739
159892
|
init_esm();
|
|
159740
159893
|
init_home_assistant_entity_behavior();
|
|
159741
|
-
var
|
|
159894
|
+
var logger205 = Logger.get("ElectricalEnergyMeasurementServer");
|
|
159742
159895
|
var FeaturedBase = ElectricalEnergyMeasurementServer.with("CumulativeEnergy", "ImportedEnergy");
|
|
159743
159896
|
var ElectricalEnergyMeasurementServerBase = class extends FeaturedBase {
|
|
159744
159897
|
async initialize() {
|
|
@@ -159747,7 +159900,7 @@ var ElectricalEnergyMeasurementServerBase = class extends FeaturedBase {
|
|
|
159747
159900
|
const entityId = homeAssistant.entityId;
|
|
159748
159901
|
const energyEntity = homeAssistant.state.mapping?.energyEntity;
|
|
159749
159902
|
if (energyEntity) {
|
|
159750
|
-
|
|
159903
|
+
logger205.debug(
|
|
159751
159904
|
`[${entityId}] ElectricalEnergyMeasurement using mapped energy entity: ${energyEntity}`
|
|
159752
159905
|
);
|
|
159753
159906
|
}
|
|
@@ -159803,7 +159956,7 @@ var HaElectricalEnergyMeasurementServer = ElectricalEnergyMeasurementServerBase.
|
|
|
159803
159956
|
// src/matter/behaviors/electrical-power-measurement-server.ts
|
|
159804
159957
|
init_esm();
|
|
159805
159958
|
init_home_assistant_entity_behavior();
|
|
159806
|
-
var
|
|
159959
|
+
var logger206 = Logger.get("ElectricalPowerMeasurementServer");
|
|
159807
159960
|
var FeaturedBase2 = ElectricalPowerMeasurementServer.with("AlternatingCurrent");
|
|
159808
159961
|
var ElectricalPowerMeasurementServerBase = class extends FeaturedBase2 {
|
|
159809
159962
|
async initialize() {
|
|
@@ -159812,7 +159965,7 @@ var ElectricalPowerMeasurementServerBase = class extends FeaturedBase2 {
|
|
|
159812
159965
|
const entityId = homeAssistant.entityId;
|
|
159813
159966
|
const powerEntity = homeAssistant.state.mapping?.powerEntity;
|
|
159814
159967
|
if (powerEntity) {
|
|
159815
|
-
|
|
159968
|
+
logger206.debug(
|
|
159816
159969
|
`[${entityId}] ElectricalPowerMeasurement using mapped power entity: ${powerEntity}`
|
|
159817
159970
|
);
|
|
159818
159971
|
}
|
|
@@ -159951,7 +160104,7 @@ init_home_assistant_entity_behavior();
|
|
|
159951
160104
|
// src/matter/behaviors/humidity-measurement-server.ts
|
|
159952
160105
|
init_esm();
|
|
159953
160106
|
init_home_assistant_entity_behavior();
|
|
159954
|
-
var
|
|
160107
|
+
var logger207 = Logger.get("HumidityMeasurementServer");
|
|
159955
160108
|
var HumidityMeasurementServerBase = class extends RelativeHumidityMeasurementServer {
|
|
159956
160109
|
async initialize() {
|
|
159957
160110
|
await super.initialize();
|
|
@@ -159964,7 +160117,7 @@ var HumidityMeasurementServerBase = class extends RelativeHumidityMeasurementSer
|
|
|
159964
160117
|
return;
|
|
159965
160118
|
}
|
|
159966
160119
|
const humidity = this.getHumidity(this.state.config, entity.state);
|
|
159967
|
-
|
|
160120
|
+
logger207.debug(
|
|
159968
160121
|
`Humidity ${entity.state.entity_id} raw=${entity.state.state} measuredValue=${humidity}`
|
|
159969
160122
|
);
|
|
159970
160123
|
applyPatchState(this.state, {
|
|
@@ -159994,7 +160147,7 @@ function HumidityMeasurementServer(config8) {
|
|
|
159994
160147
|
// src/matter/behaviors/power-source-server.ts
|
|
159995
160148
|
init_esm();
|
|
159996
160149
|
init_home_assistant_entity_behavior();
|
|
159997
|
-
var
|
|
160150
|
+
var logger208 = Logger.get("PowerSourceServer");
|
|
159998
160151
|
var FeaturedBase3 = PowerSourceServer.with("Battery", "Rechargeable");
|
|
159999
160152
|
var PowerSourceServerBase = class extends FeaturedBase3 {
|
|
160000
160153
|
async initialize() {
|
|
@@ -160006,17 +160159,17 @@ var PowerSourceServerBase = class extends FeaturedBase3 {
|
|
|
160006
160159
|
applyPatchState(this.state, {
|
|
160007
160160
|
endpointList: [endpointNumber]
|
|
160008
160161
|
});
|
|
160009
|
-
|
|
160162
|
+
logger208.debug(
|
|
160010
160163
|
`[${entityId}] PowerSource initialized with endpointList=[${endpointNumber}]`
|
|
160011
160164
|
);
|
|
160012
160165
|
} else {
|
|
160013
|
-
|
|
160166
|
+
logger208.warn(
|
|
160014
160167
|
`[${entityId}] PowerSource endpoint number is null during initialize - endpointList will be empty!`
|
|
160015
160168
|
);
|
|
160016
160169
|
}
|
|
160017
160170
|
const batteryEntity = homeAssistant.state.mapping?.batteryEntity;
|
|
160018
160171
|
if (batteryEntity) {
|
|
160019
|
-
|
|
160172
|
+
logger208.debug(
|
|
160020
160173
|
`[${entityId}] PowerSource using mapped battery entity: ${batteryEntity}`
|
|
160021
160174
|
);
|
|
160022
160175
|
}
|
|
@@ -160337,12 +160490,8 @@ var FanSpeed = class _FanSpeed {
|
|
|
160337
160490
|
}
|
|
160338
160491
|
};
|
|
160339
160492
|
|
|
160340
|
-
// src/utils/transaction-is-offline.ts
|
|
160341
|
-
function transactionIsOffline(context) {
|
|
160342
|
-
return !context || hasLocalActor(context);
|
|
160343
|
-
}
|
|
160344
|
-
|
|
160345
160493
|
// src/matter/behaviors/fan-control-server.ts
|
|
160494
|
+
init_transaction_is_offline();
|
|
160346
160495
|
init_home_assistant_entity_behavior();
|
|
160347
160496
|
|
|
160348
160497
|
// src/matter/behaviors/on-off-server.ts
|
|
@@ -160396,7 +160545,7 @@ function notifyLightTurnedOff(entityId, haLastChanged) {
|
|
|
160396
160545
|
sweepLastTurnOff(now);
|
|
160397
160546
|
lastTurnOffTimestamps.set(entityId, { ts: now, haLastChanged });
|
|
160398
160547
|
}
|
|
160399
|
-
var
|
|
160548
|
+
var logger209 = Logger.get("LevelControlServer");
|
|
160400
160549
|
var FeaturedBase5 = LevelControlServer.with("OnOff", "Lighting");
|
|
160401
160550
|
var LevelControlServerBase = class extends FeaturedBase5 {
|
|
160402
160551
|
pendingTransitionTime;
|
|
@@ -160414,7 +160563,7 @@ var LevelControlServerBase = class extends FeaturedBase5 {
|
|
|
160414
160563
|
try {
|
|
160415
160564
|
await super.initialize();
|
|
160416
160565
|
} catch (error) {
|
|
160417
|
-
|
|
160566
|
+
logger209.error("super.initialize() failed:", error);
|
|
160418
160567
|
throw error;
|
|
160419
160568
|
}
|
|
160420
160569
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
@@ -160532,7 +160681,7 @@ var LevelControlServerBase = class extends FeaturedBase5 {
|
|
|
160532
160681
|
expectedLevel: remembered,
|
|
160533
160682
|
timestamp: now2
|
|
160534
160683
|
});
|
|
160535
|
-
|
|
160684
|
+
logger209.debug(
|
|
160536
160685
|
`[${entityId}] Storing level ${level} without calling HA - moveToLevel arrived ${sinceTurnOff}ms after a Matter off while still off (#434)`
|
|
160537
160686
|
);
|
|
160538
160687
|
return;
|
|
@@ -160543,7 +160692,7 @@ var LevelControlServerBase = class extends FeaturedBase5 {
|
|
|
160543
160692
|
const lastTurnOn = lastTurnOnTimestamps.get(entityId);
|
|
160544
160693
|
const timeSinceTurnOn = lastTurnOn ? Date.now() - lastTurnOn : Infinity;
|
|
160545
160694
|
if (level >= this.maxLevel && timeSinceTurnOn < 200) {
|
|
160546
|
-
|
|
160695
|
+
logger209.debug(
|
|
160547
160696
|
`[${entityId}] Ignoring moveToLevel(${level}) - Alexa brightness reset detected (${timeSinceTurnOn}ms after turn-on)`
|
|
160548
160697
|
);
|
|
160549
160698
|
return;
|
|
@@ -160589,7 +160738,7 @@ function LevelControlServer2(config8) {
|
|
|
160589
160738
|
}
|
|
160590
160739
|
|
|
160591
160740
|
// src/matter/behaviors/on-off-server.ts
|
|
160592
|
-
var
|
|
160741
|
+
var logger210 = Logger.get("OnOffServer");
|
|
160593
160742
|
var optimisticOnOffState = /* @__PURE__ */ new Map();
|
|
160594
160743
|
var OPTIMISTIC_TIMEOUT_MS2 = 3e3;
|
|
160595
160744
|
function sweepOptimisticOnOff(now) {
|
|
@@ -160653,7 +160802,7 @@ var OnOffServerBase = class extends OnOffServer {
|
|
|
160653
160802
|
if (!action) {
|
|
160654
160803
|
return;
|
|
160655
160804
|
}
|
|
160656
|
-
|
|
160805
|
+
logger210.info(`[${homeAssistant.entityId}] Turning ON -> ${action.action}`);
|
|
160657
160806
|
notifyLightTurnedOn(homeAssistant.entityId);
|
|
160658
160807
|
if (!skipMomentaryFlip) {
|
|
160659
160808
|
const now = Date.now();
|
|
@@ -160684,7 +160833,7 @@ var OnOffServerBase = class extends OnOffServer {
|
|
|
160684
160833
|
if (!action) {
|
|
160685
160834
|
return;
|
|
160686
160835
|
}
|
|
160687
|
-
|
|
160836
|
+
logger210.info(`[${homeAssistant.entityId}] Turning OFF -> ${action.action}`);
|
|
160688
160837
|
const now = Date.now();
|
|
160689
160838
|
sweepOptimisticOnOff(now);
|
|
160690
160839
|
optimisticOnOffState.set(homeAssistant.entityId, {
|
|
@@ -160718,7 +160867,7 @@ function setOptimisticOnOff(entityId, expectedOnOff) {
|
|
|
160718
160867
|
}
|
|
160719
160868
|
|
|
160720
160869
|
// src/matter/behaviors/fan-control-server.ts
|
|
160721
|
-
var
|
|
160870
|
+
var logger211 = Logger.get("FanControlServer");
|
|
160722
160871
|
var defaultStepSize = 33.33;
|
|
160723
160872
|
var minSpeedMax = 3;
|
|
160724
160873
|
var maxSpeedMax = 100;
|
|
@@ -161025,6 +161174,7 @@ var FanControlServerBase = class extends FeaturedBase6 {
|
|
|
161025
161174
|
homeAssistant.callAction(action);
|
|
161026
161175
|
return;
|
|
161027
161176
|
}
|
|
161177
|
+
homeAssistant.assertAvailable();
|
|
161028
161178
|
const entityId = homeAssistant.entityId;
|
|
161029
161179
|
const actions = this.env.get(HomeAssistantActions);
|
|
161030
161180
|
const st = getFanDebounce(this.endpoint);
|
|
@@ -161057,7 +161207,7 @@ var FanControlServerBase = class extends FeaturedBase6 {
|
|
|
161057
161207
|
const wasOff = homeAssistant.entity.state?.state === "off" || this.agent.has(OnOffBehavior) && !this.agent.get(OnOffBehavior).state.onOff;
|
|
161058
161208
|
const remembered = this.remembered();
|
|
161059
161209
|
if (wasOff) {
|
|
161060
|
-
|
|
161210
|
+
logger211.debug(
|
|
161061
161211
|
`[${homeAssistant.entityId}] power-on write ${percentage}%: restore flag=${restoreOnPowerOn}, last speed=${remembered.percent}`
|
|
161062
161212
|
);
|
|
161063
161213
|
}
|
|
@@ -161250,7 +161400,7 @@ var FanControlServerBase = class extends FeaturedBase6 {
|
|
|
161250
161400
|
const entityId = this.agent.get(HomeAssistantEntityBehavior).entity.entity_id;
|
|
161251
161401
|
setOptimisticOnOff(entityId, on);
|
|
161252
161402
|
} catch (e) {
|
|
161253
|
-
|
|
161403
|
+
logger211.debug(
|
|
161254
161404
|
`syncOnOff(${on}) failed: ${e instanceof Error ? e.message : String(e)}`
|
|
161255
161405
|
);
|
|
161256
161406
|
}
|
|
@@ -161393,7 +161543,7 @@ var FanOnOffServer = OnOffServer2({
|
|
|
161393
161543
|
});
|
|
161394
161544
|
|
|
161395
161545
|
// src/matter/endpoints/composed/composed-air-purifier-endpoint.ts
|
|
161396
|
-
var
|
|
161546
|
+
var logger212 = Logger.get("ComposedAirPurifierEndpoint");
|
|
161397
161547
|
var temperatureConfig = {
|
|
161398
161548
|
getValue(entity, agent) {
|
|
161399
161549
|
const fallbackUnit = agent.env.get(HomeAssistantConfig).unitSystem.temperature;
|
|
@@ -161611,7 +161761,7 @@ var ComposedAirPurifierEndpoint = class _ComposedAirPurifierEndpoint extends End
|
|
|
161611
161761
|
config8.powerEntityId ? "+Pwr" : "",
|
|
161612
161762
|
config8.energyEntityId ? "+Nrg" : ""
|
|
161613
161763
|
].filter(Boolean).join("");
|
|
161614
|
-
|
|
161764
|
+
logger212.info(
|
|
161615
161765
|
`Created composed air purifier ${primaryEntityId}: ${clusterLabels}`
|
|
161616
161766
|
);
|
|
161617
161767
|
return endpoint;
|
|
@@ -161929,12 +162079,12 @@ var ClimateHumidityMeasurementServer = HumidityMeasurementServer(humidityConfig2
|
|
|
161929
162079
|
// src/matter/endpoints/legacy/climate/behaviors/climate-on-off-server.ts
|
|
161930
162080
|
init_esm();
|
|
161931
162081
|
init_home_assistant_entity_behavior();
|
|
161932
|
-
var
|
|
162082
|
+
var logger213 = Logger.get("ClimateOnOffServer");
|
|
161933
162083
|
var ClimateOnOffServer = OnOffServer2({
|
|
161934
162084
|
turnOn: (_value, agent) => {
|
|
161935
162085
|
const entity = agent.get(HomeAssistantEntityBehavior).entity;
|
|
161936
162086
|
if (entity.state.state !== "off" && agent.get(OnOffServer).state.onOff) {
|
|
161937
|
-
|
|
162087
|
+
logger213.debug(
|
|
161938
162088
|
`[${entity.entity_id}] Skipping redundant OnOff.on(), cached state "${entity.state.state}"`
|
|
161939
162089
|
);
|
|
161940
162090
|
return void 0;
|
|
@@ -161968,7 +162118,8 @@ init_home_assistant_entity_behavior();
|
|
|
161968
162118
|
// src/matter/behaviors/thermostat-server.ts
|
|
161969
162119
|
init_esm();
|
|
161970
162120
|
init_home_assistant_entity_behavior();
|
|
161971
|
-
|
|
162121
|
+
init_transaction_is_offline();
|
|
162122
|
+
var logger214 = Logger.get("ThermostatServer");
|
|
161972
162123
|
var SystemMode = Thermostat3.SystemMode;
|
|
161973
162124
|
var RunningMode = Thermostat3.ThermostatRunningMode;
|
|
161974
162125
|
var nudgingSetpoints = /* @__PURE__ */ new Set();
|
|
@@ -162047,7 +162198,7 @@ function clearInactiveSetpointState(self, scope) {
|
|
|
162047
162198
|
}
|
|
162048
162199
|
function thermostatPreInitialize(self) {
|
|
162049
162200
|
const currentLocal = self.state.localTemperature;
|
|
162050
|
-
|
|
162201
|
+
logger214.debug(
|
|
162051
162202
|
`initialize: features - heating=${self.features.heating}, cooling=${self.features.cooling}`
|
|
162052
162203
|
);
|
|
162053
162204
|
const localValue = typeof currentLocal === "number" && !Number.isNaN(currentLocal) ? currentLocal : currentLocal === null ? null : 2100;
|
|
@@ -162094,7 +162245,7 @@ function thermostatPreInitialize(self) {
|
|
|
162094
162245
|
} else {
|
|
162095
162246
|
clearInactiveSetpointState(self, "Cool");
|
|
162096
162247
|
}
|
|
162097
|
-
|
|
162248
|
+
logger214.debug(
|
|
162098
162249
|
`initialize: after force-set - local=${self.state.localTemperature}`
|
|
162099
162250
|
);
|
|
162100
162251
|
self.state.thermostatRunningState = runningStateAllOff;
|
|
@@ -162187,7 +162338,7 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
162187
162338
|
maxCoolLimit,
|
|
162188
162339
|
"cool"
|
|
162189
162340
|
);
|
|
162190
|
-
|
|
162341
|
+
logger214.debug(
|
|
162191
162342
|
`update: limits heat=[${minHeatLimit}, ${maxHeatLimit}], cool=[${minCoolLimit}, ${maxCoolLimit}], systemMode=${systemMode}, runningMode=${runningMode}`
|
|
162192
162343
|
);
|
|
162193
162344
|
let controlSequence = config8.getControlSequence(entity.state, this.agent);
|
|
@@ -162260,18 +162411,18 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
162260
162411
|
*/
|
|
162261
162412
|
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: Called via thermostatPostInitialize + prototype copy
|
|
162262
162413
|
heatingSetpointChanging(value, _oldValue, context) {
|
|
162263
|
-
|
|
162414
|
+
logger214.debug(
|
|
162264
162415
|
`heatingSetpointChanging: value=${value}, oldValue=${_oldValue}, isOffline=${transactionIsOffline(context)}`
|
|
162265
162416
|
);
|
|
162266
162417
|
if (transactionIsOffline(context)) {
|
|
162267
|
-
|
|
162418
|
+
logger214.debug(
|
|
162268
162419
|
"heatingSetpointChanging: skipping - transaction is offline"
|
|
162269
162420
|
);
|
|
162270
162421
|
return;
|
|
162271
162422
|
}
|
|
162272
162423
|
const next = Temperature.celsius(value / 100);
|
|
162273
162424
|
if (!next) {
|
|
162274
|
-
|
|
162425
|
+
logger214.debug("heatingSetpointChanging: skipping - invalid temperature");
|
|
162275
162426
|
return;
|
|
162276
162427
|
}
|
|
162277
162428
|
this.agent.asLocalActor(() => {
|
|
@@ -162282,7 +162433,7 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
162282
162433
|
this.agent
|
|
162283
162434
|
);
|
|
162284
162435
|
const currentMode2 = this.state.systemMode;
|
|
162285
|
-
|
|
162436
|
+
logger214.debug(
|
|
162286
162437
|
`heatingSetpointChanging: supportsRange=${supportsRange}, systemMode=${currentMode2}, features.heating=${this.features.heating}, features.cooling=${this.features.cooling}`
|
|
162287
162438
|
);
|
|
162288
162439
|
if (!supportsRange) {
|
|
@@ -162292,12 +162443,12 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
162292
162443
|
const isOff = currentMode2 === Thermostat3.SystemMode.Off;
|
|
162293
162444
|
if (isOff && this.features.heating) {
|
|
162294
162445
|
if (nudgingSetpoints.has(homeAssistant.entityId)) {
|
|
162295
|
-
|
|
162446
|
+
logger214.debug(
|
|
162296
162447
|
`heatingSetpointChanging: skipping auto-resume - nudge write in progress`
|
|
162297
162448
|
);
|
|
162298
162449
|
return;
|
|
162299
162450
|
}
|
|
162300
|
-
|
|
162451
|
+
logger214.info(
|
|
162301
162452
|
`heatingSetpointChanging: auto-resume - switching to Heat (was Off)`
|
|
162302
162453
|
);
|
|
162303
162454
|
const modeAction = config8.setSystemMode(
|
|
@@ -162306,17 +162457,17 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
162306
162457
|
);
|
|
162307
162458
|
homeAssistant.callAction(modeAction);
|
|
162308
162459
|
} else if (!isAutoMode && !isHeatingMode) {
|
|
162309
|
-
|
|
162460
|
+
logger214.debug(
|
|
162310
162461
|
`heatingSetpointChanging: skipping - not in heating/auto mode (mode=${currentMode2}, haMode=${haHvacMode})`
|
|
162311
162462
|
);
|
|
162312
162463
|
return;
|
|
162313
162464
|
}
|
|
162314
|
-
|
|
162465
|
+
logger214.debug(
|
|
162315
162466
|
`heatingSetpointChanging: proceeding - isAutoMode=${isAutoMode}, isHeatingMode=${isHeatingMode}, isOff=${isOff}, haMode=${haHvacMode}`
|
|
162316
162467
|
);
|
|
162317
162468
|
}
|
|
162318
162469
|
const coolingSetpoint = this.features.cooling ? this.state.occupiedCoolingSetpoint : value;
|
|
162319
|
-
|
|
162470
|
+
logger214.debug(
|
|
162320
162471
|
`heatingSetpointChanging: calling setTemperature with heat=${next.celsius(true)}, cool=${coolingSetpoint}`
|
|
162321
162472
|
);
|
|
162322
162473
|
this.setTemperature(
|
|
@@ -162355,12 +162506,12 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
162355
162506
|
const isOff = currentMode2 === Thermostat3.SystemMode.Off;
|
|
162356
162507
|
if (isOff && !this.features.heating && this.features.cooling) {
|
|
162357
162508
|
if (nudgingSetpoints.has(homeAssistant.entityId)) {
|
|
162358
|
-
|
|
162509
|
+
logger214.debug(
|
|
162359
162510
|
`coolingSetpointChanging: skipping auto-resume - nudge write in progress`
|
|
162360
162511
|
);
|
|
162361
162512
|
return;
|
|
162362
162513
|
}
|
|
162363
|
-
|
|
162514
|
+
logger214.info(
|
|
162364
162515
|
`coolingSetpointChanging: auto-resume - switching to Cool (was Off)`
|
|
162365
162516
|
);
|
|
162366
162517
|
const modeAction = config8.setSystemMode(
|
|
@@ -162369,12 +162520,12 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
162369
162520
|
);
|
|
162370
162521
|
homeAssistant.callAction(modeAction);
|
|
162371
162522
|
} else if (!isAutoMode && !isCoolingMode) {
|
|
162372
|
-
|
|
162523
|
+
logger214.debug(
|
|
162373
162524
|
`coolingSetpointChanging: skipping - not in cooling/auto mode (mode=${currentMode2}, haMode=${haHvacMode})`
|
|
162374
162525
|
);
|
|
162375
162526
|
return;
|
|
162376
162527
|
}
|
|
162377
|
-
|
|
162528
|
+
logger214.debug(
|
|
162378
162529
|
`coolingSetpointChanging: proceeding - isAutoMode=${isAutoMode}, isCoolingMode=${isCoolingMode}, isOff=${isOff}, haMode=${haHvacMode}`
|
|
162379
162530
|
);
|
|
162380
162531
|
}
|
|
@@ -162488,7 +162639,7 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
162488
162639
|
const effectiveMax = max ?? 5e3;
|
|
162489
162640
|
if (value == null || Number.isNaN(value)) {
|
|
162490
162641
|
const defaultValue = type === "heat" ? 2e3 : 2400;
|
|
162491
|
-
|
|
162642
|
+
logger214.debug(
|
|
162492
162643
|
`${type} setpoint is undefined, using default: ${defaultValue}`
|
|
162493
162644
|
);
|
|
162494
162645
|
return Math.max(effectiveMin, Math.min(effectiveMax, defaultValue));
|
|
@@ -163066,7 +163217,7 @@ function ClimateDevice(homeAssistantEntity, includeBasicInformation = true) {
|
|
|
163066
163217
|
}
|
|
163067
163218
|
|
|
163068
163219
|
// src/matter/endpoints/composed/composed-climate-fan-endpoint.ts
|
|
163069
|
-
var
|
|
163220
|
+
var logger215 = Logger.get("ComposedClimateFanEndpoint");
|
|
163070
163221
|
function createEndpointId3(entityId, customName) {
|
|
163071
163222
|
const baseName = customName || entityId;
|
|
163072
163223
|
return baseName.replace(/\./g, "_").replace(/\s+/g, "_");
|
|
@@ -163104,7 +163255,7 @@ var ComposedClimateFanEndpoint = class _ComposedClimateFanEndpoint extends Endpo
|
|
|
163104
163255
|
climateSub = new Endpoint(climateType, { id: `${endpointId}_climate` });
|
|
163105
163256
|
} catch (error) {
|
|
163106
163257
|
const message = error instanceof Error ? error.message : String(error);
|
|
163107
|
-
|
|
163258
|
+
logger215.warn(
|
|
163108
163259
|
`Companion fan: climate sub build failed for ${primaryEntityId}: ${message}`
|
|
163109
163260
|
);
|
|
163110
163261
|
return void 0;
|
|
@@ -163148,7 +163299,7 @@ var ComposedClimateFanEndpoint = class _ComposedClimateFanEndpoint extends Endpo
|
|
|
163148
163299
|
endpointId,
|
|
163149
163300
|
[climateSub, fanSub]
|
|
163150
163301
|
);
|
|
163151
|
-
|
|
163302
|
+
logger215.info(`Created composed climate+fan endpoint ${primaryEntityId}`);
|
|
163152
163303
|
return endpoint;
|
|
163153
163304
|
}
|
|
163154
163305
|
constructor(type, entityId, id, parts) {
|
|
@@ -163243,7 +163394,7 @@ init_home_assistant_entity_behavior();
|
|
|
163243
163394
|
// src/matter/behaviors/pressure-measurement-server.ts
|
|
163244
163395
|
init_esm();
|
|
163245
163396
|
init_home_assistant_entity_behavior();
|
|
163246
|
-
var
|
|
163397
|
+
var logger216 = Logger.get("PressureMeasurementServer");
|
|
163247
163398
|
var MIN_PRESSURE = 300;
|
|
163248
163399
|
var MAX_PRESSURE = 1100;
|
|
163249
163400
|
var PressureMeasurementServerBase = class extends PressureMeasurementServer {
|
|
@@ -163271,7 +163422,7 @@ var PressureMeasurementServerBase = class extends PressureMeasurementServer {
|
|
|
163271
163422
|
}
|
|
163272
163423
|
const rounded = Math.round(value);
|
|
163273
163424
|
if (rounded < MIN_PRESSURE || rounded > MAX_PRESSURE) {
|
|
163274
|
-
|
|
163425
|
+
logger216.warn(
|
|
163275
163426
|
`Pressure value ${rounded} (raw: ${value}) for ${entity.entity_id} is outside valid range [${MIN_PRESSURE}-${MAX_PRESSURE}], ignoring`
|
|
163276
163427
|
);
|
|
163277
163428
|
return null;
|
|
@@ -163290,7 +163441,7 @@ function PressureMeasurementServer2(config8) {
|
|
|
163290
163441
|
}
|
|
163291
163442
|
|
|
163292
163443
|
// src/matter/endpoints/composed/composed-sensor-endpoint.ts
|
|
163293
|
-
var
|
|
163444
|
+
var logger217 = Logger.get("ComposedSensorEndpoint");
|
|
163294
163445
|
var temperatureConfig2 = {
|
|
163295
163446
|
getValue(entity, agent) {
|
|
163296
163447
|
const fallbackUnit = agent.env.get(HomeAssistantConfig).unitSystem.temperature;
|
|
@@ -163468,7 +163619,7 @@ var ComposedSensorEndpoint = class _ComposedSensorEndpoint extends Endpoint {
|
|
|
163468
163619
|
if (config8.pressureEntityId && pressSub) {
|
|
163469
163620
|
endpoint.subEndpoints.set(config8.pressureEntityId, pressSub);
|
|
163470
163621
|
}
|
|
163471
|
-
|
|
163622
|
+
logger217.info(
|
|
163472
163623
|
`Created composed sensor ${primaryEntityId} with ${parts.length} sub-endpoint(s): T${humSub ? "+H" : ""}${pressSub ? "+P" : ""}${config8.batteryEntityId ? "+Bat" : ""}${config8.powerEntityId ? "+Pwr" : ""}${config8.energyEntityId ? "+Nrg" : ""}`
|
|
163473
163624
|
);
|
|
163474
163625
|
return endpoint;
|
|
@@ -163605,7 +163756,7 @@ init_home_assistant_entity_behavior();
|
|
|
163605
163756
|
// src/matter/behaviors/mode-select-server.ts
|
|
163606
163757
|
init_esm();
|
|
163607
163758
|
init_home_assistant_entity_behavior();
|
|
163608
|
-
var
|
|
163759
|
+
var logger218 = Logger.get("ModeSelectServer");
|
|
163609
163760
|
function buildSupportedModes(options) {
|
|
163610
163761
|
return options.map((label, index) => ({
|
|
163611
163762
|
label: label.length > 64 ? label.substring(0, 64) : label,
|
|
@@ -163642,13 +163793,13 @@ var ModeSelectServerBase = class extends ModeSelectServer {
|
|
|
163642
163793
|
const options = config8.getOptions(homeAssistant.entity);
|
|
163643
163794
|
const { newMode } = request;
|
|
163644
163795
|
if (newMode < 0 || newMode >= options.length) {
|
|
163645
|
-
|
|
163796
|
+
logger218.warn(
|
|
163646
163797
|
`[${homeAssistant.entityId}] Invalid mode ${newMode}, options: [${options.join(", ")}]`
|
|
163647
163798
|
);
|
|
163648
163799
|
return;
|
|
163649
163800
|
}
|
|
163650
163801
|
const option = options[newMode];
|
|
163651
|
-
|
|
163802
|
+
logger218.info(
|
|
163652
163803
|
`[${homeAssistant.entityId}] changeToMode(${newMode}) -> "${option}"`
|
|
163653
163804
|
);
|
|
163654
163805
|
applyPatchState(this.state, { currentMode: newMode });
|
|
@@ -164199,7 +164350,7 @@ var CoAlarmWithBatteryType = SmokeCoAlarmDevice.with(
|
|
|
164199
164350
|
);
|
|
164200
164351
|
|
|
164201
164352
|
// src/matter/endpoints/legacy/binary-sensor/index.ts
|
|
164202
|
-
var
|
|
164353
|
+
var logger219 = Logger.get("BinarySensorDevice");
|
|
164203
164354
|
var deviceClasses = {
|
|
164204
164355
|
[BinarySensorDeviceClass.CarbonMonoxide]: CoAlarmType,
|
|
164205
164356
|
[BinarySensorDeviceClass.Gas]: CoAlarmType,
|
|
@@ -164250,11 +164401,11 @@ function BinarySensorDevice(homeAssistantEntity) {
|
|
|
164250
164401
|
const originalTypeName = type.name;
|
|
164251
164402
|
if (hasBattery && batteryTypes.has(type)) {
|
|
164252
164403
|
type = batteryTypes.get(type);
|
|
164253
|
-
|
|
164404
|
+
logger219.info(
|
|
164254
164405
|
`[${entityId}] Using battery variant: ${originalTypeName} -> ${type.name}, batteryAttr=${hasBatteryAttr}, batteryEntity=${homeAssistantEntity.mapping?.batteryEntity ?? "none"}`
|
|
164255
164406
|
);
|
|
164256
164407
|
} else if (hasBattery) {
|
|
164257
|
-
|
|
164408
|
+
logger219.warn(
|
|
164258
164409
|
`[${entityId}] Has battery but no variant available for ${originalTypeName}`
|
|
164259
164410
|
);
|
|
164260
164411
|
}
|
|
@@ -164341,7 +164492,7 @@ init_home_assistant_entity_behavior();
|
|
|
164341
164492
|
init_esm();
|
|
164342
164493
|
init_home_assistant_actions();
|
|
164343
164494
|
init_home_assistant_entity_behavior();
|
|
164344
|
-
var
|
|
164495
|
+
var logger220 = Logger.get("WindowCoveringServer");
|
|
164345
164496
|
var MovementStatus = WindowCovering3.MovementStatus;
|
|
164346
164497
|
var FeaturedBase7 = WindowCoveringServer.with(
|
|
164347
164498
|
"Lift",
|
|
@@ -164552,7 +164703,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
164552
164703
|
}
|
|
164553
164704
|
return existing100ths ?? current100ths;
|
|
164554
164705
|
};
|
|
164555
|
-
|
|
164706
|
+
logger220.debug(
|
|
164556
164707
|
`Cover update for ${entity.entity_id}: state=${state.state}, lift=${currentLift}%, tilt=${currentTilt}%, ha=${MovementStatus[movementStatus]}, effective=${MovementStatus[globalStatus]}`
|
|
164557
164708
|
);
|
|
164558
164709
|
const overrideType = config8.getCoverType?.(state, this.agent);
|
|
@@ -164597,9 +164748,9 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
164597
164748
|
);
|
|
164598
164749
|
if (Object.keys(appliedPatch).length > 0) {
|
|
164599
164750
|
const hasOperationalChange = "operationalStatus" in appliedPatch;
|
|
164600
|
-
const log = hasOperationalChange ?
|
|
164751
|
+
const log = hasOperationalChange ? logger220.info : logger220.debug;
|
|
164601
164752
|
log.call(
|
|
164602
|
-
|
|
164753
|
+
logger220,
|
|
164603
164754
|
`Cover ${entity.entity_id} state changed: ${JSON.stringify(appliedPatch)}`
|
|
164604
164755
|
);
|
|
164605
164756
|
}
|
|
@@ -164708,7 +164859,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
164708
164859
|
}
|
|
164709
164860
|
});
|
|
164710
164861
|
} catch (error) {
|
|
164711
|
-
|
|
164862
|
+
logger220.debug(
|
|
164712
164863
|
`Optimistic ${axis} timeout write failed (endpoint may be closing): ${error}`
|
|
164713
164864
|
);
|
|
164714
164865
|
}
|
|
@@ -164718,12 +164869,32 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
164718
164869
|
optimistic[axis] = { status: status3, startedAt, timer, expectedRestEnd };
|
|
164719
164870
|
this.writeOperationalStatus({ [axis]: status3 });
|
|
164720
164871
|
}
|
|
164872
|
+
// matter.js runs handleMovement as a worker, so a throw in there cannot fail
|
|
164873
|
+
// the command. The commands that start movement check up front instead, and
|
|
164874
|
+
// the HA call is deferred past the debounce anyway, outside the transaction
|
|
164875
|
+
// where a rollback could not undo the optimistic target (#446).
|
|
164876
|
+
async upOrOpen() {
|
|
164877
|
+
this.agent.get(HomeAssistantEntityBehavior).assertAvailable();
|
|
164878
|
+
return super.upOrOpen();
|
|
164879
|
+
}
|
|
164880
|
+
async downOrClose() {
|
|
164881
|
+
this.agent.get(HomeAssistantEntityBehavior).assertAvailable();
|
|
164882
|
+
return super.downOrClose();
|
|
164883
|
+
}
|
|
164884
|
+
async goToLiftPercentage(request) {
|
|
164885
|
+
this.agent.get(HomeAssistantEntityBehavior).assertAvailable();
|
|
164886
|
+
return super.goToLiftPercentage(request);
|
|
164887
|
+
}
|
|
164888
|
+
async goToTiltPercentage(request) {
|
|
164889
|
+
this.agent.get(HomeAssistantEntityBehavior).assertAvailable();
|
|
164890
|
+
return super.goToTiltPercentage(request);
|
|
164891
|
+
}
|
|
164721
164892
|
async handleMovement(type, _, direction, targetPercent100ths) {
|
|
164722
164893
|
const currentLift = this.state.currentPositionLiftPercent100ths ?? 0;
|
|
164723
164894
|
const currentTilt = this.state.currentPositionTiltPercent100ths ?? 0;
|
|
164724
164895
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
164725
164896
|
const flags2 = this.state.config.getDiagnosticFlags?.(this.agent);
|
|
164726
|
-
|
|
164897
|
+
logger220.info(
|
|
164727
164898
|
`handleMovement ${homeAssistant.entityId}: type=${MovementType[type]}, direction=${MovementDirection[direction]}, target=${targetPercent100ths}, currentLift=${currentLift}, currentTilt=${currentTilt}${flags2 ? `, ${flags2}` : ""}`
|
|
164728
164899
|
);
|
|
164729
164900
|
if (type === MovementType.Lift) {
|
|
@@ -164742,7 +164913,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
164742
164913
|
}
|
|
164743
164914
|
} else if (type === MovementType.Tilt) {
|
|
164744
164915
|
if (targetPercent100ths == null && this.lastLiftMovementDirection === direction && Date.now() - this.lastLiftMovementMs < 50) {
|
|
164745
|
-
|
|
164916
|
+
logger220.info(
|
|
164746
164917
|
`Skipping tilt ${MovementDirection[direction]}, lift already moving in same direction`
|
|
164747
164918
|
);
|
|
164748
164919
|
return;
|
|
@@ -164787,7 +164958,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
164787
164958
|
} else {
|
|
164788
164959
|
this.startOptimisticMovement("lift", MovementStatus.Opening, end);
|
|
164789
164960
|
}
|
|
164790
|
-
|
|
164961
|
+
logger220.info(
|
|
164791
164962
|
`handleLiftOpen ${homeAssistant.entityId}: calling action=${action.action}, atRest=${atRest}, ${this.state.config.getDiagnosticFlags?.(this.agent) ?? ""}`
|
|
164792
164963
|
);
|
|
164793
164964
|
homeAssistant.callAction(action);
|
|
@@ -164803,7 +164974,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
164803
164974
|
} else {
|
|
164804
164975
|
this.startOptimisticMovement("lift", MovementStatus.Closing, end);
|
|
164805
164976
|
}
|
|
164806
|
-
|
|
164977
|
+
logger220.info(
|
|
164807
164978
|
`handleLiftClose ${homeAssistant.entityId}: calling action=${action.action}, atRest=${atRest}, ${this.state.config.getDiagnosticFlags?.(this.agent) ?? ""}`
|
|
164808
164979
|
);
|
|
164809
164980
|
homeAssistant.callAction(action);
|
|
@@ -164833,7 +165004,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
164833
165004
|
const isFirstInSequence = timeSinceLastCommand > _WindowCoveringServerBase.COMMAND_SEQUENCE_THRESHOLD_MS;
|
|
164834
165005
|
const overrideMs = this.resolveDebounceOverride(homeAssistant);
|
|
164835
165006
|
const debounceMs = overrideMs != null ? overrideMs : isFirstInSequence ? _WindowCoveringServerBase.DEBOUNCE_INITIAL_MS : _WindowCoveringServerBase.DEBOUNCE_SUBSEQUENT_MS;
|
|
164836
|
-
|
|
165007
|
+
logger220.debug(
|
|
164837
165008
|
`Lift command: target=${targetPosition}%, debounce=${debounceMs}ms (${overrideMs != null ? "override" : isFirstInSequence ? "initial" : "subsequent"})`
|
|
164838
165009
|
);
|
|
164839
165010
|
if (st.liftTimer) {
|
|
@@ -164865,7 +165036,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
164865
165036
|
this.startOptimisticMovement("tilt", MovementStatus.Opening, end);
|
|
164866
165037
|
}
|
|
164867
165038
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
164868
|
-
|
|
165039
|
+
logger220.info(
|
|
164869
165040
|
`handleTiltOpen ${homeAssistant.entityId}: calling action=${action.action}, atRest=${atRest}, ${this.state.config.getDiagnosticFlags?.(this.agent) ?? ""}`
|
|
164870
165041
|
);
|
|
164871
165042
|
homeAssistant.callAction(action);
|
|
@@ -164883,7 +165054,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
164883
165054
|
this.startOptimisticMovement("tilt", MovementStatus.Closing, end);
|
|
164884
165055
|
}
|
|
164885
165056
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
164886
|
-
|
|
165057
|
+
logger220.info(
|
|
164887
165058
|
`handleTiltClose ${homeAssistant.entityId}: calling action=${action.action}, atRest=${atRest}, ${this.state.config.getDiagnosticFlags?.(this.agent) ?? ""}`
|
|
164888
165059
|
);
|
|
164889
165060
|
homeAssistant.callAction(action);
|
|
@@ -164913,7 +165084,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
164913
165084
|
const isFirstInSequence = timeSinceLastCommand > _WindowCoveringServerBase.COMMAND_SEQUENCE_THRESHOLD_MS;
|
|
164914
165085
|
const overrideMs = this.resolveDebounceOverride(homeAssistant);
|
|
164915
165086
|
const debounceMs = overrideMs != null ? overrideMs : isFirstInSequence ? _WindowCoveringServerBase.DEBOUNCE_INITIAL_MS : _WindowCoveringServerBase.DEBOUNCE_SUBSEQUENT_MS;
|
|
164916
|
-
|
|
165087
|
+
logger220.debug(
|
|
164917
165088
|
`Tilt command: target=${targetPosition}%, debounce=${debounceMs}ms (${overrideMs != null ? "override" : isFirstInSequence ? "initial" : "subsequent"})`
|
|
164918
165089
|
);
|
|
164919
165090
|
if (st.tiltTimer) {
|
|
@@ -164965,7 +165136,7 @@ function adjustPositionForWriting(position, flags2, matterSemantics) {
|
|
|
164965
165136
|
}
|
|
164966
165137
|
|
|
164967
165138
|
// src/matter/endpoints/legacy/cover/behaviors/cover-window-covering-server.ts
|
|
164968
|
-
var
|
|
165139
|
+
var logger221 = Logger.get("CoverWindowCoveringServer");
|
|
164969
165140
|
var attributes6 = (entity) => entity.attributes;
|
|
164970
165141
|
var DEVICE_CLASS_TO_MATTER_TYPE = {
|
|
164971
165142
|
curtain: {
|
|
@@ -165037,7 +165208,7 @@ var adjustPositionForReading2 = (position, agent) => {
|
|
|
165037
165208
|
const { featureFlags } = agent.env.get(BridgeDataProvider);
|
|
165038
165209
|
const matterSem = usesMatterSemantics(agent);
|
|
165039
165210
|
const result = adjustPositionForReading(position, featureFlags, matterSem);
|
|
165040
|
-
|
|
165211
|
+
logger221.debug(`adjustPositionForReading: HA=${position}%, result=${result}%`);
|
|
165041
165212
|
return result;
|
|
165042
165213
|
};
|
|
165043
165214
|
var adjustPositionForWriting2 = (position, agent) => {
|
|
@@ -165262,14 +165433,14 @@ var CoverAsDimmableLightWithBatteryType = DimmableLightDevice.with(
|
|
|
165262
165433
|
);
|
|
165263
165434
|
|
|
165264
165435
|
// src/matter/endpoints/legacy/cover/index.ts
|
|
165265
|
-
var
|
|
165436
|
+
var logger222 = Logger.get("CoverDevice");
|
|
165266
165437
|
var CoverDeviceType = (supportedFeatures, hasBattery, entityId) => {
|
|
165267
165438
|
const features = /* @__PURE__ */ new Set();
|
|
165268
165439
|
if (testBit(supportedFeatures, CoverSupportedFeatures.support_open)) {
|
|
165269
165440
|
features.add("Lift");
|
|
165270
165441
|
features.add("PositionAwareLift");
|
|
165271
165442
|
} else {
|
|
165272
|
-
|
|
165443
|
+
logger222.warn(
|
|
165273
165444
|
`[${entityId}] Cover has no support_open feature (supported_features=${supportedFeatures}), adding Lift anyway`
|
|
165274
165445
|
);
|
|
165275
165446
|
features.add("Lift");
|
|
@@ -165284,7 +165455,7 @@ var CoverDeviceType = (supportedFeatures, hasBattery, entityId) => {
|
|
|
165284
165455
|
features.add("PositionAwareTilt");
|
|
165285
165456
|
}
|
|
165286
165457
|
}
|
|
165287
|
-
|
|
165458
|
+
logger222.info(
|
|
165288
165459
|
`[${entityId}] Creating WindowCovering with features: [${[...features].join(", ")}], supported_features=${supportedFeatures}`
|
|
165289
165460
|
);
|
|
165290
165461
|
const baseBehaviors2 = [
|
|
@@ -165308,16 +165479,16 @@ function CoverDevice(homeAssistantEntity) {
|
|
|
165308
165479
|
const hasBatteryEntity = !!homeAssistantEntity.mapping?.batteryEntity;
|
|
165309
165480
|
const hasBattery = hasBatteryAttr || hasBatteryEntity;
|
|
165310
165481
|
if (hasBattery) {
|
|
165311
|
-
|
|
165482
|
+
logger222.info(
|
|
165312
165483
|
`[${entityId}] Creating cover with PowerSource cluster, batteryAttr=${hasBatteryAttr}, batteryEntity=${homeAssistantEntity.mapping?.batteryEntity ?? "none"}`
|
|
165313
165484
|
);
|
|
165314
165485
|
} else {
|
|
165315
|
-
|
|
165486
|
+
logger222.debug(
|
|
165316
165487
|
`[${entityId}] Creating cover without battery (batteryAttr=${hasBatteryAttr}, batteryEntity=${homeAssistantEntity.mapping?.batteryEntity ?? "none"})`
|
|
165317
165488
|
);
|
|
165318
165489
|
}
|
|
165319
165490
|
if (homeAssistantEntity.mapping?.coverExposeAsDimmableLight) {
|
|
165320
|
-
|
|
165491
|
+
logger222.info(`[${entityId}] Exposing cover as a Dimmable Light (#372)`);
|
|
165321
165492
|
const type = hasBattery ? CoverAsDimmableLightWithBatteryType : CoverAsDimmableLightType;
|
|
165322
165493
|
return type.set({ homeAssistantEntity });
|
|
165323
165494
|
}
|
|
@@ -165432,7 +165603,7 @@ function DishwasherEndpoint(homeAssistantEntity) {
|
|
|
165432
165603
|
// src/matter/behaviors/generic-switch-server.ts
|
|
165433
165604
|
init_esm();
|
|
165434
165605
|
init_home_assistant_entity_behavior();
|
|
165435
|
-
var
|
|
165606
|
+
var logger223 = Logger.get("GenericSwitchServer");
|
|
165436
165607
|
var SimpleBase = SwitchServer.with(
|
|
165437
165608
|
"MomentarySwitch",
|
|
165438
165609
|
"MomentarySwitchRelease",
|
|
@@ -165474,7 +165645,7 @@ var HaGenericSwitchServerBase = class extends SimpleBase {
|
|
|
165474
165645
|
await super.initialize();
|
|
165475
165646
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
165476
165647
|
const entityId = homeAssistant.entityId;
|
|
165477
|
-
|
|
165648
|
+
logger223.debug(`[${entityId}] GenericSwitch initialized (simple)`);
|
|
165478
165649
|
this.reactTo(homeAssistant.onChange, this.handleEventChange);
|
|
165479
165650
|
}
|
|
165480
165651
|
handleEventChange() {
|
|
@@ -165485,7 +165656,7 @@ var HaGenericSwitchServerBase = class extends SimpleBase {
|
|
|
165485
165656
|
const eventType = attrs.event_type;
|
|
165486
165657
|
if (!eventType) return;
|
|
165487
165658
|
const entityId = homeAssistant.entityId;
|
|
165488
|
-
|
|
165659
|
+
logger223.debug(`[${entityId}] Event fired: ${eventType}`);
|
|
165489
165660
|
this.triggerPress(eventType);
|
|
165490
165661
|
}
|
|
165491
165662
|
triggerPress(eventType) {
|
|
@@ -165531,7 +165702,7 @@ var HaGenericSwitchServerMultiBase = class extends FullBase {
|
|
|
165531
165702
|
await super.initialize();
|
|
165532
165703
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
165533
165704
|
const entityId = homeAssistant.entityId;
|
|
165534
|
-
|
|
165705
|
+
logger223.debug(`[${entityId}] GenericSwitch initialized (multi)`);
|
|
165535
165706
|
this.reactTo(homeAssistant.onChange, this.handleEventChange);
|
|
165536
165707
|
}
|
|
165537
165708
|
handleEventChange() {
|
|
@@ -165542,7 +165713,7 @@ var HaGenericSwitchServerMultiBase = class extends FullBase {
|
|
|
165542
165713
|
const eventType = attrs.event_type;
|
|
165543
165714
|
if (!eventType) return;
|
|
165544
165715
|
const entityId = homeAssistant.entityId;
|
|
165545
|
-
|
|
165716
|
+
logger223.debug(`[${entityId}] Event fired: ${eventType}`);
|
|
165546
165717
|
this.triggerPress(eventType);
|
|
165547
165718
|
}
|
|
165548
165719
|
triggerPress(eventType) {
|
|
@@ -165919,7 +166090,7 @@ init_nodejs();
|
|
|
165919
166090
|
init_home_assistant_entity_behavior();
|
|
165920
166091
|
var OperationalState4 = RvcOperationalState4.OperationalState;
|
|
165921
166092
|
var ErrorState = RvcOperationalState4.ErrorState;
|
|
165922
|
-
var
|
|
166093
|
+
var logger224 = Logger.get("RvcOperationalStateServer");
|
|
165923
166094
|
var activeStates = /* @__PURE__ */ new Set([
|
|
165924
166095
|
OperationalState4.Running,
|
|
165925
166096
|
OperationalState4.SeekingCharger
|
|
@@ -165971,7 +166142,7 @@ var RvcOperationalStateServerBase = class extends RvcOperationalStateServer {
|
|
|
165971
166142
|
{ force: true }
|
|
165972
166143
|
);
|
|
165973
166144
|
if (activeStates.has(previousState) && !activeStates.has(newState)) {
|
|
165974
|
-
|
|
166145
|
+
logger224.info(
|
|
165975
166146
|
`Operation completed: ${OperationalState4[previousState]} -> ${OperationalState4[newState]}`
|
|
165976
166147
|
);
|
|
165977
166148
|
try {
|
|
@@ -165984,7 +166155,7 @@ var RvcOperationalStateServerBase = class extends RvcOperationalStateServer {
|
|
|
165984
166155
|
this.context
|
|
165985
166156
|
);
|
|
165986
166157
|
} catch (e) {
|
|
165987
|
-
|
|
166158
|
+
logger224.debug("Failed to emit operationCompletion event:", e);
|
|
165988
166159
|
}
|
|
165989
166160
|
}
|
|
165990
166161
|
}
|
|
@@ -166019,7 +166190,7 @@ var RvcOperationalStateServerBase = class extends RvcOperationalStateServer {
|
|
|
166019
166190
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
166020
166191
|
homeAssistant.callAction(goHomeAction(void 0, this.agent));
|
|
166021
166192
|
} else {
|
|
166022
|
-
|
|
166193
|
+
logger224.warn("GoHome command received but no goHome action configured");
|
|
166023
166194
|
}
|
|
166024
166195
|
return {
|
|
166025
166196
|
commandResponseState: {
|
|
@@ -166039,7 +166210,7 @@ function RvcOperationalStateServer2(config8) {
|
|
|
166039
166210
|
}
|
|
166040
166211
|
|
|
166041
166212
|
// src/matter/endpoints/legacy/lawn-mower/behaviors/lawn-mower-rvc-operational-state-server.ts
|
|
166042
|
-
var
|
|
166213
|
+
var logger225 = Logger.get("LawnMowerRvcOperationalStateServer");
|
|
166043
166214
|
function mapLawnMowerOperationalState(entity) {
|
|
166044
166215
|
const state = entity.state;
|
|
166045
166216
|
switch (state) {
|
|
@@ -166055,7 +166226,7 @@ function mapLawnMowerOperationalState(entity) {
|
|
|
166055
166226
|
case "unavailable":
|
|
166056
166227
|
return RvcOperationalState4.OperationalState.Error;
|
|
166057
166228
|
default:
|
|
166058
|
-
|
|
166229
|
+
logger225.info(`Unknown lawn_mower state "${state}", treating as Stopped`);
|
|
166059
166230
|
return RvcOperationalState4.OperationalState.Stopped;
|
|
166060
166231
|
}
|
|
166061
166232
|
}
|
|
@@ -166109,7 +166280,7 @@ function inferCleanedAreaProgress(cleanedSqm, orderedAreas) {
|
|
|
166109
166280
|
}
|
|
166110
166281
|
|
|
166111
166282
|
// src/matter/behaviors/rvc-run-mode-server.ts
|
|
166112
|
-
var
|
|
166283
|
+
var logger226 = Logger.get("RvcRunModeServer");
|
|
166113
166284
|
var ROOM_MODE_BASE = 100;
|
|
166114
166285
|
function isRoomMode(mode) {
|
|
166115
166286
|
return mode >= ROOM_MODE_BASE;
|
|
@@ -166235,7 +166406,7 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
166235
166406
|
const s = getSession(this.endpoint);
|
|
166236
166407
|
if (s.loggedShortCircuits.has(reason)) return;
|
|
166237
166408
|
s.loggedShortCircuits.add(reason);
|
|
166238
|
-
|
|
166409
|
+
logger226.info(message);
|
|
166239
166410
|
}
|
|
166240
166411
|
/**
|
|
166241
166412
|
* Read the currentRoomEntity sensor and update currentArea + progress
|
|
@@ -166292,7 +166463,7 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
166292
166463
|
}
|
|
166293
166464
|
}
|
|
166294
166465
|
if (matchedAreaId === null) {
|
|
166295
|
-
|
|
166466
|
+
logger226.info(
|
|
166296
166467
|
`currentRoom sensor: no match for "${roomName}" (segmentId=${segmentId}), activeAreas=[${s.activeAreas.join(", ")}], supportedAreas=[${serviceArea.state.supportedAreas.map((a) => `${a.areaId}:${a.areaInfo.locationInfo?.locationName}`).join(", ")}]`
|
|
166297
166468
|
);
|
|
166298
166469
|
return;
|
|
@@ -166302,14 +166473,14 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
166302
166473
|
s.completedAreas.add(s.lastCurrentArea);
|
|
166303
166474
|
}
|
|
166304
166475
|
s.lastCurrentArea = matchedAreaId;
|
|
166305
|
-
|
|
166476
|
+
logger226.info(
|
|
166306
166477
|
`currentRoom sensor: transition to area ${matchedAreaId} ("${roomName}"), completed: [${[...s.completedAreas].join(", ")}]`
|
|
166307
166478
|
);
|
|
166308
166479
|
this.trySetCurrentArea(matchedAreaId);
|
|
166309
166480
|
} catch (e) {
|
|
166310
166481
|
const msg = e instanceof Error ? e.message : String(e);
|
|
166311
166482
|
if (!msg.includes("No provider for") && !msg.includes("not supported")) {
|
|
166312
|
-
|
|
166483
|
+
logger226.warn(`currentRoom sensor update failed: ${msg}`);
|
|
166313
166484
|
}
|
|
166314
166485
|
}
|
|
166315
166486
|
}
|
|
@@ -166389,7 +166560,7 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
166389
166560
|
cleaned,
|
|
166390
166561
|
ordered
|
|
166391
166562
|
);
|
|
166392
|
-
|
|
166563
|
+
logger226.debug(
|
|
166393
166564
|
`cleanedArea: raw=${raw} baseline=${s.cleanedAreaBaseline} cleaned=${cleaned} sizes=[${ordered.map((o) => `${o.areaId}:${o.sizeSqm}`).join(",")}] -> current=${currentArea} completed=[${completed.join(",")}]`
|
|
166394
166565
|
);
|
|
166395
166566
|
for (const id of completed) {
|
|
@@ -166403,7 +166574,7 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
166403
166574
|
} catch (e) {
|
|
166404
166575
|
const msg = e instanceof Error ? e.message : String(e);
|
|
166405
166576
|
if (!msg.includes("No provider for") && !msg.includes("not supported")) {
|
|
166406
|
-
|
|
166577
|
+
logger226.warn(`cleanedArea room update failed: ${msg}`);
|
|
166407
166578
|
}
|
|
166408
166579
|
}
|
|
166409
166580
|
}
|
|
@@ -166418,7 +166589,7 @@ var RvcRunModeServerBase = class extends RvcRunModeServer {
|
|
|
166418
166589
|
const serviceArea = this.agent.get(ServiceAreaBehavior);
|
|
166419
166590
|
if (serviceArea.state.currentArea !== areaId) {
|
|
166420
166591
|
serviceArea.state.currentArea = areaId;
|
|
166421
|
-
|
|
166592
|
+
logger226.debug(`currentArea set to ${areaId}`);
|
|
166422
166593
|
}
|
|
166423
166594
|
this.updateProgress(serviceArea, areaId);
|
|
166424
166595
|
} catch {
|
|
@@ -166701,7 +166872,7 @@ init_nodejs();
|
|
|
166701
166872
|
|
|
166702
166873
|
// src/matter/behaviors/color-control-server.ts
|
|
166703
166874
|
init_home_assistant_entity_behavior();
|
|
166704
|
-
var
|
|
166875
|
+
var logger227 = Logger.get("ColorControlServer");
|
|
166705
166876
|
var optimisticColorState = /* @__PURE__ */ new Map();
|
|
166706
166877
|
var OPTIMISTIC_TIMEOUT_MS3 = 3e3;
|
|
166707
166878
|
var OPTIMISTIC_TOLERANCE2 = 5;
|
|
@@ -166740,7 +166911,7 @@ var ColorControlServerBase = class extends FeaturedBase8 {
|
|
|
166740
166911
|
if (this.state.startUpColorTemperatureMireds == null) {
|
|
166741
166912
|
this.state.startUpColorTemperatureMireds = defaultMireds;
|
|
166742
166913
|
}
|
|
166743
|
-
|
|
166914
|
+
logger227.debug(
|
|
166744
166915
|
`initialize: set ColorTemperature defaults - min=${this.state.colorTempPhysicalMinMireds}, max=${this.state.colorTempPhysicalMaxMireds}, current=${this.state.colorTemperatureMireds}`
|
|
166745
166916
|
);
|
|
166746
166917
|
}
|
|
@@ -167294,8 +167465,9 @@ init_home_assistant_entity_behavior();
|
|
|
167294
167465
|
|
|
167295
167466
|
// src/matter/behaviors/lock-server.ts
|
|
167296
167467
|
init_esm();
|
|
167468
|
+
init_types2();
|
|
167297
167469
|
init_home_assistant_entity_behavior();
|
|
167298
|
-
var
|
|
167470
|
+
var logger228 = Logger.get("LockServer");
|
|
167299
167471
|
var SUPPORTED_SLOT = 1;
|
|
167300
167472
|
function normalizeSupportedIndex(index) {
|
|
167301
167473
|
if (index === 0 || index === SUPPORTED_SLOT) {
|
|
@@ -167636,7 +167808,7 @@ var LockServerWithPinBase = class extends PinCredentialBase {
|
|
|
167636
167808
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
167637
167809
|
const action = this.state.config.lock(void 0, this.agent);
|
|
167638
167810
|
const hasPinProvided = !!request.pinCode;
|
|
167639
|
-
|
|
167811
|
+
logger228.debug(
|
|
167640
167812
|
`lockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}`
|
|
167641
167813
|
);
|
|
167642
167814
|
if (request.pinCode) {
|
|
@@ -167649,12 +167821,12 @@ var LockServerWithPinBase = class extends PinCredentialBase {
|
|
|
167649
167821
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
167650
167822
|
const action = this.state.config.unlock(void 0, this.agent);
|
|
167651
167823
|
const hasPinProvided = !!request.pinCode;
|
|
167652
|
-
|
|
167824
|
+
logger228.debug(
|
|
167653
167825
|
`unlockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}, requirePin: ${this.state.requirePinForRemoteOperation}`
|
|
167654
167826
|
);
|
|
167655
167827
|
if (this.state.requirePinForRemoteOperation) {
|
|
167656
167828
|
if (!request.pinCode) {
|
|
167657
|
-
|
|
167829
|
+
logger228.info(
|
|
167658
167830
|
`unlockDoor REJECTED for ${homeAssistant.entityId} - no PIN provided`
|
|
167659
167831
|
);
|
|
167660
167832
|
throw new StatusResponseError(
|
|
@@ -167664,12 +167836,12 @@ var LockServerWithPinBase = class extends PinCredentialBase {
|
|
|
167664
167836
|
}
|
|
167665
167837
|
const providedPin = new TextDecoder().decode(request.pinCode);
|
|
167666
167838
|
if (!verifyStoredPinHelper(this.env, homeAssistant.entityId, providedPin)) {
|
|
167667
|
-
|
|
167839
|
+
logger228.info(
|
|
167668
167840
|
`unlockDoor REJECTED for ${homeAssistant.entityId} - invalid PIN`
|
|
167669
167841
|
);
|
|
167670
167842
|
throw new StatusResponseError("Invalid PIN code", StatusCode.Failure);
|
|
167671
167843
|
}
|
|
167672
|
-
|
|
167844
|
+
logger228.debug(`unlockDoor PIN verified for ${homeAssistant.entityId}`);
|
|
167673
167845
|
action.data = { ...action.data, code: providedPin };
|
|
167674
167846
|
}
|
|
167675
167847
|
homeAssistant.callAction(action);
|
|
@@ -167811,7 +167983,7 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
167811
167983
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
167812
167984
|
const action = this.state.config.lock(void 0, this.agent);
|
|
167813
167985
|
const hasPinProvided = !!request.pinCode;
|
|
167814
|
-
|
|
167986
|
+
logger228.debug(
|
|
167815
167987
|
`lockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}`
|
|
167816
167988
|
);
|
|
167817
167989
|
if (request.pinCode) {
|
|
@@ -167825,12 +167997,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
167825
167997
|
const unlatchConfig = this.state.config.unlatch;
|
|
167826
167998
|
const action = unlatchConfig ? unlatchConfig(void 0, this.agent) : this.state.config.unlock(void 0, this.agent);
|
|
167827
167999
|
const hasPinProvided = !!request.pinCode;
|
|
167828
|
-
|
|
168000
|
+
logger228.debug(
|
|
167829
168001
|
`unlockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}, requirePin: ${this.state.requirePinForRemoteOperation}, usingUnlatch: ${!!unlatchConfig}`
|
|
167830
168002
|
);
|
|
167831
168003
|
if (this.state.requirePinForRemoteOperation) {
|
|
167832
168004
|
if (!request.pinCode) {
|
|
167833
|
-
|
|
168005
|
+
logger228.info(
|
|
167834
168006
|
`unlockDoor REJECTED for ${homeAssistant.entityId} - no PIN provided`
|
|
167835
168007
|
);
|
|
167836
168008
|
throw new StatusResponseError(
|
|
@@ -167840,12 +168012,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
167840
168012
|
}
|
|
167841
168013
|
const providedPin = new TextDecoder().decode(request.pinCode);
|
|
167842
168014
|
if (!verifyStoredPinHelper(this.env, homeAssistant.entityId, providedPin)) {
|
|
167843
|
-
|
|
168015
|
+
logger228.info(
|
|
167844
168016
|
`unlockDoor REJECTED for ${homeAssistant.entityId} - invalid PIN`
|
|
167845
168017
|
);
|
|
167846
168018
|
throw new StatusResponseError("Invalid PIN code", StatusCode.Failure);
|
|
167847
168019
|
}
|
|
167848
|
-
|
|
168020
|
+
logger228.debug(`unlockDoor PIN verified for ${homeAssistant.entityId}`);
|
|
167849
168021
|
action.data = { ...action.data, code: providedPin };
|
|
167850
168022
|
}
|
|
167851
168023
|
homeAssistant.callAction(action);
|
|
@@ -167854,12 +168026,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
167854
168026
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
167855
168027
|
const action = this.state.config.unlock(void 0, this.agent);
|
|
167856
168028
|
const hasPinProvided = !!request.pinCode;
|
|
167857
|
-
|
|
168029
|
+
logger228.debug(
|
|
167858
168030
|
`unboltDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}, requirePin: ${this.state.requirePinForRemoteOperation}`
|
|
167859
168031
|
);
|
|
167860
168032
|
if (this.state.requirePinForRemoteOperation) {
|
|
167861
168033
|
if (!request.pinCode) {
|
|
167862
|
-
|
|
168034
|
+
logger228.info(
|
|
167863
168035
|
`unboltDoor REJECTED for ${homeAssistant.entityId} - no PIN provided`
|
|
167864
168036
|
);
|
|
167865
168037
|
throw new StatusResponseError(
|
|
@@ -167869,12 +168041,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
167869
168041
|
}
|
|
167870
168042
|
const providedPin = new TextDecoder().decode(request.pinCode);
|
|
167871
168043
|
if (!verifyStoredPinHelper(this.env, homeAssistant.entityId, providedPin)) {
|
|
167872
|
-
|
|
168044
|
+
logger228.info(
|
|
167873
168045
|
`unboltDoor REJECTED for ${homeAssistant.entityId} - invalid PIN`
|
|
167874
168046
|
);
|
|
167875
168047
|
throw new StatusResponseError("Invalid PIN code", StatusCode.Failure);
|
|
167876
168048
|
}
|
|
167877
|
-
|
|
168049
|
+
logger228.debug(`unboltDoor PIN verified for ${homeAssistant.entityId}`);
|
|
167878
168050
|
action.data = { ...action.data, code: providedPin };
|
|
167879
168051
|
}
|
|
167880
168052
|
homeAssistant.callAction(action);
|
|
@@ -168013,7 +168185,7 @@ init_home_assistant_entity_behavior();
|
|
|
168013
168185
|
init_dist();
|
|
168014
168186
|
init_esm();
|
|
168015
168187
|
init_home_assistant_entity_behavior();
|
|
168016
|
-
var
|
|
168188
|
+
var logger229 = Logger.get("MediaPlayerKeypadInputServer");
|
|
168017
168189
|
var MediaPlayerKeypadInputServer = class extends KeypadInputServer {
|
|
168018
168190
|
sendKey(request) {
|
|
168019
168191
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
@@ -168024,12 +168196,12 @@ var MediaPlayerKeypadInputServer = class extends KeypadInputServer {
|
|
|
168024
168196
|
const features = attributes9.supported_features ?? 0;
|
|
168025
168197
|
const action = this.mapKeyToAction(request.keyCode, features);
|
|
168026
168198
|
if (!action) {
|
|
168027
|
-
|
|
168199
|
+
logger229.debug(
|
|
168028
168200
|
`Unsupported key code ${request.keyCode} for ${homeAssistant.entityId}`
|
|
168029
168201
|
);
|
|
168030
168202
|
return { status: KeypadInput3.Status.UnsupportedKey };
|
|
168031
168203
|
}
|
|
168032
|
-
|
|
168204
|
+
logger229.debug(
|
|
168033
168205
|
`sendKey(${request.keyCode}) \u2192 ${action} for ${homeAssistant.entityId}`
|
|
168034
168206
|
);
|
|
168035
168207
|
homeAssistant.callAction({ action });
|
|
@@ -168308,7 +168480,7 @@ init_home_assistant_entity_behavior();
|
|
|
168308
168480
|
// src/matter/behaviors/speaker-level-control-server.ts
|
|
168309
168481
|
init_esm();
|
|
168310
168482
|
init_home_assistant_entity_behavior();
|
|
168311
|
-
var
|
|
168483
|
+
var logger230 = Logger.get("SpeakerLevelControlServer");
|
|
168312
168484
|
var optimisticLevelState2 = /* @__PURE__ */ new Map();
|
|
168313
168485
|
var OPTIMISTIC_TIMEOUT_MS4 = 3e3;
|
|
168314
168486
|
var OPTIMISTIC_TOLERANCE3 = 5;
|
|
@@ -168351,7 +168523,7 @@ var SpeakerLevelControlServerBase = class extends FeaturedBase9 {
|
|
|
168351
168523
|
currentLevel = Math.min(Math.max(minLevel, currentLevel), maxLevel);
|
|
168352
168524
|
}
|
|
168353
168525
|
const entityId = this.agent.get(HomeAssistantEntityBehavior).entity.entity_id;
|
|
168354
|
-
|
|
168526
|
+
logger230.debug(
|
|
168355
168527
|
`[${entityId}] Volume update: HA=${currentLevelPercent != null ? Math.round(currentLevelPercent * 100) : "null"}% -> currentLevel=${currentLevel}`
|
|
168356
168528
|
);
|
|
168357
168529
|
const optimistic = optimisticLevelState2.get(entity.entity_id);
|
|
@@ -168399,7 +168571,7 @@ var SpeakerLevelControlServerBase = class extends FeaturedBase9 {
|
|
|
168399
168571
|
const config8 = this.state.config;
|
|
168400
168572
|
const entityId = homeAssistant.entity.entity_id;
|
|
168401
168573
|
const levelPercent = level / 254;
|
|
168402
|
-
|
|
168574
|
+
logger230.debug(
|
|
168403
168575
|
`[${entityId}] Volume command: level=${level} -> HA volume_level=${levelPercent}`
|
|
168404
168576
|
);
|
|
168405
168577
|
const current = config8.getValuePercent(
|
|
@@ -169286,6 +169458,7 @@ var ElectricalUtilityMeterType = ElectricalUtilityMeterDevice.with(
|
|
|
169286
169458
|
|
|
169287
169459
|
// src/matter/endpoints/legacy/sensor/devices/energy-evse.ts
|
|
169288
169460
|
init_esm();
|
|
169461
|
+
init_types2();
|
|
169289
169462
|
init_home_assistant_actions();
|
|
169290
169463
|
init_home_assistant_entity_behavior();
|
|
169291
169464
|
|
|
@@ -169343,7 +169516,7 @@ function mapEvseStatus(rawState, chargingSwitchOn) {
|
|
|
169343
169516
|
}
|
|
169344
169517
|
|
|
169345
169518
|
// src/matter/endpoints/legacy/sensor/devices/energy-evse.ts
|
|
169346
|
-
var
|
|
169519
|
+
var logger231 = Logger.get("EnergyEvse");
|
|
169347
169520
|
var MIN_CHARGE_CURRENT_MA = 6e3;
|
|
169348
169521
|
var MAX_CHARGE_CURRENT_MA = 32e3;
|
|
169349
169522
|
var CIRCUIT_CAPACITY_MA = 32e3;
|
|
@@ -169427,7 +169600,7 @@ var EvseStatusServer = class _EvseStatusServer extends EnergyEvseServer {
|
|
|
169427
169600
|
dispatched = true;
|
|
169428
169601
|
}
|
|
169429
169602
|
if (!dispatched) {
|
|
169430
|
-
|
|
169603
|
+
logger231.debug(
|
|
169431
169604
|
`enableCharging ignored for ${homeAssistant.entityId}: no charging switch or current limit mapped`
|
|
169432
169605
|
);
|
|
169433
169606
|
return;
|
|
@@ -169467,7 +169640,7 @@ var EvseStatusServer = class _EvseStatusServer extends EnergyEvseServer {
|
|
|
169467
169640
|
chargingEnabledUntil: null
|
|
169468
169641
|
});
|
|
169469
169642
|
} catch (error) {
|
|
169470
|
-
|
|
169643
|
+
logger231.debug(
|
|
169471
169644
|
`EVSE charge-window expiry write failed (endpoint may be closing): ${error}`
|
|
169472
169645
|
);
|
|
169473
169646
|
} finally {
|
|
@@ -169498,7 +169671,7 @@ var EvseStatusServer = class _EvseStatusServer extends EnergyEvseServer {
|
|
|
169498
169671
|
chargingEnabledUntil: null
|
|
169499
169672
|
});
|
|
169500
169673
|
} else {
|
|
169501
|
-
|
|
169674
|
+
logger231.debug(
|
|
169502
169675
|
`disable ignored for ${homeAssistant.entityId}: no charging switch mapped`
|
|
169503
169676
|
);
|
|
169504
169677
|
}
|
|
@@ -170303,7 +170476,7 @@ var TvocConcentrationMeasurementServer = class extends TvocConcentrationMeasurem
|
|
|
170303
170476
|
};
|
|
170304
170477
|
|
|
170305
170478
|
// src/matter/endpoints/legacy/sensor/devices/tvoc-sensor.ts
|
|
170306
|
-
var
|
|
170479
|
+
var logger232 = Logger.get("TvocSensor");
|
|
170307
170480
|
function airQualityFromUgm3(value) {
|
|
170308
170481
|
if (value <= 300) return AirQuality3.AirQualityEnum.Good;
|
|
170309
170482
|
if (value <= 1e3) return AirQuality3.AirQualityEnum.Fair;
|
|
@@ -170344,17 +170517,17 @@ var TvocAirQualityServer = class extends TvocAirQualityServerBase {
|
|
|
170344
170517
|
const attributes9 = entity.state.attributes;
|
|
170345
170518
|
const deviceClass = attributes9.device_class;
|
|
170346
170519
|
let airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
170347
|
-
|
|
170520
|
+
logger232.debug(
|
|
170348
170521
|
`[${entity.entity_id}] TVOC update: state="${state}", device_class="${deviceClass}"`
|
|
170349
170522
|
);
|
|
170350
170523
|
if (state != null && !Number.isNaN(+state)) {
|
|
170351
170524
|
const value = +state;
|
|
170352
170525
|
airQuality = deviceClass === SensorDeviceClass.volatile_organic_compounds ? airQualityFromUgm3(value) : airQualityFromPpb(value);
|
|
170353
|
-
|
|
170526
|
+
logger232.debug(
|
|
170354
170527
|
`[${entity.entity_id}] TVOC value=${value} (${deviceClass}) -> airQuality=${AirQuality3.AirQualityEnum[airQuality]}`
|
|
170355
170528
|
);
|
|
170356
170529
|
} else {
|
|
170357
|
-
|
|
170530
|
+
logger232.warn(
|
|
170358
170531
|
`[${entity.entity_id}] TVOC state not a valid number: "${state}"`
|
|
170359
170532
|
);
|
|
170360
170533
|
}
|
|
@@ -170371,6 +170544,7 @@ var TvocSensorType = AirQualitySensorDevice.with(
|
|
|
170371
170544
|
|
|
170372
170545
|
// src/matter/endpoints/legacy/sensor/index.ts
|
|
170373
170546
|
init_dist();
|
|
170547
|
+
init_types2();
|
|
170374
170548
|
init_diagnostic_event_bus();
|
|
170375
170549
|
|
|
170376
170550
|
// src/matter/behaviors/carbon-dioxide-concentration-measurement-server.ts
|
|
@@ -170568,7 +170742,7 @@ init_home_assistant_entity_behavior();
|
|
|
170568
170742
|
// src/matter/behaviors/pm25-concentration-measurement-server.ts
|
|
170569
170743
|
init_esm();
|
|
170570
170744
|
init_home_assistant_entity_behavior();
|
|
170571
|
-
var
|
|
170745
|
+
var logger233 = Logger.get("Pm25ConcentrationMeasurementServer");
|
|
170572
170746
|
var Pm25ConcentrationMeasurementServerBase = Pm25ConcentrationMeasurementServer.with(
|
|
170573
170747
|
ConcentrationMeasurement3.Feature.NumericMeasurement
|
|
170574
170748
|
);
|
|
@@ -170592,11 +170766,11 @@ var Pm25ConcentrationMeasurementServer2 = class extends Pm25ConcentrationMeasure
|
|
|
170592
170766
|
if (this.state.measurementMedium === void 0) {
|
|
170593
170767
|
this.state.measurementMedium = ConcentrationMeasurement3.MeasurementMedium.Air;
|
|
170594
170768
|
}
|
|
170595
|
-
|
|
170769
|
+
logger233.debug(
|
|
170596
170770
|
"Pm25ConcentrationMeasurementServer: before super.initialize()"
|
|
170597
170771
|
);
|
|
170598
170772
|
await super.initialize();
|
|
170599
|
-
|
|
170773
|
+
logger233.debug(
|
|
170600
170774
|
"Pm25ConcentrationMeasurementServer: after super.initialize()"
|
|
170601
170775
|
);
|
|
170602
170776
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
@@ -170619,7 +170793,7 @@ var Pm25ConcentrationMeasurementServer2 = class extends Pm25ConcentrationMeasure
|
|
|
170619
170793
|
};
|
|
170620
170794
|
|
|
170621
170795
|
// src/matter/endpoints/legacy/sensor/devices/pm25-sensor.ts
|
|
170622
|
-
var
|
|
170796
|
+
var logger234 = Logger.get("Pm25AirQualityServer");
|
|
170623
170797
|
var Pm25AirQualityServerBase = AirQualityServer.with(
|
|
170624
170798
|
AirQuality3.Feature.Fair,
|
|
170625
170799
|
AirQuality3.Feature.Moderate,
|
|
@@ -170631,9 +170805,9 @@ var Pm25AirQualityServer = class extends Pm25AirQualityServerBase {
|
|
|
170631
170805
|
if (this.state.airQuality === void 0) {
|
|
170632
170806
|
this.state.airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
170633
170807
|
}
|
|
170634
|
-
|
|
170808
|
+
logger234.debug("Pm25AirQualityServer: before super.initialize()");
|
|
170635
170809
|
await super.initialize();
|
|
170636
|
-
|
|
170810
|
+
logger234.debug("Pm25AirQualityServer: after super.initialize()");
|
|
170637
170811
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
170638
170812
|
this.update(homeAssistant.entity);
|
|
170639
170813
|
this.reactTo(homeAssistant.onChange, this.update, { offline: true });
|
|
@@ -171058,56 +171232,25 @@ init_home_assistant_entity_behavior();
|
|
|
171058
171232
|
init_dist();
|
|
171059
171233
|
init_esm();
|
|
171060
171234
|
init_home_assistant_entity_behavior();
|
|
171061
|
-
var
|
|
171062
|
-
var IDENTIFY_BUTTON_SUFFIXES = ["_identify", "_locate", "_find_me"];
|
|
171235
|
+
var logger235 = Logger.get("VacuumIdentifyServer");
|
|
171063
171236
|
var VacuumIdentifyServer = class extends IdentifyServer2 {
|
|
171064
|
-
|
|
171065
|
-
this.#locate("triggerEffect");
|
|
171066
|
-
return super.triggerEffect(effect);
|
|
171067
|
-
}
|
|
171068
|
-
identify(request) {
|
|
171069
|
-
if (request.identifyTime > 0) {
|
|
171070
|
-
this.#locate("identify");
|
|
171071
|
-
}
|
|
171072
|
-
return super.identify(request);
|
|
171073
|
-
}
|
|
171074
|
-
#locate(source) {
|
|
171237
|
+
identifyInHomeAssistant(source) {
|
|
171075
171238
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
171076
171239
|
const features = homeAssistant.entity.state.attributes.supported_features ?? 0;
|
|
171077
171240
|
if (testBit(features, VacuumDeviceFeature.LOCATE)) {
|
|
171078
|
-
|
|
171241
|
+
logger235.info(`${source} \u2192 vacuum.locate for ${homeAssistant.entityId}`);
|
|
171079
171242
|
homeAssistant.callAction({ action: "vacuum.locate" });
|
|
171080
171243
|
return;
|
|
171081
171244
|
}
|
|
171082
|
-
|
|
171083
|
-
|
|
171084
|
-
logger234.info(
|
|
171085
|
-
`${source} \u2192 button.press ${sibling} for ${homeAssistant.entityId}`
|
|
171086
|
-
);
|
|
171087
|
-
homeAssistant.callAction({ action: "button.press", target: sibling });
|
|
171245
|
+
if (this.findIdentifyEntity(homeAssistant)) {
|
|
171246
|
+
super.identifyInHomeAssistant(source);
|
|
171088
171247
|
return;
|
|
171089
171248
|
}
|
|
171090
|
-
|
|
171249
|
+
logger235.warn(
|
|
171091
171250
|
`${source} for ${homeAssistant.entityId}, LOCATE not in supported_features (${features}), trying vacuum.locate anyway`
|
|
171092
171251
|
);
|
|
171093
171252
|
homeAssistant.callAction({ action: "vacuum.locate" });
|
|
171094
171253
|
}
|
|
171095
|
-
#findIdentifyButton(homeAssistant) {
|
|
171096
|
-
const deviceId = homeAssistant.entity.registry?.device_id;
|
|
171097
|
-
if (!deviceId) return void 0;
|
|
171098
|
-
const registry3 = this.env.get(HomeAssistantRegistry);
|
|
171099
|
-
for (const entity of Object.values(registry3.entities)) {
|
|
171100
|
-
if (entity.device_id !== deviceId) continue;
|
|
171101
|
-
if (!entity.entity_id.startsWith("button.")) continue;
|
|
171102
|
-
const uniqueId = entity.unique_id ?? "";
|
|
171103
|
-
if (IDENTIFY_BUTTON_SUFFIXES.some(
|
|
171104
|
-
(s) => entity.entity_id.endsWith(s) || uniqueId.endsWith(s)
|
|
171105
|
-
)) {
|
|
171106
|
-
return entity.entity_id;
|
|
171107
|
-
}
|
|
171108
|
-
}
|
|
171109
|
-
return void 0;
|
|
171110
|
-
}
|
|
171111
171254
|
};
|
|
171112
171255
|
|
|
171113
171256
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-run-mode-server.ts
|
|
@@ -171287,7 +171430,7 @@ init_esm();
|
|
|
171287
171430
|
// src/matter/behaviors/service-area-server.ts
|
|
171288
171431
|
init_esm();
|
|
171289
171432
|
init_home_assistant_entity_behavior();
|
|
171290
|
-
var
|
|
171433
|
+
var logger236 = Logger.get("ServiceAreaServer");
|
|
171291
171434
|
function orderSelection(areas, agent) {
|
|
171292
171435
|
try {
|
|
171293
171436
|
const ascending = agent?.get(HomeAssistantEntityBehavior).state.mapping?.vacuumAscendingRoomOrder === true;
|
|
@@ -171302,7 +171445,7 @@ var ServiceAreaWithProgress = ServiceAreaBehavior.with(
|
|
|
171302
171445
|
var ServiceAreaServerBase = class extends ServiceAreaWithProgress {
|
|
171303
171446
|
selectAreas(request) {
|
|
171304
171447
|
const { newAreas } = request;
|
|
171305
|
-
|
|
171448
|
+
logger236.info(
|
|
171306
171449
|
`ServiceArea selectAreas called with: ${JSON.stringify(newAreas)}`
|
|
171307
171450
|
);
|
|
171308
171451
|
const uniqueAreas = orderSelection([...new Set(newAreas)], this.agent);
|
|
@@ -171311,7 +171454,7 @@ var ServiceAreaServerBase = class extends ServiceAreaWithProgress {
|
|
|
171311
171454
|
(id) => !supportedAreaIds.includes(id)
|
|
171312
171455
|
);
|
|
171313
171456
|
if (invalidAreas.length > 0) {
|
|
171314
|
-
|
|
171457
|
+
logger236.warn(`Invalid area IDs requested: ${invalidAreas.join(", ")}`);
|
|
171315
171458
|
return {
|
|
171316
171459
|
status: ServiceArea3.SelectAreasStatus.UnsupportedArea,
|
|
171317
171460
|
statusText: `Invalid area IDs: ${invalidAreas.join(", ")}`
|
|
@@ -171323,7 +171466,7 @@ var ServiceAreaServerBase = class extends ServiceAreaWithProgress {
|
|
|
171323
171466
|
status: ServiceArea3.OperationalStatus.Pending
|
|
171324
171467
|
}));
|
|
171325
171468
|
this.state.currentArea = null;
|
|
171326
|
-
|
|
171469
|
+
logger236.info(
|
|
171327
171470
|
`ServiceArea: Stored ${uniqueAreas.length} areas for cleaning: ${uniqueAreas.join(", ")}`
|
|
171328
171471
|
);
|
|
171329
171472
|
return {
|
|
@@ -171344,7 +171487,7 @@ var ServiceAreaServerBase = class extends ServiceAreaWithProgress {
|
|
|
171344
171487
|
ServiceAreaServerBase2.State = State;
|
|
171345
171488
|
})(ServiceAreaServerBase || (ServiceAreaServerBase = {}));
|
|
171346
171489
|
function ServiceAreaServer2(initialState) {
|
|
171347
|
-
|
|
171490
|
+
logger236.info(
|
|
171348
171491
|
`Creating ServiceAreaServer with ${initialState.supportedAreas.length} areas`
|
|
171349
171492
|
);
|
|
171350
171493
|
return ServiceAreaServerBase.set({
|
|
@@ -171361,7 +171504,7 @@ var ServiceAreaWithMapsAndProgress = ServiceAreaBehavior.with(
|
|
|
171361
171504
|
var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMapsAndProgress {
|
|
171362
171505
|
selectAreas(request) {
|
|
171363
171506
|
const { newAreas } = request;
|
|
171364
|
-
|
|
171507
|
+
logger236.info(
|
|
171365
171508
|
`ServiceArea selectAreas called with: ${JSON.stringify(newAreas)}`
|
|
171366
171509
|
);
|
|
171367
171510
|
const uniqueAreas = orderSelection([...new Set(newAreas)], this.agent);
|
|
@@ -171370,7 +171513,7 @@ var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMapsAndProgress
|
|
|
171370
171513
|
(id) => !supportedAreaIds.includes(id)
|
|
171371
171514
|
);
|
|
171372
171515
|
if (invalidAreas.length > 0) {
|
|
171373
|
-
|
|
171516
|
+
logger236.warn(`Invalid area IDs requested: ${invalidAreas.join(", ")}`);
|
|
171374
171517
|
return {
|
|
171375
171518
|
status: ServiceArea3.SelectAreasStatus.UnsupportedArea,
|
|
171376
171519
|
statusText: `Invalid area IDs: ${invalidAreas.join(", ")}`
|
|
@@ -171382,7 +171525,7 @@ var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMapsAndProgress
|
|
|
171382
171525
|
status: ServiceArea3.OperationalStatus.Pending
|
|
171383
171526
|
}));
|
|
171384
171527
|
this.state.currentArea = null;
|
|
171385
|
-
|
|
171528
|
+
logger236.info(
|
|
171386
171529
|
`ServiceArea: Stored ${uniqueAreas.length} areas for cleaning: ${uniqueAreas.join(", ")}`
|
|
171387
171530
|
);
|
|
171388
171531
|
return {
|
|
@@ -171403,14 +171546,14 @@ var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMapsAndProgress
|
|
|
171403
171546
|
ServiceAreaServerWithMapsBase2.State = State;
|
|
171404
171547
|
})(ServiceAreaServerWithMapsBase || (ServiceAreaServerWithMapsBase = {}));
|
|
171405
171548
|
function ServiceAreaServerWithMaps(initialState) {
|
|
171406
|
-
|
|
171549
|
+
logger236.info(
|
|
171407
171550
|
`Creating ServiceAreaServer with Maps: ${initialState.supportedAreas.length} areas, ${initialState.supportedMaps.length} maps`
|
|
171408
171551
|
);
|
|
171409
171552
|
for (const map of initialState.supportedMaps) {
|
|
171410
171553
|
const areaCount = initialState.supportedAreas.filter(
|
|
171411
171554
|
(a) => a.mapId === map.mapId
|
|
171412
171555
|
).length;
|
|
171413
|
-
|
|
171556
|
+
logger236.info(` Map ${map.mapId}: "${map.name}" (${areaCount} areas)`);
|
|
171414
171557
|
}
|
|
171415
171558
|
return ServiceAreaServerWithMapsBase.set({
|
|
171416
171559
|
supportedAreas: initialState.supportedAreas,
|
|
@@ -171422,7 +171565,7 @@ function ServiceAreaServerWithMaps(initialState) {
|
|
|
171422
171565
|
}
|
|
171423
171566
|
|
|
171424
171567
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-service-area-server.ts
|
|
171425
|
-
var
|
|
171568
|
+
var logger237 = Logger.get("VacuumServiceAreaServer");
|
|
171426
171569
|
function toAreaId(roomId) {
|
|
171427
171570
|
if (typeof roomId === "number") {
|
|
171428
171571
|
return roomId;
|
|
@@ -171501,13 +171644,13 @@ function createVacuumServiceAreaServer(attributes9, roomEntities, includeUnnamed
|
|
|
171501
171644
|
let rooms;
|
|
171502
171645
|
if (roomEntities && roomEntities.length > 0) {
|
|
171503
171646
|
rooms = buttonEntitiesToRooms(roomEntities, attributes9);
|
|
171504
|
-
|
|
171647
|
+
logger237.info(
|
|
171505
171648
|
`Using ${rooms.length} button entities as rooms: ${rooms.map((r) => r.name).join(", ")}`
|
|
171506
171649
|
);
|
|
171507
171650
|
} else {
|
|
171508
171651
|
rooms = parseVacuumRooms(attributes9, includeUnnamedRooms);
|
|
171509
171652
|
if (rooms.length > 0) {
|
|
171510
|
-
|
|
171653
|
+
logger237.info(
|
|
171511
171654
|
`Using ${rooms.length} rooms from attributes: ${rooms.map((r) => r.name).join(", ")}`
|
|
171512
171655
|
);
|
|
171513
171656
|
}
|
|
@@ -171561,7 +171704,7 @@ function createCustomServiceAreaServer(customAreas) {
|
|
|
171561
171704
|
landmarkInfo: null
|
|
171562
171705
|
}
|
|
171563
171706
|
}));
|
|
171564
|
-
|
|
171707
|
+
logger237.info(
|
|
171565
171708
|
`Using ${customAreas.length} custom service areas: ${customAreas.map((a) => a.name).join(", ")}`
|
|
171566
171709
|
);
|
|
171567
171710
|
return ServiceAreaServer2({
|
|
@@ -171583,7 +171726,7 @@ function createCleanAreaServiceAreaServer(cleanAreaRooms) {
|
|
|
171583
171726
|
landmarkInfo: null
|
|
171584
171727
|
}
|
|
171585
171728
|
}));
|
|
171586
|
-
|
|
171729
|
+
logger237.info(
|
|
171587
171730
|
`Using ${cleanAreaRooms.length} HA areas via CLEAN_AREA: ${cleanAreaRooms.map((r) => r.name).join(", ")}`
|
|
171588
171731
|
);
|
|
171589
171732
|
return ServiceAreaServer2({
|
|
@@ -171619,11 +171762,11 @@ function getVacuumServiceAreas(attributes9, mapping) {
|
|
|
171619
171762
|
}
|
|
171620
171763
|
|
|
171621
171764
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-run-mode-server.ts
|
|
171622
|
-
var
|
|
171765
|
+
var logger238 = Logger.get("VacuumRvcRunModeServer");
|
|
171623
171766
|
function buildValetudoSegmentAction(vacuumEntityId, segmentIds, valetudoIdentifier) {
|
|
171624
171767
|
const identifier = valetudoIdentifier || vacuumEntityId.replace(/^vacuum\.valetudo_/, "");
|
|
171625
171768
|
const topic = `valetudo/${identifier}/MapSegmentationCapability/clean/set`;
|
|
171626
|
-
|
|
171769
|
+
logger238.info(
|
|
171627
171770
|
`Valetudo: mqtt.publish to ${topic}, segments: ${segmentIds.join(", ")}`
|
|
171628
171771
|
);
|
|
171629
171772
|
return {
|
|
@@ -171728,14 +171871,14 @@ function mergeBatchData(areas) {
|
|
|
171728
171871
|
function handleCustomServiceAreas(selectedAreas, customAreas, session) {
|
|
171729
171872
|
const matched = selectedAreas.map((areaId) => ({ areaId, area: customAreas[areaId - 1] })).filter((m) => !!m.area);
|
|
171730
171873
|
if (matched.length === 0) {
|
|
171731
|
-
|
|
171874
|
+
logger238.warn(
|
|
171732
171875
|
`Custom service areas: no match for selected IDs ${selectedAreas.join(", ")}`
|
|
171733
171876
|
);
|
|
171734
171877
|
return { action: "vacuum.start" };
|
|
171735
171878
|
}
|
|
171736
171879
|
const batchArea = matched.find(({ area }) => area.batchDispatch === true);
|
|
171737
171880
|
if (batchArea) {
|
|
171738
|
-
|
|
171881
|
+
logger238.info(
|
|
171739
171882
|
`Custom service areas (batch): single call for ${matched.length} room(s): ${matched.map(({ area }) => area.name).join(", ")}`
|
|
171740
171883
|
);
|
|
171741
171884
|
session.pendingDispatches = [];
|
|
@@ -171756,7 +171899,7 @@ function handleCustomServiceAreas(selectedAreas, customAreas, session) {
|
|
|
171756
171899
|
}
|
|
171757
171900
|
};
|
|
171758
171901
|
}
|
|
171759
|
-
|
|
171902
|
+
logger238.info(
|
|
171760
171903
|
`Custom service areas: ${matched.length} room(s) queued: ${matched.map(({ area }) => `${area.service} (${area.name})`).join(", ")}`
|
|
171761
171904
|
);
|
|
171762
171905
|
session.pendingDispatches = matched.slice(1).map(({ areaId, area }) => ({
|
|
@@ -171814,7 +171957,7 @@ function dispatchRoomClean(attributes9, mapping, entityId, selectedAreas, seam)
|
|
|
171814
171957
|
if (cleanAreaRooms && cleanAreaRooms.length > 0) {
|
|
171815
171958
|
const haAreaIds = resolveCleanAreaIds(selectedAreas, cleanAreaRooms);
|
|
171816
171959
|
if (haAreaIds.length > 0) {
|
|
171817
|
-
|
|
171960
|
+
logger238.info(`CLEAN_AREA: cleaning HA areas: ${haAreaIds.join(", ")}`);
|
|
171818
171961
|
return {
|
|
171819
171962
|
action: {
|
|
171820
171963
|
action: "vacuum.clean_area",
|
|
@@ -171834,7 +171977,7 @@ function dispatchRoomClean(attributes9, mapping, entityId, selectedAreas, seam)
|
|
|
171834
171977
|
}
|
|
171835
171978
|
}
|
|
171836
171979
|
if (matched.length > 0) {
|
|
171837
|
-
|
|
171980
|
+
logger238.info(
|
|
171838
171981
|
`Roborock: ${matched.length} room button(s) queued: ${matched.map((m) => m.entityId).join(", ")}`
|
|
171839
171982
|
);
|
|
171840
171983
|
return {
|
|
@@ -171869,12 +172012,12 @@ function dispatchRoomClean(attributes9, mapping, entityId, selectedAreas, seam)
|
|
|
171869
172012
|
}
|
|
171870
172013
|
}
|
|
171871
172014
|
if (roomIds.length > 0) {
|
|
171872
|
-
|
|
172015
|
+
logger238.info(`Starting cleaning with selected areas: ${roomIds.join(", ")}`);
|
|
171873
172016
|
if (isDreameVacuum(attributes9)) {
|
|
171874
172017
|
if (targetMapName) {
|
|
171875
172018
|
const vacName = entityId.replace("vacuum.", "");
|
|
171876
172019
|
const selectedMapEntity = `select.${vacName}_selected_map`;
|
|
171877
|
-
|
|
172020
|
+
logger238.info(
|
|
171878
172021
|
`Dreame multi-floor: switching to map "${targetMapName}" via ${selectedMapEntity}`
|
|
171879
172022
|
);
|
|
171880
172023
|
seam.callAction({
|
|
@@ -171902,7 +172045,7 @@ function dispatchRoomClean(attributes9, mapping, entityId, selectedAreas, seam)
|
|
|
171902
172045
|
}
|
|
171903
172046
|
if (isEcovacsVacuum(attributes9)) {
|
|
171904
172047
|
const roomIdStr = roomIds.join(",");
|
|
171905
|
-
|
|
172048
|
+
logger238.info(`Ecovacs vacuum: Using spot_area for rooms: ${roomIdStr}`);
|
|
171906
172049
|
return {
|
|
171907
172050
|
action: {
|
|
171908
172051
|
action: "vacuum.send_command",
|
|
@@ -171914,7 +172057,7 @@ function dispatchRoomClean(attributes9, mapping, entityId, selectedAreas, seam)
|
|
|
171914
172057
|
pending: []
|
|
171915
172058
|
};
|
|
171916
172059
|
}
|
|
171917
|
-
|
|
172060
|
+
logger238.warn(
|
|
171918
172061
|
`Room cleaning via send_command not supported for this vacuum type. Rooms: ${roomIds.join(", ")}. Falling back to vacuum.start`
|
|
171919
172062
|
);
|
|
171920
172063
|
}
|
|
@@ -171923,7 +172066,7 @@ function dispatchRoomClean(attributes9, mapping, entityId, selectedAreas, seam)
|
|
|
171923
172066
|
var vacuumRvcRunModeConfig = {
|
|
171924
172067
|
getCurrentMode: (entity) => {
|
|
171925
172068
|
const isCleaning = vacuumIsCleaning(entity.state);
|
|
171926
|
-
|
|
172069
|
+
logger238.debug(
|
|
171927
172070
|
`Vacuum state: "${entity.state}", isCleaning: ${isCleaning}, currentMode: ${isCleaning ? "Cleaning" : "Idle"}`
|
|
171928
172071
|
);
|
|
171929
172072
|
return isCleaning ? 1 /* Cleaning */ : 0 /* Idle */;
|
|
@@ -171962,7 +172105,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
171962
172105
|
}
|
|
171963
172106
|
} catch {
|
|
171964
172107
|
}
|
|
171965
|
-
|
|
172108
|
+
logger238.info("Starting regular cleaning (no areas selected)");
|
|
171966
172109
|
return { action: "vacuum.start" };
|
|
171967
172110
|
},
|
|
171968
172111
|
returnToBase: () => ({ action: "vacuum.return_to_base" }),
|
|
@@ -171977,7 +172120,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
171977
172120
|
const homeAssistant = agent.get(HomeAssistantEntityBehavior);
|
|
171978
172121
|
const entity = homeAssistant.entity;
|
|
171979
172122
|
const attributes9 = entity.state.attributes;
|
|
171980
|
-
|
|
172123
|
+
logger238.info(`cleanRoom called: roomMode=${roomMode}`);
|
|
171981
172124
|
const cleanAreaRooms = homeAssistant.state.mapping?.cleanAreaRooms;
|
|
171982
172125
|
if (cleanAreaRooms && cleanAreaRooms.length > 0) {
|
|
171983
172126
|
const sorted = [...cleanAreaRooms].sort(
|
|
@@ -171986,7 +172129,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
171986
172129
|
const areaIndex = roomMode - ROOM_MODE_BASE2 - 1;
|
|
171987
172130
|
if (areaIndex >= 0 && areaIndex < sorted.length) {
|
|
171988
172131
|
const area = sorted[areaIndex];
|
|
171989
|
-
|
|
172132
|
+
logger238.info(
|
|
171990
172133
|
`cleanRoom: CLEAN_AREA "${area.name}" \u2192 vacuum.clean_area(${area.haAreaId})`
|
|
171991
172134
|
);
|
|
171992
172135
|
return {
|
|
@@ -172003,7 +172146,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
172003
172146
|
const areaIndex = roomMode - ROOM_MODE_BASE2 - 1;
|
|
172004
172147
|
if (areaIndex >= 0 && areaIndex < sorted.length) {
|
|
172005
172148
|
const area = sorted[areaIndex];
|
|
172006
|
-
|
|
172149
|
+
logger238.info(
|
|
172007
172150
|
`cleanRoom: custom service area "${area.name}" \u2192 ${area.service}`
|
|
172008
172151
|
);
|
|
172009
172152
|
return {
|
|
@@ -172024,7 +172167,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
172024
172167
|
}
|
|
172025
172168
|
const rooms = parseVacuumRooms(attributes9);
|
|
172026
172169
|
const numericIdFromMode = getRoomIdFromMode(roomMode);
|
|
172027
|
-
|
|
172170
|
+
logger238.info(
|
|
172028
172171
|
`cleanRoom: numericIdFromMode=${numericIdFromMode}, available rooms: ${JSON.stringify(rooms.map((r) => ({ id: r.id, name: r.name, modeValue: getRoomModeValue(r) })))}`
|
|
172029
172172
|
);
|
|
172030
172173
|
const room = rooms.find((r) => getRoomModeValue(r) === roomMode);
|
|
@@ -172034,7 +172177,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
172034
172177
|
if (room.mapName) {
|
|
172035
172178
|
const vacuumName = vacuumEntityId.replace("vacuum.", "");
|
|
172036
172179
|
const selectedMapEntity = `select.${vacuumName}_selected_map`;
|
|
172037
|
-
|
|
172180
|
+
logger238.info(
|
|
172038
172181
|
`Dreame multi-floor: switching to map "${room.mapName}" via ${selectedMapEntity}`
|
|
172039
172182
|
);
|
|
172040
172183
|
homeAssistant.callAction({
|
|
@@ -172043,7 +172186,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
172043
172186
|
data: { option: room.mapName }
|
|
172044
172187
|
});
|
|
172045
172188
|
}
|
|
172046
|
-
|
|
172189
|
+
logger238.debug(
|
|
172047
172190
|
`Dreame vacuum detected, using dreame_vacuum.vacuum_clean_segment for room ${room.name} (commandId: ${commandId3}, id: ${room.id})`
|
|
172048
172191
|
);
|
|
172049
172192
|
return {
|
|
@@ -172054,7 +172197,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
172054
172197
|
};
|
|
172055
172198
|
}
|
|
172056
172199
|
if (isRoborockVacuum(attributes9) || isXiaomiMiotVacuum(attributes9)) {
|
|
172057
|
-
|
|
172200
|
+
logger238.debug(
|
|
172058
172201
|
`Using vacuum.send_command with app_segment_clean for room ${room.name} (commandId: ${commandId3}, id: ${room.id})`
|
|
172059
172202
|
);
|
|
172060
172203
|
return {
|
|
@@ -172067,7 +172210,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
172067
172210
|
}
|
|
172068
172211
|
if (isEcovacsVacuum(attributes9)) {
|
|
172069
172212
|
const roomIdStr = String(commandId3);
|
|
172070
|
-
|
|
172213
|
+
logger238.info(
|
|
172071
172214
|
`Ecovacs vacuum: Using spot_area for room ${room.name} (id: ${roomIdStr})`
|
|
172072
172215
|
);
|
|
172073
172216
|
return {
|
|
@@ -172082,7 +172225,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
172082
172225
|
}
|
|
172083
172226
|
};
|
|
172084
172227
|
}
|
|
172085
|
-
|
|
172228
|
+
logger238.warn(
|
|
172086
172229
|
`Room cleaning via send_command not supported for this vacuum type. Room: ${room.name} (id=${commandId3}). Falling back to vacuum.start`
|
|
172087
172230
|
);
|
|
172088
172231
|
}
|
|
@@ -172099,20 +172242,20 @@ function createVacuumRvcRunModeServer(attributes9, includeUnnamedRooms = false,
|
|
|
172099
172242
|
customAreas,
|
|
172100
172243
|
disableRoomModes
|
|
172101
172244
|
);
|
|
172102
|
-
|
|
172245
|
+
logger238.info(
|
|
172103
172246
|
`Creating VacuumRvcRunModeServer with ${rooms.length} rooms, ${supportedModes2.length} total modes`
|
|
172104
172247
|
);
|
|
172105
172248
|
if (rooms.length > 0) {
|
|
172106
|
-
|
|
172249
|
+
logger238.info(`Rooms found: ${rooms.map((r) => r.name).join(", ")}`);
|
|
172107
172250
|
}
|
|
172108
172251
|
if (filteredCount > 0) {
|
|
172109
172252
|
const filtered = allRooms.filter((r) => !rooms.some((x) => x.id === r.id));
|
|
172110
|
-
|
|
172253
|
+
logger238.info(
|
|
172111
172254
|
`Filtered out ${filteredCount} unnamed room(s): ${filtered.map((r) => r.name).join(", ")}`
|
|
172112
172255
|
);
|
|
172113
172256
|
}
|
|
172114
172257
|
if (allRooms.length === 0) {
|
|
172115
|
-
|
|
172258
|
+
logger238.debug(
|
|
172116
172259
|
`No rooms found. Attributes: rooms=${JSON.stringify(attributes9.rooms)}, segments=${JSON.stringify(attributes9.segments)}, room_list=${attributes9.room_list}`
|
|
172117
172260
|
);
|
|
172118
172261
|
}
|
|
@@ -172146,7 +172289,7 @@ function createCleanAreaRvcRunModeServer(cleanAreaRooms) {
|
|
|
172146
172289
|
modeTags: [{ value: RvcRunMode3.ModeTag.Cleaning }]
|
|
172147
172290
|
});
|
|
172148
172291
|
}
|
|
172149
|
-
|
|
172292
|
+
logger238.info(
|
|
172150
172293
|
`Creating CLEAN_AREA RvcRunModeServer with ${cleanAreaRooms.length} HA areas, ${modes.length} total modes`
|
|
172151
172294
|
);
|
|
172152
172295
|
return RvcRunModeServer2(vacuumRvcRunModeConfig, {
|
|
@@ -172236,7 +172379,7 @@ init_nodejs();
|
|
|
172236
172379
|
|
|
172237
172380
|
// src/matter/behaviors/rvc-clean-mode-server.ts
|
|
172238
172381
|
init_home_assistant_entity_behavior();
|
|
172239
|
-
var
|
|
172382
|
+
var logger239 = Logger.get("RvcCleanModeServerBase");
|
|
172240
172383
|
var RvcCleanModeServerBase = class _RvcCleanModeServerBase extends RvcCleanModeServer {
|
|
172241
172384
|
// Pending mode from a recent changeToMode command.
|
|
172242
172385
|
// Prevents stale HA state (from a different entity like select.xxx)
|
|
@@ -172283,14 +172426,14 @@ var RvcCleanModeServerBase = class _RvcCleanModeServerBase extends RvcCleanModeS
|
|
|
172283
172426
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
172284
172427
|
const { newMode } = request;
|
|
172285
172428
|
if (newMode !== this.state.currentMode && !this.state.supportedModes.some((m) => m.mode === newMode)) {
|
|
172286
|
-
|
|
172429
|
+
logger239.warn(`changeToMode(${newMode}) rejected: unsupported mode`);
|
|
172287
172430
|
return {
|
|
172288
172431
|
status: ModeBase3.ModeChangeStatus.UnsupportedMode,
|
|
172289
172432
|
statusText: `Unsupported mode: ${newMode}`
|
|
172290
172433
|
};
|
|
172291
172434
|
}
|
|
172292
172435
|
const modeLabel = this.state.supportedModes.find((m) => m.mode === newMode);
|
|
172293
|
-
|
|
172436
|
+
logger239.info(
|
|
172294
172437
|
`changeToMode(${newMode}) "${modeLabel?.label ?? "unknown"}" for ${homeAssistant.entityId}`
|
|
172295
172438
|
);
|
|
172296
172439
|
this.pendingMode = newMode;
|
|
@@ -172298,7 +172441,7 @@ var RvcCleanModeServerBase = class _RvcCleanModeServerBase extends RvcCleanModeS
|
|
|
172298
172441
|
this.state.currentMode = newMode;
|
|
172299
172442
|
const action = this.state.config.setCleanMode(newMode, this.agent);
|
|
172300
172443
|
if (action) {
|
|
172301
|
-
|
|
172444
|
+
logger239.info(
|
|
172302
172445
|
`changeToMode: dispatching action ${action.action} \u2192 ${action.target ?? homeAssistant.entityId}`
|
|
172303
172446
|
);
|
|
172304
172447
|
homeAssistant.callAction(action);
|
|
@@ -172331,7 +172474,7 @@ function RvcCleanModeServer2(config8, initialState) {
|
|
|
172331
172474
|
}
|
|
172332
172475
|
|
|
172333
172476
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-clean-mode-server.ts
|
|
172334
|
-
var
|
|
172477
|
+
var logger240 = Logger.get("VacuumRvcCleanModeServer");
|
|
172335
172478
|
var MODE_VACUUM = 0;
|
|
172336
172479
|
var MODE_VACUUM_AND_MOP = 1;
|
|
172337
172480
|
var MODE_MOP = 2;
|
|
@@ -172601,7 +172744,7 @@ function findMatchingCleanOption(ct, availableOptions) {
|
|
|
172601
172744
|
const match = availableOptions.find((o) => classifyCleanOption(o) === type);
|
|
172602
172745
|
if (match) return match;
|
|
172603
172746
|
}
|
|
172604
|
-
|
|
172747
|
+
logger240.warn(
|
|
172605
172748
|
`No match for ${CLEAN_TYPE_LABELS[ct]} in [${availableOptions.join(", ")}]`
|
|
172606
172749
|
);
|
|
172607
172750
|
return availableOptions[0];
|
|
@@ -172610,7 +172753,7 @@ function buildCleaningModeAction(targetCleanType, agent) {
|
|
|
172610
172753
|
const selectEntityId = getCleaningModeSelectEntity(agent);
|
|
172611
172754
|
const { options } = readSelectEntity(selectEntityId, agent);
|
|
172612
172755
|
const optionToUse = findMatchingCleanOption(targetCleanType, options);
|
|
172613
|
-
|
|
172756
|
+
logger240.info(
|
|
172614
172757
|
`Switching cleaning mode to: ${optionToUse} via ${selectEntityId}`
|
|
172615
172758
|
);
|
|
172616
172759
|
return {
|
|
@@ -172699,7 +172842,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
172699
172842
|
}
|
|
172700
172843
|
}
|
|
172701
172844
|
if (speedMode !== void 0) {
|
|
172702
|
-
|
|
172845
|
+
logger240.debug(
|
|
172703
172846
|
`Current mode: Vacuum + fan_speed="${speedState}" -> mode ${speedMode}`
|
|
172704
172847
|
);
|
|
172705
172848
|
return speedMode;
|
|
@@ -172720,7 +172863,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
172720
172863
|
}
|
|
172721
172864
|
}
|
|
172722
172865
|
if (mopMode !== void 0) {
|
|
172723
|
-
|
|
172866
|
+
logger240.debug(
|
|
172724
172867
|
`Current mode: Mop + intensity="${state}" -> mode ${mopMode}`
|
|
172725
172868
|
);
|
|
172726
172869
|
return mopMode;
|
|
@@ -172738,14 +172881,14 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
172738
172881
|
const homeAssistant = agent.get(HomeAssistantEntityBehavior);
|
|
172739
172882
|
const vacuumEntityId = homeAssistant.entityId;
|
|
172740
172883
|
const mapping = homeAssistant.state.mapping;
|
|
172741
|
-
|
|
172884
|
+
logger240.info(
|
|
172742
172885
|
`setCleanMode(${mode}) for ${vacuumEntityId}, suctionEntity=${mapping?.suctionLevelEntity ?? "none"}, mopEntity=${mapping?.mopIntensityEntity ?? "none"}, fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])}, customTags=${JSON.stringify(customFanSpeedTags ?? {})}`
|
|
172743
172886
|
);
|
|
172744
172887
|
if (mopIntensityList && mopIntensityList.length > 0 && isMopIntensityMode(mode)) {
|
|
172745
172888
|
const mopIndex = mode - MOP_INTENSITY_MODE_BASE;
|
|
172746
172889
|
const mopName = mopIntensityList[mopIndex];
|
|
172747
172890
|
if (!mopName) {
|
|
172748
|
-
|
|
172891
|
+
logger240.warn(`Invalid mop intensity mode index: ${mopIndex}`);
|
|
172749
172892
|
return void 0;
|
|
172750
172893
|
}
|
|
172751
172894
|
if (hasCleanTypes) {
|
|
@@ -172758,18 +172901,18 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
172758
172901
|
mapping.mopIntensityEntity,
|
|
172759
172902
|
agent
|
|
172760
172903
|
);
|
|
172761
|
-
|
|
172904
|
+
logger240.info(
|
|
172762
172905
|
`Mop intensity entity ${mapping.mopIntensityEntity}: current="${state}", options=${JSON.stringify(options ?? [])}`
|
|
172763
172906
|
);
|
|
172764
172907
|
let option = matchMopIntensityOption(mopName, options);
|
|
172765
172908
|
if (!option && options && mopIndex < options.length) {
|
|
172766
172909
|
option = options[mopIndex];
|
|
172767
|
-
|
|
172910
|
+
logger240.info(
|
|
172768
172911
|
`Positional match for mop "${mopName}" -> "${option}" (index ${mopIndex})`
|
|
172769
172912
|
);
|
|
172770
172913
|
}
|
|
172771
172914
|
if (option) {
|
|
172772
|
-
|
|
172915
|
+
logger240.info(
|
|
172773
172916
|
`Setting mop intensity to: ${option} via ${mapping.mopIntensityEntity}`
|
|
172774
172917
|
);
|
|
172775
172918
|
return {
|
|
@@ -172778,11 +172921,11 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
172778
172921
|
target: mapping.mopIntensityEntity
|
|
172779
172922
|
};
|
|
172780
172923
|
}
|
|
172781
|
-
|
|
172924
|
+
logger240.warn(
|
|
172782
172925
|
`No match for mop intensity "${mopName}" in options: [${(options ?? []).join(", ")}]`
|
|
172783
172926
|
);
|
|
172784
172927
|
} else {
|
|
172785
|
-
|
|
172928
|
+
logger240.warn(
|
|
172786
172929
|
`Mop intensity mode ${mode} requested but no mopIntensityEntity configured`
|
|
172787
172930
|
);
|
|
172788
172931
|
}
|
|
@@ -172792,7 +172935,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
172792
172935
|
const fanSpeedIndex = mode - FAN_SPEED_MODE_BASE;
|
|
172793
172936
|
const fanSpeedName = fanSpeedList[fanSpeedIndex];
|
|
172794
172937
|
if (!fanSpeedName) {
|
|
172795
|
-
|
|
172938
|
+
logger240.warn(`Invalid fan speed mode index: ${fanSpeedIndex}`);
|
|
172796
172939
|
return void 0;
|
|
172797
172940
|
}
|
|
172798
172941
|
if (mapping?.suctionLevelEntity) {
|
|
@@ -172805,7 +172948,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
172805
172948
|
mapping.suctionLevelEntity,
|
|
172806
172949
|
agent
|
|
172807
172950
|
);
|
|
172808
|
-
|
|
172951
|
+
logger240.info(
|
|
172809
172952
|
`Suction entity ${mapping.suctionLevelEntity}: current="${state}", options=${JSON.stringify(options ?? [])}`
|
|
172810
172953
|
);
|
|
172811
172954
|
let option = matchFanSpeedOption(
|
|
@@ -172815,12 +172958,12 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
172815
172958
|
);
|
|
172816
172959
|
if (!option && options && fanSpeedIndex < options.length) {
|
|
172817
172960
|
option = options[fanSpeedIndex];
|
|
172818
|
-
|
|
172961
|
+
logger240.info(
|
|
172819
172962
|
`Positional match for fan "${fanSpeedName}" -> "${option}" (index ${fanSpeedIndex})`
|
|
172820
172963
|
);
|
|
172821
172964
|
}
|
|
172822
172965
|
if (option) {
|
|
172823
|
-
|
|
172966
|
+
logger240.info(
|
|
172824
172967
|
`Setting suction to: ${option} via ${mapping.suctionLevelEntity}`
|
|
172825
172968
|
);
|
|
172826
172969
|
return {
|
|
@@ -172829,7 +172972,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
172829
172972
|
target: mapping.suctionLevelEntity
|
|
172830
172973
|
};
|
|
172831
172974
|
}
|
|
172832
|
-
|
|
172975
|
+
logger240.warn(
|
|
172833
172976
|
`No match for fan speed "${fanSpeedName}" in suction options: [${(options ?? []).join(", ")}]`
|
|
172834
172977
|
);
|
|
172835
172978
|
return void 0;
|
|
@@ -172839,7 +172982,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
172839
172982
|
buildCleaningModeAction(0 /* Sweeping */, agent)
|
|
172840
172983
|
);
|
|
172841
172984
|
}
|
|
172842
|
-
|
|
172985
|
+
logger240.info(
|
|
172843
172986
|
`Setting fan speed to: ${fanSpeedName} via vacuum.set_fan_speed`
|
|
172844
172987
|
);
|
|
172845
172988
|
return {
|
|
@@ -172849,7 +172992,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
172849
172992
|
};
|
|
172850
172993
|
}
|
|
172851
172994
|
if (!hasCleanTypes) {
|
|
172852
|
-
|
|
172995
|
+
logger240.debug(
|
|
172853
172996
|
`Ignoring cleaning type change (mode=${mode}): no cleaning mode entity`
|
|
172854
172997
|
);
|
|
172855
172998
|
return void 0;
|
|
@@ -172861,7 +173004,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
172861
173004
|
agent
|
|
172862
173005
|
);
|
|
172863
173006
|
const optionToUse = findMatchingCleanOption(cleanType, availableOptions);
|
|
172864
|
-
|
|
173007
|
+
logger240.info(
|
|
172865
173008
|
`Setting cleaning mode to: ${optionToUse} (mode=${mode}) via ${selectEntityId}`
|
|
172866
173009
|
);
|
|
172867
173010
|
return {
|
|
@@ -172879,10 +173022,10 @@ function createVacuumRvcCleanModeServer(_attributes, fanSpeedList, mopIntensityL
|
|
|
172879
173022
|
cleaningModeOptions,
|
|
172880
173023
|
customFanSpeedTags
|
|
172881
173024
|
);
|
|
172882
|
-
|
|
173025
|
+
logger240.info(
|
|
172883
173026
|
`Creating VacuumRvcCleanModeServer with ${supportedModes2.length} modes (fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])}, cleaningModeOptions=${JSON.stringify(cleaningModeOptions ?? [])}, customTags=${JSON.stringify(customFanSpeedTags ?? {})})`
|
|
172884
173027
|
);
|
|
172885
|
-
|
|
173028
|
+
logger240.info(
|
|
172886
173029
|
`Modes: ${supportedModes2.map((m) => `${m.mode}:${m.label}[${m.modeTags.map((t) => t.value).join(",")}]`).join(", ")}`
|
|
172887
173030
|
);
|
|
172888
173031
|
const initialState = {
|
|
@@ -172945,7 +173088,7 @@ function resolveMopIntensityList(mopIntensityEntity) {
|
|
|
172945
173088
|
init_dist();
|
|
172946
173089
|
init_esm();
|
|
172947
173090
|
init_home_assistant_entity_behavior();
|
|
172948
|
-
var
|
|
173091
|
+
var logger241 = Logger.get("VacuumRvcOperationalStateServer");
|
|
172949
173092
|
function batteryFromAttributes(attrs) {
|
|
172950
173093
|
const raw = attrs.battery_level ?? attrs.battery;
|
|
172951
173094
|
if (raw == null) return null;
|
|
@@ -172996,16 +173139,16 @@ function mapVacuumOperationalState(entity, batteryPercent = batteryFromAttribute
|
|
|
172996
173139
|
operationalState = RvcOperationalState4.OperationalState.Error;
|
|
172997
173140
|
} else {
|
|
172998
173141
|
if (state.toLowerCase().includes("clean")) {
|
|
172999
|
-
|
|
173142
|
+
logger241.info(
|
|
173000
173143
|
`Unknown vacuum state "${state}" contains 'clean', treating as Running`
|
|
173001
173144
|
);
|
|
173002
173145
|
operationalState = RvcOperationalState4.OperationalState.Running;
|
|
173003
173146
|
} else {
|
|
173004
|
-
|
|
173147
|
+
logger241.info(`Unknown vacuum state "${state}", treating as Stopped`);
|
|
173005
173148
|
operationalState = RvcOperationalState4.OperationalState.Stopped;
|
|
173006
173149
|
}
|
|
173007
173150
|
}
|
|
173008
|
-
|
|
173151
|
+
logger241.debug(
|
|
173009
173152
|
`Vacuum operationalState: "${state}" -> ${RvcOperationalState4.OperationalState[operationalState]}`
|
|
173010
173153
|
);
|
|
173011
173154
|
return operationalState;
|
|
@@ -173034,7 +173177,7 @@ var VacuumRvcOperationalStateServer = RvcOperationalStateServer2({
|
|
|
173034
173177
|
});
|
|
173035
173178
|
|
|
173036
173179
|
// src/matter/endpoints/legacy/vacuum/index.ts
|
|
173037
|
-
var
|
|
173180
|
+
var logger242 = Logger.get("VacuumDevice");
|
|
173038
173181
|
var VacuumEndpointType = RoboticVacuumCleanerDevice.with(
|
|
173039
173182
|
BasicInformationServer2,
|
|
173040
173183
|
VacuumIdentifyServer,
|
|
@@ -173048,7 +173191,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
|
|
|
173048
173191
|
const entityId = homeAssistantEntity.entity.entity_id;
|
|
173049
173192
|
const attributes9 = homeAssistantEntity.entity.state.attributes;
|
|
173050
173193
|
const customAreas = homeAssistantEntity.mapping?.customServiceAreas;
|
|
173051
|
-
|
|
173194
|
+
logger242.info(
|
|
173052
173195
|
`Creating vacuum endpoint for ${entityId}, mapping: ${JSON.stringify(homeAssistantEntity.mapping ?? "none")}`
|
|
173053
173196
|
);
|
|
173054
173197
|
const cleanAreaRooms = homeAssistantEntity.mapping?.cleanAreaRooms;
|
|
@@ -173061,32 +173204,32 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
|
|
|
173061
173204
|
)
|
|
173062
173205
|
).set({ homeAssistantEntity });
|
|
173063
173206
|
if (includeOnOff) {
|
|
173064
|
-
|
|
173207
|
+
logger242.info(`${entityId}: Adding OnOff cluster (vacuumOnOff flag enabled)`);
|
|
173065
173208
|
device = device.with(VacuumOnOffServer);
|
|
173066
173209
|
}
|
|
173067
173210
|
device = device.with(VacuumPowerSourceServer);
|
|
173068
173211
|
const roomEntities = homeAssistantEntity.mapping?.roomEntities;
|
|
173069
173212
|
const rooms = parseVacuumRooms(attributes9);
|
|
173070
|
-
|
|
173213
|
+
logger242.info(
|
|
173071
173214
|
`${entityId}: customAreas=${customAreas?.length ?? 0}, roomEntities=${JSON.stringify(roomEntities ?? [])}, parsedRooms=${rooms.length}, cleanAreaRooms=${cleanAreaRooms?.length ?? 0}`
|
|
173072
173215
|
);
|
|
173073
173216
|
if (cleanAreaRooms && cleanAreaRooms.length > 0) {
|
|
173074
|
-
|
|
173217
|
+
logger242.info(
|
|
173075
173218
|
`${entityId}: Adding ServiceArea (${cleanAreaRooms.length} HA areas via CLEAN_AREA)`
|
|
173076
173219
|
);
|
|
173077
173220
|
device = device.with(createCleanAreaServiceAreaServer(cleanAreaRooms));
|
|
173078
173221
|
} else if (customAreas && customAreas.length > 0) {
|
|
173079
|
-
|
|
173222
|
+
logger242.info(
|
|
173080
173223
|
`${entityId}: Adding ServiceArea (${customAreas.length} custom areas)`
|
|
173081
173224
|
);
|
|
173082
173225
|
device = device.with(createCustomServiceAreaServer(customAreas));
|
|
173083
173226
|
} else if (rooms.length > 0 || roomEntities && roomEntities.length > 0) {
|
|
173084
|
-
|
|
173227
|
+
logger242.info(`${entityId}: Adding ServiceArea (${rooms.length} rooms)`);
|
|
173085
173228
|
device = device.with(
|
|
173086
173229
|
createVacuumServiceAreaServer(attributes9, roomEntities)
|
|
173087
173230
|
);
|
|
173088
173231
|
} else {
|
|
173089
|
-
|
|
173232
|
+
logger242.info(`${entityId}: Adding ServiceArea (default single-area)`);
|
|
173090
173233
|
device = device.with(createDefaultServiceAreaServer());
|
|
173091
173234
|
}
|
|
173092
173235
|
const fanSpeedList = resolveFanSpeedList(
|
|
@@ -173097,7 +173240,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
|
|
|
173097
173240
|
homeAssistantEntity.mapping?.mopIntensityEntity
|
|
173098
173241
|
);
|
|
173099
173242
|
if (cleaningModeOptions || fanSpeedList || mopIntensityList) {
|
|
173100
|
-
|
|
173243
|
+
logger242.info(
|
|
173101
173244
|
`${entityId}: Adding RvcCleanMode (multi-mode, cleaningModeOptions=${JSON.stringify(cleaningModeOptions ?? [])}, fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])})`
|
|
173102
173245
|
);
|
|
173103
173246
|
device = device.with(
|
|
@@ -173110,7 +173253,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
|
|
|
173110
173253
|
)
|
|
173111
173254
|
);
|
|
173112
173255
|
} else {
|
|
173113
|
-
|
|
173256
|
+
logger242.info(`${entityId}: Adding RvcCleanMode (default single-mode)`);
|
|
173114
173257
|
device = device.with(createDefaultRvcCleanModeServer());
|
|
173115
173258
|
}
|
|
173116
173259
|
return device;
|
|
@@ -173276,7 +173419,7 @@ var WaterHeaterThermostatServer = ThermostatServer2(
|
|
|
173276
173419
|
);
|
|
173277
173420
|
|
|
173278
173421
|
// src/matter/endpoints/legacy/water-heater/index.ts
|
|
173279
|
-
var
|
|
173422
|
+
var logger243 = Logger.get("WaterHeaterDevice");
|
|
173280
173423
|
var WaterHeaterDeviceType = ThermostatDevice.with(
|
|
173281
173424
|
BasicInformationServer2,
|
|
173282
173425
|
IdentifyServer2,
|
|
@@ -173292,7 +173435,7 @@ function toMatterTemp2(value) {
|
|
|
173292
173435
|
}
|
|
173293
173436
|
function WaterHeaterDevice2(homeAssistantEntity) {
|
|
173294
173437
|
const attributes9 = homeAssistantEntity.entity.state.attributes;
|
|
173295
|
-
|
|
173438
|
+
logger243.debug(
|
|
173296
173439
|
`Creating device for ${homeAssistantEntity.entity.entity_id}, min_temp=${attributes9.min_temp}, max_temp=${attributes9.max_temp}`
|
|
173297
173440
|
);
|
|
173298
173441
|
const minLimit = toMatterTemp2(attributes9.min_temp) ?? 0;
|
|
@@ -173378,6 +173521,7 @@ var WaterHeaterBoostMemoryBehavior = class extends Behavior {
|
|
|
173378
173521
|
// src/matter/endpoints/legacy/water-heater/behaviors/water-heater-management-server.ts
|
|
173379
173522
|
init_dist();
|
|
173380
173523
|
init_esm();
|
|
173524
|
+
init_types2();
|
|
173381
173525
|
init_home_assistant_entity_behavior();
|
|
173382
173526
|
|
|
173383
173527
|
// src/matter/endpoints/legacy/water-heater/water-heater-modes.ts
|
|
@@ -173534,7 +173678,7 @@ function activeHeatSource(attributes9) {
|
|
|
173534
173678
|
}
|
|
173535
173679
|
|
|
173536
173680
|
// src/matter/endpoints/legacy/water-heater/behaviors/water-heater-management-server.ts
|
|
173537
|
-
var
|
|
173681
|
+
var logger244 = Logger.get("WaterHeaterManagementServer");
|
|
173538
173682
|
var MAX_TIMER_MS2 = 2147483647;
|
|
173539
173683
|
var boostSessions = /* @__PURE__ */ new WeakMap();
|
|
173540
173684
|
function clearBoostTimer(endpoint) {
|
|
@@ -173780,7 +173924,7 @@ var WaterHeaterManagementServerBase = class _WaterHeaterManagementServerBase ext
|
|
|
173780
173924
|
armBoostTimer(durationSeconds) {
|
|
173781
173925
|
const delay = durationSeconds * 1e3;
|
|
173782
173926
|
if (!Number.isFinite(delay) || delay <= 0 || delay > MAX_TIMER_MS2) {
|
|
173783
|
-
|
|
173927
|
+
logger244.debug(
|
|
173784
173928
|
`Boost duration ${durationSeconds}s outside the timer range, boost stays active until CancelBoost`
|
|
173785
173929
|
);
|
|
173786
173930
|
return;
|
|
@@ -173794,7 +173938,7 @@ var WaterHeaterManagementServerBase = class _WaterHeaterManagementServerBase ext
|
|
|
173794
173938
|
agent.get(_WaterHeaterManagementServerBase).endBoost({ restoreMode: true });
|
|
173795
173939
|
});
|
|
173796
173940
|
} catch (error) {
|
|
173797
|
-
|
|
173941
|
+
logger244.debug(
|
|
173798
173942
|
`Boost expiry failed (endpoint may be closing): ${error}`
|
|
173799
173943
|
);
|
|
173800
173944
|
}
|
|
@@ -173897,13 +174041,13 @@ function WaterHeaterModeServer2(mapping, initialMode) {
|
|
|
173897
174041
|
}
|
|
173898
174042
|
|
|
173899
174043
|
// src/matter/endpoints/legacy/water-heater/water-heater-management-device.ts
|
|
173900
|
-
var
|
|
174044
|
+
var logger245 = Logger.get("WaterHeaterManagementDevice");
|
|
173901
174045
|
function WaterHeaterManagementDevice(homeAssistantEntity) {
|
|
173902
174046
|
const entityState = homeAssistantEntity.entity.state;
|
|
173903
174047
|
const attributes9 = entityState.attributes;
|
|
173904
174048
|
const modeMapping = buildModeMapping(attributes9);
|
|
173905
174049
|
const initialMode = currentMode(modeMapping, entityState.state, attributes9);
|
|
173906
|
-
|
|
174050
|
+
logger245.debug(
|
|
173907
174051
|
`Creating Matter 1.4 water heater for ${homeAssistantEntity.entity.entity_id}, modes=[${modeMapping.supportedModes.map((m) => `${m.mode}:${m.label}`).join(", ")}], boostMode=${modeMapping.boostOperationMode ?? "none"}`
|
|
173908
174052
|
);
|
|
173909
174053
|
const minLimit = toMatterTemp2(attributes9.min_temp) ?? 0;
|
|
@@ -174174,7 +174318,7 @@ var matterDeviceTypeFactories = {
|
|
|
174174
174318
|
};
|
|
174175
174319
|
|
|
174176
174320
|
// src/matter/endpoints/composed/user-composed-endpoint.ts
|
|
174177
|
-
var
|
|
174321
|
+
var logger246 = Logger.get("UserComposedEndpoint");
|
|
174178
174322
|
function stripBasicInformation(type) {
|
|
174179
174323
|
const behaviors = { ...type.behaviors };
|
|
174180
174324
|
delete behaviors.bridgedDeviceBasicInformation;
|
|
@@ -174250,7 +174394,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
174250
174394
|
{ vacuumOnOff: registry3.isVacuumOnOffEnabled() }
|
|
174251
174395
|
);
|
|
174252
174396
|
if (!primaryType) {
|
|
174253
|
-
|
|
174397
|
+
logger246.warn(
|
|
174254
174398
|
`Cannot create endpoint type for primary entity ${primaryEntityId}`
|
|
174255
174399
|
);
|
|
174256
174400
|
return void 0;
|
|
@@ -174265,7 +174409,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
174265
174409
|
if (!sub.entityId) continue;
|
|
174266
174410
|
const subPayload = buildEntityPayload4(registry3, sub.entityId);
|
|
174267
174411
|
if (!subPayload) {
|
|
174268
|
-
|
|
174412
|
+
logger246.warn(
|
|
174269
174413
|
`Cannot find state for composed sub-entity ${sub.entityId}, it does not exist in Home Assistant (removed or renamed?)`
|
|
174270
174414
|
);
|
|
174271
174415
|
continue;
|
|
@@ -174280,7 +174424,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
174280
174424
|
config8.areaName
|
|
174281
174425
|
);
|
|
174282
174426
|
if (!subType) {
|
|
174283
|
-
|
|
174427
|
+
logger246.warn(
|
|
174284
174428
|
`Cannot create endpoint type for composed sub-entity ${sub.entityId}`
|
|
174285
174429
|
);
|
|
174286
174430
|
continue;
|
|
@@ -174293,7 +174437,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
174293
174437
|
mappedIds.push(sub.entityId);
|
|
174294
174438
|
}
|
|
174295
174439
|
if (parts.length < 2) {
|
|
174296
|
-
|
|
174440
|
+
logger246.warn(
|
|
174297
174441
|
`User composed device ${primaryEntityId}: only ${parts.length} sub-endpoint(s), need at least 2 (primary + one sub-entity). Falling back to standalone.`
|
|
174298
174442
|
);
|
|
174299
174443
|
return void 0;
|
|
@@ -174317,7 +174461,7 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
174317
174461
|
const labels = parts.map(
|
|
174318
174462
|
(_, i) => i === 0 ? primaryEntityId.split(".")[0] : composedEntities[i - 1]?.entityId?.split(".")[0] ?? "?"
|
|
174319
174463
|
).join("+");
|
|
174320
|
-
|
|
174464
|
+
logger246.info(
|
|
174321
174465
|
`Created user composed device ${primaryEntityId}: ${parts.length} sub-endpoint(s) [${labels}]`
|
|
174322
174466
|
);
|
|
174323
174467
|
return endpoint;
|
|
@@ -174423,7 +174567,7 @@ function asStandaloneEndpointType(type) {
|
|
|
174423
174567
|
}
|
|
174424
174568
|
|
|
174425
174569
|
// src/matter/endpoints/legacy/legacy-endpoint.ts
|
|
174426
|
-
var
|
|
174570
|
+
var logger247 = Logger.get("LegacyEndpoint");
|
|
174427
174571
|
var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
174428
174572
|
constructor(type, entityId, customName, mappedEntityIds, throttleMs, endpointId, vacuumEffective) {
|
|
174429
174573
|
super(type, entityId, customName, mappedEntityIds, endpointId);
|
|
@@ -174439,25 +174583,25 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
174439
174583
|
return;
|
|
174440
174584
|
}
|
|
174441
174585
|
if (registry3.isAutoBatteryMappingEnabled() && registry3.isBatteryEntityUsed(entityId)) {
|
|
174442
|
-
|
|
174586
|
+
logger247.debug(
|
|
174443
174587
|
`Skipping ${entityId} - already auto-assigned as battery to another device`
|
|
174444
174588
|
);
|
|
174445
174589
|
return;
|
|
174446
174590
|
}
|
|
174447
174591
|
if (registry3.isAutoHumidityMappingEnabled() && registry3.isHumidityEntityUsed(entityId)) {
|
|
174448
|
-
|
|
174592
|
+
logger247.debug(
|
|
174449
174593
|
`Skipping ${entityId} - already auto-assigned as humidity to a temperature sensor`
|
|
174450
174594
|
);
|
|
174451
174595
|
return;
|
|
174452
174596
|
}
|
|
174453
174597
|
if (registry3.isAutoPressureMappingEnabled() && registry3.isPressureEntityUsed(entityId)) {
|
|
174454
|
-
|
|
174598
|
+
logger247.debug(
|
|
174455
174599
|
`Skipping ${entityId} - already auto-assigned as pressure to a temperature sensor`
|
|
174456
174600
|
);
|
|
174457
174601
|
return;
|
|
174458
174602
|
}
|
|
174459
174603
|
if (registry3.isAutoComposedDevicesEnabled() && registry3.isComposedSubEntityUsed(entityId)) {
|
|
174460
|
-
|
|
174604
|
+
logger247.debug(
|
|
174461
174605
|
`Skipping ${entityId} - already consumed by a composed device`
|
|
174462
174606
|
);
|
|
174463
174607
|
return;
|
|
@@ -174477,7 +174621,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
174477
174621
|
humidityEntity: humidityEntityId
|
|
174478
174622
|
};
|
|
174479
174623
|
registry3.markHumidityEntityUsed(humidityEntityId);
|
|
174480
|
-
|
|
174624
|
+
logger247.debug(
|
|
174481
174625
|
`Auto-assigned humidity ${humidityEntityId} to ${entityId}`
|
|
174482
174626
|
);
|
|
174483
174627
|
}
|
|
@@ -174496,7 +174640,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
174496
174640
|
pressureEntity: pressureEntityId
|
|
174497
174641
|
};
|
|
174498
174642
|
registry3.markPressureEntityUsed(pressureEntityId);
|
|
174499
|
-
|
|
174643
|
+
logger247.debug(
|
|
174500
174644
|
`Auto-assigned pressure ${pressureEntityId} to ${entityId}`
|
|
174501
174645
|
);
|
|
174502
174646
|
}
|
|
@@ -174514,7 +174658,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
174514
174658
|
batteryEntity: batteryEntityId
|
|
174515
174659
|
};
|
|
174516
174660
|
registry3.markBatteryEntityUsed(batteryEntityId);
|
|
174517
|
-
|
|
174661
|
+
logger247.debug(
|
|
174518
174662
|
`Auto-assigned battery ${batteryEntityId} to ${entityId}`
|
|
174519
174663
|
);
|
|
174520
174664
|
}
|
|
@@ -174531,7 +174675,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
174531
174675
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
174532
174676
|
faultEntity: faultEntityId
|
|
174533
174677
|
};
|
|
174534
|
-
|
|
174678
|
+
logger247.debug(`Auto-assigned fault ${faultEntityId} to ${entityId}`);
|
|
174535
174679
|
}
|
|
174536
174680
|
}
|
|
174537
174681
|
if (!mapping?.powerEntity) {
|
|
@@ -174547,7 +174691,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
174547
174691
|
powerEntity: powerEntityId
|
|
174548
174692
|
};
|
|
174549
174693
|
registry3.markPowerEntityUsed(powerEntityId);
|
|
174550
|
-
|
|
174694
|
+
logger247.debug(`Auto-assigned power ${powerEntityId} to ${entityId}`);
|
|
174551
174695
|
}
|
|
174552
174696
|
}
|
|
174553
174697
|
}
|
|
@@ -174564,7 +174708,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
174564
174708
|
energyEntity: energyEntityId
|
|
174565
174709
|
};
|
|
174566
174710
|
registry3.markEnergyEntityUsed(energyEntityId);
|
|
174567
|
-
|
|
174711
|
+
logger247.debug(
|
|
174568
174712
|
`Auto-assigned energy ${energyEntityId} to ${entityId}`
|
|
174569
174713
|
);
|
|
174570
174714
|
}
|
|
@@ -174580,7 +174724,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
174580
174724
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
174581
174725
|
cleaningModeEntity: vacuumEntities.cleaningModeEntity
|
|
174582
174726
|
};
|
|
174583
|
-
|
|
174727
|
+
logger247.info(
|
|
174584
174728
|
`Auto-assigned cleaningMode ${vacuumEntities.cleaningModeEntity} to ${entityId}`
|
|
174585
174729
|
);
|
|
174586
174730
|
}
|
|
@@ -174590,7 +174734,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
174590
174734
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
174591
174735
|
suctionLevelEntity: vacuumEntities.suctionLevelEntity
|
|
174592
174736
|
};
|
|
174593
|
-
|
|
174737
|
+
logger247.info(
|
|
174594
174738
|
`Auto-assigned suctionLevel ${vacuumEntities.suctionLevelEntity} to ${entityId}`
|
|
174595
174739
|
);
|
|
174596
174740
|
}
|
|
@@ -174600,7 +174744,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
174600
174744
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
174601
174745
|
mopIntensityEntity: vacuumEntities.mopIntensityEntity
|
|
174602
174746
|
};
|
|
174603
|
-
|
|
174747
|
+
logger247.info(
|
|
174604
174748
|
`Auto-assigned mopIntensity ${vacuumEntities.mopIntensityEntity} to ${entityId}`
|
|
174605
174749
|
);
|
|
174606
174750
|
}
|
|
@@ -174610,7 +174754,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
174610
174754
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
174611
174755
|
currentRoomEntity: vacuumEntities.currentRoomEntity
|
|
174612
174756
|
};
|
|
174613
|
-
|
|
174757
|
+
logger247.info(
|
|
174614
174758
|
`Auto-assigned currentRoom ${vacuumEntities.currentRoomEntity} to ${entityId}`
|
|
174615
174759
|
);
|
|
174616
174760
|
}
|
|
@@ -174625,7 +174769,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
174625
174769
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
174626
174770
|
cleanAreaRooms
|
|
174627
174771
|
};
|
|
174628
|
-
|
|
174772
|
+
logger247.info(
|
|
174629
174773
|
`Using ${cleanAreaRooms.length} HA areas via CLEAN_AREA for ${entityId}`
|
|
174630
174774
|
);
|
|
174631
174775
|
}
|
|
@@ -174646,7 +174790,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
174646
174790
|
rooms: roomsObj
|
|
174647
174791
|
}
|
|
174648
174792
|
};
|
|
174649
|
-
|
|
174793
|
+
logger247.debug(
|
|
174650
174794
|
`Auto-detected ${valetudoRooms.length} Valetudo segments for ${entityId}`
|
|
174651
174795
|
);
|
|
174652
174796
|
} else {
|
|
@@ -174663,7 +174807,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
174663
174807
|
rooms: roomsObj
|
|
174664
174808
|
}
|
|
174665
174809
|
};
|
|
174666
|
-
|
|
174810
|
+
logger247.debug(
|
|
174667
174811
|
`Auto-detected ${roborockRooms.length} Roborock rooms for ${entityId}`
|
|
174668
174812
|
);
|
|
174669
174813
|
}
|
|
@@ -174672,7 +174816,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
174672
174816
|
}
|
|
174673
174817
|
}
|
|
174674
174818
|
if (standalone && ((effectiveMapping?.composedEntities?.length ?? 0) > 0 || effectiveMapping?.climateExposeFan === true)) {
|
|
174675
|
-
|
|
174819
|
+
logger247.warn(
|
|
174676
174820
|
`Composed mappings are not supported in server mode, exposing ${entityId} as a flat standalone endpoint`
|
|
174677
174821
|
);
|
|
174678
174822
|
}
|
|
@@ -174691,7 +174835,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
174691
174835
|
if (composed) {
|
|
174692
174836
|
return composed;
|
|
174693
174837
|
}
|
|
174694
|
-
|
|
174838
|
+
logger247.warn(
|
|
174695
174839
|
`User composed device creation failed for ${entityId}, falling back to standalone`
|
|
174696
174840
|
);
|
|
174697
174841
|
}
|
|
@@ -174756,7 +174900,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
174756
174900
|
if (composed) {
|
|
174757
174901
|
return composed;
|
|
174758
174902
|
}
|
|
174759
|
-
|
|
174903
|
+
logger247.warn(
|
|
174760
174904
|
`Companion fan creation failed for ${entityId}, falling back to standalone`
|
|
174761
174905
|
);
|
|
174762
174906
|
}
|
|
@@ -174834,11 +174978,11 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
174834
174978
|
}
|
|
174835
174979
|
if (mappedChanged) {
|
|
174836
174980
|
this.pendingMappedChange = true;
|
|
174837
|
-
|
|
174981
|
+
logger247.debug(
|
|
174838
174982
|
`Mapped entity change detected for ${this.entityId}, forcing update`
|
|
174839
174983
|
);
|
|
174840
174984
|
}
|
|
174841
|
-
|
|
174985
|
+
logger247.debug(
|
|
174842
174986
|
`State update received for ${this.entityId}: state=${state.state}`
|
|
174843
174987
|
);
|
|
174844
174988
|
this.lastState = state;
|
|
@@ -175059,12 +175203,14 @@ var CameraAvStreamServer = class extends Base4 {
|
|
|
175059
175203
|
// src/plugins/builtin/camera/webrtc-provider-server.ts
|
|
175060
175204
|
init_esm();
|
|
175061
175205
|
init_esm7();
|
|
175206
|
+
init_types2();
|
|
175062
175207
|
init_esm3();
|
|
175063
175208
|
|
|
175064
175209
|
// src/plugins/builtin/camera/requestor-client.ts
|
|
175065
175210
|
init_esm();
|
|
175211
|
+
init_types2();
|
|
175066
175212
|
init_esm4();
|
|
175067
|
-
var
|
|
175213
|
+
var logger248 = Logger.get("CameraWebRtcRequestor");
|
|
175068
175214
|
var registry2 = /* @__PURE__ */ new Map();
|
|
175069
175215
|
var pendingDeliveries = /* @__PURE__ */ new Map();
|
|
175070
175216
|
var invokeTransport = defaultInvoke;
|
|
@@ -175098,19 +175244,19 @@ function deliverAnswerDeferred(sessionId, sdp, onGiveUp) {
|
|
|
175098
175244
|
return;
|
|
175099
175245
|
}
|
|
175100
175246
|
if (await sendAnswer(sessionId, sdp)) {
|
|
175101
|
-
|
|
175247
|
+
logger248.info(`answer delivered for session ${sessionId}`);
|
|
175102
175248
|
return;
|
|
175103
175249
|
}
|
|
175104
175250
|
}
|
|
175105
175251
|
if (registry2.get(sessionId) !== owner || pendingDeliveries.get(sessionId) !== timer) {
|
|
175106
175252
|
return;
|
|
175107
175253
|
}
|
|
175108
|
-
|
|
175254
|
+
logger248.info(
|
|
175109
175255
|
`answer delivery failed for session ${sessionId}, giving up`
|
|
175110
175256
|
);
|
|
175111
175257
|
await onGiveUp();
|
|
175112
175258
|
} catch (err) {
|
|
175113
|
-
|
|
175259
|
+
logger248.info(
|
|
175114
175260
|
`answer delivery for session ${sessionId} threw: ${errText(err)}`
|
|
175115
175261
|
);
|
|
175116
175262
|
} finally {
|
|
@@ -175135,11 +175281,11 @@ function sendAnswer(sessionId, sdp) {
|
|
|
175135
175281
|
async function invokeRequestor(sessionId, command, fields) {
|
|
175136
175282
|
const registration = registry2.get(sessionId);
|
|
175137
175283
|
if (!registration) {
|
|
175138
|
-
|
|
175284
|
+
logger248.info(`requestor ${command}: no session ${sessionId} registered`);
|
|
175139
175285
|
return false;
|
|
175140
175286
|
}
|
|
175141
175287
|
if (registration.session.isClosed) {
|
|
175142
|
-
|
|
175288
|
+
logger248.info(`requestor ${command}: session ${sessionId} already closed`);
|
|
175143
175289
|
return false;
|
|
175144
175290
|
}
|
|
175145
175291
|
const request = {
|
|
@@ -175151,7 +175297,7 @@ async function invokeRequestor(sessionId, command, fields) {
|
|
|
175151
175297
|
try {
|
|
175152
175298
|
return await invokeTransport({ registration, request });
|
|
175153
175299
|
} catch (err) {
|
|
175154
|
-
|
|
175300
|
+
logger248.info(
|
|
175155
175301
|
`requestor ${command} failed for session ${sessionId}: ${errText(err)}`
|
|
175156
175302
|
);
|
|
175157
175303
|
return false;
|
|
@@ -175186,7 +175332,7 @@ async function defaultInvoke({
|
|
|
175186
175332
|
for (const entry of chunk) {
|
|
175187
175333
|
if (entry.kind === "cmd-status") {
|
|
175188
175334
|
if (entry.status !== Status2.Success) {
|
|
175189
|
-
|
|
175335
|
+
logger248.info(
|
|
175190
175336
|
`requestor ${request.command} status ${entry.status} for session ${String(request.fields.webRtcSessionId)}`
|
|
175191
175337
|
);
|
|
175192
175338
|
return false;
|
|
@@ -175206,7 +175352,7 @@ function errText(err) {
|
|
|
175206
175352
|
}
|
|
175207
175353
|
|
|
175208
175354
|
// src/plugins/builtin/camera/webrtc-provider-server.ts
|
|
175209
|
-
var
|
|
175355
|
+
var logger249 = Logger.get("CameraWebRtc");
|
|
175210
175356
|
var nextGlobalSessionId = 0;
|
|
175211
175357
|
function mintSessionId() {
|
|
175212
175358
|
for (let i = 0; i <= 65534; i++) {
|
|
@@ -175220,14 +175366,14 @@ var CameraWebRtcProviderServer = class extends WebRtcTransportProviderServer {
|
|
|
175220
175366
|
solicitOffer(request) {
|
|
175221
175367
|
const id = mintSessionId();
|
|
175222
175368
|
this.trackSession(id, request.streamUsage, request.originatingEndpointId);
|
|
175223
|
-
|
|
175369
|
+
logger249.info(
|
|
175224
175370
|
`solicitOffer session=${id} (${this.state.entityId}), deferred offer`
|
|
175225
175371
|
);
|
|
175226
175372
|
void this.state.bridge.startSession(id, this.state.entityId, {
|
|
175227
175373
|
iceServers: request.iceServers,
|
|
175228
175374
|
iceTransportPolicy: request.iceTransportPolicy
|
|
175229
175375
|
}).catch(
|
|
175230
|
-
(err) =>
|
|
175376
|
+
(err) => logger249.info(
|
|
175231
175377
|
`solicitOffer startSession failed for ${this.state.entityId}: ${errText2(err)}`
|
|
175232
175378
|
)
|
|
175233
175379
|
);
|
|
@@ -175235,7 +175381,7 @@ var CameraWebRtcProviderServer = class extends WebRtcTransportProviderServer {
|
|
|
175235
175381
|
}
|
|
175236
175382
|
async provideOffer(request) {
|
|
175237
175383
|
const id = request.webRtcSessionId ?? mintSessionId();
|
|
175238
|
-
|
|
175384
|
+
logger249.info(
|
|
175239
175385
|
`provideOffer entry: entityId=${this.state.entityId} session=${id} (sdp ${request.sdp.length} chars)`
|
|
175240
175386
|
);
|
|
175241
175387
|
if (request.webRtcSessionId == null) {
|
|
@@ -175269,7 +175415,7 @@ var CameraWebRtcProviderServer = class extends WebRtcTransportProviderServer {
|
|
|
175269
175415
|
);
|
|
175270
175416
|
} catch (err) {
|
|
175271
175417
|
const message = errText2(err);
|
|
175272
|
-
|
|
175418
|
+
logger249.info(
|
|
175273
175419
|
`provideOffer failed for ${this.state.entityId} session=${id}: ${message}`
|
|
175274
175420
|
);
|
|
175275
175421
|
unregisterRequestor(id);
|
|
@@ -175281,7 +175427,7 @@ var CameraWebRtcProviderServer = class extends WebRtcTransportProviderServer {
|
|
|
175281
175427
|
StatusCode.Failure
|
|
175282
175428
|
);
|
|
175283
175429
|
}
|
|
175284
|
-
|
|
175430
|
+
logger249.info(
|
|
175285
175431
|
`provideOffer answer computed for ${this.state.entityId} session=${id} (${answerSdp.length} chars); delivering via requestor`
|
|
175286
175432
|
);
|
|
175287
175433
|
const bridge = this.state.bridge;
|
|
@@ -175300,7 +175446,7 @@ var CameraWebRtcProviderServer = class extends WebRtcTransportProviderServer {
|
|
|
175300
175446
|
return { webRtcSessionId: id };
|
|
175301
175447
|
}
|
|
175302
175448
|
provideAnswer(request) {
|
|
175303
|
-
|
|
175449
|
+
logger249.info(
|
|
175304
175450
|
`provideAnswer session=${request.webRtcSessionId} (sdp ${request.sdp.length} chars, ${this.state.entityId})`
|
|
175305
175451
|
);
|
|
175306
175452
|
return this.state.bridge.acceptControllerAnswer(
|
|
@@ -175309,7 +175455,7 @@ var CameraWebRtcProviderServer = class extends WebRtcTransportProviderServer {
|
|
|
175309
175455
|
);
|
|
175310
175456
|
}
|
|
175311
175457
|
async provideIceCandidates(request) {
|
|
175312
|
-
|
|
175458
|
+
logger249.info(
|
|
175313
175459
|
`provideIceCandidates session=${request.webRtcSessionId}: ${request.iceCandidates.length} candidate(s) (${this.state.entityId})`
|
|
175314
175460
|
);
|
|
175315
175461
|
for (const c of request.iceCandidates) {
|
|
@@ -175322,7 +175468,7 @@ var CameraWebRtcProviderServer = class extends WebRtcTransportProviderServer {
|
|
|
175322
175468
|
}
|
|
175323
175469
|
}
|
|
175324
175470
|
async endSession(request) {
|
|
175325
|
-
|
|
175471
|
+
logger249.info(
|
|
175326
175472
|
`endSession session=${request.webRtcSessionId} (${this.state.entityId})`
|
|
175327
175473
|
);
|
|
175328
175474
|
await this.state.bridge.endSession(request.webRtcSessionId);
|
|
@@ -175443,7 +175589,7 @@ import {
|
|
|
175443
175589
|
createLongLivedTokenAuth as createLongLivedTokenAuth2
|
|
175444
175590
|
} from "home-assistant-js-websocket";
|
|
175445
175591
|
import { RTCPeerConnection } from "werift";
|
|
175446
|
-
var
|
|
175592
|
+
var logger250 = Logger.get("CameraWebRtc");
|
|
175447
175593
|
var DEFAULT_HA_WEBRTC_TIMEOUT_MS = 15e3;
|
|
175448
175594
|
var haWebRtcTimeoutMs = DEFAULT_HA_WEBRTC_TIMEOUT_MS;
|
|
175449
175595
|
var WebRtcBridge = class {
|
|
@@ -175490,7 +175636,7 @@ var WebRtcBridge = class {
|
|
|
175490
175636
|
const haOffer = await haPeer.createOffer();
|
|
175491
175637
|
await haPeer.setLocalDescription(haOffer);
|
|
175492
175638
|
const haOfferSdp = this.localSdp(haPeer);
|
|
175493
|
-
|
|
175639
|
+
logger250.info(`HA offer sent for ${entityId} (${haOfferSdp.length} chars)`);
|
|
175494
175640
|
const { answer, sessionId, unsubscribe } = await this.requestHaWebRtc(
|
|
175495
175641
|
entityId,
|
|
175496
175642
|
haOfferSdp,
|
|
@@ -175513,12 +175659,12 @@ var WebRtcBridge = class {
|
|
|
175513
175659
|
const controllerOffer = await controllerPeer.createOffer();
|
|
175514
175660
|
await controllerPeer.setLocalDescription(controllerOffer);
|
|
175515
175661
|
const sdp = this.localSdp(controllerPeer);
|
|
175516
|
-
|
|
175662
|
+
logger250.info(
|
|
175517
175663
|
`controller offer created for ${entityId} (${sdp.length} chars)`
|
|
175518
175664
|
);
|
|
175519
175665
|
return { sdp, iceCandidates };
|
|
175520
175666
|
} catch (err) {
|
|
175521
|
-
|
|
175667
|
+
logger250.info(`startSession failed for ${entityId}: ${errText3(err)}`);
|
|
175522
175668
|
await this.endSession(matterSessionId);
|
|
175523
175669
|
throw err;
|
|
175524
175670
|
}
|
|
@@ -175548,7 +175694,7 @@ var WebRtcBridge = class {
|
|
|
175548
175694
|
const haOffer = await haPeer.createOffer();
|
|
175549
175695
|
await haPeer.setLocalDescription(haOffer);
|
|
175550
175696
|
const haOfferSdp = this.localSdp(haPeer);
|
|
175551
|
-
|
|
175697
|
+
logger250.info(`HA offer sent for ${entityId} (${haOfferSdp.length} chars)`);
|
|
175552
175698
|
const { answer, sessionId, unsubscribe } = await this.requestHaWebRtc(
|
|
175553
175699
|
entityId,
|
|
175554
175700
|
haOfferSdp,
|
|
@@ -175567,12 +175713,12 @@ var WebRtcBridge = class {
|
|
|
175567
175713
|
const controllerAnswer = await controllerPeer.createAnswer();
|
|
175568
175714
|
await controllerPeer.setLocalDescription(controllerAnswer);
|
|
175569
175715
|
const answerSdp = this.localSdp(controllerPeer);
|
|
175570
|
-
|
|
175716
|
+
logger250.info(
|
|
175571
175717
|
`controller answer created for ${entityId} (${answerSdp.length} chars)`
|
|
175572
175718
|
);
|
|
175573
175719
|
return answerSdp;
|
|
175574
175720
|
} catch (err) {
|
|
175575
|
-
|
|
175721
|
+
logger250.info(
|
|
175576
175722
|
`acceptControllerOffer failed for ${entityId}: ${errText3(err)}`
|
|
175577
175723
|
);
|
|
175578
175724
|
await this.endSession(matterSessionId);
|
|
@@ -175583,14 +175729,14 @@ var WebRtcBridge = class {
|
|
|
175583
175729
|
async acceptControllerAnswer(matterSessionId, sdp) {
|
|
175584
175730
|
const session = this.sessions.get(matterSessionId);
|
|
175585
175731
|
if (!session) return;
|
|
175586
|
-
|
|
175732
|
+
logger250.debug(`controller answer applied for ${session.entityId}`);
|
|
175587
175733
|
await session.controllerPeer.setRemoteDescription({ type: "answer", sdp });
|
|
175588
175734
|
}
|
|
175589
175735
|
/** Add a remote ICE candidate from the Matter controller. */
|
|
175590
175736
|
async addControllerIceCandidate(matterSessionId, candidate, sdpMid, sdpMLineIndex) {
|
|
175591
175737
|
const session = this.sessions.get(matterSessionId);
|
|
175592
175738
|
if (!session) return;
|
|
175593
|
-
|
|
175739
|
+
logger250.debug(
|
|
175594
175740
|
`controller ICE candidate for ${session.entityId}: ${candidate}`
|
|
175595
175741
|
);
|
|
175596
175742
|
await session.controllerPeer.addIceCandidate({
|
|
@@ -175604,12 +175750,12 @@ var WebRtcBridge = class {
|
|
|
175604
175750
|
async closeExistingPeers(matterSessionId) {
|
|
175605
175751
|
const prior = this.sessions.get(matterSessionId);
|
|
175606
175752
|
if (!prior) return;
|
|
175607
|
-
|
|
175753
|
+
logger250.info(
|
|
175608
175754
|
`replacing session ${matterSessionId} (${prior.entityId}), closing prior peers`
|
|
175609
175755
|
);
|
|
175610
175756
|
if (prior.haUnsubscribe) {
|
|
175611
175757
|
await Promise.resolve(prior.haUnsubscribe()).catch(
|
|
175612
|
-
(err) =>
|
|
175758
|
+
(err) => logger250.debug(`HA unsubscribe failed: ${errText3(err)}`)
|
|
175613
175759
|
);
|
|
175614
175760
|
}
|
|
175615
175761
|
await prior.haPeer.close().catch(() => {
|
|
@@ -175622,11 +175768,11 @@ var WebRtcBridge = class {
|
|
|
175622
175768
|
async endSession(matterSessionId) {
|
|
175623
175769
|
const session = this.sessions.get(matterSessionId);
|
|
175624
175770
|
if (!session) return;
|
|
175625
|
-
|
|
175771
|
+
logger250.info(`ending session ${matterSessionId} (${session.entityId})`);
|
|
175626
175772
|
this.sessions.delete(matterSessionId);
|
|
175627
175773
|
if (session.haUnsubscribe) {
|
|
175628
175774
|
await Promise.resolve(session.haUnsubscribe()).catch(
|
|
175629
|
-
(err) =>
|
|
175775
|
+
(err) => logger250.debug(`HA unsubscribe failed: ${errText3(err)}`)
|
|
175630
175776
|
);
|
|
175631
175777
|
}
|
|
175632
175778
|
await session.haPeer.close().catch(() => {
|
|
@@ -175656,11 +175802,11 @@ var WebRtcBridge = class {
|
|
|
175656
175802
|
headers: { Authorization: `Bearer ${this.config.haToken}` }
|
|
175657
175803
|
});
|
|
175658
175804
|
} catch (err) {
|
|
175659
|
-
|
|
175805
|
+
logger250.info(`snapshot fetch failed for ${entityId}: ${errText3(err)}`);
|
|
175660
175806
|
throw err;
|
|
175661
175807
|
}
|
|
175662
175808
|
if (!res.ok) {
|
|
175663
|
-
|
|
175809
|
+
logger250.info(
|
|
175664
175810
|
`snapshot fetch failed for ${entityId}: camera_proxy ${res.status}`
|
|
175665
175811
|
);
|
|
175666
175812
|
throw new Error(`HA camera_proxy ${entityId}: ${res.status}`);
|
|
@@ -175677,10 +175823,10 @@ var WebRtcBridge = class {
|
|
|
175677
175823
|
// Forward every track HA sends into the matching pre-added controller sender.
|
|
175678
175824
|
forwardHaTracks(haPeer, senders, entityId) {
|
|
175679
175825
|
haPeer.onTrack.subscribe((track) => {
|
|
175680
|
-
|
|
175826
|
+
logger250.info(`onTrack ${track.kind} from HA (${entityId})`);
|
|
175681
175827
|
const transceiver = senders.get(track.kind);
|
|
175682
175828
|
if (!transceiver) {
|
|
175683
|
-
|
|
175829
|
+
logger250.info(
|
|
175684
175830
|
`no controller transceiver for ${track.kind} (${entityId})`
|
|
175685
175831
|
);
|
|
175686
175832
|
return;
|
|
@@ -175689,7 +175835,7 @@ var WebRtcBridge = class {
|
|
|
175689
175835
|
track.onReceiveRtp.subscribe((rtp) => {
|
|
175690
175836
|
if (!firstLogged) {
|
|
175691
175837
|
firstLogged = true;
|
|
175692
|
-
|
|
175838
|
+
logger250.info(`first RTP forwarded for ${track.kind} (${entityId})`);
|
|
175693
175839
|
}
|
|
175694
175840
|
transceiver.sender.sendRtp(rtp);
|
|
175695
175841
|
});
|
|
@@ -175698,10 +175844,10 @@ var WebRtcBridge = class {
|
|
|
175698
175844
|
// Log connection/ice state transitions (these events fire on change only).
|
|
175699
175845
|
wireStateLogging(peer, label, entityId) {
|
|
175700
175846
|
peer.connectionStateChange.subscribe(
|
|
175701
|
-
(s) =>
|
|
175847
|
+
(s) => logger250.info(`${label} connectionState=${s} (${entityId})`)
|
|
175702
175848
|
);
|
|
175703
175849
|
peer.iceConnectionStateChange.subscribe(
|
|
175704
|
-
(s) =>
|
|
175850
|
+
(s) => logger250.info(`${label} iceConnectionState=${s} (${entityId})`)
|
|
175705
175851
|
);
|
|
175706
175852
|
}
|
|
175707
175853
|
// Map the Matter ICE struct onto werift's config. Only the controller peer
|
|
@@ -175715,11 +175861,11 @@ var WebRtcBridge = class {
|
|
|
175715
175861
|
}))
|
|
175716
175862
|
);
|
|
175717
175863
|
if (iceServers.length === 0) {
|
|
175718
|
-
|
|
175864
|
+
logger250.info(`controller peer using default ICE servers (${entityId})`);
|
|
175719
175865
|
return void 0;
|
|
175720
175866
|
}
|
|
175721
175867
|
const policy = ice?.iceTransportPolicy === "relay" || ice?.iceTransportPolicy === "all" ? ice.iceTransportPolicy : void 0;
|
|
175722
|
-
|
|
175868
|
+
logger250.info(
|
|
175723
175869
|
`controller peer using ${iceServers.length} controller ICE server(s)${policy ? ` policy=${policy}` : ""} (${entityId})`
|
|
175724
175870
|
);
|
|
175725
175871
|
return policy ? { iceServers, iceTransportPolicy: policy } : { iceServers };
|
|
@@ -175733,13 +175879,13 @@ var WebRtcBridge = class {
|
|
|
175733
175879
|
feedHaCandidate(entityId, haPeer, candidate) {
|
|
175734
175880
|
const value = candidate?.candidate;
|
|
175735
175881
|
if (!value) return;
|
|
175736
|
-
|
|
175882
|
+
logger250.debug(`HA ICE candidate for ${entityId}: ${value}`);
|
|
175737
175883
|
void haPeer.addIceCandidate({
|
|
175738
175884
|
candidate: value,
|
|
175739
175885
|
sdpMid: candidate?.sdpMid ?? void 0,
|
|
175740
175886
|
sdpMLineIndex: candidate?.sdpMLineIndex ?? void 0
|
|
175741
175887
|
}).catch(
|
|
175742
|
-
(e) =>
|
|
175888
|
+
(e) => logger250.debug(
|
|
175743
175889
|
`HA addIceCandidate failed for ${entityId}: ${errText3(e)}`
|
|
175744
175890
|
)
|
|
175745
175891
|
);
|
|
@@ -175768,7 +175914,7 @@ var WebRtcBridge = class {
|
|
|
175768
175914
|
reject(err);
|
|
175769
175915
|
});
|
|
175770
175916
|
timer = setTimeout(() => {
|
|
175771
|
-
|
|
175917
|
+
logger250.info(
|
|
175772
175918
|
`HA WebRTC timed out after ${haWebRtcTimeoutMs}ms for ${entityId}`
|
|
175773
175919
|
);
|
|
175774
175920
|
fail(
|
|
@@ -175786,7 +175932,7 @@ var WebRtcBridge = class {
|
|
|
175786
175932
|
if (msg.session_id) sessionId = msg.session_id;
|
|
175787
175933
|
const ans = msg.answer;
|
|
175788
175934
|
settle(() => {
|
|
175789
|
-
|
|
175935
|
+
logger250.info(
|
|
175790
175936
|
`HA answer received for ${entityId} (${ans.length} chars)`
|
|
175791
175937
|
);
|
|
175792
175938
|
resolve11(ans);
|
|
@@ -175795,7 +175941,7 @@ var WebRtcBridge = class {
|
|
|
175795
175941
|
break;
|
|
175796
175942
|
case "error": {
|
|
175797
175943
|
const detail = msg.message ?? msg.code ?? "unknown error";
|
|
175798
|
-
|
|
175944
|
+
logger250.info(`HA WebRTC error for ${entityId}: ${detail}`);
|
|
175799
175945
|
fail(new Error(`HA WebRTC error: ${detail}`));
|
|
175800
175946
|
break;
|
|
175801
175947
|
}
|
|
@@ -175969,7 +176115,7 @@ var CameraPlugin = class {
|
|
|
175969
176115
|
// src/plugins/builtin/security/security-plugin.ts
|
|
175970
176116
|
init_esm();
|
|
175971
176117
|
import {
|
|
175972
|
-
callService
|
|
176118
|
+
callService,
|
|
175973
176119
|
createConnection as createConnection4,
|
|
175974
176120
|
createLongLivedTokenAuth as createLongLivedTokenAuth3
|
|
175975
176121
|
} from "home-assistant-js-websocket";
|
|
@@ -176821,7 +176967,7 @@ var SecurityPlugin = class {
|
|
|
176821
176967
|
let timer;
|
|
176822
176968
|
try {
|
|
176823
176969
|
await Promise.race([
|
|
176824
|
-
|
|
176970
|
+
callService(connection, domain, service, void 0, {
|
|
176825
176971
|
entity_id: entityId
|
|
176826
176972
|
}),
|
|
176827
176973
|
new Promise((_, reject) => {
|
|
@@ -176952,7 +177098,7 @@ import {
|
|
|
176952
177098
|
getCollection
|
|
176953
177099
|
} from "home-assistant-js-websocket";
|
|
176954
177100
|
import { atLeastHaVersion } from "home-assistant-js-websocket/dist/util.js";
|
|
176955
|
-
var
|
|
177101
|
+
var logger251 = Logger.get("SubscribeEntities");
|
|
176956
177102
|
function processEvent(store, updates) {
|
|
176957
177103
|
const state = { ...store.state };
|
|
176958
177104
|
if (updates.a) {
|
|
@@ -176978,7 +177124,7 @@ function processEvent(store, updates) {
|
|
|
176978
177124
|
for (const entityId in updates.c) {
|
|
176979
177125
|
let entityState = state[entityId];
|
|
176980
177126
|
if (!entityState) {
|
|
176981
|
-
|
|
177127
|
+
logger251.warn("Received state update for unknown entity", entityId);
|
|
176982
177128
|
continue;
|
|
176983
177129
|
}
|
|
176984
177130
|
entityState = { ...entityState };
|
|
@@ -177067,7 +177213,7 @@ var subscribeEntities = (conn, onChange, entityIds) => {
|
|
|
177067
177213
|
// src/services/bridges/entity-isolation-service.ts
|
|
177068
177214
|
init_esm();
|
|
177069
177215
|
init_diagnostic_event_bus();
|
|
177070
|
-
var
|
|
177216
|
+
var logger252 = Logger.get("EntityIsolation");
|
|
177071
177217
|
var EntityIsolationServiceImpl = class {
|
|
177072
177218
|
isolatedEntities = /* @__PURE__ */ new Map();
|
|
177073
177219
|
isolationCallbacks = /* @__PURE__ */ new Map();
|
|
@@ -177135,13 +177281,13 @@ var EntityIsolationServiceImpl = class {
|
|
|
177135
177281
|
}
|
|
177136
177282
|
const parsed = this.parseEndpointPath(msg);
|
|
177137
177283
|
if (!parsed) {
|
|
177138
|
-
|
|
177284
|
+
logger252.warn("Could not parse entity from error:", msg);
|
|
177139
177285
|
return false;
|
|
177140
177286
|
}
|
|
177141
177287
|
const { bridgeId, entityName } = parsed;
|
|
177142
177288
|
const callback = this.isolationCallbacks.get(bridgeId);
|
|
177143
177289
|
if (!callback) {
|
|
177144
|
-
|
|
177290
|
+
logger252.warn(
|
|
177145
177291
|
`No isolation callback registered for bridge ${bridgeId}, entity: ${entityName}`
|
|
177146
177292
|
);
|
|
177147
177293
|
return false;
|
|
@@ -177156,7 +177302,7 @@ var EntityIsolationServiceImpl = class {
|
|
|
177156
177302
|
reason,
|
|
177157
177303
|
failedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
177158
177304
|
});
|
|
177159
|
-
|
|
177305
|
+
logger252.warn(
|
|
177160
177306
|
`Isolating entity "${entityName}" from bridge ${bridgeId} due to: ${reason}`
|
|
177161
177307
|
);
|
|
177162
177308
|
diagnosticEventBus.emit("entity_error", `Entity isolated: ${entityName}`, {
|
|
@@ -177168,7 +177314,7 @@ var EntityIsolationServiceImpl = class {
|
|
|
177168
177314
|
await callback(entityName);
|
|
177169
177315
|
return true;
|
|
177170
177316
|
} catch (e) {
|
|
177171
|
-
|
|
177317
|
+
logger252.error(`Failed to isolate entity ${entityName}:`, e);
|
|
177172
177318
|
return false;
|
|
177173
177319
|
}
|
|
177174
177320
|
}
|
|
@@ -177249,6 +177395,9 @@ var BridgeEndpointManager = class extends Service {
|
|
|
177249
177395
|
// entityId -> first absence stamp (grace window)
|
|
177250
177396
|
pendingRemovals = /* @__PURE__ */ new Map();
|
|
177251
177397
|
removalRecheckTimer = null;
|
|
177398
|
+
// Bumped on every stop, so a refresh that was already running cannot arm a
|
|
177399
|
+
// timer on a bridge that has since stopped (#438).
|
|
177400
|
+
lifecycle = 0;
|
|
177252
177401
|
pluginEndpoints = /* @__PURE__ */ new Map();
|
|
177253
177402
|
pluginStateUpdating = /* @__PURE__ */ new Set();
|
|
177254
177403
|
pluginListeners = /* @__PURE__ */ new Map();
|
|
@@ -177533,11 +177682,12 @@ var BridgeEndpointManager = class extends Service {
|
|
|
177533
177682
|
this.removalRecheckTimer = null;
|
|
177534
177683
|
}
|
|
177535
177684
|
if (this.pendingRemovals.size === 0) return;
|
|
177685
|
+
const lifecycle = this.lifecycle;
|
|
177536
177686
|
this.removalRecheckTimer = setTimeout(() => {
|
|
177537
177687
|
this.removalRecheckTimer = null;
|
|
177538
177688
|
this.refreshDevices().catch((e) => {
|
|
177539
177689
|
this.log.warn("Endpoint removal recheck failed:", e);
|
|
177540
|
-
this.scheduleRemovalRecheck();
|
|
177690
|
+
if (lifecycle === this.lifecycle) this.scheduleRemovalRecheck();
|
|
177541
177691
|
});
|
|
177542
177692
|
}, ENDPOINT_REMOVAL_GRACE_MS + 5e3);
|
|
177543
177693
|
}
|
|
@@ -177608,6 +177758,7 @@ var BridgeEndpointManager = class extends Service {
|
|
|
177608
177758
|
}
|
|
177609
177759
|
stopObserving() {
|
|
177610
177760
|
this.observingRequested = false;
|
|
177761
|
+
this.lifecycle++;
|
|
177611
177762
|
this.clearSubscription();
|
|
177612
177763
|
if (this.removalRecheckTimer) {
|
|
177613
177764
|
clearTimeout(this.removalRecheckTimer);
|
|
@@ -177616,6 +177767,7 @@ var BridgeEndpointManager = class extends Service {
|
|
|
177616
177767
|
}
|
|
177617
177768
|
async refreshDevices() {
|
|
177618
177769
|
this.registry.refresh();
|
|
177770
|
+
const lifecycle = this.lifecycle;
|
|
177619
177771
|
const endpoints = [...this.root.parts].filter(hasEntityIdentity).filter((p) => !(p instanceof VacuumAreaSwitchEndpoint));
|
|
177620
177772
|
const fullEntities = this.registry.fullEntities;
|
|
177621
177773
|
if (!this.client.haRunning || Object.keys(fullEntities).length === 0) {
|
|
@@ -177789,7 +177941,9 @@ var BridgeEndpointManager = class extends Service {
|
|
|
177789
177941
|
}
|
|
177790
177942
|
}
|
|
177791
177943
|
}
|
|
177792
|
-
this.
|
|
177944
|
+
if (lifecycle === this.lifecycle) {
|
|
177945
|
+
this.scheduleRemovalRecheck();
|
|
177946
|
+
}
|
|
177793
177947
|
let memoryLimitReached = false;
|
|
177794
177948
|
for (const entityId of this.entityIds) {
|
|
177795
177949
|
if (!memoryLimitReached && isHeapUnderPressure()) {
|
|
@@ -178088,7 +178242,7 @@ var BridgeEndpointManager = class extends Service {
|
|
|
178088
178242
|
init_dist();
|
|
178089
178243
|
init_esm();
|
|
178090
178244
|
init_send_ha_message();
|
|
178091
|
-
import { callService as
|
|
178245
|
+
import { callService as callService2 } from "home-assistant-js-websocket";
|
|
178092
178246
|
import { keys as keys2, pickBy, values as values3 } from "lodash-es";
|
|
178093
178247
|
var BridgeRegistry = class _BridgeRegistry {
|
|
178094
178248
|
constructor(registry3, dataProvider, client) {
|
|
@@ -178478,7 +178632,7 @@ var BridgeRegistry = class _BridgeRegistry {
|
|
|
178478
178632
|
async resolveRoborockRooms(entityId) {
|
|
178479
178633
|
if (!this.client) return [];
|
|
178480
178634
|
try {
|
|
178481
|
-
const raw = await
|
|
178635
|
+
const raw = await callService2(
|
|
178482
178636
|
this.client.connection,
|
|
178483
178637
|
"roborock",
|
|
178484
178638
|
"get_maps",
|
|
@@ -178857,6 +179011,7 @@ function hashAreaId(areaId) {
|
|
|
178857
179011
|
init_dist();
|
|
178858
179012
|
init_esm7();
|
|
178859
179013
|
import * as os10 from "node:os";
|
|
179014
|
+
init_protocol3();
|
|
178860
179015
|
init_diagnostic_event_bus();
|
|
178861
179016
|
var imWrapMarker2 = /* @__PURE__ */ Symbol("hamh.wedgeImWrap");
|
|
178862
179017
|
var commandMessageTypes2 = [
|
|
@@ -178872,11 +179027,11 @@ function makeWarmStartState(state, now = (/* @__PURE__ */ new Date()).toISOStrin
|
|
|
178872
179027
|
return { ...state, last_updated: now };
|
|
178873
179028
|
}
|
|
178874
179029
|
var ServerModeBridge = class {
|
|
178875
|
-
constructor(
|
|
179030
|
+
constructor(logger255, dataProvider, endpointManager, server) {
|
|
178876
179031
|
this.dataProvider = dataProvider;
|
|
178877
179032
|
this.endpointManager = endpointManager;
|
|
178878
179033
|
this.server = server;
|
|
178879
|
-
this.log =
|
|
179034
|
+
this.log = logger255.get(`ServerModeBridge / ${dataProvider.id}`);
|
|
178880
179035
|
}
|
|
178881
179036
|
dataProvider;
|
|
178882
179037
|
endpointManager;
|
|
@@ -180018,7 +180173,7 @@ function ServerModeVacuumDevice(homeAssistantEntity, includeOnOff = false, clean
|
|
|
180018
180173
|
}
|
|
180019
180174
|
|
|
180020
180175
|
// src/matter/endpoints/server-mode-vacuum-endpoint.ts
|
|
180021
|
-
var
|
|
180176
|
+
var logger253 = Logger.get("ServerModeVacuumEndpoint");
|
|
180022
180177
|
var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEndpoint {
|
|
180023
180178
|
static async create(registry3, entityId, mapping, endpointId) {
|
|
180024
180179
|
const deviceRegistry = registry3.deviceOf(entityId);
|
|
@@ -180031,7 +180186,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180031
180186
|
if (mapping?.disableBatteryMapping && mapping.batteryEntity) {
|
|
180032
180187
|
effectiveMapping = { ...mapping, batteryEntity: void 0 };
|
|
180033
180188
|
}
|
|
180034
|
-
|
|
180189
|
+
logger253.info(
|
|
180035
180190
|
`${entityId}: device_id=${entity.device_id}, manualBattery=${mapping?.batteryEntity ?? "none"}`
|
|
180036
180191
|
);
|
|
180037
180192
|
if (entity.device_id) {
|
|
@@ -180046,15 +180201,15 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180046
180201
|
batteryEntity: batteryEntityId
|
|
180047
180202
|
};
|
|
180048
180203
|
registry3.markBatteryEntityUsed(batteryEntityId);
|
|
180049
|
-
|
|
180204
|
+
logger253.info(`${entityId}: Auto-assigned battery ${batteryEntityId}`);
|
|
180050
180205
|
} else {
|
|
180051
180206
|
const attrs = state.attributes;
|
|
180052
180207
|
if (attrs.battery_level != null || attrs.battery != null) {
|
|
180053
|
-
|
|
180208
|
+
logger253.info(
|
|
180054
180209
|
`${entityId}: No battery entity found, using battery attribute from vacuum state`
|
|
180055
180210
|
);
|
|
180056
180211
|
} else {
|
|
180057
|
-
|
|
180212
|
+
logger253.warn(
|
|
180058
180213
|
`${entityId}: No battery entity found for device ${entity.device_id}`
|
|
180059
180214
|
);
|
|
180060
180215
|
}
|
|
@@ -180069,7 +180224,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180069
180224
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
180070
180225
|
cleaningModeEntity: vacuumEntities.cleaningModeEntity
|
|
180071
180226
|
};
|
|
180072
|
-
|
|
180227
|
+
logger253.info(
|
|
180073
180228
|
`${entityId}: Auto-assigned cleaningMode ${vacuumEntities.cleaningModeEntity}`
|
|
180074
180229
|
);
|
|
180075
180230
|
}
|
|
@@ -180079,7 +180234,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180079
180234
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
180080
180235
|
suctionLevelEntity: vacuumEntities.suctionLevelEntity
|
|
180081
180236
|
};
|
|
180082
|
-
|
|
180237
|
+
logger253.info(
|
|
180083
180238
|
`${entityId}: Auto-assigned suctionLevel ${vacuumEntities.suctionLevelEntity}`
|
|
180084
180239
|
);
|
|
180085
180240
|
}
|
|
@@ -180089,7 +180244,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180089
180244
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
180090
180245
|
mopIntensityEntity: vacuumEntities.mopIntensityEntity
|
|
180091
180246
|
};
|
|
180092
|
-
|
|
180247
|
+
logger253.info(
|
|
180093
180248
|
`${entityId}: Auto-assigned mopIntensity ${vacuumEntities.mopIntensityEntity}`
|
|
180094
180249
|
);
|
|
180095
180250
|
}
|
|
@@ -180099,7 +180254,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180099
180254
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
180100
180255
|
currentRoomEntity: vacuumEntities.currentRoomEntity
|
|
180101
180256
|
};
|
|
180102
|
-
|
|
180257
|
+
logger253.info(
|
|
180103
180258
|
`${entityId}: Auto-assigned currentRoom ${vacuumEntities.currentRoomEntity}`
|
|
180104
180259
|
);
|
|
180105
180260
|
}
|
|
@@ -180114,7 +180269,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180114
180269
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
180115
180270
|
cleanAreaRooms
|
|
180116
180271
|
};
|
|
180117
|
-
|
|
180272
|
+
logger253.info(
|
|
180118
180273
|
`${entityId}: Using ${cleanAreaRooms.length} HA areas via CLEAN_AREA`
|
|
180119
180274
|
);
|
|
180120
180275
|
}
|
|
@@ -180135,7 +180290,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180135
180290
|
rooms: roomsObj
|
|
180136
180291
|
}
|
|
180137
180292
|
};
|
|
180138
|
-
|
|
180293
|
+
logger253.info(
|
|
180139
180294
|
`${entityId}: Auto-detected ${valetudoRooms.length} Valetudo segments`
|
|
180140
180295
|
);
|
|
180141
180296
|
} else {
|
|
@@ -180152,14 +180307,14 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180152
180307
|
rooms: roomsObj
|
|
180153
180308
|
}
|
|
180154
180309
|
};
|
|
180155
|
-
|
|
180310
|
+
logger253.info(
|
|
180156
180311
|
`${entityId}: Auto-detected ${roborockRooms.length} Roborock rooms`
|
|
180157
180312
|
);
|
|
180158
180313
|
}
|
|
180159
180314
|
}
|
|
180160
180315
|
}
|
|
180161
180316
|
} else {
|
|
180162
|
-
|
|
180317
|
+
logger253.warn(`${entityId}: No device_id, cannot auto-assign battery`);
|
|
180163
180318
|
}
|
|
180164
180319
|
const payload = {
|
|
180165
180320
|
entity_id: entityId,
|
|
@@ -180232,11 +180387,11 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180232
180387
|
}
|
|
180233
180388
|
if (mappedChanged) {
|
|
180234
180389
|
this.pendingMappedChange = true;
|
|
180235
|
-
|
|
180390
|
+
logger253.debug(
|
|
180236
180391
|
`Mapped entity change detected for ${this.entityId}, forcing update`
|
|
180237
180392
|
);
|
|
180238
180393
|
}
|
|
180239
|
-
|
|
180394
|
+
logger253.debug(
|
|
180240
180395
|
`State update received for ${this.entityId}: state=${state.state}`
|
|
180241
180396
|
);
|
|
180242
180397
|
this.lastState = state;
|
|
@@ -180307,6 +180462,12 @@ var ServerModeEndpointManager = class extends Service {
|
|
|
180307
180462
|
// device (#438).
|
|
180308
180463
|
pendingRemovals = /* @__PURE__ */ new Map();
|
|
180309
180464
|
removalRecheckTimer = null;
|
|
180465
|
+
// endpoint id -> entity that closed but may come back (disable). Its number
|
|
180466
|
+
// is still parked, so nobody else may mount on that id (#438).
|
|
180467
|
+
parkedEndpointIds = /* @__PURE__ */ new Map();
|
|
180468
|
+
// Bumped on every stop, so a refresh that was already running cannot arm a
|
|
180469
|
+
// timer on a bridge that has since stopped.
|
|
180470
|
+
lifecycle = 0;
|
|
180310
180471
|
get failedEntities() {
|
|
180311
180472
|
return this._failedEntities;
|
|
180312
180473
|
}
|
|
@@ -180369,6 +180530,7 @@ var ServerModeEndpointManager = class extends Service {
|
|
|
180369
180530
|
}
|
|
180370
180531
|
stopObserving() {
|
|
180371
180532
|
this.observingRequested = false;
|
|
180533
|
+
this.lifecycle++;
|
|
180372
180534
|
this.clearSubscription();
|
|
180373
180535
|
if (this.removalRecheckTimer) {
|
|
180374
180536
|
clearTimeout(this.removalRecheckTimer);
|
|
@@ -180426,11 +180588,12 @@ var ServerModeEndpointManager = class extends Service {
|
|
|
180426
180588
|
this.removalRecheckTimer = null;
|
|
180427
180589
|
}
|
|
180428
180590
|
if (this.pendingRemovals.size === 0) return;
|
|
180591
|
+
const lifecycle = this.lifecycle;
|
|
180429
180592
|
this.removalRecheckTimer = setTimeout(() => {
|
|
180430
180593
|
this.removalRecheckTimer = null;
|
|
180431
180594
|
this.refreshDevices().catch((e) => {
|
|
180432
180595
|
this.log.warn("Endpoint removal recheck failed:", e);
|
|
180433
|
-
this.scheduleRemovalRecheck();
|
|
180596
|
+
if (lifecycle === this.lifecycle) this.scheduleRemovalRecheck();
|
|
180434
180597
|
});
|
|
180435
180598
|
}, ENDPOINT_REMOVAL_GRACE_MS + 5e3);
|
|
180436
180599
|
}
|
|
@@ -180450,6 +180613,7 @@ var ServerModeEndpointManager = class extends Service {
|
|
|
180450
180613
|
}
|
|
180451
180614
|
async refreshDevices() {
|
|
180452
180615
|
this.registry.refresh();
|
|
180616
|
+
const lifecycle = this.lifecycle;
|
|
180453
180617
|
const fullEntities = this.registry.fullEntities;
|
|
180454
180618
|
try {
|
|
180455
180619
|
if (!this.client.haRunning || Object.keys(fullEntities).length === 0) {
|
|
@@ -180539,6 +180703,17 @@ var ServerModeEndpointManager = class extends Service {
|
|
|
180539
180703
|
const confirmedRemoved = this.removableAfterGrace(genuinelyRemoved);
|
|
180540
180704
|
let structureChanged = removed.length > genuinelyRemoved.length || confirmedRemoved.length > 0;
|
|
180541
180705
|
await this.removeEndpoints(confirmedRemoved);
|
|
180706
|
+
for (const entityId of orderedIds) {
|
|
180707
|
+
const mapping = this.getEntityMapping(entityId);
|
|
180708
|
+
if (!mapping?.disabled) continue;
|
|
180709
|
+
for (const [id, owner] of this.parkedEndpointIds) {
|
|
180710
|
+
if (owner === entityId) this.parkedEndpointIds.delete(id);
|
|
180711
|
+
}
|
|
180712
|
+
this.parkedEndpointIds.set(
|
|
180713
|
+
this.endpoints.get(entityId)?.endpoint.id ?? resolvedByEntity.get(entityId)?.endpointId ?? createEndpointId(entityId, mapping.customName),
|
|
180714
|
+
entityId
|
|
180715
|
+
);
|
|
180716
|
+
}
|
|
180542
180717
|
for (const entityId of orderedIds) {
|
|
180543
180718
|
const mapping = this.getEntityMapping(entityId);
|
|
180544
180719
|
if (mapping?.disabled) {
|
|
@@ -180585,10 +180760,11 @@ var ServerModeEndpointManager = class extends Service {
|
|
|
180585
180760
|
const collision = [...this.endpoints.entries()].find(
|
|
180586
180761
|
([, entry]) => entry.endpoint.id === endpointId
|
|
180587
180762
|
);
|
|
180588
|
-
|
|
180763
|
+
const parkedBy = this.parkedEndpointIds.get(endpointId);
|
|
180764
|
+
if (collision || parkedBy != null && parkedBy !== entityId) {
|
|
180589
180765
|
this._failedEntities.push({
|
|
180590
180766
|
entityId,
|
|
180591
|
-
reason: `Endpoint id collides with ${collision[0]}. Set distinct custom names.`
|
|
180767
|
+
reason: `Endpoint id collides with ${collision?.[0] ?? parkedBy}. Set distinct custom names.`
|
|
180592
180768
|
});
|
|
180593
180769
|
continue;
|
|
180594
180770
|
}
|
|
@@ -180626,6 +180802,11 @@ var ServerModeEndpointManager = class extends Service {
|
|
|
180626
180802
|
}
|
|
180627
180803
|
await this.serverNode.addDevice(endpoint);
|
|
180628
180804
|
this.endpoints.set(entityId, { endpoint, fingerprint });
|
|
180805
|
+
for (const [id, owner] of this.parkedEndpointIds) {
|
|
180806
|
+
if (id === endpointId || owner === entityId) {
|
|
180807
|
+
this.parkedEndpointIds.delete(id);
|
|
180808
|
+
}
|
|
180809
|
+
}
|
|
180629
180810
|
structureChanged = true;
|
|
180630
180811
|
this.log.info(`Server mode: Added device ${entityId}`);
|
|
180631
180812
|
} catch (e) {
|
|
@@ -180645,7 +180826,9 @@ var ServerModeEndpointManager = class extends Service {
|
|
|
180645
180826
|
}
|
|
180646
180827
|
}
|
|
180647
180828
|
} finally {
|
|
180648
|
-
this.
|
|
180829
|
+
if (lifecycle === this.lifecycle) {
|
|
180830
|
+
this.scheduleRemovalRecheck();
|
|
180831
|
+
}
|
|
180649
180832
|
if (this.observingRequested) {
|
|
180650
180833
|
this.startObserving();
|
|
180651
180834
|
}
|
|
@@ -180887,10 +181070,10 @@ var BridgeEnvironmentFactory = class extends BridgeFactory {
|
|
|
180887
181070
|
// src/core/ioc/app-environment.ts
|
|
180888
181071
|
var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
180889
181072
|
constructor(rootEnv, options) {
|
|
180890
|
-
const
|
|
181073
|
+
const logger255 = rootEnv.get(LoggerService);
|
|
180891
181074
|
super({
|
|
180892
181075
|
id: "App",
|
|
180893
|
-
log:
|
|
181076
|
+
log: logger255.get("AppContainer"),
|
|
180894
181077
|
parent: rootEnv
|
|
180895
181078
|
});
|
|
180896
181079
|
this.options = options;
|
|
@@ -180904,8 +181087,8 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
180904
181087
|
}
|
|
180905
181088
|
construction;
|
|
180906
181089
|
async init() {
|
|
180907
|
-
const
|
|
180908
|
-
this.set(LoggerService,
|
|
181090
|
+
const logger255 = this.get(LoggerService);
|
|
181091
|
+
this.set(LoggerService, logger255);
|
|
180909
181092
|
this.set(AppStorage, new AppStorage(await this.load(StorageService)));
|
|
180910
181093
|
this.set(BridgeStorage, new BridgeStorage(await this.load(AppStorage)));
|
|
180911
181094
|
this.set(
|
|
@@ -180926,7 +181109,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
180926
181109
|
);
|
|
180927
181110
|
this.set(
|
|
180928
181111
|
HomeAssistantClient,
|
|
180929
|
-
new HomeAssistantClient(
|
|
181112
|
+
new HomeAssistantClient(logger255, this.options.homeAssistant)
|
|
180930
181113
|
);
|
|
180931
181114
|
this.set(
|
|
180932
181115
|
HomeAssistantConfig,
|
|
@@ -180934,7 +181117,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
180934
181117
|
);
|
|
180935
181118
|
this.set(
|
|
180936
181119
|
HomeAssistantActions,
|
|
180937
|
-
new HomeAssistantActions(
|
|
181120
|
+
new HomeAssistantActions(logger255, await this.load(HomeAssistantClient))
|
|
180938
181121
|
);
|
|
180939
181122
|
this.set(
|
|
180940
181123
|
HomeAssistantRegistry,
|
|
@@ -180970,7 +181153,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
180970
181153
|
this.set(
|
|
180971
181154
|
WebApi,
|
|
180972
181155
|
new WebApi(
|
|
180973
|
-
|
|
181156
|
+
logger255,
|
|
180974
181157
|
await this.load(BridgeService),
|
|
180975
181158
|
await this.load(HomeAssistantClient),
|
|
180976
181159
|
await this.load(HomeAssistantRegistry),
|
|
@@ -180991,7 +181174,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
180991
181174
|
|
|
180992
181175
|
// src/matter/patches/patch-level-control-tlv.ts
|
|
180993
181176
|
init_esm();
|
|
180994
|
-
var
|
|
181177
|
+
var logger254 = Logger.get("PatchLevelControlTlv");
|
|
180995
181178
|
var optionalFieldModels = /* @__PURE__ */ new WeakSet();
|
|
180996
181179
|
var fieldModelMandatoryGetterPatched = false;
|
|
180997
181180
|
function patchLevelControlTlv() {
|
|
@@ -181047,11 +181230,11 @@ function patchLevelControlTlv() {
|
|
|
181047
181230
|
patched++;
|
|
181048
181231
|
}
|
|
181049
181232
|
if (patched > 0) {
|
|
181050
|
-
|
|
181233
|
+
logger254.info(
|
|
181051
181234
|
`Patched ${patched} LevelControl TLV schema(s): transitionTime is now optional (Google Home compatibility)`
|
|
181052
181235
|
);
|
|
181053
181236
|
} else {
|
|
181054
|
-
|
|
181237
|
+
logger254.warn(
|
|
181055
181238
|
"Failed to patch LevelControl TLV schemas, field definitions not found. Google Home brightness adjustment may not work.",
|
|
181056
181239
|
{
|
|
181057
181240
|
moveToLevel: describeFields(
|
|
@@ -182793,6 +182976,7 @@ export {
|
|
|
182793
182976
|
@matter/main/dist/esm/version.js:
|
|
182794
182977
|
@matter/main/dist/esm/index.js:
|
|
182795
182978
|
@matter/main/dist/esm/protocol.js:
|
|
182979
|
+
@matter/main/dist/esm/types.js:
|
|
182796
182980
|
@matter/types/dist/esm/clusters/fan-control.js:
|
|
182797
182981
|
@matter/node/dist/esm/behaviors/fan-control/FanControlBehavior.js:
|
|
182798
182982
|
@matter/node/dist/esm/behaviors/fan-control/FanControlServer.js:
|
|
@@ -183223,7 +183407,6 @@ export {
|
|
|
183223
183407
|
@matter/node/dist/esm/devices/index.js:
|
|
183224
183408
|
@matter/main/dist/esm/devices.js:
|
|
183225
183409
|
@matter/main/dist/esm/node.js:
|
|
183226
|
-
@matter/main/dist/esm/types.js:
|
|
183227
183410
|
@matter/node/dist/esm/behaviors/account-login/index.js:
|
|
183228
183411
|
@matter/node/dist/esm/behaviors/actions/ActionsClient.js:
|
|
183229
183412
|
@matter/node/dist/esm/behaviors/actions/index.js:
|
|
@@ -183448,6 +183631,13 @@ export {
|
|
|
183448
183631
|
@matter/node/dist/esm/behaviors/zone-management/index.js:
|
|
183449
183632
|
@matter/node/dist/esm/behaviors/index.js:
|
|
183450
183633
|
@matter/main/dist/esm/behaviors.js:
|
|
183634
|
+
@matter/types/dist/esm/clusters/alarm-base.js:
|
|
183635
|
+
@matter/types/dist/esm/clusters/concentration-measurement.js:
|
|
183636
|
+
@matter/types/dist/esm/clusters/label.js:
|
|
183637
|
+
@matter/types/dist/esm/clusters/resource-monitoring.js:
|
|
183638
|
+
@matter/types/dist/esm/clusters/web-rtc-transport-definitions.js:
|
|
183639
|
+
@matter/types/dist/esm/clusters/index.js:
|
|
183640
|
+
@matter/main/dist/esm/clusters.js:
|
|
183451
183641
|
@matter/node/dist/esm/endpoints/base.js:
|
|
183452
183642
|
@matter/node/dist/esm/endpoints/bridged-node.js:
|
|
183453
183643
|
@matter/node/dist/esm/endpoints/device-energy-management.js:
|
|
@@ -183459,13 +183649,6 @@ export {
|
|
|
183459
183649
|
@matter/node/dist/esm/endpoints/secondary-network-interface.js:
|
|
183460
183650
|
@matter/node/dist/esm/endpoints/index.js:
|
|
183461
183651
|
@matter/main/dist/esm/endpoints.js:
|
|
183462
|
-
@matter/types/dist/esm/clusters/alarm-base.js:
|
|
183463
|
-
@matter/types/dist/esm/clusters/concentration-measurement.js:
|
|
183464
|
-
@matter/types/dist/esm/clusters/label.js:
|
|
183465
|
-
@matter/types/dist/esm/clusters/resource-monitoring.js:
|
|
183466
|
-
@matter/types/dist/esm/clusters/web-rtc-transport-definitions.js:
|
|
183467
|
-
@matter/types/dist/esm/clusters/index.js:
|
|
183468
|
-
@matter/main/dist/esm/clusters.js:
|
|
183469
183652
|
@matter/main/dist/esm/model.js:
|
|
183470
183653
|
@matter/main/dist/esm/forwards/clusters/level-control.js:
|
|
183471
183654
|
@matter/main/dist/esm/forwards/behaviors/boolean-state.js:
|