@riddix/hamh 2.1.0-alpha.427 → 2.1.0-alpha.428
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
|
@@ -1743,8 +1743,8 @@ var init_Cancelable = __esm({
|
|
|
1743
1743
|
};
|
|
1744
1744
|
return result;
|
|
1745
1745
|
}
|
|
1746
|
-
static set logger(
|
|
1747
|
-
this.#logger =
|
|
1746
|
+
static set logger(logger194) {
|
|
1747
|
+
this.#logger = logger194;
|
|
1748
1748
|
}
|
|
1749
1749
|
static get logger() {
|
|
1750
1750
|
return this.#logger;
|
|
@@ -3422,13 +3422,13 @@ var init_Logger = __esm({
|
|
|
3422
3422
|
*
|
|
3423
3423
|
* @deprecated use {@link destinations}
|
|
3424
3424
|
*/
|
|
3425
|
-
static addLogger(identifier,
|
|
3425
|
+
static addLogger(identifier, logger194, options) {
|
|
3426
3426
|
if (identifier in this.destinations) {
|
|
3427
3427
|
throw new ImplementationError(`Logger "${identifier}" already exists`);
|
|
3428
3428
|
}
|
|
3429
3429
|
const dest = LogDestination({ name: identifier });
|
|
3430
3430
|
const legacy = adaptDestinationToLegacy(dest);
|
|
3431
|
-
legacy.log =
|
|
3431
|
+
legacy.log = logger194;
|
|
3432
3432
|
if (options?.defaultLogLevel !== void 0) {
|
|
3433
3433
|
legacy.defaultLogLevel = options.defaultLogLevel;
|
|
3434
3434
|
}
|
|
@@ -5538,8 +5538,8 @@ function Construction(subject, initializer) {
|
|
|
5538
5538
|
}
|
|
5539
5539
|
}
|
|
5540
5540
|
function unhandledError(...args) {
|
|
5541
|
-
const
|
|
5542
|
-
|
|
5541
|
+
const logger194 = Logger.get(subject.constructor.name);
|
|
5542
|
+
logger194.error(...args);
|
|
5543
5543
|
}
|
|
5544
5544
|
function createErrorHandler(name) {
|
|
5545
5545
|
return (e) => {
|
|
@@ -135998,11 +135998,11 @@ var init_Api = __esm({
|
|
|
135998
135998
|
}
|
|
135999
135999
|
Api2.resourceFor = resourceFor;
|
|
136000
136000
|
function log(level, facility, id, ...message) {
|
|
136001
|
-
let
|
|
136002
|
-
if (!
|
|
136003
|
-
loggers.set(facility,
|
|
136001
|
+
let logger194 = loggers.get(facility);
|
|
136002
|
+
if (!logger194) {
|
|
136003
|
+
loggers.set(facility, logger194 = Logger.get(facility));
|
|
136004
136004
|
}
|
|
136005
|
-
|
|
136005
|
+
logger194[level](Diagnostic.via(id || "(anon)"), message);
|
|
136006
136006
|
}
|
|
136007
136007
|
Api2.log = log;
|
|
136008
136008
|
function logRequest(facility, id, method, target) {
|
|
@@ -147202,10 +147202,10 @@ var init_home_assistant_actions = __esm({
|
|
|
147202
147202
|
circuitBreakerResetMs: 3e4
|
|
147203
147203
|
};
|
|
147204
147204
|
HomeAssistantActions = class extends Service {
|
|
147205
|
-
constructor(
|
|
147205
|
+
constructor(logger194, client, config10) {
|
|
147206
147206
|
super("HomeAssistantActions");
|
|
147207
147207
|
this.client = client;
|
|
147208
|
-
this.log =
|
|
147208
|
+
this.log = logger194.get(this);
|
|
147209
147209
|
this.config = { ...defaultConfig, ...config10 };
|
|
147210
147210
|
this.circuitBreaker = new CircuitBreaker(
|
|
147211
147211
|
this.config.circuitBreakerThreshold,
|
|
@@ -147526,10 +147526,10 @@ var DiagnosticService = class {
|
|
|
147526
147526
|
};
|
|
147527
147527
|
|
|
147528
147528
|
// src/api/access-log.ts
|
|
147529
|
-
function accessLogger(
|
|
147529
|
+
function accessLogger(logger194) {
|
|
147530
147530
|
return (req, res, next) => {
|
|
147531
147531
|
res.on("finish", () => {
|
|
147532
|
-
|
|
147532
|
+
logger194.debug(
|
|
147533
147533
|
`${req.method} ${decodeURI(req.originalUrl)} ${res.statusCode} ${res.statusMessage} from ${req.socket.remoteAddress}`
|
|
147534
147534
|
);
|
|
147535
147535
|
});
|
|
@@ -149632,12 +149632,14 @@ function settingsApi(settingsStorage, envAuth) {
|
|
|
149632
149632
|
}
|
|
149633
149633
|
|
|
149634
149634
|
// src/api/system-api.ts
|
|
149635
|
+
init_esm();
|
|
149635
149636
|
import { exec } from "node:child_process";
|
|
149636
149637
|
import os2 from "node:os";
|
|
149637
149638
|
import { promisify } from "node:util";
|
|
149638
149639
|
import v8 from "node:v8";
|
|
149639
149640
|
import express12 from "express";
|
|
149640
149641
|
var execAsync = promisify(exec);
|
|
149642
|
+
var logger141 = Logger.get("SystemApi");
|
|
149641
149643
|
function detectEnvironment2() {
|
|
149642
149644
|
if (process.env.SUPERVISOR_TOKEN || process.env.HASSIO_TOKEN) {
|
|
149643
149645
|
return "Home Assistant Add-on";
|
|
@@ -149701,7 +149703,7 @@ function systemApi(version) {
|
|
|
149701
149703
|
};
|
|
149702
149704
|
res.json(systemInfo);
|
|
149703
149705
|
} catch (error) {
|
|
149704
|
-
|
|
149706
|
+
logger141.error("Failed to get system info:", error);
|
|
149705
149707
|
res.status(500).json({ error: "Failed to get system info" });
|
|
149706
149708
|
}
|
|
149707
149709
|
});
|
|
@@ -149744,7 +149746,7 @@ async function getStorageInfo() {
|
|
|
149744
149746
|
return await getUnixStorageInfo(pathToCheck);
|
|
149745
149747
|
}
|
|
149746
149748
|
} catch (error) {
|
|
149747
|
-
|
|
149749
|
+
logger141.error("Failed to get storage info:", error);
|
|
149748
149750
|
return { total: 0, used: 0, free: 0 };
|
|
149749
149751
|
}
|
|
149750
149752
|
}
|
|
@@ -149971,7 +149973,7 @@ var WebSocketApi = class {
|
|
|
149971
149973
|
|
|
149972
149974
|
// src/api/web-api.ts
|
|
149973
149975
|
var WebApi = class extends Service {
|
|
149974
|
-
constructor(
|
|
149976
|
+
constructor(logger194, bridgeService, haClient, haRegistry, bridgeStorage, mappingStorage, lockCredentialStorage, settingsStorage, props) {
|
|
149975
149977
|
super("WebApi");
|
|
149976
149978
|
this.bridgeService = bridgeService;
|
|
149977
149979
|
this.haClient = haClient;
|
|
@@ -149981,8 +149983,8 @@ var WebApi = class extends Service {
|
|
|
149981
149983
|
this.lockCredentialStorage = lockCredentialStorage;
|
|
149982
149984
|
this.settingsStorage = settingsStorage;
|
|
149983
149985
|
this.props = props;
|
|
149984
|
-
this.logger =
|
|
149985
|
-
this.log =
|
|
149986
|
+
this.logger = logger194;
|
|
149987
|
+
this.log = logger194.get(this);
|
|
149986
149988
|
this.accessLogger = accessLogger(this.log.createChild("Access Log"));
|
|
149987
149989
|
this.startTime = Date.now();
|
|
149988
149990
|
this.wsApi = new WebSocketApi(
|
|
@@ -150415,12 +150417,12 @@ var CustomStorage = class extends StorageBackendDisk {
|
|
|
150415
150417
|
|
|
150416
150418
|
// src/core/app/storage.ts
|
|
150417
150419
|
function storage(environment, options) {
|
|
150418
|
-
const
|
|
150420
|
+
const logger194 = environment.get(LoggerService).get("CustomStorage");
|
|
150419
150421
|
const location2 = resolveStorageLocation(options.location);
|
|
150420
150422
|
fs6.mkdirSync(location2, { recursive: true });
|
|
150421
150423
|
const storageService = environment.get(StorageService);
|
|
150422
150424
|
storageService.location = location2;
|
|
150423
|
-
storageService.factory = (ns) => new CustomStorage(
|
|
150425
|
+
storageService.factory = (ns) => new CustomStorage(logger194, path6.resolve(location2, ns));
|
|
150424
150426
|
}
|
|
150425
150427
|
function resolveStorageLocation(storageLocation) {
|
|
150426
150428
|
const homedir = os3.homedir();
|
|
@@ -150774,10 +150776,10 @@ import {
|
|
|
150774
150776
|
getConfig
|
|
150775
150777
|
} from "home-assistant-js-websocket";
|
|
150776
150778
|
var HomeAssistantClient = class extends Service {
|
|
150777
|
-
constructor(
|
|
150779
|
+
constructor(logger194, options) {
|
|
150778
150780
|
super("HomeAssistantClient");
|
|
150779
150781
|
this.options = options;
|
|
150780
|
-
this.log =
|
|
150782
|
+
this.log = logger194.get(this);
|
|
150781
150783
|
}
|
|
150782
150784
|
static Options = /* @__PURE__ */ Symbol.for("HomeAssistantClientProps");
|
|
150783
150785
|
_connection;
|
|
@@ -150923,7 +150925,7 @@ async function getAreaRegistry(connection) {
|
|
|
150923
150925
|
}
|
|
150924
150926
|
|
|
150925
150927
|
// src/services/home-assistant/home-assistant-registry.ts
|
|
150926
|
-
var
|
|
150928
|
+
var logger142 = Logger.get("HomeAssistantRegistry");
|
|
150927
150929
|
var HomeAssistantRegistry = class extends Service {
|
|
150928
150930
|
constructor(client, options) {
|
|
150929
150931
|
super("HomeAssistantRegistry");
|
|
@@ -150967,7 +150969,7 @@ var HomeAssistantRegistry = class extends Service {
|
|
|
150967
150969
|
onRefresh();
|
|
150968
150970
|
}
|
|
150969
150971
|
} catch (e) {
|
|
150970
|
-
|
|
150972
|
+
logger142.warn("Failed to refresh registry, will retry next interval:", e);
|
|
150971
150973
|
}
|
|
150972
150974
|
}, this.options.refreshInterval * 1e3);
|
|
150973
150975
|
}
|
|
@@ -150983,7 +150985,7 @@ var HomeAssistantRegistry = class extends Service {
|
|
|
150983
150985
|
baseDelayMs: 2e3,
|
|
150984
150986
|
maxDelayMs: 15e3,
|
|
150985
150987
|
onRetry: (attempt, error, delayMs) => {
|
|
150986
|
-
|
|
150988
|
+
logger142.warn(
|
|
150987
150989
|
`Registry fetch failed (attempt ${attempt}), retrying in ${delayMs}ms:`,
|
|
150988
150990
|
error
|
|
150989
150991
|
);
|
|
@@ -151023,7 +151025,7 @@ var HomeAssistantRegistry = class extends Service {
|
|
|
151023
151025
|
const fingerprint = hash2.digest("hex");
|
|
151024
151026
|
this._states = keyBy(statesList, "entity_id");
|
|
151025
151027
|
if (fingerprint === this.lastRegistryFingerprint) {
|
|
151026
|
-
|
|
151028
|
+
logger142.debug("Registry unchanged, skipping full refresh");
|
|
151027
151029
|
return false;
|
|
151028
151030
|
}
|
|
151029
151031
|
this.lastRegistryFingerprint = fingerprint;
|
|
@@ -151044,10 +151046,10 @@ var HomeAssistantRegistry = class extends Service {
|
|
|
151044
151046
|
const missingDevices = fromPairs(missingDeviceIds.map((d) => [d, { id: d }]));
|
|
151045
151047
|
this._devices = { ...missingDevices, ...realDevices };
|
|
151046
151048
|
this._entities = allEntities;
|
|
151047
|
-
|
|
151049
|
+
logger142.debug(
|
|
151048
151050
|
`Loaded HA registry: ${keys(allEntities).length} entities, ${keys(realDevices).length} devices, ${keys(this._states).length} states`
|
|
151049
151051
|
);
|
|
151050
|
-
logMemoryUsage(
|
|
151052
|
+
logMemoryUsage(logger142, "after HA registry load");
|
|
151051
151053
|
this._labels = labels;
|
|
151052
151054
|
this._areas = new Map(areas.map((a) => [a.area_id, a.name]));
|
|
151053
151055
|
return true;
|
|
@@ -151623,7 +151625,7 @@ var __privateIn2 = (member, obj) => Object(obj) !== obj ? __typeError40('Cannot
|
|
|
151623
151625
|
var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
151624
151626
|
var __privateSet2 = (obj, member, value, setter) => (__accessCheck2(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
151625
151627
|
var __privateMethod2 = (obj, member, method) => (__accessCheck2(obj, member, "access private method"), method);
|
|
151626
|
-
var
|
|
151628
|
+
var logger143 = Logger.get("ScenesManagementServer");
|
|
151627
151629
|
var UNDEFINED_SCENE_ID = 255;
|
|
151628
151630
|
var GLOBAL_SCENE_ID = 0;
|
|
151629
151631
|
var UNDEFINED_GROUP = GroupId(0);
|
|
@@ -151782,11 +151784,11 @@ var ScenesManagementServer = class extends ScenesManagementBase {
|
|
|
151782
151784
|
return { status: Status2.ResourceExhausted, groupId: groupId22, sceneId };
|
|
151783
151785
|
}
|
|
151784
151786
|
this.state.sceneTable.push(sceneData);
|
|
151785
|
-
|
|
151787
|
+
logger143.debug(`Added scene ${sceneId} in group ${groupId22} for fabric ${fabricIndex}`);
|
|
151786
151788
|
this.#updateFabricSceneInfoCountsForFabric(fabricIndex);
|
|
151787
151789
|
} else {
|
|
151788
151790
|
this.state.sceneTable[existingSceneIndex] = sceneData;
|
|
151789
|
-
|
|
151791
|
+
logger143.debug(`Updated scene ${sceneId} in group ${groupId22} for fabric ${fabricIndex}`);
|
|
151790
151792
|
}
|
|
151791
151793
|
return { status: Status2.Success, groupId: groupId22, sceneId };
|
|
151792
151794
|
}
|
|
@@ -152089,20 +152091,20 @@ var ScenesManagementServer = class extends ScenesManagementBase {
|
|
|
152089
152091
|
}
|
|
152090
152092
|
}
|
|
152091
152093
|
if (fieldCount !== 2) {
|
|
152092
|
-
|
|
152094
|
+
logger143.warn(
|
|
152093
152095
|
`AttributeValuePair has invalid number (${fieldCount}) of fields (${serialize(attributeValuePair)})`
|
|
152094
152096
|
);
|
|
152095
152097
|
return void 0;
|
|
152096
152098
|
}
|
|
152097
152099
|
const value = attributeValuePair[mappedType];
|
|
152098
152100
|
if (value === void 0) {
|
|
152099
|
-
|
|
152101
|
+
logger143.warn(
|
|
152100
152102
|
`AttributeValuePair missing value for mappedType ${mappedType} (${serialize(attributeValuePair)})`
|
|
152101
152103
|
);
|
|
152102
152104
|
return void 0;
|
|
152103
152105
|
}
|
|
152104
152106
|
if (typeof value !== "number" && typeof value !== "bigint") {
|
|
152105
|
-
|
|
152107
|
+
logger143.warn(
|
|
152106
152108
|
`AttributeValuePair has invalid non-numeric value for mappedType ${mappedType} (${serialize(attributeValuePair)})`
|
|
152107
152109
|
// Should never happen
|
|
152108
152110
|
);
|
|
@@ -152200,7 +152202,7 @@ var ScenesManagementServer = class extends ScenesManagementBase {
|
|
|
152200
152202
|
} else if (schema6.schema.baseTypeMin < 0 && schema6.schema.min > schema6.schema.baseTypeMin) {
|
|
152201
152203
|
return { attributeId, [mappedType]: schema6.schema.baseTypeMin };
|
|
152202
152204
|
} else {
|
|
152203
|
-
|
|
152205
|
+
logger143.warn(
|
|
152204
152206
|
`Cannot determine out-of-bounds value for attribute schema, returning min value of datatype schema`
|
|
152205
152207
|
);
|
|
152206
152208
|
}
|
|
@@ -152221,7 +152223,7 @@ var ScenesManagementServer = class extends ScenesManagementBase {
|
|
|
152221
152223
|
}
|
|
152222
152224
|
}
|
|
152223
152225
|
});
|
|
152224
|
-
|
|
152226
|
+
logger143.debug(`Collected scene attribute values on Endpoint ${this.endpoint.id}: ${serialize(sceneValues)}`);
|
|
152225
152227
|
return sceneValues;
|
|
152226
152228
|
}
|
|
152227
152229
|
/**
|
|
@@ -152260,7 +152262,7 @@ var ScenesManagementServer = class extends ScenesManagementBase {
|
|
|
152260
152262
|
}
|
|
152261
152263
|
const attrType = attribute2.primitiveBase?.name;
|
|
152262
152264
|
if (attrType === void 0 || DataTypeToSceneAttributeDataMap[attrType] === void 0) {
|
|
152263
|
-
|
|
152265
|
+
logger143.warn(
|
|
152264
152266
|
`Scene Attribute ${attribute2.name} on Cluster ${clusterName} has unsupported datatype ${attrType} for scene management on Endpoint ${this.endpoint.id}`
|
|
152265
152267
|
);
|
|
152266
152268
|
continue;
|
|
@@ -152275,7 +152277,7 @@ var ScenesManagementServer = class extends ScenesManagementBase {
|
|
|
152275
152277
|
});
|
|
152276
152278
|
}
|
|
152277
152279
|
if (sceneClusterDetails) {
|
|
152278
|
-
|
|
152280
|
+
logger143.info(
|
|
152279
152281
|
`Registered ${sceneClusterDetails.attributes.size} scene attributes for Cluster ${clusterName} on Endpoint ${this.endpoint.id}`
|
|
152280
152282
|
);
|
|
152281
152283
|
this.internal.endpointSceneableBehaviors.add(sceneClusterDetails);
|
|
@@ -152283,7 +152285,7 @@ var ScenesManagementServer = class extends ScenesManagementBase {
|
|
|
152283
152285
|
}
|
|
152284
152286
|
/** Apply scene attribute values in the various clusters on the endpoint. */
|
|
152285
152287
|
#applySceneAttributeValues(sceneValues, transitionTime = null) {
|
|
152286
|
-
|
|
152288
|
+
logger143.debug(`Recalling scene on Endpoint ${this.endpoint.id} with values: ${serialize(sceneValues)}`);
|
|
152287
152289
|
const agent = this.endpoint.agentFor(this.context);
|
|
152288
152290
|
const promises = [];
|
|
152289
152291
|
for (const [clusterName, clusterAttributes] of Object.entries(sceneValues)) {
|
|
@@ -152294,7 +152296,7 @@ var ScenesManagementServer = class extends ScenesManagementBase {
|
|
|
152294
152296
|
promises.push(result);
|
|
152295
152297
|
}
|
|
152296
152298
|
} else {
|
|
152297
|
-
|
|
152299
|
+
logger143.warn(
|
|
152298
152300
|
`No scenes implementation found for cluster ${clusterName} on Endpoint ${this.endpoint.id} during scene recall. Values are ignored`
|
|
152299
152301
|
);
|
|
152300
152302
|
}
|
|
@@ -152302,7 +152304,7 @@ var ScenesManagementServer = class extends ScenesManagementBase {
|
|
|
152302
152304
|
if (promises.length) {
|
|
152303
152305
|
return Promise.all(promises).then(
|
|
152304
152306
|
() => void 0,
|
|
152305
|
-
(error) =>
|
|
152307
|
+
(error) => logger143.warn(`Error applying scene attribute values on Endpoint ${this.endpoint.id}:`, error)
|
|
152306
152308
|
);
|
|
152307
152309
|
}
|
|
152308
152310
|
}
|
|
@@ -152493,7 +152495,7 @@ var GroupsBehaviorConstructor = ClusterBehavior.withInterface().for(Groups3.Clus
|
|
|
152493
152495
|
var GroupsBehavior = GroupsBehaviorConstructor;
|
|
152494
152496
|
|
|
152495
152497
|
// ../../node_modules/.pnpm/@matter+node@0.16.10/node_modules/@matter/node/dist/esm/behaviors/groups/GroupsServer.js
|
|
152496
|
-
var
|
|
152498
|
+
var logger144 = Logger.get("GroupsServer");
|
|
152497
152499
|
Groups3.Cluster.commands = {
|
|
152498
152500
|
...Groups3.Cluster.commands,
|
|
152499
152501
|
addGroup: Command(
|
|
@@ -152557,7 +152559,7 @@ var GroupsServer = class extends GroupsBase {
|
|
|
152557
152559
|
(fabric2, gkm) => gkm.addEndpointForGroup(fabric2, groupId3, endpointNumber, groupName)
|
|
152558
152560
|
);
|
|
152559
152561
|
} catch (error) {
|
|
152560
|
-
|
|
152562
|
+
logger144.error(error);
|
|
152561
152563
|
StatusResponseError.accept(error);
|
|
152562
152564
|
return { status: error.code, groupId: groupId3 };
|
|
152563
152565
|
}
|
|
@@ -155597,7 +155599,7 @@ function miredsToXy(mireds) {
|
|
|
155597
155599
|
}
|
|
155598
155600
|
|
|
155599
155601
|
// ../../node_modules/.pnpm/@matter+node@0.16.10/node_modules/@matter/node/dist/esm/behaviors/color-control/ColorControlServer.js
|
|
155600
|
-
var
|
|
155602
|
+
var logger145 = Logger.get("ColorControlServer");
|
|
155601
155603
|
var ColorControlBase = ColorControlBehavior.with(
|
|
155602
155604
|
ColorControl3.Feature.HueSaturation,
|
|
155603
155605
|
ColorControl3.Feature.EnhancedHue,
|
|
@@ -156778,7 +156780,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
|
|
|
156778
156780
|
switch (oldMode) {
|
|
156779
156781
|
case ColorControl3.ColorMode.CurrentHueAndCurrentSaturation:
|
|
156780
156782
|
if (this.state.currentHue === void 0 || this.state.currentSaturation === void 0) {
|
|
156781
|
-
|
|
156783
|
+
logger145.warn("Could not convert from hue/saturation because one of them is undefined");
|
|
156782
156784
|
break;
|
|
156783
156785
|
}
|
|
156784
156786
|
switch (newMode) {
|
|
@@ -156790,7 +156792,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
|
|
|
156790
156792
|
case ColorControl3.ColorMode.ColorTemperatureMireds:
|
|
156791
156793
|
const mireds = hsvToMireds(this.hue, this.saturation);
|
|
156792
156794
|
if (mireds === void 0) {
|
|
156793
|
-
|
|
156795
|
+
logger145.warn(
|
|
156794
156796
|
`Could not convert hue/saturation (${this.hue}/${this.saturation}) to color temperature`
|
|
156795
156797
|
);
|
|
156796
156798
|
} else {
|
|
@@ -156801,7 +156803,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
|
|
|
156801
156803
|
break;
|
|
156802
156804
|
case ColorControl3.ColorMode.CurrentXAndCurrentY:
|
|
156803
156805
|
if (this.state.currentX === void 0 || this.state.currentY === void 0) {
|
|
156804
|
-
|
|
156806
|
+
logger145.warn("Could not convert from xy because one of them is undefined");
|
|
156805
156807
|
break;
|
|
156806
156808
|
}
|
|
156807
156809
|
switch (newMode) {
|
|
@@ -156813,7 +156815,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
|
|
|
156813
156815
|
case ColorControl3.ColorMode.ColorTemperatureMireds:
|
|
156814
156816
|
const mireds = xyToMireds(this.x, this.y);
|
|
156815
156817
|
if (mireds === void 0) {
|
|
156816
|
-
|
|
156818
|
+
logger145.warn(`Could not convert xy ${this.x / this.y} to color temperature`);
|
|
156817
156819
|
} else {
|
|
156818
156820
|
this.mireds = mireds;
|
|
156819
156821
|
}
|
|
@@ -156822,14 +156824,14 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
|
|
|
156822
156824
|
break;
|
|
156823
156825
|
case ColorControl3.ColorMode.ColorTemperatureMireds:
|
|
156824
156826
|
if (this.state.colorTemperatureMireds === void 0) {
|
|
156825
|
-
|
|
156827
|
+
logger145.warn("Could not convert from color temperature because it is undefined");
|
|
156826
156828
|
break;
|
|
156827
156829
|
}
|
|
156828
156830
|
switch (newMode) {
|
|
156829
156831
|
case ColorControl3.ColorMode.CurrentHueAndCurrentSaturation:
|
|
156830
156832
|
const hsvResult = miredsToHsv(this.mireds);
|
|
156831
156833
|
if (hsvResult === void 0) {
|
|
156832
|
-
|
|
156834
|
+
logger145.warn(`Could not convert color temperature ${this.mireds} to hue/saturation`);
|
|
156833
156835
|
} else {
|
|
156834
156836
|
const [hue, saturation] = hsvResult;
|
|
156835
156837
|
this.hue = hue;
|
|
@@ -156839,7 +156841,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
|
|
|
156839
156841
|
case ColorControl3.ColorMode.CurrentXAndCurrentY:
|
|
156840
156842
|
const xyResult = miredsToXy(this.mireds);
|
|
156841
156843
|
if (xyResult === void 0) {
|
|
156842
|
-
|
|
156844
|
+
logger145.warn("Could not convert color temperature to xy");
|
|
156843
156845
|
} else {
|
|
156844
156846
|
const [x, y] = xyResult;
|
|
156845
156847
|
this.x = x;
|
|
@@ -156888,7 +156890,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
|
|
|
156888
156890
|
);
|
|
156889
156891
|
newColorTemp = tempPhysMax - tempDelta;
|
|
156890
156892
|
}
|
|
156891
|
-
|
|
156893
|
+
logger145.debug(`Synced color temperature with level: ${level}, new color temperature: ${newColorTemp}`);
|
|
156892
156894
|
return this.moveToColorTemperatureLogic(newColorTemp, 0);
|
|
156893
156895
|
}
|
|
156894
156896
|
#assertRate(mode, rate) {
|
|
@@ -157092,7 +157094,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
|
|
|
157092
157094
|
targetEnhancedColorMode = values4.enhancedColorMode;
|
|
157093
157095
|
}
|
|
157094
157096
|
if (!this.#supportsColorMode(targetEnhancedColorMode)) {
|
|
157095
|
-
|
|
157097
|
+
logger145.info(
|
|
157096
157098
|
`Can not apply scene with unsupported color mode: ${ColorControl3.EnhancedColorMode[targetEnhancedColorMode]} (${targetEnhancedColorMode})`
|
|
157097
157099
|
);
|
|
157098
157100
|
}
|
|
@@ -157134,7 +157136,7 @@ var ColorControlBaseServer = class _ColorControlBaseServer extends ColorControlB
|
|
|
157134
157136
|
}
|
|
157135
157137
|
break;
|
|
157136
157138
|
default:
|
|
157137
|
-
|
|
157139
|
+
logger145.info(
|
|
157138
157140
|
`No supported color mode found to apply scene: ${ColorControl3.EnhancedColorMode[targetEnhancedColorMode]} (${targetEnhancedColorMode})`
|
|
157139
157141
|
);
|
|
157140
157142
|
break;
|
|
@@ -157227,7 +157229,7 @@ init_esm();
|
|
|
157227
157229
|
init_ServerNode();
|
|
157228
157230
|
init_esm4();
|
|
157229
157231
|
init_esm3();
|
|
157230
|
-
var
|
|
157232
|
+
var logger146 = Logger.get("LevelControlServer");
|
|
157231
157233
|
var LevelControlBase = LevelControlBehavior.with(LevelControl3.Feature.OnOff, LevelControl3.Feature.Lighting);
|
|
157232
157234
|
var LevelControlBaseServer = class _LevelControlBaseServer extends LevelControlBase {
|
|
157233
157235
|
/** Returns the minimum level, including feature specific fallback value handling. */
|
|
@@ -157314,17 +157316,17 @@ var LevelControlBaseServer = class _LevelControlBaseServer extends LevelControlB
|
|
|
157314
157316
|
*/
|
|
157315
157317
|
initializeLighting() {
|
|
157316
157318
|
if (this.state.currentLevel === 0) {
|
|
157317
|
-
|
|
157319
|
+
logger146.warn(
|
|
157318
157320
|
`The currentLevel value of ${this.state.currentLevel} is invalid according to Matter specification. The value must not be 0.`
|
|
157319
157321
|
);
|
|
157320
157322
|
}
|
|
157321
157323
|
if (this.minLevel !== 1) {
|
|
157322
|
-
|
|
157324
|
+
logger146.warn(
|
|
157323
157325
|
`The minLevel value of ${this.minLevel} is invalid according to Matter specification. The value should be 1.`
|
|
157324
157326
|
);
|
|
157325
157327
|
}
|
|
157326
157328
|
if (this.maxLevel !== 254) {
|
|
157327
|
-
|
|
157329
|
+
logger146.warn(
|
|
157328
157330
|
`The maxLevel value of ${this.maxLevel} is invalid according to Matter specification. The value should be 254.`
|
|
157329
157331
|
);
|
|
157330
157332
|
}
|
|
@@ -157635,7 +157637,7 @@ var LevelControlBaseServer = class _LevelControlBaseServer extends LevelControlB
|
|
|
157635
157637
|
if (!onOff || this.state.onLevel === null) {
|
|
157636
157638
|
return;
|
|
157637
157639
|
}
|
|
157638
|
-
|
|
157640
|
+
logger146.debug(`OnOff changed to ON, setting level to onLevel value of ${this.state.onLevel}`);
|
|
157639
157641
|
this.state.currentLevel = this.state.onLevel;
|
|
157640
157642
|
}
|
|
157641
157643
|
#calculateEffectiveOptions(optionsMask, optionsOverride) {
|
|
@@ -158670,7 +158672,7 @@ var SwitchBehavior = SwitchBehaviorConstructor;
|
|
|
158670
158672
|
// ../../node_modules/.pnpm/@matter+node@0.16.10/node_modules/@matter/node/dist/esm/behaviors/switch/SwitchServer.js
|
|
158671
158673
|
var DEFAULT_MULTIPRESS_DELAY = Millis(300);
|
|
158672
158674
|
var DEFAULT_LONG_PRESS_DELAY = Seconds(2);
|
|
158673
|
-
var
|
|
158675
|
+
var logger147 = Logger.get("SwitchServer");
|
|
158674
158676
|
var SwitchServerBase = SwitchBehavior.for(Switch3.Complete).with(
|
|
158675
158677
|
Switch3.Feature.LatchingSwitch,
|
|
158676
158678
|
Switch3.Feature.MomentarySwitch,
|
|
@@ -158724,7 +158726,7 @@ var SwitchBaseServer = class extends SwitchServerBase {
|
|
|
158724
158726
|
this.internal.currentIsLongPress = false;
|
|
158725
158727
|
this.internal.multiPressTimer?.stop();
|
|
158726
158728
|
this.internal.longPressTimer?.stop();
|
|
158727
|
-
|
|
158729
|
+
logger147.info("State of Switch got reset");
|
|
158728
158730
|
}
|
|
158729
158731
|
// TODO remove when Validator logic can assess that with 1.3 introduction
|
|
158730
158732
|
#assertPositionInRange(position) {
|
|
@@ -159251,7 +159253,7 @@ var ModeSelectBehaviorConstructor = ClusterBehavior.withInterface().for(ModeSele
|
|
|
159251
159253
|
var ModeSelectBehavior = ModeSelectBehaviorConstructor;
|
|
159252
159254
|
|
|
159253
159255
|
// ../../node_modules/.pnpm/@matter+node@0.16.10/node_modules/@matter/node/dist/esm/behaviors/mode-select/ModeSelectServer.js
|
|
159254
|
-
var
|
|
159256
|
+
var logger148 = Logger.get("ModeSelectServer");
|
|
159255
159257
|
var ModeSelectBase = ModeSelectBehavior.with(ModeSelect3.Feature.OnOff);
|
|
159256
159258
|
var ModeSelectBaseServer = class extends ModeSelectBase {
|
|
159257
159259
|
initialize() {
|
|
@@ -159268,7 +159270,7 @@ var ModeSelectBaseServer = class extends ModeSelectBase {
|
|
|
159268
159270
|
}
|
|
159269
159271
|
this.reactTo(onOffServer.events.onOff$Changed, this.#handleOnOffDependency);
|
|
159270
159272
|
} else {
|
|
159271
|
-
|
|
159273
|
+
logger148.warn("OnOffServer not found on endpoint, but OnMode is set.");
|
|
159272
159274
|
}
|
|
159273
159275
|
}
|
|
159274
159276
|
if (!currentModeOverridden && this.state.startUpMode !== void 0 && this.state.startUpMode !== null && this.#getBootReason() !== GeneralDiagnostics3.BootReason.SoftwareUpdateCompleted) {
|
|
@@ -159489,7 +159491,7 @@ init_IdentifyServer();
|
|
|
159489
159491
|
// ../../node_modules/.pnpm/@matter+node@0.16.10/node_modules/@matter/node/dist/esm/behaviors/occupancy-sensing/OccupancySensingServer.js
|
|
159490
159492
|
init_occupancy_sensing();
|
|
159491
159493
|
init_esm();
|
|
159492
|
-
var
|
|
159494
|
+
var logger149 = Logger.get("OccupancySensingServer");
|
|
159493
159495
|
var holdTimeDependencies = [
|
|
159494
159496
|
"holdTimeLimits",
|
|
159495
159497
|
"pirOccupiedToUnoccupiedDelay",
|
|
@@ -159505,7 +159507,7 @@ var holdTimeDependencies = [
|
|
|
159505
159507
|
var OccupancySensingServer = class extends OccupancySensingBehavior {
|
|
159506
159508
|
initialize() {
|
|
159507
159509
|
if (!Object.values(this.features).some((feature) => feature)) {
|
|
159508
|
-
|
|
159510
|
+
logger149.error(
|
|
159509
159511
|
`OccupancySensingServer: Since revision 5 of the cluster features need to be set based on the detector type. Currently no features are enabled.`
|
|
159510
159512
|
);
|
|
159511
159513
|
} else if (!Object.values(this.state.occupancySensorTypeBitmap).some((feature) => feature) || this.state.occupancySensorType === void 0) {
|
|
@@ -159532,7 +159534,7 @@ var OccupancySensingServer = class extends OccupancySensingBehavior {
|
|
|
159532
159534
|
} else if (this.state.occupancySensorTypeBitmap.physicalContact) {
|
|
159533
159535
|
this.state.occupancySensorType = OccupancySensing3.OccupancySensorType.PhysicalContact;
|
|
159534
159536
|
}
|
|
159535
|
-
|
|
159537
|
+
logger149.debug(
|
|
159536
159538
|
"Sync occupancySensorType to",
|
|
159537
159539
|
OccupancySensing3.OccupancySensorType[this.state.occupancySensorType],
|
|
159538
159540
|
"and occupancySensorTypeBitmap to",
|
|
@@ -160496,7 +160498,7 @@ init_esm3();
|
|
|
160496
160498
|
|
|
160497
160499
|
// ../../node_modules/.pnpm/@matter+node@0.16.10/node_modules/@matter/node/dist/esm/behaviors/thermostat/AtomicWriteState.js
|
|
160498
160500
|
init_esm();
|
|
160499
|
-
var
|
|
160501
|
+
var logger150 = Logger.get("AtomicWriteState");
|
|
160500
160502
|
var MAXIMUM_ALLOWED_TIMEOUT = Seconds(9);
|
|
160501
160503
|
var AtomicWriteState = class {
|
|
160502
160504
|
peerAddress;
|
|
@@ -160531,19 +160533,19 @@ var AtomicWriteState = class {
|
|
|
160531
160533
|
});
|
|
160532
160534
|
}
|
|
160533
160535
|
start() {
|
|
160534
|
-
|
|
160536
|
+
logger150.debug(
|
|
160535
160537
|
`Starting atomic write state for peer ${this.peerAddress.toString()} on endpoint ${this.endpoint.id}`
|
|
160536
160538
|
);
|
|
160537
160539
|
this.#timer.start();
|
|
160538
160540
|
}
|
|
160539
160541
|
#timeoutTriggered() {
|
|
160540
|
-
|
|
160542
|
+
logger150.debug(
|
|
160541
160543
|
`Atomic write state for peer ${this.peerAddress.toString()} on endpoint ${this.endpoint.id} timed out`
|
|
160542
160544
|
);
|
|
160543
160545
|
this.close();
|
|
160544
160546
|
}
|
|
160545
160547
|
close() {
|
|
160546
|
-
|
|
160548
|
+
logger150.debug(
|
|
160547
160549
|
`Closing atomic write state for peer ${this.peerAddress.toString()} on endpoint ${this.endpoint.id}`
|
|
160548
160550
|
);
|
|
160549
160551
|
if (this.#timer.isRunning) {
|
|
@@ -160554,7 +160556,7 @@ var AtomicWriteState = class {
|
|
|
160554
160556
|
};
|
|
160555
160557
|
|
|
160556
160558
|
// ../../node_modules/.pnpm/@matter+node@0.16.10/node_modules/@matter/node/dist/esm/behaviors/thermostat/AtomicWriteHandler.js
|
|
160557
|
-
var
|
|
160559
|
+
var logger151 = Logger.get("AtomicWriteHandler");
|
|
160558
160560
|
var AtomicWriteHandler = class _AtomicWriteHandler {
|
|
160559
160561
|
#observers = new ObserverGroup();
|
|
160560
160562
|
#pendingWrites = new BasicSet();
|
|
@@ -160624,7 +160626,7 @@ var AtomicWriteHandler = class _AtomicWriteHandler {
|
|
|
160624
160626
|
);
|
|
160625
160627
|
this.#pendingWrites.add(state);
|
|
160626
160628
|
state.closed.on(() => void this.#pendingWrites.delete(state));
|
|
160627
|
-
|
|
160629
|
+
logger151.debug("Added atomic write state:", state);
|
|
160628
160630
|
return state;
|
|
160629
160631
|
}
|
|
160630
160632
|
if (existingState === void 0) {
|
|
@@ -160691,10 +160693,10 @@ var AtomicWriteHandler = class _AtomicWriteHandler {
|
|
|
160691
160693
|
writeAttribute(context, endpoint, cluster2, attribute2, value) {
|
|
160692
160694
|
const state = this.#assertPendingWriteForAttributeAndPeer(context, endpoint, cluster2, attribute2);
|
|
160693
160695
|
const attributeName = state.attributeNames.get(attribute2);
|
|
160694
|
-
|
|
160696
|
+
logger151.debug(`Writing pending value for attribute ${attributeName}, ${attribute2} in atomic write`, value);
|
|
160695
160697
|
endpoint.eventsOf(cluster2.id)[`${attributeName}$AtomicChanging`]?.emit(value, state.pendingAttributeValues[attribute2] !== void 0 ? state.pendingAttributeValues[attribute2] : state.initialValues[attribute2], context);
|
|
160696
160698
|
state.pendingAttributeValues[attribute2] = value;
|
|
160697
|
-
|
|
160699
|
+
logger151.debug("Atomic write state after current write:", state);
|
|
160698
160700
|
}
|
|
160699
160701
|
/**
|
|
160700
160702
|
* Implements the commit logic for an atomic write.
|
|
@@ -160713,7 +160715,7 @@ var AtomicWriteHandler = class _AtomicWriteHandler {
|
|
|
160713
160715
|
await context.transaction?.commit();
|
|
160714
160716
|
} catch (error) {
|
|
160715
160717
|
await context.transaction?.rollback();
|
|
160716
|
-
|
|
160718
|
+
logger151.info(`Failed to write attribute ${attr} during atomic write commit: ${error}`);
|
|
160717
160719
|
statusCode = error instanceof StatusResponseError ? error.code : Status2.Failure;
|
|
160718
160720
|
commandStatusCode = commandStatusCode === Status2.Failure ? Status2.Failure : commandStatusCode === Status2.ConstraintError ? Status2.ConstraintError : Status2.Failure;
|
|
160719
160721
|
}
|
|
@@ -160749,7 +160751,7 @@ var AtomicWriteHandler = class _AtomicWriteHandler {
|
|
|
160749
160751
|
const fabricIndex = fabric.fabricIndex;
|
|
160750
160752
|
for (const writeState of Array.from(this.#pendingWrites)) {
|
|
160751
160753
|
if (writeState.peerAddress.fabricIndex === fabricIndex) {
|
|
160752
|
-
|
|
160754
|
+
logger151.debug(
|
|
160753
160755
|
`Closing atomic write state for peer ${writeState.peerAddress.toString()} on endpoint ${writeState.endpoint.id} due to fabric removal`
|
|
160754
160756
|
);
|
|
160755
160757
|
writeState.close();
|
|
@@ -160790,7 +160792,7 @@ var AtomicWriteHandler = class _AtomicWriteHandler {
|
|
|
160790
160792
|
if (!PeerAddress.is(attrWriteState.peerAddress, peerAddress)) {
|
|
160791
160793
|
return void 0;
|
|
160792
160794
|
}
|
|
160793
|
-
|
|
160795
|
+
logger151.debug(
|
|
160794
160796
|
`Found pending value for attribute ${attribute2} for peer ${peerAddress.nodeId}`,
|
|
160795
160797
|
serialize(attrWriteState.pendingAttributeValues[attribute2])
|
|
160796
160798
|
);
|
|
@@ -160826,7 +160828,7 @@ var AtomicWriteHandler = class _AtomicWriteHandler {
|
|
|
160826
160828
|
};
|
|
160827
160829
|
|
|
160828
160830
|
// ../../node_modules/.pnpm/@matter+node@0.16.10/node_modules/@matter/node/dist/esm/behaviors/thermostat/ThermostatServer.js
|
|
160829
|
-
var
|
|
160831
|
+
var logger152 = Logger.get("ThermostatServer");
|
|
160830
160832
|
var ThermostatBehaviorLogicBase = ThermostatBehavior.with(
|
|
160831
160833
|
Thermostat3.Feature.Heating,
|
|
160832
160834
|
Thermostat3.Feature.Cooling,
|
|
@@ -160855,7 +160857,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
160855
160857
|
throw new ImplementationError("Setback feature is deprecated and not allowed to be enabled");
|
|
160856
160858
|
}
|
|
160857
160859
|
if (this.features.matterScheduleConfiguration) {
|
|
160858
|
-
|
|
160860
|
+
logger152.warn("MatterScheduleConfiguration feature is not yet implemented. Please do not activate it");
|
|
160859
160861
|
}
|
|
160860
160862
|
const options = this.endpoint.behaviors.optionsFor(_ThermostatBaseServer);
|
|
160861
160863
|
if (this.features.presets && this.state.persistedPresets === void 0) {
|
|
@@ -160973,7 +160975,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
160973
160975
|
throw new StatusResponse.InvalidCommandError("Requested PresetHandle not found");
|
|
160974
160976
|
}
|
|
160975
160977
|
}
|
|
160976
|
-
|
|
160978
|
+
logger152.info(`Setting active preset handle to`, presetHandle);
|
|
160977
160979
|
this.state.activePresetHandle = presetHandle;
|
|
160978
160980
|
return preset;
|
|
160979
160981
|
}
|
|
@@ -161043,7 +161045,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
161043
161045
|
}
|
|
161044
161046
|
if (this.state.setpointHoldExpiryTimestamp === void 0) {
|
|
161045
161047
|
} else {
|
|
161046
|
-
|
|
161048
|
+
logger152.warn(
|
|
161047
161049
|
"Handling for setpointHoldExpiryTimestamp is not yet implemented. To use this attribute you need to install the needed logic yourself"
|
|
161048
161050
|
);
|
|
161049
161051
|
}
|
|
@@ -161116,7 +161118,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
161116
161118
|
"RemoteSensing cannot be set to LocalTemperature when LocalTemperatureNotExposed feature is enabled"
|
|
161117
161119
|
);
|
|
161118
161120
|
}
|
|
161119
|
-
|
|
161121
|
+
logger152.debug("LocalTemperatureNotExposed feature is enabled, ignoring local temperature measurement");
|
|
161120
161122
|
this.state.localTemperature = null;
|
|
161121
161123
|
}
|
|
161122
161124
|
let localTemperature = null;
|
|
@@ -161125,11 +161127,11 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
161125
161127
|
const endpoints = this.env.get(ServerNode).endpoints;
|
|
161126
161128
|
const endpoint = endpoints.has(localTempEndpoint) ? endpoints.for(localTempEndpoint) : void 0;
|
|
161127
161129
|
if (endpoint !== void 0 && endpoint.behaviors.has(TemperatureMeasurementServer)) {
|
|
161128
|
-
|
|
161130
|
+
logger152.debug(
|
|
161129
161131
|
`Using existing TemperatureMeasurement cluster on endpoint #${localTempEndpoint} for local temperature measurement`
|
|
161130
161132
|
);
|
|
161131
161133
|
if (this.state.externalMeasuredIndoorTemperature !== void 0) {
|
|
161132
|
-
|
|
161134
|
+
logger152.warn(
|
|
161133
161135
|
"Both local TemperatureMeasurement cluster and externalMeasuredIndoorTemperature state are set, using local cluster"
|
|
161134
161136
|
);
|
|
161135
161137
|
}
|
|
@@ -161139,19 +161141,19 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
161139
161141
|
);
|
|
161140
161142
|
localTemperature = endpoint.stateOf(TemperatureMeasurementServer).measuredValue;
|
|
161141
161143
|
} else {
|
|
161142
|
-
|
|
161144
|
+
logger152.warn(
|
|
161143
161145
|
`No TemperatureMeasurement cluster found on endpoint #${localTempEndpoint}, falling back to externalMeasuredIndoorTemperature state if set`
|
|
161144
161146
|
);
|
|
161145
161147
|
}
|
|
161146
161148
|
} else {
|
|
161147
161149
|
if (this.state.externalMeasuredIndoorTemperature === void 0) {
|
|
161148
161150
|
if (this.state.localTemperatureCalibration !== void 0) {
|
|
161149
|
-
|
|
161151
|
+
logger152.warn(
|
|
161150
161152
|
"No local TemperatureMeasurement cluster available, externalMeasuredIndoorTemperature state not set but localTemperatureCalibration is used: Ensure to correctly consider the calibration when updating the localTemperature value"
|
|
161151
161153
|
);
|
|
161152
161154
|
}
|
|
161153
161155
|
} else {
|
|
161154
|
-
|
|
161156
|
+
logger152.info("Using measured temperature via externalMeasuredIndoorTemperature state");
|
|
161155
161157
|
localTemperature = this.state.externalMeasuredIndoorTemperature ?? null;
|
|
161156
161158
|
}
|
|
161157
161159
|
this.reactTo(this.events.externalMeasuredIndoorTemperature$Changed, this.#handleMeasuredTemperatureChange);
|
|
@@ -161191,28 +161193,28 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
161191
161193
|
const endpoints = this.env.get(ServerNode).endpoints;
|
|
161192
161194
|
const endpoint = endpoints.has(localOccupancyEndpoint) ? endpoints.for(localOccupancyEndpoint) : void 0;
|
|
161193
161195
|
if (endpoint !== void 0 && endpoint.behaviors.has(OccupancySensingServer)) {
|
|
161194
|
-
|
|
161196
|
+
logger152.debug(
|
|
161195
161197
|
`Using existing OccupancySensing cluster on endpoint ${localOccupancyEndpoint} for local occupancy sensing`
|
|
161196
161198
|
);
|
|
161197
161199
|
if (this.state.externallyMeasuredOccupancy !== void 0) {
|
|
161198
|
-
|
|
161200
|
+
logger152.warn(
|
|
161199
161201
|
"Both local OccupancySensing cluster and externallyMeasuredOccupancy state are set, using local cluster"
|
|
161200
161202
|
);
|
|
161201
161203
|
}
|
|
161202
161204
|
this.reactTo(endpoint.eventsOf(OccupancySensingServer).occupancy$Changed, this.#handleOccupancyChange);
|
|
161203
161205
|
currentOccupancy = !!endpoint.stateOf(OccupancySensingServer).occupancy.occupied;
|
|
161204
161206
|
} else {
|
|
161205
|
-
|
|
161207
|
+
logger152.warn(
|
|
161206
161208
|
`No OccupancySensing cluster found on endpoint ${localOccupancyEndpoint}, falling back to externallyMeasuredOccupancy state if set`
|
|
161207
161209
|
);
|
|
161208
161210
|
}
|
|
161209
161211
|
} else {
|
|
161210
161212
|
if (this.state.externallyMeasuredOccupancy === void 0) {
|
|
161211
|
-
|
|
161213
|
+
logger152.warn(
|
|
161212
161214
|
"No local OccupancySensing cluster available and externallyMeasuredOccupancy state not set"
|
|
161213
161215
|
);
|
|
161214
161216
|
} else {
|
|
161215
|
-
|
|
161217
|
+
logger152.info("Using occupancy via externallyMeasuredOccupancy state");
|
|
161216
161218
|
currentOccupancy = this.state.externallyMeasuredOccupancy;
|
|
161217
161219
|
}
|
|
161218
161220
|
this.reactTo(this.events.externallyMeasuredOccupancy$Changed, this.#handleExternalOccupancyChange);
|
|
@@ -161479,7 +161481,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
161479
161481
|
max = this.state[`max${scope}`] ?? defaults.absMax,
|
|
161480
161482
|
absMax = this.state[`absMax${scope}`] ?? defaults.absMax
|
|
161481
161483
|
} = details;
|
|
161482
|
-
|
|
161484
|
+
logger152.debug(
|
|
161483
161485
|
`Validating user setpoint limits for ${scope}: absMin=${absMin}, min=${min}, max=${max}, absMax=${absMax}`
|
|
161484
161486
|
);
|
|
161485
161487
|
if (absMin > min) {
|
|
@@ -161526,7 +161528,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
161526
161528
|
const limitMax = scope === "Heat" ? this.heatSetpointMaximum : this.coolSetpointMaximum;
|
|
161527
161529
|
const result = cropValueRange(setpoint, limitMin, limitMax);
|
|
161528
161530
|
if (result !== setpoint) {
|
|
161529
|
-
|
|
161531
|
+
logger152.debug(
|
|
161530
161532
|
`${scope} setpoint (${setpoint}) is out of limits [${limitMin}, ${limitMax}], clamping to ${result}`
|
|
161531
161533
|
);
|
|
161532
161534
|
}
|
|
@@ -161563,7 +161565,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
161563
161565
|
const otherLimit = otherType === "Heating" ? this.heatSetpointMinimum : this.coolSetpointMaximum;
|
|
161564
161566
|
if (otherType === "Cooling") {
|
|
161565
161567
|
const minValidSetpoint = value + deadband;
|
|
161566
|
-
|
|
161568
|
+
logger152.debug(
|
|
161567
161569
|
`Ensuring deadband for ${type}${otherType}Setpoint, min valid setpoint is ${minValidSetpoint}`
|
|
161568
161570
|
);
|
|
161569
161571
|
if (otherSetpoint >= minValidSetpoint) {
|
|
@@ -161574,11 +161576,11 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
161574
161576
|
`Cannot adjust cooling setpoint to maintain deadband, would exceed max cooling setpoint (${otherLimit})`
|
|
161575
161577
|
);
|
|
161576
161578
|
}
|
|
161577
|
-
|
|
161579
|
+
logger152.debug(`Adjusting ${type}${otherType}Setpoint to ${minValidSetpoint} to maintain deadband`);
|
|
161578
161580
|
this.state[`${type}${otherType}Setpoint`] = minValidSetpoint;
|
|
161579
161581
|
} else {
|
|
161580
161582
|
const maxValidSetpoint = value - deadband;
|
|
161581
|
-
|
|
161583
|
+
logger152.debug(
|
|
161582
161584
|
`Ensuring deadband for ${type}${otherType}Setpoint, max valid setpoint is ${maxValidSetpoint}`
|
|
161583
161585
|
);
|
|
161584
161586
|
if (otherSetpoint <= maxValidSetpoint) {
|
|
@@ -161589,7 +161591,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
161589
161591
|
`Cannot adjust heating setpoint to maintain deadband, would exceed min heating setpoint (${otherLimit})`
|
|
161590
161592
|
);
|
|
161591
161593
|
}
|
|
161592
|
-
|
|
161594
|
+
logger152.debug(`Adjusting ${type}${otherType}Setpoint to ${maxValidSetpoint} to maintain deadband`);
|
|
161593
161595
|
this.state[`${type}${otherType}Setpoint`] = maxValidSetpoint;
|
|
161594
161596
|
}
|
|
161595
161597
|
}
|
|
@@ -161857,7 +161859,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
161857
161859
|
*/
|
|
161858
161860
|
#handlePersistedPresetsChanged(newPresets, oldPresets) {
|
|
161859
161861
|
if (oldPresets === void 0) {
|
|
161860
|
-
|
|
161862
|
+
logger152.debug(
|
|
161861
161863
|
"Old presets is undefined, skipping some checks. This should only happen on setup of the behavior."
|
|
161862
161864
|
);
|
|
161863
161865
|
}
|
|
@@ -161866,7 +161868,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
161866
161868
|
const newPresetHandles = /* @__PURE__ */ new Set();
|
|
161867
161869
|
for (const preset of newPresets) {
|
|
161868
161870
|
if (preset.presetHandle === null) {
|
|
161869
|
-
|
|
161871
|
+
logger152.error("Preset is missing presetHandle, generating a new one");
|
|
161870
161872
|
preset.presetHandle = entropy.randomBytes(16);
|
|
161871
161873
|
changed = true;
|
|
161872
161874
|
}
|
|
@@ -161915,7 +161917,7 @@ var ThermostatBaseServer = class _ThermostatBaseServer extends ThermostatBehavio
|
|
|
161915
161917
|
throw new StatusResponse.InvalidInStateError(`ActivePresetHandle references non-existing presetHandle`);
|
|
161916
161918
|
}
|
|
161917
161919
|
if (changed) {
|
|
161918
|
-
|
|
161920
|
+
logger152.error("PresetHandles or BuiltIn flags were updated, updating persistedPresets");
|
|
161919
161921
|
this.state.persistedPresets = deepCopy(newPresets);
|
|
161920
161922
|
}
|
|
161921
161923
|
}
|
|
@@ -162817,7 +162819,7 @@ init_IdentifyServer();
|
|
|
162817
162819
|
init_window_covering();
|
|
162818
162820
|
init_esm();
|
|
162819
162821
|
init_esm3();
|
|
162820
|
-
var
|
|
162822
|
+
var logger153 = Logger.get("WindowCoveringServer");
|
|
162821
162823
|
var WindowCoveringBase = WindowCoveringBehavior.with(
|
|
162822
162824
|
WindowCovering3.Feature.Lift,
|
|
162823
162825
|
WindowCovering3.Feature.Tilt,
|
|
@@ -162902,7 +162904,7 @@ var WindowCoveringBaseServer = class extends WindowCoveringBase {
|
|
|
162902
162904
|
this.state.configStatus = configStatus;
|
|
162903
162905
|
});
|
|
162904
162906
|
}
|
|
162905
|
-
|
|
162907
|
+
logger153.debug(
|
|
162906
162908
|
`Mode changed to ${Diagnostic.json(mode)} and config status to ${Diagnostic.json(configStatus)} and internal calibration mode to ${this.internal.calibrationMode}`
|
|
162907
162909
|
);
|
|
162908
162910
|
}
|
|
@@ -162910,7 +162912,7 @@ var WindowCoveringBaseServer = class extends WindowCoveringBase {
|
|
|
162910
162912
|
#handleOperationalStatusChanging(operationalStatus) {
|
|
162911
162913
|
const globalStatus = operationalStatus.lift !== WindowCovering3.MovementStatus.Stopped ? operationalStatus.lift : operationalStatus.tilt;
|
|
162912
162914
|
operationalStatus.global = globalStatus;
|
|
162913
|
-
|
|
162915
|
+
logger153.debug(
|
|
162914
162916
|
`Operational status changed to ${Diagnostic.json(operationalStatus)} with new global status ${globalStatus}`
|
|
162915
162917
|
);
|
|
162916
162918
|
this.state.operationalStatus = operationalStatus;
|
|
@@ -162939,10 +162941,10 @@ var WindowCoveringBaseServer = class extends WindowCoveringBase {
|
|
|
162939
162941
|
this.state.currentPositionLiftPercentage = percent100ths3 === null ? percent100ths3 : Math.floor(percent100ths3 / WC_PERCENT100THS_COEFFICIENT);
|
|
162940
162942
|
if (this.state.operationalStatus.lift !== WindowCovering3.MovementStatus.Stopped && percent100ths3 === this.state.targetPositionLiftPercent100ths) {
|
|
162941
162943
|
this.state.operationalStatus.lift = WindowCovering3.MovementStatus.Stopped;
|
|
162942
|
-
|
|
162944
|
+
logger153.debug("Lift movement stopped, target value reached");
|
|
162943
162945
|
}
|
|
162944
162946
|
}
|
|
162945
|
-
|
|
162947
|
+
logger153.debug(
|
|
162946
162948
|
`Syncing lift position ${this.state.currentPositionLiftPercent100ths === null ? null : (this.state.currentPositionLiftPercent100ths / 100).toFixed(2)} to ${this.state.currentPositionLiftPercentage}%`
|
|
162947
162949
|
);
|
|
162948
162950
|
}
|
|
@@ -162952,10 +162954,10 @@ var WindowCoveringBaseServer = class extends WindowCoveringBase {
|
|
|
162952
162954
|
this.state.currentPositionTiltPercentage = percent100ths3 === null ? percent100ths3 : Math.floor(percent100ths3 / WC_PERCENT100THS_COEFFICIENT);
|
|
162953
162955
|
if (this.state.operationalStatus.tilt !== WindowCovering3.MovementStatus.Stopped && percent100ths3 === this.state.targetPositionTiltPercent100ths) {
|
|
162954
162956
|
this.state.operationalStatus.tilt = WindowCovering3.MovementStatus.Stopped;
|
|
162955
|
-
|
|
162957
|
+
logger153.debug("Tilt movement stopped, target value reached");
|
|
162956
162958
|
}
|
|
162957
162959
|
}
|
|
162958
|
-
|
|
162960
|
+
logger153.debug(
|
|
162959
162961
|
`Syncing tilt position ${this.state.currentPositionTiltPercent100ths === null ? null : (this.state.currentPositionTiltPercent100ths / 100).toFixed(2)} to ${this.state.currentPositionTiltPercentage}%`
|
|
162960
162962
|
);
|
|
162961
162963
|
}
|
|
@@ -163043,7 +163045,7 @@ var WindowCoveringBaseServer = class extends WindowCoveringBase {
|
|
|
163043
163045
|
}
|
|
163044
163046
|
const directionInfo = direction === 2 ? ` in direction by position` : ` in direction ${direction === 1 ? "Close" : "Open"}`;
|
|
163045
163047
|
const targetInfo = targetPercent100ths === void 0 ? "" : ` to target position ${(targetPercent100ths / 100).toFixed(2)}`;
|
|
163046
|
-
|
|
163048
|
+
logger153.debug(
|
|
163047
163049
|
`Moving the device ${type === 0 ? "Lift" : "Tilt"}${directionInfo} (reversed=${reversed})${targetInfo}`
|
|
163048
163050
|
);
|
|
163049
163051
|
}
|
|
@@ -163065,7 +163067,7 @@ var WindowCoveringBaseServer = class extends WindowCoveringBase {
|
|
|
163065
163067
|
);
|
|
163066
163068
|
}
|
|
163067
163069
|
if (type === 0 && this.state.configStatus.liftMovementReversed) {
|
|
163068
|
-
|
|
163070
|
+
logger153.debug("Lift movement is reversed");
|
|
163069
163071
|
}
|
|
163070
163072
|
switch (type) {
|
|
163071
163073
|
case 0:
|
|
@@ -163427,7 +163429,7 @@ var BridgedDeviceBasicInformationBehaviorConstructor = ClusterBehavior.withInter
|
|
|
163427
163429
|
var BridgedDeviceBasicInformationBehavior = BridgedDeviceBasicInformationBehaviorConstructor;
|
|
163428
163430
|
|
|
163429
163431
|
// ../../node_modules/.pnpm/@matter+node@0.16.10/node_modules/@matter/node/dist/esm/behaviors/bridged-device-basic-information/BridgedDeviceBasicInformationServer.js
|
|
163430
|
-
var
|
|
163432
|
+
var logger154 = Logger.get("BridgedDeviceBasicInformationServer");
|
|
163431
163433
|
var BridgedDeviceBasicInformationServer = class extends BridgedDeviceBasicInformationBehavior {
|
|
163432
163434
|
async initialize() {
|
|
163433
163435
|
if (this.endpoint.lifecycle.isInstalled) {
|
|
@@ -163442,7 +163444,7 @@ var BridgedDeviceBasicInformationServer = class extends BridgedDeviceBasicInform
|
|
|
163442
163444
|
this.state.uniqueId = BasicInformationServer.createUniqueId();
|
|
163443
163445
|
}
|
|
163444
163446
|
if (serialNumber !== void 0 && uniqueId === this.state.serialNumber) {
|
|
163445
|
-
|
|
163447
|
+
logger154.warn("uniqueId and serialNumber shall not be the same.");
|
|
163446
163448
|
}
|
|
163447
163449
|
}
|
|
163448
163450
|
static schema = BasicInformationServer.enableUniqueIdPersistence(
|
|
@@ -164025,10 +164027,10 @@ function ensureCommissioningConfig(server) {
|
|
|
164025
164027
|
// src/services/bridges/bridge.ts
|
|
164026
164028
|
var AUTO_FORCE_SYNC_INTERVAL_MS = 9e4;
|
|
164027
164029
|
var Bridge = class {
|
|
164028
|
-
constructor(env,
|
|
164030
|
+
constructor(env, logger194, dataProvider, endpointManager) {
|
|
164029
164031
|
this.dataProvider = dataProvider;
|
|
164030
164032
|
this.endpointManager = endpointManager;
|
|
164031
|
-
this.log =
|
|
164033
|
+
this.log = logger194.get(`Bridge / ${dataProvider.id}`);
|
|
164032
164034
|
this.server = new BridgeServerNode(
|
|
164033
164035
|
env,
|
|
164034
164036
|
this.dataProvider,
|
|
@@ -165242,7 +165244,7 @@ import crypto5 from "node:crypto";
|
|
|
165242
165244
|
|
|
165243
165245
|
// src/utils/apply-patch-state.ts
|
|
165244
165246
|
init_esm();
|
|
165245
|
-
var
|
|
165247
|
+
var logger155 = Logger.get("ApplyPatchState");
|
|
165246
165248
|
function applyPatchState(state, patch, options) {
|
|
165247
165249
|
return applyPatch(state, patch, options?.force);
|
|
165248
165250
|
}
|
|
@@ -165269,23 +165271,23 @@ function applyPatch(state, patch, force = false) {
|
|
|
165269
165271
|
if (errorMessage.includes(
|
|
165270
165272
|
"Endpoint storage inaccessible because endpoint is not a node and is not owned by another endpoint"
|
|
165271
165273
|
)) {
|
|
165272
|
-
|
|
165274
|
+
logger155.debug(
|
|
165273
165275
|
`Suppressed endpoint storage error, patch not applied: ${JSON.stringify(actualPatch)}`
|
|
165274
165276
|
);
|
|
165275
165277
|
return actualPatch;
|
|
165276
165278
|
}
|
|
165277
165279
|
if (errorMessage.includes("synchronous-transaction-conflict")) {
|
|
165278
|
-
|
|
165280
|
+
logger155.warn(
|
|
165279
165281
|
`Transaction conflict, state update DROPPED: ${JSON.stringify(actualPatch)}`
|
|
165280
165282
|
);
|
|
165281
165283
|
return actualPatch;
|
|
165282
165284
|
}
|
|
165283
165285
|
failedKeys.push(key);
|
|
165284
|
-
|
|
165286
|
+
logger155.warn(`Failed to set property '${key}': ${errorMessage}`);
|
|
165285
165287
|
}
|
|
165286
165288
|
}
|
|
165287
165289
|
if (failedKeys.length > 0) {
|
|
165288
|
-
|
|
165290
|
+
logger155.warn(
|
|
165289
165291
|
`${failedKeys.length} properties failed to update: [${failedKeys.join(", ")}]`
|
|
165290
165292
|
);
|
|
165291
165293
|
}
|
|
@@ -165360,7 +165362,7 @@ init_home_assistant_entity_behavior();
|
|
|
165360
165362
|
// src/matter/behaviors/humidity-measurement-server.ts
|
|
165361
165363
|
init_esm();
|
|
165362
165364
|
init_home_assistant_entity_behavior();
|
|
165363
|
-
var
|
|
165365
|
+
var logger156 = Logger.get("HumidityMeasurementServer");
|
|
165364
165366
|
var HumidityMeasurementServerBase = class extends RelativeHumidityMeasurementServer {
|
|
165365
165367
|
async initialize() {
|
|
165366
165368
|
await super.initialize();
|
|
@@ -165373,7 +165375,7 @@ var HumidityMeasurementServerBase = class extends RelativeHumidityMeasurementSer
|
|
|
165373
165375
|
return;
|
|
165374
165376
|
}
|
|
165375
165377
|
const humidity = this.getHumidity(this.state.config, entity.state);
|
|
165376
|
-
|
|
165378
|
+
logger156.debug(
|
|
165377
165379
|
`Humidity ${entity.state.entity_id} raw=${entity.state.state} measuredValue=${humidity}`
|
|
165378
165380
|
);
|
|
165379
165381
|
applyPatchState(this.state, {
|
|
@@ -165413,7 +165415,7 @@ init_clusters();
|
|
|
165413
165415
|
|
|
165414
165416
|
// src/matter/behaviors/power-source-server.ts
|
|
165415
165417
|
init_home_assistant_entity_behavior();
|
|
165416
|
-
var
|
|
165418
|
+
var logger157 = Logger.get("PowerSourceServer");
|
|
165417
165419
|
var FeaturedBase = PowerSourceServer.with("Battery", "Rechargeable");
|
|
165418
165420
|
var PowerSourceServerBase = class extends FeaturedBase {
|
|
165419
165421
|
async initialize() {
|
|
@@ -165425,17 +165427,17 @@ var PowerSourceServerBase = class extends FeaturedBase {
|
|
|
165425
165427
|
applyPatchState(this.state, {
|
|
165426
165428
|
endpointList: [endpointNumber]
|
|
165427
165429
|
});
|
|
165428
|
-
|
|
165430
|
+
logger157.debug(
|
|
165429
165431
|
`[${entityId}] PowerSource initialized with endpointList=[${endpointNumber}]`
|
|
165430
165432
|
);
|
|
165431
165433
|
} else {
|
|
165432
|
-
|
|
165434
|
+
logger157.warn(
|
|
165433
165435
|
`[${entityId}] PowerSource endpoint number is null during initialize - endpointList will be empty!`
|
|
165434
165436
|
);
|
|
165435
165437
|
}
|
|
165436
165438
|
const batteryEntity = homeAssistant.state.mapping?.batteryEntity;
|
|
165437
165439
|
if (batteryEntity) {
|
|
165438
|
-
|
|
165440
|
+
logger157.debug(
|
|
165439
165441
|
`[${entityId}] PowerSource using mapped battery entity: ${batteryEntity}`
|
|
165440
165442
|
);
|
|
165441
165443
|
}
|
|
@@ -166119,7 +166121,7 @@ var lastTurnOnTimestamps = /* @__PURE__ */ new Map();
|
|
|
166119
166121
|
function notifyLightTurnedOn(entityId) {
|
|
166120
166122
|
lastTurnOnTimestamps.set(entityId, Date.now());
|
|
166121
166123
|
}
|
|
166122
|
-
var
|
|
166124
|
+
var logger158 = Logger.get("LevelControlServer");
|
|
166123
166125
|
var FeaturedBase4 = LevelControlServer.with("OnOff", "Lighting");
|
|
166124
166126
|
var LevelControlServerBase = class extends FeaturedBase4 {
|
|
166125
166127
|
pendingTransitionTime;
|
|
@@ -166134,12 +166136,12 @@ var LevelControlServerBase = class extends FeaturedBase4 {
|
|
|
166134
166136
|
this.state.maxLevel = 254;
|
|
166135
166137
|
}
|
|
166136
166138
|
this.state.onLevel = null;
|
|
166137
|
-
|
|
166139
|
+
logger158.debug(`initialize: calling super.initialize()`);
|
|
166138
166140
|
try {
|
|
166139
166141
|
await super.initialize();
|
|
166140
|
-
|
|
166142
|
+
logger158.debug(`initialize: super.initialize() completed successfully`);
|
|
166141
166143
|
} catch (error) {
|
|
166142
|
-
|
|
166144
|
+
logger158.error(`initialize: super.initialize() FAILED:`, error);
|
|
166143
166145
|
throw error;
|
|
166144
166146
|
}
|
|
166145
166147
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
@@ -166205,7 +166207,7 @@ var LevelControlServerBase = class extends FeaturedBase4 {
|
|
|
166205
166207
|
const timeSinceTurnOn = lastTurnOn ? Date.now() - lastTurnOn : Infinity;
|
|
166206
166208
|
const isMaxBrightness = level >= this.maxLevel;
|
|
166207
166209
|
if (isMaxBrightness && timeSinceTurnOn < 200) {
|
|
166208
|
-
|
|
166210
|
+
logger158.debug(
|
|
166209
166211
|
`[${entityId}] Ignoring moveToLevel(${level}) - Alexa brightness reset detected (${timeSinceTurnOn}ms after turn-on)`
|
|
166210
166212
|
);
|
|
166211
166213
|
return;
|
|
@@ -166244,7 +166246,7 @@ function LevelControlServer2(config10) {
|
|
|
166244
166246
|
}
|
|
166245
166247
|
|
|
166246
166248
|
// src/matter/behaviors/on-off-server.ts
|
|
166247
|
-
var
|
|
166249
|
+
var logger159 = Logger.get("OnOffServer");
|
|
166248
166250
|
var OnOffServerBase = class extends OnOffServer {
|
|
166249
166251
|
async initialize() {
|
|
166250
166252
|
await super.initialize();
|
|
@@ -166270,7 +166272,7 @@ var OnOffServerBase = class extends OnOffServer {
|
|
|
166270
166272
|
const action = turnOn?.(void 0, this.agent) ?? {
|
|
166271
166273
|
action: "homeassistant.turn_on"
|
|
166272
166274
|
};
|
|
166273
|
-
|
|
166275
|
+
logger159.info(`[${homeAssistant.entityId}] Turning ON -> ${action.action}`);
|
|
166274
166276
|
notifyLightTurnedOn(homeAssistant.entityId);
|
|
166275
166277
|
applyPatchState(this.state, { onOff: true });
|
|
166276
166278
|
homeAssistant.callAction(action);
|
|
@@ -166288,7 +166290,7 @@ var OnOffServerBase = class extends OnOffServer {
|
|
|
166288
166290
|
const action = turnOff?.(void 0, this.agent) ?? {
|
|
166289
166291
|
action: "homeassistant.turn_off"
|
|
166290
166292
|
};
|
|
166291
|
-
|
|
166293
|
+
logger159.info(`[${homeAssistant.entityId}] Turning OFF -> ${action.action}`);
|
|
166292
166294
|
applyPatchState(this.state, { onOff: false });
|
|
166293
166295
|
homeAssistant.callAction(action);
|
|
166294
166296
|
}
|
|
@@ -166314,7 +166316,7 @@ var FanOnOffServer = OnOffServer2({
|
|
|
166314
166316
|
});
|
|
166315
166317
|
|
|
166316
166318
|
// src/matter/endpoints/composed/composed-air-purifier-endpoint.ts
|
|
166317
|
-
var
|
|
166319
|
+
var logger160 = Logger.get("ComposedAirPurifierEndpoint");
|
|
166318
166320
|
function createTemperatureConfig(temperatureEntityId) {
|
|
166319
166321
|
return {
|
|
166320
166322
|
getValue(_entity, agent) {
|
|
@@ -166469,7 +166471,7 @@ var ComposedAirPurifierEndpoint = class _ComposedAirPurifierEndpoint extends End
|
|
|
166469
166471
|
config10.humidityEntityId ? "+Hum" : "",
|
|
166470
166472
|
config10.batteryEntityId ? "+Bat" : ""
|
|
166471
166473
|
].filter(Boolean).join("");
|
|
166472
|
-
|
|
166474
|
+
logger160.info(`Created air purifier ${primaryEntityId}: ${clusterLabels}`);
|
|
166473
166475
|
return endpoint;
|
|
166474
166476
|
}
|
|
166475
166477
|
constructor(type, entityId, id, trackedEntityIds) {
|
|
@@ -166564,7 +166566,7 @@ init_home_assistant_entity_behavior();
|
|
|
166564
166566
|
// src/matter/behaviors/pressure-measurement-server.ts
|
|
166565
166567
|
init_esm();
|
|
166566
166568
|
init_home_assistant_entity_behavior();
|
|
166567
|
-
var
|
|
166569
|
+
var logger161 = Logger.get("PressureMeasurementServer");
|
|
166568
166570
|
var MIN_PRESSURE = 300;
|
|
166569
166571
|
var MAX_PRESSURE = 1100;
|
|
166570
166572
|
var PressureMeasurementServerBase = class extends PressureMeasurementServer {
|
|
@@ -166592,7 +166594,7 @@ var PressureMeasurementServerBase = class extends PressureMeasurementServer {
|
|
|
166592
166594
|
}
|
|
166593
166595
|
const rounded = Math.round(value);
|
|
166594
166596
|
if (rounded < MIN_PRESSURE || rounded > MAX_PRESSURE) {
|
|
166595
|
-
|
|
166597
|
+
logger161.warn(
|
|
166596
166598
|
`Pressure value ${rounded} (raw: ${value}) for ${entity.entity_id} is outside valid range [${MIN_PRESSURE}-${MAX_PRESSURE}], ignoring`
|
|
166597
166599
|
);
|
|
166598
166600
|
return null;
|
|
@@ -166611,7 +166613,7 @@ function PressureMeasurementServer2(config10) {
|
|
|
166611
166613
|
}
|
|
166612
166614
|
|
|
166613
166615
|
// src/matter/endpoints/composed/composed-sensor-endpoint.ts
|
|
166614
|
-
var
|
|
166616
|
+
var logger162 = Logger.get("ComposedSensorEndpoint");
|
|
166615
166617
|
var temperatureConfig = {
|
|
166616
166618
|
getValue(entity, agent) {
|
|
166617
166619
|
const fallbackUnit = agent.env.get(HomeAssistantConfig).unitSystem.temperature;
|
|
@@ -166770,7 +166772,7 @@ var ComposedSensorEndpoint = class _ComposedSensorEndpoint extends Endpoint {
|
|
|
166770
166772
|
if (config10.pressureEntityId && pressSub) {
|
|
166771
166773
|
endpoint.subEndpoints.set(config10.pressureEntityId, pressSub);
|
|
166772
166774
|
}
|
|
166773
|
-
|
|
166775
|
+
logger162.info(
|
|
166774
166776
|
`Created composed sensor ${primaryEntityId} with ${parts.length} sub-endpoint(s): T${humSub ? "+H" : ""}${pressSub ? "+P" : ""}${config10.batteryEntityId ? "+Bat" : ""}`
|
|
166775
166777
|
);
|
|
166776
166778
|
return endpoint;
|
|
@@ -166896,7 +166898,7 @@ init_home_assistant_entity_behavior();
|
|
|
166896
166898
|
// src/matter/behaviors/mode-select-server.ts
|
|
166897
166899
|
init_esm();
|
|
166898
166900
|
init_home_assistant_entity_behavior();
|
|
166899
|
-
var
|
|
166901
|
+
var logger163 = Logger.get("ModeSelectServer");
|
|
166900
166902
|
var ModeSelectServerBase = class extends ModeSelectServer {
|
|
166901
166903
|
async initialize() {
|
|
166902
166904
|
await super.initialize();
|
|
@@ -166925,13 +166927,13 @@ var ModeSelectServerBase = class extends ModeSelectServer {
|
|
|
166925
166927
|
const options = config10.getOptions(homeAssistant.entity);
|
|
166926
166928
|
const { newMode } = request;
|
|
166927
166929
|
if (newMode < 0 || newMode >= options.length) {
|
|
166928
|
-
|
|
166930
|
+
logger163.warn(
|
|
166929
166931
|
`[${homeAssistant.entityId}] Invalid mode ${newMode}, options: [${options.join(", ")}]`
|
|
166930
166932
|
);
|
|
166931
166933
|
return;
|
|
166932
166934
|
}
|
|
166933
166935
|
const option = options[newMode];
|
|
166934
|
-
|
|
166936
|
+
logger163.info(
|
|
166935
166937
|
`[${homeAssistant.entityId}] changeToMode(${newMode}) -> "${option}"`
|
|
166936
166938
|
);
|
|
166937
166939
|
applyPatchState(this.state, { currentMode: newMode });
|
|
@@ -167376,7 +167378,7 @@ var WaterLeakDetectorType = WaterLeakDetectorDevice.with(
|
|
|
167376
167378
|
);
|
|
167377
167379
|
|
|
167378
167380
|
// src/matter/endpoints/legacy/binary-sensor/index.ts
|
|
167379
|
-
var
|
|
167381
|
+
var logger164 = Logger.get("BinarySensorDevice");
|
|
167380
167382
|
var deviceClasses = {
|
|
167381
167383
|
[BinarySensorDeviceClass.CarbonMonoxide]: CoAlarmType,
|
|
167382
167384
|
[BinarySensorDeviceClass.Gas]: CoAlarmType,
|
|
@@ -167426,11 +167428,11 @@ function BinarySensorDevice(homeAssistantEntity) {
|
|
|
167426
167428
|
const originalTypeName = type.name;
|
|
167427
167429
|
if (hasBattery && batteryTypes.has(type)) {
|
|
167428
167430
|
type = batteryTypes.get(type);
|
|
167429
|
-
|
|
167431
|
+
logger164.info(
|
|
167430
167432
|
`[${entityId}] Using battery variant: ${originalTypeName} -> ${type.name}, batteryAttr=${hasBatteryAttr}, batteryEntity=${homeAssistantEntity.mapping?.batteryEntity ?? "none"}`
|
|
167431
167433
|
);
|
|
167432
167434
|
} else if (hasBattery) {
|
|
167433
|
-
|
|
167435
|
+
logger164.warn(
|
|
167434
167436
|
`[${entityId}] Has battery but no variant available for ${originalTypeName}`
|
|
167435
167437
|
);
|
|
167436
167438
|
}
|
|
@@ -167577,7 +167579,7 @@ init_home_assistant_entity_behavior();
|
|
|
167577
167579
|
// src/matter/behaviors/thermostat-server.ts
|
|
167578
167580
|
init_esm();
|
|
167579
167581
|
init_home_assistant_entity_behavior();
|
|
167580
|
-
var
|
|
167582
|
+
var logger165 = Logger.get("ThermostatServer");
|
|
167581
167583
|
var SystemMode = Thermostat3.SystemMode;
|
|
167582
167584
|
var RunningMode = Thermostat3.ThermostatRunningMode;
|
|
167583
167585
|
var nudgingSetpoints = /* @__PURE__ */ new Set();
|
|
@@ -167635,7 +167637,7 @@ var HeatingAndCoolingFeaturedBase = ThermostatServer.with("Heating", "Cooling").
|
|
|
167635
167637
|
);
|
|
167636
167638
|
function thermostatPreInitialize(self) {
|
|
167637
167639
|
const currentLocal = self.state.localTemperature;
|
|
167638
|
-
|
|
167640
|
+
logger165.debug(
|
|
167639
167641
|
`initialize: features - heating=${self.features.heating}, cooling=${self.features.cooling}`
|
|
167640
167642
|
);
|
|
167641
167643
|
const localValue = typeof currentLocal === "number" && !Number.isNaN(currentLocal) ? currentLocal : currentLocal === null ? null : 2100;
|
|
@@ -167658,7 +167660,7 @@ function thermostatPreInitialize(self) {
|
|
|
167658
167660
|
const coolingValue = typeof currentCooling === "number" && !Number.isNaN(currentCooling) ? currentCooling : 2400;
|
|
167659
167661
|
self.state.occupiedCoolingSetpoint = coolingValue;
|
|
167660
167662
|
}
|
|
167661
|
-
|
|
167663
|
+
logger165.debug(
|
|
167662
167664
|
`initialize: after force-set - local=${self.state.localTemperature}`
|
|
167663
167665
|
);
|
|
167664
167666
|
self.state.thermostatRunningState = runningStateAllOff;
|
|
@@ -167740,7 +167742,7 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
167740
167742
|
maxCoolLimit,
|
|
167741
167743
|
"cool"
|
|
167742
167744
|
);
|
|
167743
|
-
|
|
167745
|
+
logger165.debug(
|
|
167744
167746
|
`update: limits heat=[${minHeatLimit}, ${maxHeatLimit}], cool=[${minCoolLimit}, ${maxCoolLimit}], systemMode=${systemMode}, runningMode=${runningMode}`
|
|
167745
167747
|
);
|
|
167746
167748
|
const controlSequence = config10.getControlSequence(entity.state, this.agent);
|
|
@@ -167812,18 +167814,18 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
167812
167814
|
*/
|
|
167813
167815
|
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: Called via thermostatPostInitialize + prototype copy
|
|
167814
167816
|
heatingSetpointChanging(value, _oldValue, context) {
|
|
167815
|
-
|
|
167817
|
+
logger165.debug(
|
|
167816
167818
|
`heatingSetpointChanging: value=${value}, oldValue=${_oldValue}, isOffline=${transactionIsOffline(context)}`
|
|
167817
167819
|
);
|
|
167818
167820
|
if (transactionIsOffline(context)) {
|
|
167819
|
-
|
|
167821
|
+
logger165.debug(
|
|
167820
167822
|
"heatingSetpointChanging: skipping - transaction is offline"
|
|
167821
167823
|
);
|
|
167822
167824
|
return;
|
|
167823
167825
|
}
|
|
167824
167826
|
const next = Temperature.celsius(value / 100);
|
|
167825
167827
|
if (!next) {
|
|
167826
|
-
|
|
167828
|
+
logger165.debug("heatingSetpointChanging: skipping - invalid temperature");
|
|
167827
167829
|
return;
|
|
167828
167830
|
}
|
|
167829
167831
|
this.agent.asLocalActor(() => {
|
|
@@ -167834,7 +167836,7 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
167834
167836
|
this.agent
|
|
167835
167837
|
);
|
|
167836
167838
|
const currentMode = this.state.systemMode;
|
|
167837
|
-
|
|
167839
|
+
logger165.debug(
|
|
167838
167840
|
`heatingSetpointChanging: supportsRange=${supportsRange}, systemMode=${currentMode}, features.heating=${this.features.heating}, features.cooling=${this.features.cooling}`
|
|
167839
167841
|
);
|
|
167840
167842
|
if (!supportsRange) {
|
|
@@ -167844,12 +167846,12 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
167844
167846
|
const isOff = currentMode === Thermostat3.SystemMode.Off;
|
|
167845
167847
|
if (isOff && this.features.heating) {
|
|
167846
167848
|
if (nudgingSetpoints.has(homeAssistant.entityId)) {
|
|
167847
|
-
|
|
167849
|
+
logger165.debug(
|
|
167848
167850
|
`heatingSetpointChanging: skipping auto-resume - nudge write in progress`
|
|
167849
167851
|
);
|
|
167850
167852
|
return;
|
|
167851
167853
|
}
|
|
167852
|
-
|
|
167854
|
+
logger165.info(
|
|
167853
167855
|
`heatingSetpointChanging: auto-resume - switching to Heat (was Off)`
|
|
167854
167856
|
);
|
|
167855
167857
|
const modeAction = config10.setSystemMode(
|
|
@@ -167858,17 +167860,17 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
167858
167860
|
);
|
|
167859
167861
|
homeAssistant.callAction(modeAction);
|
|
167860
167862
|
} else if (!isAutoMode && !isHeatingMode) {
|
|
167861
|
-
|
|
167863
|
+
logger165.debug(
|
|
167862
167864
|
`heatingSetpointChanging: skipping - not in heating/auto mode (mode=${currentMode}, haMode=${haHvacMode})`
|
|
167863
167865
|
);
|
|
167864
167866
|
return;
|
|
167865
167867
|
}
|
|
167866
|
-
|
|
167868
|
+
logger165.debug(
|
|
167867
167869
|
`heatingSetpointChanging: proceeding - isAutoMode=${isAutoMode}, isHeatingMode=${isHeatingMode}, isOff=${isOff}, haMode=${haHvacMode}`
|
|
167868
167870
|
);
|
|
167869
167871
|
}
|
|
167870
167872
|
const coolingSetpoint = this.features.cooling ? this.state.occupiedCoolingSetpoint : value;
|
|
167871
|
-
|
|
167873
|
+
logger165.debug(
|
|
167872
167874
|
`heatingSetpointChanging: calling setTemperature with heat=${next.celsius(true)}, cool=${coolingSetpoint}`
|
|
167873
167875
|
);
|
|
167874
167876
|
this.setTemperature(
|
|
@@ -167907,12 +167909,12 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
167907
167909
|
const isOff = currentMode === Thermostat3.SystemMode.Off;
|
|
167908
167910
|
if (isOff && !this.features.heating && this.features.cooling) {
|
|
167909
167911
|
if (nudgingSetpoints.has(homeAssistant.entityId)) {
|
|
167910
|
-
|
|
167912
|
+
logger165.debug(
|
|
167911
167913
|
`coolingSetpointChanging: skipping auto-resume - nudge write in progress`
|
|
167912
167914
|
);
|
|
167913
167915
|
return;
|
|
167914
167916
|
}
|
|
167915
|
-
|
|
167917
|
+
logger165.info(
|
|
167916
167918
|
`coolingSetpointChanging: auto-resume - switching to Cool (was Off)`
|
|
167917
167919
|
);
|
|
167918
167920
|
const modeAction = config10.setSystemMode(
|
|
@@ -167921,12 +167923,12 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
167921
167923
|
);
|
|
167922
167924
|
homeAssistant.callAction(modeAction);
|
|
167923
167925
|
} else if (!isAutoMode && !isCoolingMode) {
|
|
167924
|
-
|
|
167926
|
+
logger165.debug(
|
|
167925
167927
|
`coolingSetpointChanging: skipping - not in cooling/auto mode (mode=${currentMode}, haMode=${haHvacMode})`
|
|
167926
167928
|
);
|
|
167927
167929
|
return;
|
|
167928
167930
|
}
|
|
167929
|
-
|
|
167931
|
+
logger165.debug(
|
|
167930
167932
|
`coolingSetpointChanging: proceeding - isAutoMode=${isAutoMode}, isCoolingMode=${isCoolingMode}, isOff=${isOff}, haMode=${haHvacMode}`
|
|
167931
167933
|
);
|
|
167932
167934
|
}
|
|
@@ -168003,7 +168005,7 @@ var ThermostatServerBase = class extends FullFeaturedBase {
|
|
|
168003
168005
|
const effectiveMax = max ?? 5e3;
|
|
168004
168006
|
if (value == null || Number.isNaN(value)) {
|
|
168005
168007
|
const defaultValue = type === "heat" ? 2e3 : 2400;
|
|
168006
|
-
|
|
168008
|
+
logger165.debug(
|
|
168007
168009
|
`${type} setpoint is undefined, using default: ${defaultValue}`
|
|
168008
168010
|
);
|
|
168009
168011
|
return Math.max(effectiveMin, Math.min(effectiveMax, defaultValue));
|
|
@@ -168467,7 +168469,7 @@ init_home_assistant_entity_behavior();
|
|
|
168467
168469
|
init_esm();
|
|
168468
168470
|
init_home_assistant_actions();
|
|
168469
168471
|
init_home_assistant_entity_behavior();
|
|
168470
|
-
var
|
|
168472
|
+
var logger166 = Logger.get("WindowCoveringServer");
|
|
168471
168473
|
var MovementStatus = WindowCovering3.MovementStatus;
|
|
168472
168474
|
var FeaturedBase5 = WindowCoveringServer.with(
|
|
168473
168475
|
"Lift",
|
|
@@ -168551,7 +168553,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
168551
168553
|
);
|
|
168552
168554
|
const currentTilt100ths = currentTilt != null ? currentTilt * 100 : null;
|
|
168553
168555
|
const isStopped = movementStatus === MovementStatus.Stopped;
|
|
168554
|
-
|
|
168556
|
+
logger166.debug(
|
|
168555
168557
|
`Cover update for ${entity.entity_id}: state=${state.state}, lift=${currentLift}%, tilt=${currentTilt}%, movement=${MovementStatus[movementStatus]}`
|
|
168556
168558
|
);
|
|
168557
168559
|
const appliedPatch = applyPatchState(
|
|
@@ -168590,9 +168592,9 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
168590
168592
|
);
|
|
168591
168593
|
if (Object.keys(appliedPatch).length > 0) {
|
|
168592
168594
|
const hasOperationalChange = "operationalStatus" in appliedPatch;
|
|
168593
|
-
const log = hasOperationalChange ?
|
|
168595
|
+
const log = hasOperationalChange ? logger166.info : logger166.debug;
|
|
168594
168596
|
log.call(
|
|
168595
|
-
|
|
168597
|
+
logger166,
|
|
168596
168598
|
`Cover ${entity.entity_id} state changed: ${JSON.stringify(appliedPatch)}`
|
|
168597
168599
|
);
|
|
168598
168600
|
}
|
|
@@ -168600,7 +168602,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
168600
168602
|
async handleMovement(type, _, direction, targetPercent100ths) {
|
|
168601
168603
|
const currentLift = this.state.currentPositionLiftPercent100ths ?? 0;
|
|
168602
168604
|
const currentTilt = this.state.currentPositionTiltPercent100ths ?? 0;
|
|
168603
|
-
|
|
168605
|
+
logger166.info(
|
|
168604
168606
|
`handleMovement: type=${MovementType[type]}, direction=${MovementDirection[direction]}, target=${targetPercent100ths}, currentLift=${currentLift}, currentTilt=${currentTilt}, absolutePosition=${this.features.absolutePosition}`
|
|
168605
168607
|
);
|
|
168606
168608
|
if (type === MovementType.Lift) {
|
|
@@ -168636,13 +168638,13 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
168636
168638
|
handleLiftOpen() {
|
|
168637
168639
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
168638
168640
|
const action = this.state.config.openCoverLift(void 0, this.agent);
|
|
168639
|
-
|
|
168641
|
+
logger166.info(`handleLiftOpen: calling action=${action.action}`);
|
|
168640
168642
|
homeAssistant.callAction(action);
|
|
168641
168643
|
}
|
|
168642
168644
|
handleLiftClose() {
|
|
168643
168645
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
168644
168646
|
const action = this.state.config.closeCoverLift(void 0, this.agent);
|
|
168645
|
-
|
|
168647
|
+
logger166.info(`handleLiftClose: calling action=${action.action}`);
|
|
168646
168648
|
homeAssistant.callAction(action);
|
|
168647
168649
|
}
|
|
168648
168650
|
handleGoToLiftPosition(targetPercent100ths) {
|
|
@@ -168663,7 +168665,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
168663
168665
|
this.lastLiftCommandTime = now;
|
|
168664
168666
|
const isFirstInSequence = timeSinceLastCommand > _WindowCoveringServerBase.COMMAND_SEQUENCE_THRESHOLD_MS;
|
|
168665
168667
|
const debounceMs = isFirstInSequence ? _WindowCoveringServerBase.DEBOUNCE_INITIAL_MS : _WindowCoveringServerBase.DEBOUNCE_SUBSEQUENT_MS;
|
|
168666
|
-
|
|
168668
|
+
logger166.debug(
|
|
168667
168669
|
`Lift command: target=${targetPosition}%, debounce=${debounceMs}ms (${isFirstInSequence ? "initial" : "subsequent"})`
|
|
168668
168670
|
);
|
|
168669
168671
|
if (this.liftDebounceTimer) {
|
|
@@ -168712,7 +168714,7 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
168712
168714
|
this.lastTiltCommandTime = now;
|
|
168713
168715
|
const isFirstInSequence = timeSinceLastCommand > _WindowCoveringServerBase.COMMAND_SEQUENCE_THRESHOLD_MS;
|
|
168714
168716
|
const debounceMs = isFirstInSequence ? _WindowCoveringServerBase.DEBOUNCE_INITIAL_MS : _WindowCoveringServerBase.DEBOUNCE_SUBSEQUENT_MS;
|
|
168715
|
-
|
|
168717
|
+
logger166.debug(
|
|
168716
168718
|
`Tilt command: target=${targetPosition}%, debounce=${debounceMs}ms (${isFirstInSequence ? "initial" : "subsequent"})`
|
|
168717
168719
|
);
|
|
168718
168720
|
if (this.tiltDebounceTimer) {
|
|
@@ -168771,7 +168773,7 @@ function adjustPositionForWriting(position, flags2, matterSemantics) {
|
|
|
168771
168773
|
}
|
|
168772
168774
|
|
|
168773
168775
|
// src/matter/endpoints/legacy/cover/behaviors/cover-window-covering-server.ts
|
|
168774
|
-
var
|
|
168776
|
+
var logger167 = Logger.get("CoverWindowCoveringServer");
|
|
168775
168777
|
var attributes5 = (entity) => entity.attributes;
|
|
168776
168778
|
var MATTER_SEMANTIC_PLATFORMS = [
|
|
168777
168779
|
// Currently empty - no known platforms use Matter semantics by default
|
|
@@ -168789,7 +168791,7 @@ var adjustPositionForReading2 = (position, agent) => {
|
|
|
168789
168791
|
const { featureFlags } = agent.env.get(BridgeDataProvider);
|
|
168790
168792
|
const matterSem = usesMatterSemantics(agent);
|
|
168791
168793
|
const result = adjustPositionForReading(position, featureFlags, matterSem);
|
|
168792
|
-
|
|
168794
|
+
logger167.debug(`adjustPositionForReading: HA=${position}%, result=${result}%`);
|
|
168793
168795
|
return result;
|
|
168794
168796
|
};
|
|
168795
168797
|
var adjustPositionForWriting2 = (position, agent) => {
|
|
@@ -168893,7 +168895,7 @@ var config5 = {
|
|
|
168893
168895
|
var CoverWindowCoveringServer = WindowCoveringServer2(config5);
|
|
168894
168896
|
|
|
168895
168897
|
// src/matter/endpoints/legacy/cover/index.ts
|
|
168896
|
-
var
|
|
168898
|
+
var logger168 = Logger.get("CoverDevice");
|
|
168897
168899
|
var CoverPowerSourceServer = PowerSourceServer2({
|
|
168898
168900
|
getBatteryPercent: (entity, agent) => {
|
|
168899
168901
|
const homeAssistant = agent.get(HomeAssistantEntityBehavior);
|
|
@@ -168920,7 +168922,7 @@ var CoverDeviceType = (supportedFeatures, hasBattery, entityId) => {
|
|
|
168920
168922
|
features2.add("PositionAwareLift");
|
|
168921
168923
|
features2.add("AbsolutePosition");
|
|
168922
168924
|
} else {
|
|
168923
|
-
|
|
168925
|
+
logger168.warn(
|
|
168924
168926
|
`[${entityId}] Cover has no support_open feature (supported_features=${supportedFeatures}), adding Lift anyway`
|
|
168925
168927
|
);
|
|
168926
168928
|
features2.add("Lift");
|
|
@@ -168937,7 +168939,7 @@ var CoverDeviceType = (supportedFeatures, hasBattery, entityId) => {
|
|
|
168937
168939
|
features2.add("AbsolutePosition");
|
|
168938
168940
|
}
|
|
168939
168941
|
}
|
|
168940
|
-
|
|
168942
|
+
logger168.info(
|
|
168941
168943
|
`[${entityId}] Creating WindowCovering with features: [${[...features2].join(", ")}], supported_features=${supportedFeatures}`
|
|
168942
168944
|
);
|
|
168943
168945
|
const baseBehaviors = [
|
|
@@ -168958,11 +168960,11 @@ function CoverDevice(homeAssistantEntity) {
|
|
|
168958
168960
|
const hasBatteryEntity = !!homeAssistantEntity.mapping?.batteryEntity;
|
|
168959
168961
|
const hasBattery = hasBatteryAttr || hasBatteryEntity;
|
|
168960
168962
|
if (hasBattery) {
|
|
168961
|
-
|
|
168963
|
+
logger168.info(
|
|
168962
168964
|
`[${entityId}] Creating cover with PowerSource cluster, batteryAttr=${hasBatteryAttr}, batteryEntity=${homeAssistantEntity.mapping?.batteryEntity ?? "none"}`
|
|
168963
168965
|
);
|
|
168964
168966
|
} else {
|
|
168965
|
-
|
|
168967
|
+
logger168.debug(
|
|
168966
168968
|
`[${entityId}] Creating cover without battery (batteryAttr=${hasBatteryAttr}, batteryEntity=${homeAssistantEntity.mapping?.batteryEntity ?? "none"})`
|
|
168967
168969
|
);
|
|
168968
168970
|
}
|
|
@@ -168978,7 +168980,7 @@ function CoverDevice(homeAssistantEntity) {
|
|
|
168978
168980
|
// src/matter/behaviors/generic-switch-server.ts
|
|
168979
168981
|
init_esm();
|
|
168980
168982
|
init_home_assistant_entity_behavior();
|
|
168981
|
-
var
|
|
168983
|
+
var logger169 = Logger.get("GenericSwitchServer");
|
|
168982
168984
|
var FeaturedBase6 = SwitchServer.with(
|
|
168983
168985
|
"MomentarySwitch",
|
|
168984
168986
|
"MomentarySwitchRelease",
|
|
@@ -168989,7 +168991,7 @@ var GenericSwitchServerBase = class extends FeaturedBase6 {
|
|
|
168989
168991
|
await super.initialize();
|
|
168990
168992
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
168991
168993
|
const entityId = homeAssistant.entityId;
|
|
168992
|
-
|
|
168994
|
+
logger169.debug(`[${entityId}] GenericSwitch initialized`);
|
|
168993
168995
|
this.reactTo(homeAssistant.onChange, this.handleEventChange);
|
|
168994
168996
|
}
|
|
168995
168997
|
handleEventChange() {
|
|
@@ -169000,7 +169002,7 @@ var GenericSwitchServerBase = class extends FeaturedBase6 {
|
|
|
169000
169002
|
const eventType = attrs.event_type;
|
|
169001
169003
|
if (!eventType) return;
|
|
169002
169004
|
const entityId = homeAssistant.entityId;
|
|
169003
|
-
|
|
169005
|
+
logger169.debug(`[${entityId}] Event fired: ${eventType}`);
|
|
169004
169006
|
this.triggerPress(eventType);
|
|
169005
169007
|
}
|
|
169006
169008
|
triggerPress(eventType) {
|
|
@@ -169314,7 +169316,7 @@ init_nodejs();
|
|
|
169314
169316
|
|
|
169315
169317
|
// src/matter/behaviors/color-control-server.ts
|
|
169316
169318
|
init_home_assistant_entity_behavior();
|
|
169317
|
-
var
|
|
169319
|
+
var logger170 = Logger.get("ColorControlServer");
|
|
169318
169320
|
var FeaturedBase7 = ColorControlServer.with("ColorTemperature", "HueSaturation");
|
|
169319
169321
|
var ColorControlServerBase = class extends FeaturedBase7 {
|
|
169320
169322
|
pendingTransitionTime;
|
|
@@ -169338,7 +169340,7 @@ var ColorControlServerBase = class extends FeaturedBase7 {
|
|
|
169338
169340
|
if (this.state.startUpColorTemperatureMireds == null) {
|
|
169339
169341
|
this.state.startUpColorTemperatureMireds = defaultMireds;
|
|
169340
169342
|
}
|
|
169341
|
-
|
|
169343
|
+
logger170.debug(
|
|
169342
169344
|
`initialize: set ColorTemperature defaults - min=${this.state.colorTempPhysicalMinMireds}, max=${this.state.colorTempPhysicalMaxMireds}, current=${this.state.colorTemperatureMireds}`
|
|
169343
169345
|
);
|
|
169344
169346
|
}
|
|
@@ -169730,7 +169732,7 @@ init_dist();
|
|
|
169730
169732
|
// src/matter/behaviors/electrical-energy-measurement-server.ts
|
|
169731
169733
|
init_esm();
|
|
169732
169734
|
init_home_assistant_entity_behavior();
|
|
169733
|
-
var
|
|
169735
|
+
var logger171 = Logger.get("ElectricalEnergyMeasurementServer");
|
|
169734
169736
|
var FeaturedBase8 = ElectricalEnergyMeasurementServer.with("CumulativeEnergy", "ImportedEnergy");
|
|
169735
169737
|
var ElectricalEnergyMeasurementServerBase = class extends FeaturedBase8 {
|
|
169736
169738
|
async initialize() {
|
|
@@ -169739,7 +169741,7 @@ var ElectricalEnergyMeasurementServerBase = class extends FeaturedBase8 {
|
|
|
169739
169741
|
const entityId = homeAssistant.entityId;
|
|
169740
169742
|
const energyEntity = homeAssistant.state.mapping?.energyEntity;
|
|
169741
169743
|
if (energyEntity) {
|
|
169742
|
-
|
|
169744
|
+
logger171.debug(
|
|
169743
169745
|
`[${entityId}] ElectricalEnergyMeasurement using mapped energy entity: ${energyEntity}`
|
|
169744
169746
|
);
|
|
169745
169747
|
}
|
|
@@ -169791,7 +169793,7 @@ var HaElectricalEnergyMeasurementServer = ElectricalEnergyMeasurementServerBase.
|
|
|
169791
169793
|
// src/matter/behaviors/electrical-power-measurement-server.ts
|
|
169792
169794
|
init_esm();
|
|
169793
169795
|
init_home_assistant_entity_behavior();
|
|
169794
|
-
var
|
|
169796
|
+
var logger172 = Logger.get("ElectricalPowerMeasurementServer");
|
|
169795
169797
|
var ElectricalPowerMeasurementServerBase = class extends ElectricalPowerMeasurementServer {
|
|
169796
169798
|
async initialize() {
|
|
169797
169799
|
await super.initialize();
|
|
@@ -169799,7 +169801,7 @@ var ElectricalPowerMeasurementServerBase = class extends ElectricalPowerMeasurem
|
|
|
169799
169801
|
const entityId = homeAssistant.entityId;
|
|
169800
169802
|
const powerEntity = homeAssistant.state.mapping?.powerEntity;
|
|
169801
169803
|
if (powerEntity) {
|
|
169802
|
-
|
|
169804
|
+
logger172.debug(
|
|
169803
169805
|
`[${entityId}] ElectricalPowerMeasurement using mapped power entity: ${powerEntity}`
|
|
169804
169806
|
);
|
|
169805
169807
|
}
|
|
@@ -169895,7 +169897,7 @@ init_home_assistant_entity_behavior();
|
|
|
169895
169897
|
// src/matter/behaviors/lock-server.ts
|
|
169896
169898
|
init_esm();
|
|
169897
169899
|
init_home_assistant_entity_behavior();
|
|
169898
|
-
var
|
|
169900
|
+
var logger173 = Logger.get("LockServer");
|
|
169899
169901
|
function hasStoredCredentialHelper(env, entityId) {
|
|
169900
169902
|
try {
|
|
169901
169903
|
const storage2 = env.get(LockCredentialStorage);
|
|
@@ -170053,7 +170055,7 @@ var LockServerWithPinBase = class extends PinCredentialBase {
|
|
|
170053
170055
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
170054
170056
|
const action = this.state.config.lock(void 0, this.agent);
|
|
170055
170057
|
const hasPinProvided = !!request.pinCode;
|
|
170056
|
-
|
|
170058
|
+
logger173.debug(
|
|
170057
170059
|
`lockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}`
|
|
170058
170060
|
);
|
|
170059
170061
|
if (request.pinCode) {
|
|
@@ -170066,12 +170068,12 @@ var LockServerWithPinBase = class extends PinCredentialBase {
|
|
|
170066
170068
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
170067
170069
|
const action = this.state.config.unlock(void 0, this.agent);
|
|
170068
170070
|
const hasPinProvided = !!request.pinCode;
|
|
170069
|
-
|
|
170071
|
+
logger173.debug(
|
|
170070
170072
|
`unlockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}, requirePin: ${this.state.requirePinForRemoteOperation}`
|
|
170071
170073
|
);
|
|
170072
170074
|
if (this.state.requirePinForRemoteOperation) {
|
|
170073
170075
|
if (!request.pinCode) {
|
|
170074
|
-
|
|
170076
|
+
logger173.info(
|
|
170075
170077
|
`unlockDoor REJECTED for ${homeAssistant.entityId} - no PIN provided`
|
|
170076
170078
|
);
|
|
170077
170079
|
throw new StatusResponseError(
|
|
@@ -170081,12 +170083,12 @@ var LockServerWithPinBase = class extends PinCredentialBase {
|
|
|
170081
170083
|
}
|
|
170082
170084
|
const providedPin = new TextDecoder().decode(request.pinCode);
|
|
170083
170085
|
if (!this.verifyStoredPin(homeAssistant.entityId, providedPin)) {
|
|
170084
|
-
|
|
170086
|
+
logger173.info(
|
|
170085
170087
|
`unlockDoor REJECTED for ${homeAssistant.entityId} - invalid PIN`
|
|
170086
170088
|
);
|
|
170087
170089
|
throw new StatusResponseError("Invalid PIN code", StatusCode.Failure);
|
|
170088
170090
|
}
|
|
170089
|
-
|
|
170091
|
+
logger173.debug(`unlockDoor PIN verified for ${homeAssistant.entityId}`);
|
|
170090
170092
|
action.data = { ...action.data, code: providedPin };
|
|
170091
170093
|
}
|
|
170092
170094
|
homeAssistant.callAction(action);
|
|
@@ -170247,7 +170249,7 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
170247
170249
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
170248
170250
|
const action = this.state.config.lock(void 0, this.agent);
|
|
170249
170251
|
const hasPinProvided = !!request.pinCode;
|
|
170250
|
-
|
|
170252
|
+
logger173.debug(
|
|
170251
170253
|
`lockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}`
|
|
170252
170254
|
);
|
|
170253
170255
|
if (request.pinCode) {
|
|
@@ -170261,12 +170263,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
170261
170263
|
const unlatchConfig = this.state.config.unlatch;
|
|
170262
170264
|
const action = unlatchConfig ? unlatchConfig(void 0, this.agent) : this.state.config.unlock(void 0, this.agent);
|
|
170263
170265
|
const hasPinProvided = !!request.pinCode;
|
|
170264
|
-
|
|
170266
|
+
logger173.debug(
|
|
170265
170267
|
`unlockDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}, requirePin: ${this.state.requirePinForRemoteOperation}, usingUnlatch: ${!!unlatchConfig}`
|
|
170266
170268
|
);
|
|
170267
170269
|
if (this.state.requirePinForRemoteOperation) {
|
|
170268
170270
|
if (!request.pinCode) {
|
|
170269
|
-
|
|
170271
|
+
logger173.info(
|
|
170270
170272
|
`unlockDoor REJECTED for ${homeAssistant.entityId} - no PIN provided`
|
|
170271
170273
|
);
|
|
170272
170274
|
throw new StatusResponseError(
|
|
@@ -170276,12 +170278,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
170276
170278
|
}
|
|
170277
170279
|
const providedPin = new TextDecoder().decode(request.pinCode);
|
|
170278
170280
|
if (!verifyStoredPinHelper(this.env, homeAssistant.entityId, providedPin)) {
|
|
170279
|
-
|
|
170281
|
+
logger173.info(
|
|
170280
170282
|
`unlockDoor REJECTED for ${homeAssistant.entityId} - invalid PIN`
|
|
170281
170283
|
);
|
|
170282
170284
|
throw new StatusResponseError("Invalid PIN code", StatusCode.Failure);
|
|
170283
170285
|
}
|
|
170284
|
-
|
|
170286
|
+
logger173.debug(`unlockDoor PIN verified for ${homeAssistant.entityId}`);
|
|
170285
170287
|
action.data = { ...action.data, code: providedPin };
|
|
170286
170288
|
}
|
|
170287
170289
|
homeAssistant.callAction(action);
|
|
@@ -170296,12 +170298,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
170296
170298
|
}
|
|
170297
170299
|
const action = unlatchConfig(void 0, this.agent);
|
|
170298
170300
|
const hasPinProvided = !!request.pinCode;
|
|
170299
|
-
|
|
170301
|
+
logger173.debug(
|
|
170300
170302
|
`unboltDoor called for ${homeAssistant.entityId}, PIN provided: ${hasPinProvided}, requirePin: ${this.state.requirePinForRemoteOperation}`
|
|
170301
170303
|
);
|
|
170302
170304
|
if (this.state.requirePinForRemoteOperation) {
|
|
170303
170305
|
if (!request.pinCode) {
|
|
170304
|
-
|
|
170306
|
+
logger173.info(
|
|
170305
170307
|
`unboltDoor REJECTED for ${homeAssistant.entityId} - no PIN provided`
|
|
170306
170308
|
);
|
|
170307
170309
|
throw new StatusResponseError(
|
|
@@ -170311,12 +170313,12 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
170311
170313
|
}
|
|
170312
170314
|
const providedPin = new TextDecoder().decode(request.pinCode);
|
|
170313
170315
|
if (!verifyStoredPinHelper(this.env, homeAssistant.entityId, providedPin)) {
|
|
170314
|
-
|
|
170316
|
+
logger173.info(
|
|
170315
170317
|
`unboltDoor REJECTED for ${homeAssistant.entityId} - invalid PIN`
|
|
170316
170318
|
);
|
|
170317
170319
|
throw new StatusResponseError("Invalid PIN code", StatusCode.Failure);
|
|
170318
170320
|
}
|
|
170319
|
-
|
|
170321
|
+
logger173.debug(`unboltDoor PIN verified for ${homeAssistant.entityId}`);
|
|
170320
170322
|
action.data = { ...action.data, code: providedPin };
|
|
170321
170323
|
}
|
|
170322
170324
|
homeAssistant.callAction(action);
|
|
@@ -170486,7 +170488,7 @@ init_home_assistant_entity_behavior();
|
|
|
170486
170488
|
init_dist();
|
|
170487
170489
|
init_esm();
|
|
170488
170490
|
init_home_assistant_entity_behavior();
|
|
170489
|
-
var
|
|
170491
|
+
var logger174 = Logger.get("MediaPlayerKeypadInputServer");
|
|
170490
170492
|
var MediaPlayerKeypadInputServer = class extends KeypadInputServer {
|
|
170491
170493
|
sendKey(request) {
|
|
170492
170494
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
@@ -170497,12 +170499,12 @@ var MediaPlayerKeypadInputServer = class extends KeypadInputServer {
|
|
|
170497
170499
|
const features2 = attributes7.supported_features ?? 0;
|
|
170498
170500
|
const action = this.mapKeyToAction(request.keyCode, features2);
|
|
170499
170501
|
if (!action) {
|
|
170500
|
-
|
|
170502
|
+
logger174.debug(
|
|
170501
170503
|
`Unsupported key code ${request.keyCode} for ${homeAssistant.entityId}`
|
|
170502
170504
|
);
|
|
170503
170505
|
return { status: KeypadInput3.Status.UnsupportedKey };
|
|
170504
170506
|
}
|
|
170505
|
-
|
|
170507
|
+
logger174.debug(
|
|
170506
170508
|
`sendKey(${request.keyCode}) \u2192 ${action} for ${homeAssistant.entityId}`
|
|
170507
170509
|
);
|
|
170508
170510
|
homeAssistant.callAction({ action });
|
|
@@ -170781,7 +170783,7 @@ init_home_assistant_entity_behavior();
|
|
|
170781
170783
|
// src/matter/behaviors/speaker-level-control-server.ts
|
|
170782
170784
|
init_esm();
|
|
170783
170785
|
init_home_assistant_entity_behavior();
|
|
170784
|
-
var
|
|
170786
|
+
var logger175 = Logger.get("SpeakerLevelControlServer");
|
|
170785
170787
|
var FeaturedBase9 = LevelControlServer.with("OnOff");
|
|
170786
170788
|
var SpeakerLevelControlServerBase = class extends FeaturedBase9 {
|
|
170787
170789
|
async initialize() {
|
|
@@ -170814,7 +170816,7 @@ var SpeakerLevelControlServerBase = class extends FeaturedBase9 {
|
|
|
170814
170816
|
currentLevel = Math.min(Math.max(minLevel, currentLevel), maxLevel);
|
|
170815
170817
|
}
|
|
170816
170818
|
const entityId = this.agent.get(HomeAssistantEntityBehavior).entity.entity_id;
|
|
170817
|
-
|
|
170819
|
+
logger175.debug(
|
|
170818
170820
|
`[${entityId}] Volume update: HA=${currentLevelPercent != null ? Math.round(currentLevelPercent * 100) : "null"}% -> currentLevel=${currentLevel}`
|
|
170819
170821
|
);
|
|
170820
170822
|
applyPatchState(this.state, {
|
|
@@ -170852,7 +170854,7 @@ var SpeakerLevelControlServerBase = class extends FeaturedBase9 {
|
|
|
170852
170854
|
const config10 = this.state.config;
|
|
170853
170855
|
const entityId = homeAssistant.entity.entity_id;
|
|
170854
170856
|
const levelPercent = level / 254;
|
|
170855
|
-
|
|
170857
|
+
logger175.debug(
|
|
170856
170858
|
`[${entityId}] Volume command: level=${level} -> HA volume_level=${levelPercent}`
|
|
170857
170859
|
);
|
|
170858
170860
|
const current = config10.getValuePercent(
|
|
@@ -171511,7 +171513,7 @@ var TvocConcentrationMeasurementServer = class extends TvocConcentrationMeasurem
|
|
|
171511
171513
|
};
|
|
171512
171514
|
|
|
171513
171515
|
// src/matter/endpoints/legacy/sensor/devices/tvoc-sensor.ts
|
|
171514
|
-
var
|
|
171516
|
+
var logger176 = Logger.get("TvocSensor");
|
|
171515
171517
|
function airQualityFromUgm3(value) {
|
|
171516
171518
|
if (value <= 300) return AirQuality3.AirQualityEnum.Good;
|
|
171517
171519
|
if (value <= 1e3) return AirQuality3.AirQualityEnum.Fair;
|
|
@@ -171549,17 +171551,17 @@ var TvocAirQualityServer = class extends TvocAirQualityServerBase {
|
|
|
171549
171551
|
const attributes7 = entity.state.attributes;
|
|
171550
171552
|
const deviceClass = attributes7.device_class;
|
|
171551
171553
|
let airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
171552
|
-
|
|
171554
|
+
logger176.debug(
|
|
171553
171555
|
`[${entity.entity_id}] TVOC update: state="${state}", device_class="${deviceClass}"`
|
|
171554
171556
|
);
|
|
171555
171557
|
if (state != null && !Number.isNaN(+state)) {
|
|
171556
171558
|
const value = +state;
|
|
171557
171559
|
airQuality = deviceClass === SensorDeviceClass.volatile_organic_compounds ? airQualityFromUgm3(value) : airQualityFromPpb(value);
|
|
171558
|
-
|
|
171560
|
+
logger176.debug(
|
|
171559
171561
|
`[${entity.entity_id}] TVOC value=${value} (${deviceClass}) -> airQuality=${AirQuality3.AirQualityEnum[airQuality]}`
|
|
171560
171562
|
);
|
|
171561
171563
|
} else {
|
|
171562
|
-
|
|
171564
|
+
logger176.warn(
|
|
171563
171565
|
`[${entity.entity_id}] TVOC state not a valid number: "${state}"`
|
|
171564
171566
|
);
|
|
171565
171567
|
}
|
|
@@ -171772,7 +171774,7 @@ init_home_assistant_entity_behavior();
|
|
|
171772
171774
|
// src/matter/behaviors/pm25-concentration-measurement-server.ts
|
|
171773
171775
|
init_esm();
|
|
171774
171776
|
init_home_assistant_entity_behavior();
|
|
171775
|
-
var
|
|
171777
|
+
var logger177 = Logger.get("Pm25ConcentrationMeasurementServer");
|
|
171776
171778
|
var Pm25ConcentrationMeasurementServerBase = Pm25ConcentrationMeasurementServer.with(
|
|
171777
171779
|
ConcentrationMeasurement3.Feature.NumericMeasurement
|
|
171778
171780
|
);
|
|
@@ -171796,11 +171798,11 @@ var Pm25ConcentrationMeasurementServer2 = class extends Pm25ConcentrationMeasure
|
|
|
171796
171798
|
if (this.state.measurementMedium === void 0) {
|
|
171797
171799
|
this.state.measurementMedium = ConcentrationMeasurement3.MeasurementMedium.Air;
|
|
171798
171800
|
}
|
|
171799
|
-
|
|
171801
|
+
logger177.debug(
|
|
171800
171802
|
"Pm25ConcentrationMeasurementServer: before super.initialize()"
|
|
171801
171803
|
);
|
|
171802
171804
|
await super.initialize();
|
|
171803
|
-
|
|
171805
|
+
logger177.debug(
|
|
171804
171806
|
"Pm25ConcentrationMeasurementServer: after super.initialize()"
|
|
171805
171807
|
);
|
|
171806
171808
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
@@ -171823,7 +171825,7 @@ var Pm25ConcentrationMeasurementServer2 = class extends Pm25ConcentrationMeasure
|
|
|
171823
171825
|
};
|
|
171824
171826
|
|
|
171825
171827
|
// src/matter/endpoints/legacy/sensor/devices/pm25-sensor.ts
|
|
171826
|
-
var
|
|
171828
|
+
var logger178 = Logger.get("Pm25AirQualityServer");
|
|
171827
171829
|
var Pm25AirQualityServerBase = AirQualityServer.with(
|
|
171828
171830
|
AirQuality3.Feature.Fair,
|
|
171829
171831
|
AirQuality3.Feature.Moderate,
|
|
@@ -171835,9 +171837,9 @@ var Pm25AirQualityServer = class extends Pm25AirQualityServerBase {
|
|
|
171835
171837
|
if (this.state.airQuality === void 0) {
|
|
171836
171838
|
this.state.airQuality = AirQuality3.AirQualityEnum.Unknown;
|
|
171837
171839
|
}
|
|
171838
|
-
|
|
171840
|
+
logger178.debug("Pm25AirQualityServer: before super.initialize()");
|
|
171839
171841
|
await super.initialize();
|
|
171840
|
-
|
|
171842
|
+
logger178.debug("Pm25AirQualityServer: after super.initialize()");
|
|
171841
171843
|
const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
|
|
171842
171844
|
this.update(homeAssistant.entity);
|
|
171843
171845
|
this.reactTo(homeAssistant.onChange, this.update);
|
|
@@ -172177,7 +172179,7 @@ init_home_assistant_entity_behavior();
|
|
|
172177
172179
|
init_dist();
|
|
172178
172180
|
init_esm();
|
|
172179
172181
|
init_home_assistant_entity_behavior();
|
|
172180
|
-
var
|
|
172182
|
+
var logger179 = Logger.get("VacuumIdentifyServer");
|
|
172181
172183
|
var VacuumIdentifyServer = class extends IdentifyServer2 {
|
|
172182
172184
|
triggerEffect(effect) {
|
|
172183
172185
|
this.#locate("triggerEffect");
|
|
@@ -172194,11 +172196,11 @@ var VacuumIdentifyServer = class extends IdentifyServer2 {
|
|
|
172194
172196
|
const features2 = homeAssistant.entity.state.attributes.supported_features ?? 0;
|
|
172195
172197
|
const hasLocate = testBit(features2, VacuumDeviceFeature.LOCATE);
|
|
172196
172198
|
if (!hasLocate) {
|
|
172197
|
-
|
|
172199
|
+
logger179.warn(
|
|
172198
172200
|
`${source} for ${homeAssistant.entityId} \u2014 LOCATE not in supported_features (${features2}), calling vacuum.locate anyway`
|
|
172199
172201
|
);
|
|
172200
172202
|
} else {
|
|
172201
|
-
|
|
172203
|
+
logger179.info(`${source} \u2192 vacuum.locate for ${homeAssistant.entityId}`);
|
|
172202
172204
|
}
|
|
172203
172205
|
homeAssistant.callAction({ action: "vacuum.locate" });
|
|
172204
172206
|
}
|
|
@@ -172489,11 +172491,11 @@ init_esm();
|
|
|
172489
172491
|
|
|
172490
172492
|
// src/matter/behaviors/service-area-server.ts
|
|
172491
172493
|
init_esm();
|
|
172492
|
-
var
|
|
172494
|
+
var logger180 = Logger.get("ServiceAreaServer");
|
|
172493
172495
|
var ServiceAreaServerBase = class extends ServiceAreaBehavior {
|
|
172494
172496
|
selectAreas(request) {
|
|
172495
172497
|
const { newAreas } = request;
|
|
172496
|
-
|
|
172498
|
+
logger180.info(
|
|
172497
172499
|
`ServiceArea selectAreas called with: ${JSON.stringify(newAreas)}`
|
|
172498
172500
|
);
|
|
172499
172501
|
const uniqueAreas = [...new Set(newAreas)];
|
|
@@ -172502,14 +172504,14 @@ var ServiceAreaServerBase = class extends ServiceAreaBehavior {
|
|
|
172502
172504
|
(id) => !supportedAreaIds.includes(id)
|
|
172503
172505
|
);
|
|
172504
172506
|
if (invalidAreas.length > 0) {
|
|
172505
|
-
|
|
172507
|
+
logger180.warn(`Invalid area IDs requested: ${invalidAreas.join(", ")}`);
|
|
172506
172508
|
return {
|
|
172507
172509
|
status: ServiceArea3.SelectAreasStatus.UnsupportedArea,
|
|
172508
172510
|
statusText: `Invalid area IDs: ${invalidAreas.join(", ")}`
|
|
172509
172511
|
};
|
|
172510
172512
|
}
|
|
172511
172513
|
this.state.selectedAreas = uniqueAreas;
|
|
172512
|
-
|
|
172514
|
+
logger180.info(
|
|
172513
172515
|
`ServiceArea: Stored ${uniqueAreas.length} areas for cleaning: ${uniqueAreas.join(", ")}`
|
|
172514
172516
|
);
|
|
172515
172517
|
return {
|
|
@@ -172530,7 +172532,7 @@ var ServiceAreaServerBase = class extends ServiceAreaBehavior {
|
|
|
172530
172532
|
ServiceAreaServerBase2.State = State;
|
|
172531
172533
|
})(ServiceAreaServerBase || (ServiceAreaServerBase = {}));
|
|
172532
172534
|
function ServiceAreaServer2(initialState) {
|
|
172533
|
-
|
|
172535
|
+
logger180.info(
|
|
172534
172536
|
`Creating ServiceAreaServer with ${initialState.supportedAreas.length} areas`
|
|
172535
172537
|
);
|
|
172536
172538
|
return ServiceAreaServerBase.set({
|
|
@@ -172543,7 +172545,7 @@ var ServiceAreaWithMaps = ServiceAreaBehavior.with(ServiceArea3.Feature.Maps);
|
|
|
172543
172545
|
var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMaps {
|
|
172544
172546
|
selectAreas(request) {
|
|
172545
172547
|
const { newAreas } = request;
|
|
172546
|
-
|
|
172548
|
+
logger180.info(
|
|
172547
172549
|
`ServiceArea selectAreas called with: ${JSON.stringify(newAreas)}`
|
|
172548
172550
|
);
|
|
172549
172551
|
const uniqueAreas = [...new Set(newAreas)];
|
|
@@ -172552,14 +172554,14 @@ var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMaps {
|
|
|
172552
172554
|
(id) => !supportedAreaIds.includes(id)
|
|
172553
172555
|
);
|
|
172554
172556
|
if (invalidAreas.length > 0) {
|
|
172555
|
-
|
|
172557
|
+
logger180.warn(`Invalid area IDs requested: ${invalidAreas.join(", ")}`);
|
|
172556
172558
|
return {
|
|
172557
172559
|
status: ServiceArea3.SelectAreasStatus.UnsupportedArea,
|
|
172558
172560
|
statusText: `Invalid area IDs: ${invalidAreas.join(", ")}`
|
|
172559
172561
|
};
|
|
172560
172562
|
}
|
|
172561
172563
|
this.state.selectedAreas = uniqueAreas;
|
|
172562
|
-
|
|
172564
|
+
logger180.info(
|
|
172563
172565
|
`ServiceArea: Stored ${uniqueAreas.length} areas for cleaning: ${uniqueAreas.join(", ")}`
|
|
172564
172566
|
);
|
|
172565
172567
|
return {
|
|
@@ -172580,14 +172582,14 @@ var ServiceAreaServerWithMapsBase = class extends ServiceAreaWithMaps {
|
|
|
172580
172582
|
ServiceAreaServerWithMapsBase2.State = State;
|
|
172581
172583
|
})(ServiceAreaServerWithMapsBase || (ServiceAreaServerWithMapsBase = {}));
|
|
172582
172584
|
function ServiceAreaServerWithMaps(initialState) {
|
|
172583
|
-
|
|
172585
|
+
logger180.info(
|
|
172584
172586
|
`Creating ServiceAreaServer with Maps: ${initialState.supportedAreas.length} areas, ${initialState.supportedMaps.length} maps`
|
|
172585
172587
|
);
|
|
172586
172588
|
for (const map of initialState.supportedMaps) {
|
|
172587
172589
|
const areaCount = initialState.supportedAreas.filter(
|
|
172588
172590
|
(a) => a.mapId === map.mapId
|
|
172589
172591
|
).length;
|
|
172590
|
-
|
|
172592
|
+
logger180.info(` Map ${map.mapId}: "${map.name}" (${areaCount} areas)`);
|
|
172591
172593
|
}
|
|
172592
172594
|
return ServiceAreaServerWithMapsBase.set({
|
|
172593
172595
|
supportedAreas: initialState.supportedAreas,
|
|
@@ -172598,7 +172600,7 @@ function ServiceAreaServerWithMaps(initialState) {
|
|
|
172598
172600
|
}
|
|
172599
172601
|
|
|
172600
172602
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-service-area-server.ts
|
|
172601
|
-
var
|
|
172603
|
+
var logger181 = Logger.get("VacuumServiceAreaServer");
|
|
172602
172604
|
function toAreaId(roomId) {
|
|
172603
172605
|
if (typeof roomId === "number") {
|
|
172604
172606
|
return roomId;
|
|
@@ -172677,13 +172679,13 @@ function createVacuumServiceAreaServer(attributes7, roomEntities, includeUnnamed
|
|
|
172677
172679
|
let rooms;
|
|
172678
172680
|
if (roomEntities && roomEntities.length > 0) {
|
|
172679
172681
|
rooms = buttonEntitiesToRooms(roomEntities, attributes7);
|
|
172680
|
-
|
|
172682
|
+
logger181.info(
|
|
172681
172683
|
`Using ${rooms.length} button entities as rooms: ${rooms.map((r) => r.name).join(", ")}`
|
|
172682
172684
|
);
|
|
172683
172685
|
} else {
|
|
172684
172686
|
rooms = parseVacuumRooms(attributes7, includeUnnamedRooms);
|
|
172685
172687
|
if (rooms.length > 0) {
|
|
172686
|
-
|
|
172688
|
+
logger181.info(
|
|
172687
172689
|
`Using ${rooms.length} rooms from attributes: ${rooms.map((r) => r.name).join(", ")}`
|
|
172688
172690
|
);
|
|
172689
172691
|
}
|
|
@@ -172737,7 +172739,7 @@ function createCustomServiceAreaServer(customAreas) {
|
|
|
172737
172739
|
landmarkInfo: null
|
|
172738
172740
|
}
|
|
172739
172741
|
}));
|
|
172740
|
-
|
|
172742
|
+
logger181.info(
|
|
172741
172743
|
`Using ${customAreas.length} custom service areas: ${customAreas.map((a) => a.name).join(", ")}`
|
|
172742
172744
|
);
|
|
172743
172745
|
return ServiceAreaServer2({
|
|
@@ -172748,7 +172750,7 @@ function createCustomServiceAreaServer(customAreas) {
|
|
|
172748
172750
|
}
|
|
172749
172751
|
|
|
172750
172752
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-run-mode-server.ts
|
|
172751
|
-
var
|
|
172753
|
+
var logger182 = Logger.get("VacuumRvcRunModeServer");
|
|
172752
172754
|
function buildSupportedModes2(attributes7, includeUnnamedRooms = false, customAreas) {
|
|
172753
172755
|
const modes = [
|
|
172754
172756
|
{
|
|
@@ -172794,12 +172796,12 @@ function handleCustomServiceAreas(selectedAreas, customAreas, homeAssistant, ser
|
|
|
172794
172796
|
const matched = selectedAreas.map((areaId) => customAreas[areaId - 1]).filter(Boolean);
|
|
172795
172797
|
serviceArea.state.selectedAreas = [];
|
|
172796
172798
|
if (matched.length === 0) {
|
|
172797
|
-
|
|
172799
|
+
logger182.warn(
|
|
172798
172800
|
`Custom service areas: no match for selected IDs ${selectedAreas.join(", ")}`
|
|
172799
172801
|
);
|
|
172800
172802
|
return { action: "vacuum.start" };
|
|
172801
172803
|
}
|
|
172802
|
-
|
|
172804
|
+
logger182.info(
|
|
172803
172805
|
`Custom service areas: calling ${matched.length} service(s): ${matched.map((a) => `${a.service} (${a.name})`).join(", ")}`
|
|
172804
172806
|
);
|
|
172805
172807
|
for (let i = 1; i < matched.length; i++) {
|
|
@@ -172828,7 +172830,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
172828
172830
|
VacuumState.mop_cleaning
|
|
172829
172831
|
];
|
|
172830
172832
|
const isCleaning = cleaningStates.includes(state);
|
|
172831
|
-
|
|
172833
|
+
logger182.debug(
|
|
172832
172834
|
`Vacuum state: "${state}", isCleaning: ${isCleaning}, currentMode: ${isCleaning ? "Cleaning" : "Idle"}`
|
|
172833
172835
|
);
|
|
172834
172836
|
return isCleaning ? 1 /* Cleaning */ : 0 /* Idle */;
|
|
@@ -172867,7 +172869,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
172867
172869
|
}
|
|
172868
172870
|
}
|
|
172869
172871
|
if (buttonEntityIds.length > 0) {
|
|
172870
|
-
|
|
172872
|
+
logger182.info(
|
|
172871
172873
|
`Roborock: Pressing button entities for selected rooms: ${buttonEntityIds.join(", ")}`
|
|
172872
172874
|
);
|
|
172873
172875
|
serviceArea.state.selectedAreas = [];
|
|
@@ -172896,14 +172898,14 @@ var vacuumRvcRunModeConfig = {
|
|
|
172896
172898
|
}
|
|
172897
172899
|
}
|
|
172898
172900
|
if (roomIds.length > 0) {
|
|
172899
|
-
|
|
172901
|
+
logger182.info(
|
|
172900
172902
|
`Starting cleaning with selected areas: ${roomIds.join(", ")}`
|
|
172901
172903
|
);
|
|
172902
172904
|
serviceArea.state.selectedAreas = [];
|
|
172903
172905
|
const vacuumEntityId = homeAssistant.entityId;
|
|
172904
172906
|
if (vacuumEntityId.startsWith("vacuum.valetudo_")) {
|
|
172905
172907
|
const identifier = vacuumEntityId.replace(/^vacuum\.valetudo_/, "");
|
|
172906
|
-
|
|
172908
|
+
logger182.info(
|
|
172907
172909
|
`Valetudo vacuum: Using mqtt.publish segment_cleanup for rooms: ${roomIds.join(", ")}`
|
|
172908
172910
|
);
|
|
172909
172911
|
return {
|
|
@@ -172923,7 +172925,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
172923
172925
|
if (targetMapName) {
|
|
172924
172926
|
const vacName = vacuumEntityId.replace("vacuum.", "");
|
|
172925
172927
|
const selectedMapEntity = `select.${vacName}_selected_map`;
|
|
172926
|
-
|
|
172928
|
+
logger182.info(
|
|
172927
172929
|
`Dreame multi-floor: switching to map "${targetMapName}" via ${selectedMapEntity}`
|
|
172928
172930
|
);
|
|
172929
172931
|
homeAssistant.callAction({
|
|
@@ -172950,7 +172952,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
172950
172952
|
}
|
|
172951
172953
|
if (isEcovacsVacuum(attributes7)) {
|
|
172952
172954
|
const roomIdStr = roomIds.join(",");
|
|
172953
|
-
|
|
172955
|
+
logger182.info(
|
|
172954
172956
|
`Ecovacs vacuum: Using spot_area for rooms: ${roomIdStr}`
|
|
172955
172957
|
);
|
|
172956
172958
|
return {
|
|
@@ -172965,14 +172967,14 @@ var vacuumRvcRunModeConfig = {
|
|
|
172965
172967
|
}
|
|
172966
172968
|
};
|
|
172967
172969
|
}
|
|
172968
|
-
|
|
172970
|
+
logger182.warn(
|
|
172969
172971
|
`Room cleaning via send_command not supported for this vacuum type. Rooms: ${roomIds.join(", ")}. Falling back to vacuum.start`
|
|
172970
172972
|
);
|
|
172971
172973
|
}
|
|
172972
172974
|
}
|
|
172973
172975
|
} catch {
|
|
172974
172976
|
}
|
|
172975
|
-
|
|
172977
|
+
logger182.info("Starting regular cleaning (no areas selected)");
|
|
172976
172978
|
return { action: "vacuum.start" };
|
|
172977
172979
|
},
|
|
172978
172980
|
returnToBase: () => ({ action: "vacuum.return_to_base" }),
|
|
@@ -172987,7 +172989,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
172987
172989
|
const homeAssistant = agent.get(HomeAssistantEntityBehavior);
|
|
172988
172990
|
const entity = homeAssistant.entity;
|
|
172989
172991
|
const attributes7 = entity.state.attributes;
|
|
172990
|
-
|
|
172992
|
+
logger182.info(`cleanRoom called: roomMode=${roomMode}`);
|
|
172991
172993
|
const customAreas = homeAssistant.state.mapping?.customServiceAreas;
|
|
172992
172994
|
if (customAreas && customAreas.length > 0) {
|
|
172993
172995
|
const sorted = [...customAreas].sort(
|
|
@@ -172996,7 +172998,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
172996
172998
|
const areaIndex = roomMode - ROOM_MODE_BASE2 - 1;
|
|
172997
172999
|
if (areaIndex >= 0 && areaIndex < sorted.length) {
|
|
172998
173000
|
const area = sorted[areaIndex];
|
|
172999
|
-
|
|
173001
|
+
logger182.info(
|
|
173000
173002
|
`cleanRoom: custom service area "${area.name}" \u2192 ${area.service}`
|
|
173001
173003
|
);
|
|
173002
173004
|
return {
|
|
@@ -173008,7 +173010,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
173008
173010
|
}
|
|
173009
173011
|
const rooms = parseVacuumRooms(attributes7);
|
|
173010
173012
|
const numericIdFromMode = getRoomIdFromMode(roomMode);
|
|
173011
|
-
|
|
173013
|
+
logger182.info(
|
|
173012
173014
|
`cleanRoom: numericIdFromMode=${numericIdFromMode}, available rooms: ${JSON.stringify(rooms.map((r) => ({ id: r.id, name: r.name, modeValue: getRoomModeValue(r) })))}`
|
|
173013
173015
|
);
|
|
173014
173016
|
const room = rooms.find((r) => getRoomModeValue(r) === roomMode);
|
|
@@ -173017,7 +173019,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
173017
173019
|
const vacuumEntityId = entity.entity_id;
|
|
173018
173020
|
if (vacuumEntityId.startsWith("vacuum.valetudo_")) {
|
|
173019
173021
|
const identifier = vacuumEntityId.replace(/^vacuum\.valetudo_/, "");
|
|
173020
|
-
|
|
173022
|
+
logger182.info(
|
|
173021
173023
|
`Valetudo vacuum: Using mqtt.publish segment_cleanup for room ${room.name} (id: ${commandId3})`
|
|
173022
173024
|
);
|
|
173023
173025
|
return {
|
|
@@ -173037,7 +173039,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
173037
173039
|
if (room.mapName) {
|
|
173038
173040
|
const vacuumName = vacuumEntityId.replace("vacuum.", "");
|
|
173039
173041
|
const selectedMapEntity = `select.${vacuumName}_selected_map`;
|
|
173040
|
-
|
|
173042
|
+
logger182.info(
|
|
173041
173043
|
`Dreame multi-floor: switching to map "${room.mapName}" via ${selectedMapEntity}`
|
|
173042
173044
|
);
|
|
173043
173045
|
homeAssistant.callAction({
|
|
@@ -173046,7 +173048,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
173046
173048
|
data: { option: room.mapName }
|
|
173047
173049
|
});
|
|
173048
173050
|
}
|
|
173049
|
-
|
|
173051
|
+
logger182.debug(
|
|
173050
173052
|
`Dreame vacuum detected, using dreame_vacuum.vacuum_clean_segment for room ${room.name} (commandId: ${commandId3}, id: ${room.id})`
|
|
173051
173053
|
);
|
|
173052
173054
|
return {
|
|
@@ -173057,7 +173059,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
173057
173059
|
};
|
|
173058
173060
|
}
|
|
173059
173061
|
if (isRoborockVacuum(attributes7) || isXiaomiMiotVacuum(attributes7)) {
|
|
173060
|
-
|
|
173062
|
+
logger182.debug(
|
|
173061
173063
|
`Using vacuum.send_command with app_segment_clean for room ${room.name} (commandId: ${commandId3}, id: ${room.id})`
|
|
173062
173064
|
);
|
|
173063
173065
|
return {
|
|
@@ -173070,7 +173072,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
173070
173072
|
}
|
|
173071
173073
|
if (isEcovacsVacuum(attributes7)) {
|
|
173072
173074
|
const roomIdStr = String(commandId3);
|
|
173073
|
-
|
|
173075
|
+
logger182.info(
|
|
173074
173076
|
`Ecovacs vacuum: Using spot_area for room ${room.name} (id: ${roomIdStr})`
|
|
173075
173077
|
);
|
|
173076
173078
|
return {
|
|
@@ -173085,7 +173087,7 @@ var vacuumRvcRunModeConfig = {
|
|
|
173085
173087
|
}
|
|
173086
173088
|
};
|
|
173087
173089
|
}
|
|
173088
|
-
|
|
173090
|
+
logger182.warn(
|
|
173089
173091
|
`Room cleaning via send_command not supported for this vacuum type. Room: ${room.name} (id=${commandId3}). Falling back to vacuum.start`
|
|
173090
173092
|
);
|
|
173091
173093
|
}
|
|
@@ -173101,20 +173103,20 @@ function createVacuumRvcRunModeServer(attributes7, includeUnnamedRooms = false,
|
|
|
173101
173103
|
includeUnnamedRooms,
|
|
173102
173104
|
customAreas
|
|
173103
173105
|
);
|
|
173104
|
-
|
|
173106
|
+
logger182.info(
|
|
173105
173107
|
`Creating VacuumRvcRunModeServer with ${rooms.length} rooms, ${supportedModes.length} total modes`
|
|
173106
173108
|
);
|
|
173107
173109
|
if (rooms.length > 0) {
|
|
173108
|
-
|
|
173110
|
+
logger182.info(`Rooms found: ${rooms.map((r) => r.name).join(", ")}`);
|
|
173109
173111
|
}
|
|
173110
173112
|
if (filteredCount > 0) {
|
|
173111
173113
|
const filtered = allRooms.filter((r) => !rooms.some((x) => x.id === r.id));
|
|
173112
|
-
|
|
173114
|
+
logger182.info(
|
|
173113
173115
|
`Filtered out ${filteredCount} unnamed room(s): ${filtered.map((r) => r.name).join(", ")}`
|
|
173114
173116
|
);
|
|
173115
173117
|
}
|
|
173116
173118
|
if (allRooms.length === 0) {
|
|
173117
|
-
|
|
173119
|
+
logger182.debug(
|
|
173118
173120
|
`No rooms found. Attributes: rooms=${JSON.stringify(attributes7.rooms)}, segments=${JSON.stringify(attributes7.segments)}, room_list=${attributes7.room_list}`
|
|
173119
173121
|
);
|
|
173120
173122
|
}
|
|
@@ -173172,7 +173174,7 @@ init_rvc_clean_mode();
|
|
|
173172
173174
|
|
|
173173
173175
|
// src/matter/behaviors/rvc-clean-mode-server.ts
|
|
173174
173176
|
init_home_assistant_entity_behavior();
|
|
173175
|
-
var
|
|
173177
|
+
var logger183 = Logger.get("RvcCleanModeServerBase");
|
|
173176
173178
|
var RvcCleanModeServerBase = class _RvcCleanModeServerBase extends RvcCleanModeServer {
|
|
173177
173179
|
// Pending mode from a recent changeToMode command.
|
|
173178
173180
|
// Prevents stale HA state (from a different entity like select.xxx)
|
|
@@ -173215,14 +173217,14 @@ var RvcCleanModeServerBase = class _RvcCleanModeServerBase extends RvcCleanModeS
|
|
|
173215
173217
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
173216
173218
|
const { newMode } = request;
|
|
173217
173219
|
if (newMode !== this.state.currentMode && !this.state.supportedModes.some((m) => m.mode === newMode)) {
|
|
173218
|
-
|
|
173220
|
+
logger183.warn(`changeToMode(${newMode}) rejected: unsupported mode`);
|
|
173219
173221
|
return {
|
|
173220
173222
|
status: ModeBase3.ModeChangeStatus.UnsupportedMode,
|
|
173221
173223
|
statusText: `Unsupported mode: ${newMode}`
|
|
173222
173224
|
};
|
|
173223
173225
|
}
|
|
173224
173226
|
const modeLabel = this.state.supportedModes.find((m) => m.mode === newMode);
|
|
173225
|
-
|
|
173227
|
+
logger183.info(
|
|
173226
173228
|
`changeToMode(${newMode}) "${modeLabel?.label ?? "unknown"}" for ${homeAssistant.entityId}`
|
|
173227
173229
|
);
|
|
173228
173230
|
this.pendingMode = newMode;
|
|
@@ -173230,7 +173232,7 @@ var RvcCleanModeServerBase = class _RvcCleanModeServerBase extends RvcCleanModeS
|
|
|
173230
173232
|
this.state.currentMode = newMode;
|
|
173231
173233
|
const action = this.state.config.setCleanMode(newMode, this.agent);
|
|
173232
173234
|
if (action) {
|
|
173233
|
-
|
|
173235
|
+
logger183.info(
|
|
173234
173236
|
`changeToMode: dispatching action ${action.action} \u2192 ${action.target ?? homeAssistant.entityId}`
|
|
173235
173237
|
);
|
|
173236
173238
|
homeAssistant.callAction(action);
|
|
@@ -173263,7 +173265,7 @@ function RvcCleanModeServer2(config10, initialState) {
|
|
|
173263
173265
|
}
|
|
173264
173266
|
|
|
173265
173267
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-clean-mode-server.ts
|
|
173266
|
-
var
|
|
173268
|
+
var logger184 = Logger.get("VacuumRvcCleanModeServer");
|
|
173267
173269
|
var MODE_VACUUM = 0;
|
|
173268
173270
|
var MODE_VACUUM_AND_MOP = 1;
|
|
173269
173271
|
var MODE_MOP = 2;
|
|
@@ -173562,7 +173564,7 @@ function findMatchingCleanOption(ct, availableOptions) {
|
|
|
173562
173564
|
if (match) return match;
|
|
173563
173565
|
}
|
|
173564
173566
|
}
|
|
173565
|
-
|
|
173567
|
+
logger184.warn(
|
|
173566
173568
|
`No match for ${CLEAN_TYPE_LABELS[ct]} in [${availableOptions.join(", ")}]`
|
|
173567
173569
|
);
|
|
173568
173570
|
return aliases[0];
|
|
@@ -173571,7 +173573,7 @@ function buildCleaningModeAction(targetCleanType, agent) {
|
|
|
173571
173573
|
const selectEntityId = getCleaningModeSelectEntity(agent);
|
|
173572
173574
|
const { options } = readSelectEntity(selectEntityId, agent);
|
|
173573
173575
|
const optionToUse = findMatchingCleanOption(targetCleanType, options);
|
|
173574
|
-
|
|
173576
|
+
logger184.info(
|
|
173575
173577
|
`Switching cleaning mode to: ${optionToUse} via ${selectEntityId}`
|
|
173576
173578
|
);
|
|
173577
173579
|
return {
|
|
@@ -173660,7 +173662,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
173660
173662
|
}
|
|
173661
173663
|
}
|
|
173662
173664
|
if (speedMode !== void 0) {
|
|
173663
|
-
|
|
173665
|
+
logger184.debug(
|
|
173664
173666
|
`Current mode: Vacuum + fan_speed="${speedState}" -> mode ${speedMode}`
|
|
173665
173667
|
);
|
|
173666
173668
|
return speedMode;
|
|
@@ -173681,7 +173683,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
173681
173683
|
}
|
|
173682
173684
|
}
|
|
173683
173685
|
if (mopMode !== void 0) {
|
|
173684
|
-
|
|
173686
|
+
logger184.debug(
|
|
173685
173687
|
`Current mode: Mop + intensity="${state}" -> mode ${mopMode}`
|
|
173686
173688
|
);
|
|
173687
173689
|
return mopMode;
|
|
@@ -173699,14 +173701,14 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
173699
173701
|
const homeAssistant = agent.get(HomeAssistantEntityBehavior);
|
|
173700
173702
|
const vacuumEntityId = homeAssistant.entityId;
|
|
173701
173703
|
const mapping = homeAssistant.state.mapping;
|
|
173702
|
-
|
|
173704
|
+
logger184.info(
|
|
173703
173705
|
`setCleanMode(${mode}) for ${vacuumEntityId} \u2014 suctionEntity=${mapping?.suctionLevelEntity ?? "none"}, mopEntity=${mapping?.mopIntensityEntity ?? "none"}, fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])}, customTags=${JSON.stringify(customFanSpeedTags ?? {})}`
|
|
173704
173706
|
);
|
|
173705
173707
|
if (mopIntensityList && mopIntensityList.length > 0 && isMopIntensityMode(mode)) {
|
|
173706
173708
|
const mopIndex = mode - MOP_INTENSITY_MODE_BASE;
|
|
173707
173709
|
const mopName = mopIntensityList[mopIndex];
|
|
173708
173710
|
if (!mopName) {
|
|
173709
|
-
|
|
173711
|
+
logger184.warn(`Invalid mop intensity mode index: ${mopIndex}`);
|
|
173710
173712
|
return void 0;
|
|
173711
173713
|
}
|
|
173712
173714
|
if (hasCleanTypes) {
|
|
@@ -173719,18 +173721,18 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
173719
173721
|
mapping.mopIntensityEntity,
|
|
173720
173722
|
agent
|
|
173721
173723
|
);
|
|
173722
|
-
|
|
173724
|
+
logger184.info(
|
|
173723
173725
|
`Mop intensity entity ${mapping.mopIntensityEntity}: current="${state}", options=${JSON.stringify(options ?? [])}`
|
|
173724
173726
|
);
|
|
173725
173727
|
let option = matchMopIntensityOption(mopName, options);
|
|
173726
173728
|
if (!option && options && mopIndex < options.length) {
|
|
173727
173729
|
option = options[mopIndex];
|
|
173728
|
-
|
|
173730
|
+
logger184.info(
|
|
173729
173731
|
`Positional match for mop "${mopName}" -> "${option}" (index ${mopIndex})`
|
|
173730
173732
|
);
|
|
173731
173733
|
}
|
|
173732
173734
|
if (option) {
|
|
173733
|
-
|
|
173735
|
+
logger184.info(
|
|
173734
173736
|
`Setting mop intensity to: ${option} via ${mapping.mopIntensityEntity}`
|
|
173735
173737
|
);
|
|
173736
173738
|
return {
|
|
@@ -173739,11 +173741,11 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
173739
173741
|
target: mapping.mopIntensityEntity
|
|
173740
173742
|
};
|
|
173741
173743
|
}
|
|
173742
|
-
|
|
173744
|
+
logger184.warn(
|
|
173743
173745
|
`No match for mop intensity "${mopName}" in options: [${(options ?? []).join(", ")}]`
|
|
173744
173746
|
);
|
|
173745
173747
|
} else {
|
|
173746
|
-
|
|
173748
|
+
logger184.warn(
|
|
173747
173749
|
`Mop intensity mode ${mode} requested but no mopIntensityEntity configured`
|
|
173748
173750
|
);
|
|
173749
173751
|
}
|
|
@@ -173753,7 +173755,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
173753
173755
|
const fanSpeedIndex = mode - FAN_SPEED_MODE_BASE;
|
|
173754
173756
|
const fanSpeedName = fanSpeedList[fanSpeedIndex];
|
|
173755
173757
|
if (!fanSpeedName) {
|
|
173756
|
-
|
|
173758
|
+
logger184.warn(`Invalid fan speed mode index: ${fanSpeedIndex}`);
|
|
173757
173759
|
return void 0;
|
|
173758
173760
|
}
|
|
173759
173761
|
if (mapping?.suctionLevelEntity) {
|
|
@@ -173766,7 +173768,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
173766
173768
|
mapping.suctionLevelEntity,
|
|
173767
173769
|
agent
|
|
173768
173770
|
);
|
|
173769
|
-
|
|
173771
|
+
logger184.info(
|
|
173770
173772
|
`Suction entity ${mapping.suctionLevelEntity}: current="${state}", options=${JSON.stringify(options ?? [])}`
|
|
173771
173773
|
);
|
|
173772
173774
|
let option = matchFanSpeedOption(
|
|
@@ -173776,12 +173778,12 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
173776
173778
|
);
|
|
173777
173779
|
if (!option && options && fanSpeedIndex < options.length) {
|
|
173778
173780
|
option = options[fanSpeedIndex];
|
|
173779
|
-
|
|
173781
|
+
logger184.info(
|
|
173780
173782
|
`Positional match for fan "${fanSpeedName}" -> "${option}" (index ${fanSpeedIndex})`
|
|
173781
173783
|
);
|
|
173782
173784
|
}
|
|
173783
173785
|
if (option) {
|
|
173784
|
-
|
|
173786
|
+
logger184.info(
|
|
173785
173787
|
`Setting suction to: ${option} via ${mapping.suctionLevelEntity}`
|
|
173786
173788
|
);
|
|
173787
173789
|
return {
|
|
@@ -173790,7 +173792,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
173790
173792
|
target: mapping.suctionLevelEntity
|
|
173791
173793
|
};
|
|
173792
173794
|
}
|
|
173793
|
-
|
|
173795
|
+
logger184.warn(
|
|
173794
173796
|
`No match for fan speed "${fanSpeedName}" in suction options: [${(options ?? []).join(", ")}]`
|
|
173795
173797
|
);
|
|
173796
173798
|
return void 0;
|
|
@@ -173800,7 +173802,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
173800
173802
|
buildCleaningModeAction(0 /* Sweeping */, agent)
|
|
173801
173803
|
);
|
|
173802
173804
|
}
|
|
173803
|
-
|
|
173805
|
+
logger184.info(
|
|
173804
173806
|
`Setting fan speed to: ${fanSpeedName} via vacuum.set_fan_speed`
|
|
173805
173807
|
);
|
|
173806
173808
|
return {
|
|
@@ -173810,7 +173812,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
173810
173812
|
};
|
|
173811
173813
|
}
|
|
173812
173814
|
if (!hasCleanTypes) {
|
|
173813
|
-
|
|
173815
|
+
logger184.debug(
|
|
173814
173816
|
`Ignoring cleaning type change (mode=${mode}): no cleaning mode entity`
|
|
173815
173817
|
);
|
|
173816
173818
|
return void 0;
|
|
@@ -173822,7 +173824,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
|
|
|
173822
173824
|
agent
|
|
173823
173825
|
);
|
|
173824
173826
|
const optionToUse = findMatchingCleanOption(cleanType, availableOptions);
|
|
173825
|
-
|
|
173827
|
+
logger184.info(
|
|
173826
173828
|
`Setting cleaning mode to: ${optionToUse} (mode=${mode}) via ${selectEntityId}`
|
|
173827
173829
|
);
|
|
173828
173830
|
return {
|
|
@@ -173840,10 +173842,10 @@ function createVacuumRvcCleanModeServer(_attributes, fanSpeedList, mopIntensityL
|
|
|
173840
173842
|
cleaningModeOptions,
|
|
173841
173843
|
customFanSpeedTags
|
|
173842
173844
|
);
|
|
173843
|
-
|
|
173845
|
+
logger184.info(
|
|
173844
173846
|
`Creating VacuumRvcCleanModeServer with ${supportedModes.length} modes (fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])}, cleaningModeOptions=${JSON.stringify(cleaningModeOptions ?? [])}, customTags=${JSON.stringify(customFanSpeedTags ?? {})})`
|
|
173845
173847
|
);
|
|
173846
|
-
|
|
173848
|
+
logger184.info(
|
|
173847
173849
|
`Modes: ${supportedModes.map((m) => `${m.mode}:${m.label}[${m.modeTags.map((t) => t.value).join(",")}]`).join(", ")}`
|
|
173848
173850
|
);
|
|
173849
173851
|
const initialState = {
|
|
@@ -173921,7 +173923,7 @@ init_rvc_operational_state();
|
|
|
173921
173923
|
init_home_assistant_entity_behavior();
|
|
173922
173924
|
var OperationalState4 = RvcOperationalState3.OperationalState;
|
|
173923
173925
|
var ErrorState = RvcOperationalState3.ErrorState;
|
|
173924
|
-
var
|
|
173926
|
+
var logger185 = Logger.get("RvcOperationalStateServer");
|
|
173925
173927
|
var activeStates = /* @__PURE__ */ new Set([
|
|
173926
173928
|
OperationalState4.Running,
|
|
173927
173929
|
OperationalState4.SeekingCharger
|
|
@@ -173963,7 +173965,7 @@ var RvcOperationalStateServerBase = class extends RvcOperationalStateServer {
|
|
|
173963
173965
|
}
|
|
173964
173966
|
});
|
|
173965
173967
|
if (activeStates.has(previousState) && !activeStates.has(newState)) {
|
|
173966
|
-
|
|
173968
|
+
logger185.info(
|
|
173967
173969
|
`Operation completed: ${OperationalState4[previousState]} -> ${OperationalState4[newState]}`
|
|
173968
173970
|
);
|
|
173969
173971
|
try {
|
|
@@ -173976,7 +173978,7 @@ var RvcOperationalStateServerBase = class extends RvcOperationalStateServer {
|
|
|
173976
173978
|
this.context
|
|
173977
173979
|
);
|
|
173978
173980
|
} catch (e) {
|
|
173979
|
-
|
|
173981
|
+
logger185.debug("Failed to emit operationCompletion event:", e);
|
|
173980
173982
|
}
|
|
173981
173983
|
}
|
|
173982
173984
|
}
|
|
@@ -174011,7 +174013,7 @@ var RvcOperationalStateServerBase = class extends RvcOperationalStateServer {
|
|
|
174011
174013
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
174012
174014
|
homeAssistant.callAction(goHomeAction(void 0, this.agent));
|
|
174013
174015
|
} else {
|
|
174014
|
-
|
|
174016
|
+
logger185.warn("GoHome command received but no goHome action configured");
|
|
174015
174017
|
}
|
|
174016
174018
|
return {
|
|
174017
174019
|
commandResponseState: {
|
|
@@ -174031,7 +174033,7 @@ function RvcOperationalStateServer2(config10) {
|
|
|
174031
174033
|
}
|
|
174032
174034
|
|
|
174033
174035
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-rvc-operational-state-server.ts
|
|
174034
|
-
var
|
|
174036
|
+
var logger186 = Logger.get("VacuumRvcOperationalStateServer");
|
|
174035
174037
|
function isCharging(entity) {
|
|
174036
174038
|
const attrs = entity.attributes;
|
|
174037
174039
|
if (attrs.battery_icon?.includes("charging")) return true;
|
|
@@ -174073,16 +174075,16 @@ var VacuumRvcOperationalStateServer = RvcOperationalStateServer2({
|
|
|
174073
174075
|
operationalState = RvcOperationalState3.OperationalState.Error;
|
|
174074
174076
|
} else {
|
|
174075
174077
|
if (state.toLowerCase().includes("clean")) {
|
|
174076
|
-
|
|
174078
|
+
logger186.info(
|
|
174077
174079
|
`Unknown vacuum state "${state}" contains 'clean', treating as Running`
|
|
174078
174080
|
);
|
|
174079
174081
|
operationalState = RvcOperationalState3.OperationalState.Running;
|
|
174080
174082
|
} else {
|
|
174081
|
-
|
|
174083
|
+
logger186.info(`Unknown vacuum state "${state}", treating as Paused`);
|
|
174082
174084
|
operationalState = RvcOperationalState3.OperationalState.Paused;
|
|
174083
174085
|
}
|
|
174084
174086
|
}
|
|
174085
|
-
|
|
174087
|
+
logger186.debug(
|
|
174086
174088
|
`Vacuum operationalState: "${state}" -> ${RvcOperationalState3.OperationalState[operationalState]}`
|
|
174087
174089
|
);
|
|
174088
174090
|
return operationalState;
|
|
@@ -174103,7 +174105,7 @@ var VacuumRvcOperationalStateServer = RvcOperationalStateServer2({
|
|
|
174103
174105
|
});
|
|
174104
174106
|
|
|
174105
174107
|
// src/matter/endpoints/legacy/vacuum/index.ts
|
|
174106
|
-
var
|
|
174108
|
+
var logger187 = Logger.get("VacuumDevice");
|
|
174107
174109
|
var VacuumEndpointType = RoboticVacuumCleanerDevice.with(
|
|
174108
174110
|
BasicInformationServer2,
|
|
174109
174111
|
VacuumIdentifyServer,
|
|
@@ -174117,7 +174119,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, minimalClusters
|
|
|
174117
174119
|
const entityId = homeAssistantEntity.entity.entity_id;
|
|
174118
174120
|
const attributes7 = homeAssistantEntity.entity.state.attributes;
|
|
174119
174121
|
const customAreas = homeAssistantEntity.mapping?.customServiceAreas;
|
|
174120
|
-
|
|
174122
|
+
logger187.info(
|
|
174121
174123
|
`Creating vacuum endpoint for ${entityId}, mapping: ${JSON.stringify(homeAssistantEntity.mapping ?? "none")}`
|
|
174122
174124
|
);
|
|
174123
174125
|
let device = VacuumEndpointType.with(
|
|
@@ -174128,7 +174130,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, minimalClusters
|
|
|
174128
174130
|
)
|
|
174129
174131
|
).set({ homeAssistantEntity });
|
|
174130
174132
|
if (includeOnOff) {
|
|
174131
|
-
|
|
174133
|
+
logger187.info(`${entityId}: Adding OnOff cluster (vacuumOnOff flag enabled)`);
|
|
174132
174134
|
device = device.with(VacuumOnOffServer);
|
|
174133
174135
|
}
|
|
174134
174136
|
if (!minimalClusters) {
|
|
@@ -174136,24 +174138,24 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, minimalClusters
|
|
|
174136
174138
|
}
|
|
174137
174139
|
const roomEntities = homeAssistantEntity.mapping?.roomEntities;
|
|
174138
174140
|
const rooms = parseVacuumRooms(attributes7);
|
|
174139
|
-
|
|
174141
|
+
logger187.info(
|
|
174140
174142
|
`${entityId}: customAreas=${customAreas?.length ?? 0}, roomEntities=${JSON.stringify(roomEntities ?? [])}, parsedRooms=${rooms.length}`
|
|
174141
174143
|
);
|
|
174142
174144
|
if (customAreas && customAreas.length > 0) {
|
|
174143
|
-
|
|
174145
|
+
logger187.info(
|
|
174144
174146
|
`${entityId}: Adding ServiceArea (${customAreas.length} custom areas)`
|
|
174145
174147
|
);
|
|
174146
174148
|
device = device.with(createCustomServiceAreaServer(customAreas));
|
|
174147
174149
|
} else if (rooms.length > 0 || roomEntities && roomEntities.length > 0) {
|
|
174148
|
-
|
|
174150
|
+
logger187.info(`${entityId}: Adding ServiceArea (${rooms.length} rooms)`);
|
|
174149
174151
|
device = device.with(
|
|
174150
174152
|
createVacuumServiceAreaServer(attributes7, roomEntities)
|
|
174151
174153
|
);
|
|
174152
174154
|
} else if (!minimalClusters) {
|
|
174153
|
-
|
|
174155
|
+
logger187.info(`${entityId}: Adding ServiceArea (default single-area)`);
|
|
174154
174156
|
device = device.with(createDefaultServiceAreaServer());
|
|
174155
174157
|
} else {
|
|
174156
|
-
|
|
174158
|
+
logger187.info(`${entityId}: Skipping ServiceArea (minimal clusters mode)`);
|
|
174157
174159
|
}
|
|
174158
174160
|
const fanSpeedList = resolveFanSpeedList(
|
|
174159
174161
|
attributes7,
|
|
@@ -174163,7 +174165,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, minimalClusters
|
|
|
174163
174165
|
homeAssistantEntity.mapping?.mopIntensityEntity
|
|
174164
174166
|
);
|
|
174165
174167
|
if (cleaningModeOptions || fanSpeedList || mopIntensityList) {
|
|
174166
|
-
|
|
174168
|
+
logger187.info(
|
|
174167
174169
|
`${entityId}: Adding RvcCleanMode (multi-mode, cleaningModeOptions=${JSON.stringify(cleaningModeOptions ?? [])}, fanSpeedList=${JSON.stringify(fanSpeedList ?? [])}, mopIntensityList=${JSON.stringify(mopIntensityList ?? [])})`
|
|
174168
174170
|
);
|
|
174169
174171
|
device = device.with(
|
|
@@ -174176,7 +174178,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, minimalClusters
|
|
|
174176
174178
|
)
|
|
174177
174179
|
);
|
|
174178
174180
|
} else {
|
|
174179
|
-
|
|
174181
|
+
logger187.info(`${entityId}: Adding RvcCleanMode (default single-mode)`);
|
|
174180
174182
|
device = device.with(createDefaultRvcCleanModeServer());
|
|
174181
174183
|
}
|
|
174182
174184
|
return device;
|
|
@@ -174331,7 +174333,7 @@ var WaterHeaterThermostatServer = ThermostatServer2(
|
|
|
174331
174333
|
);
|
|
174332
174334
|
|
|
174333
174335
|
// src/matter/endpoints/legacy/water-heater/index.ts
|
|
174334
|
-
var
|
|
174336
|
+
var logger188 = Logger.get("WaterHeaterDevice");
|
|
174335
174337
|
var WaterHeaterDeviceType = ThermostatDevice.with(
|
|
174336
174338
|
BasicInformationServer2,
|
|
174337
174339
|
IdentifyServer2,
|
|
@@ -174347,7 +174349,7 @@ function toMatterTemp2(value) {
|
|
|
174347
174349
|
}
|
|
174348
174350
|
function WaterHeaterDevice(homeAssistantEntity) {
|
|
174349
174351
|
const attributes7 = homeAssistantEntity.entity.state.attributes;
|
|
174350
|
-
|
|
174352
|
+
logger188.debug(
|
|
174351
174353
|
`Creating device for ${homeAssistantEntity.entity.entity_id}, min_temp=${attributes7.min_temp}, max_temp=${attributes7.max_temp}`
|
|
174352
174354
|
);
|
|
174353
174355
|
const minLimit = toMatterTemp2(attributes7.min_temp) ?? 0;
|
|
@@ -174513,7 +174515,7 @@ var matterDeviceTypeFactories = {
|
|
|
174513
174515
|
};
|
|
174514
174516
|
|
|
174515
174517
|
// src/matter/endpoints/legacy/legacy-endpoint.ts
|
|
174516
|
-
var
|
|
174518
|
+
var logger189 = Logger.get("LegacyEndpoint");
|
|
174517
174519
|
var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
174518
174520
|
static async create(registry2, entityId, mapping) {
|
|
174519
174521
|
const deviceRegistry = registry2.deviceOf(entityId);
|
|
@@ -174523,25 +174525,25 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
174523
174525
|
return;
|
|
174524
174526
|
}
|
|
174525
174527
|
if (registry2.isAutoBatteryMappingEnabled() && registry2.isBatteryEntityUsed(entityId)) {
|
|
174526
|
-
|
|
174528
|
+
logger189.debug(
|
|
174527
174529
|
`Skipping ${entityId} - already auto-assigned as battery to another device`
|
|
174528
174530
|
);
|
|
174529
174531
|
return;
|
|
174530
174532
|
}
|
|
174531
174533
|
if (registry2.isAutoHumidityMappingEnabled() && registry2.isHumidityEntityUsed(entityId)) {
|
|
174532
|
-
|
|
174534
|
+
logger189.debug(
|
|
174533
174535
|
`Skipping ${entityId} - already auto-assigned as humidity to a temperature sensor`
|
|
174534
174536
|
);
|
|
174535
174537
|
return;
|
|
174536
174538
|
}
|
|
174537
174539
|
if (registry2.isAutoPressureMappingEnabled() && registry2.isPressureEntityUsed(entityId)) {
|
|
174538
|
-
|
|
174540
|
+
logger189.debug(
|
|
174539
174541
|
`Skipping ${entityId} - already auto-assigned as pressure to a temperature sensor`
|
|
174540
174542
|
);
|
|
174541
174543
|
return;
|
|
174542
174544
|
}
|
|
174543
174545
|
if (registry2.isAutoComposedDevicesEnabled() && registry2.isComposedSubEntityUsed(entityId)) {
|
|
174544
|
-
|
|
174546
|
+
logger189.debug(
|
|
174545
174547
|
`Skipping ${entityId} - already consumed by a composed device`
|
|
174546
174548
|
);
|
|
174547
174549
|
return;
|
|
@@ -174561,7 +174563,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
174561
174563
|
humidityEntity: humidityEntityId
|
|
174562
174564
|
};
|
|
174563
174565
|
registry2.markHumidityEntityUsed(humidityEntityId);
|
|
174564
|
-
|
|
174566
|
+
logger189.debug(
|
|
174565
174567
|
`Auto-assigned humidity ${humidityEntityId} to ${entityId}`
|
|
174566
174568
|
);
|
|
174567
174569
|
}
|
|
@@ -174580,7 +174582,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
174580
174582
|
pressureEntity: pressureEntityId
|
|
174581
174583
|
};
|
|
174582
174584
|
registry2.markPressureEntityUsed(pressureEntityId);
|
|
174583
|
-
|
|
174585
|
+
logger189.debug(
|
|
174584
174586
|
`Auto-assigned pressure ${pressureEntityId} to ${entityId}`
|
|
174585
174587
|
);
|
|
174586
174588
|
}
|
|
@@ -174597,7 +174599,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
174597
174599
|
batteryEntity: batteryEntityId
|
|
174598
174600
|
};
|
|
174599
174601
|
registry2.markBatteryEntityUsed(batteryEntityId);
|
|
174600
|
-
|
|
174602
|
+
logger189.debug(
|
|
174601
174603
|
`Auto-assigned battery ${batteryEntityId} to ${entityId}`
|
|
174602
174604
|
);
|
|
174603
174605
|
}
|
|
@@ -174615,7 +174617,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
174615
174617
|
powerEntity: powerEntityId
|
|
174616
174618
|
};
|
|
174617
174619
|
registry2.markPowerEntityUsed(powerEntityId);
|
|
174618
|
-
|
|
174620
|
+
logger189.debug(`Auto-assigned power ${powerEntityId} to ${entityId}`);
|
|
174619
174621
|
}
|
|
174620
174622
|
}
|
|
174621
174623
|
}
|
|
@@ -174632,7 +174634,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
174632
174634
|
energyEntity: energyEntityId
|
|
174633
174635
|
};
|
|
174634
174636
|
registry2.markEnergyEntityUsed(energyEntityId);
|
|
174635
|
-
|
|
174637
|
+
logger189.debug(
|
|
174636
174638
|
`Auto-assigned energy ${energyEntityId} to ${entityId}`
|
|
174637
174639
|
);
|
|
174638
174640
|
}
|
|
@@ -174648,7 +174650,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
174648
174650
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
174649
174651
|
cleaningModeEntity: vacuumEntities.cleaningModeEntity
|
|
174650
174652
|
};
|
|
174651
|
-
|
|
174653
|
+
logger189.debug(
|
|
174652
174654
|
`Auto-assigned cleaningMode ${vacuumEntities.cleaningModeEntity} to ${entityId}`
|
|
174653
174655
|
);
|
|
174654
174656
|
}
|
|
@@ -174658,7 +174660,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
174658
174660
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
174659
174661
|
suctionLevelEntity: vacuumEntities.suctionLevelEntity
|
|
174660
174662
|
};
|
|
174661
|
-
|
|
174663
|
+
logger189.debug(
|
|
174662
174664
|
`Auto-assigned suctionLevel ${vacuumEntities.suctionLevelEntity} to ${entityId}`
|
|
174663
174665
|
);
|
|
174664
174666
|
}
|
|
@@ -174668,7 +174670,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
174668
174670
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
174669
174671
|
mopIntensityEntity: vacuumEntities.mopIntensityEntity
|
|
174670
174672
|
};
|
|
174671
|
-
|
|
174673
|
+
logger189.debug(
|
|
174672
174674
|
`Auto-assigned mopIntensity ${vacuumEntities.mopIntensityEntity} to ${entityId}`
|
|
174673
174675
|
);
|
|
174674
174676
|
}
|
|
@@ -174689,7 +174691,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
174689
174691
|
rooms: roomsObj
|
|
174690
174692
|
}
|
|
174691
174693
|
};
|
|
174692
|
-
|
|
174694
|
+
logger189.debug(
|
|
174693
174695
|
`Auto-detected ${valetudoRooms.length} Valetudo segments for ${entityId}`
|
|
174694
174696
|
);
|
|
174695
174697
|
} else {
|
|
@@ -174706,7 +174708,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
174706
174708
|
rooms: roomsObj
|
|
174707
174709
|
}
|
|
174708
174710
|
};
|
|
174709
|
-
|
|
174711
|
+
logger189.debug(
|
|
174710
174712
|
`Auto-detected ${roborockRooms.length} Roborock rooms for ${entityId}`
|
|
174711
174713
|
);
|
|
174712
174714
|
}
|
|
@@ -174805,7 +174807,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
174805
174807
|
if (state.state === this.lastState?.state && JSON.stringify(state.attributes) === JSON.stringify(this.lastState?.attributes)) {
|
|
174806
174808
|
return;
|
|
174807
174809
|
}
|
|
174808
|
-
|
|
174810
|
+
logger189.debug(
|
|
174809
174811
|
`State update received for ${this.entityId}: state=${state.state}`
|
|
174810
174812
|
);
|
|
174811
174813
|
this.lastState = state;
|
|
@@ -174838,11 +174840,13 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
174838
174840
|
};
|
|
174839
174841
|
|
|
174840
174842
|
// src/services/home-assistant/api/subscribe-entities.ts
|
|
174843
|
+
init_esm();
|
|
174841
174844
|
import crypto6 from "node:crypto";
|
|
174842
174845
|
import {
|
|
174843
174846
|
getCollection
|
|
174844
174847
|
} from "home-assistant-js-websocket";
|
|
174845
174848
|
import { atLeastHaVersion } from "home-assistant-js-websocket/dist/util.js";
|
|
174849
|
+
var logger190 = Logger.get("SubscribeEntities");
|
|
174846
174850
|
function processEvent(store, updates) {
|
|
174847
174851
|
const state = { ...store.state };
|
|
174848
174852
|
if (updates.a) {
|
|
@@ -174868,7 +174872,7 @@ function processEvent(store, updates) {
|
|
|
174868
174872
|
for (const entityId in updates.c) {
|
|
174869
174873
|
let entityState = state[entityId];
|
|
174870
174874
|
if (!entityState) {
|
|
174871
|
-
|
|
174875
|
+
logger190.warn("Received state update for unknown entity", entityId);
|
|
174872
174876
|
continue;
|
|
174873
174877
|
}
|
|
174874
174878
|
entityState = { ...entityState };
|
|
@@ -174938,7 +174942,7 @@ var subscribeEntities = (conn, onChange, entityIds) => entitiesColl(conn, entity
|
|
|
174938
174942
|
|
|
174939
174943
|
// src/services/bridges/entity-isolation-service.ts
|
|
174940
174944
|
init_esm();
|
|
174941
|
-
var
|
|
174945
|
+
var logger191 = Logger.get("EntityIsolation");
|
|
174942
174946
|
var EntityIsolationServiceImpl = class {
|
|
174943
174947
|
isolatedEntities = /* @__PURE__ */ new Map();
|
|
174944
174948
|
isolationCallbacks = /* @__PURE__ */ new Map();
|
|
@@ -174978,13 +174982,13 @@ var EntityIsolationServiceImpl = class {
|
|
|
174978
174982
|
}
|
|
174979
174983
|
const parsed = this.parseEndpointPath(msg);
|
|
174980
174984
|
if (!parsed) {
|
|
174981
|
-
|
|
174985
|
+
logger191.warn("Could not parse entity from error:", msg);
|
|
174982
174986
|
return false;
|
|
174983
174987
|
}
|
|
174984
174988
|
const { bridgeId, entityName } = parsed;
|
|
174985
174989
|
const callback = this.isolationCallbacks.get(bridgeId);
|
|
174986
174990
|
if (!callback) {
|
|
174987
|
-
|
|
174991
|
+
logger191.warn(
|
|
174988
174992
|
`No isolation callback registered for bridge ${bridgeId}, entity: ${entityName}`
|
|
174989
174993
|
);
|
|
174990
174994
|
return false;
|
|
@@ -174995,14 +174999,14 @@ var EntityIsolationServiceImpl = class {
|
|
|
174995
174999
|
}
|
|
174996
175000
|
const reason = `Subscription timing error (Invalid intervalMs). Entity isolated to protect bridge stability.`;
|
|
174997
175001
|
this.isolatedEntities.set(key, { entityId: entityName, reason });
|
|
174998
|
-
|
|
175002
|
+
logger191.warn(
|
|
174999
175003
|
`Isolating entity "${entityName}" from bridge ${bridgeId} due to: ${reason}`
|
|
175000
175004
|
);
|
|
175001
175005
|
try {
|
|
175002
175006
|
await callback(entityName);
|
|
175003
175007
|
return true;
|
|
175004
175008
|
} catch (e) {
|
|
175005
|
-
|
|
175009
|
+
logger191.error(`Failed to isolate entity ${entityName}:`, e);
|
|
175006
175010
|
return false;
|
|
175007
175011
|
}
|
|
175008
175012
|
}
|
|
@@ -175847,11 +175851,11 @@ var BridgeRegistry = class _BridgeRegistry {
|
|
|
175847
175851
|
init_dist();
|
|
175848
175852
|
var AUTO_FORCE_SYNC_INTERVAL_MS2 = 9e4;
|
|
175849
175853
|
var ServerModeBridge = class {
|
|
175850
|
-
constructor(
|
|
175854
|
+
constructor(logger194, dataProvider, endpointManager, server) {
|
|
175851
175855
|
this.dataProvider = dataProvider;
|
|
175852
175856
|
this.endpointManager = endpointManager;
|
|
175853
175857
|
this.server = server;
|
|
175854
|
-
this.log =
|
|
175858
|
+
this.log = logger194.get(`ServerModeBridge / ${dataProvider.id}`);
|
|
175855
175859
|
}
|
|
175856
175860
|
log;
|
|
175857
175861
|
status = {
|
|
@@ -176253,7 +176257,7 @@ function ServerModeVacuumDevice(homeAssistantEntity, includeOnOff = false, minim
|
|
|
176253
176257
|
}
|
|
176254
176258
|
|
|
176255
176259
|
// src/matter/endpoints/server-mode-vacuum-endpoint.ts
|
|
176256
|
-
var
|
|
176260
|
+
var logger192 = Logger.get("ServerModeVacuumEndpoint");
|
|
176257
176261
|
var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEndpoint {
|
|
176258
176262
|
static async create(registry2, entityId, mapping) {
|
|
176259
176263
|
const deviceRegistry = registry2.deviceOf(entityId);
|
|
@@ -176263,7 +176267,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
176263
176267
|
return void 0;
|
|
176264
176268
|
}
|
|
176265
176269
|
let effectiveMapping = mapping;
|
|
176266
|
-
|
|
176270
|
+
logger192.info(
|
|
176267
176271
|
`${entityId}: device_id=${entity.device_id}, manualBattery=${mapping?.batteryEntity ?? "none"}`
|
|
176268
176272
|
);
|
|
176269
176273
|
if (entity.device_id) {
|
|
@@ -176278,9 +176282,9 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
176278
176282
|
batteryEntity: batteryEntityId
|
|
176279
176283
|
};
|
|
176280
176284
|
registry2.markBatteryEntityUsed(batteryEntityId);
|
|
176281
|
-
|
|
176285
|
+
logger192.info(`${entityId}: Auto-assigned battery ${batteryEntityId}`);
|
|
176282
176286
|
} else {
|
|
176283
|
-
|
|
176287
|
+
logger192.warn(
|
|
176284
176288
|
`${entityId}: No battery entity found for device ${entity.device_id}`
|
|
176285
176289
|
);
|
|
176286
176290
|
}
|
|
@@ -176294,7 +176298,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
176294
176298
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
176295
176299
|
cleaningModeEntity: vacuumEntities.cleaningModeEntity
|
|
176296
176300
|
};
|
|
176297
|
-
|
|
176301
|
+
logger192.info(
|
|
176298
176302
|
`${entityId}: Auto-assigned cleaningMode ${vacuumEntities.cleaningModeEntity}`
|
|
176299
176303
|
);
|
|
176300
176304
|
}
|
|
@@ -176304,7 +176308,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
176304
176308
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
176305
176309
|
suctionLevelEntity: vacuumEntities.suctionLevelEntity
|
|
176306
176310
|
};
|
|
176307
|
-
|
|
176311
|
+
logger192.info(
|
|
176308
176312
|
`${entityId}: Auto-assigned suctionLevel ${vacuumEntities.suctionLevelEntity}`
|
|
176309
176313
|
);
|
|
176310
176314
|
}
|
|
@@ -176314,7 +176318,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
176314
176318
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
176315
176319
|
mopIntensityEntity: vacuumEntities.mopIntensityEntity
|
|
176316
176320
|
};
|
|
176317
|
-
|
|
176321
|
+
logger192.info(
|
|
176318
176322
|
`${entityId}: Auto-assigned mopIntensity ${vacuumEntities.mopIntensityEntity}`
|
|
176319
176323
|
);
|
|
176320
176324
|
}
|
|
@@ -176335,7 +176339,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
176335
176339
|
rooms: roomsObj
|
|
176336
176340
|
}
|
|
176337
176341
|
};
|
|
176338
|
-
|
|
176342
|
+
logger192.info(
|
|
176339
176343
|
`${entityId}: Auto-detected ${valetudoRooms.length} Valetudo segments`
|
|
176340
176344
|
);
|
|
176341
176345
|
} else {
|
|
@@ -176352,14 +176356,14 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
176352
176356
|
rooms: roomsObj
|
|
176353
176357
|
}
|
|
176354
176358
|
};
|
|
176355
|
-
|
|
176359
|
+
logger192.info(
|
|
176356
176360
|
`${entityId}: Auto-detected ${roborockRooms.length} Roborock rooms`
|
|
176357
176361
|
);
|
|
176358
176362
|
}
|
|
176359
176363
|
}
|
|
176360
176364
|
}
|
|
176361
176365
|
} else {
|
|
176362
|
-
|
|
176366
|
+
logger192.warn(`${entityId}: No device_id \u2014 cannot auto-assign battery`);
|
|
176363
176367
|
}
|
|
176364
176368
|
const payload = {
|
|
176365
176369
|
entity_id: entityId,
|
|
@@ -176414,7 +176418,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
176414
176418
|
if (state.state === this.lastState?.state && JSON.stringify(state.attributes) === JSON.stringify(this.lastState?.attributes)) {
|
|
176415
176419
|
return;
|
|
176416
176420
|
}
|
|
176417
|
-
|
|
176421
|
+
logger192.debug(
|
|
176418
176422
|
`State update received for ${this.entityId}: state=${state.state}`
|
|
176419
176423
|
);
|
|
176420
176424
|
this.lastState = state;
|
|
@@ -176790,10 +176794,10 @@ var BridgeEnvironmentFactory = class extends BridgeFactory {
|
|
|
176790
176794
|
// src/core/ioc/app-environment.ts
|
|
176791
176795
|
var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
176792
176796
|
constructor(rootEnv, options) {
|
|
176793
|
-
const
|
|
176797
|
+
const logger194 = rootEnv.get(LoggerService);
|
|
176794
176798
|
super({
|
|
176795
176799
|
id: "App",
|
|
176796
|
-
log:
|
|
176800
|
+
log: logger194.get("AppContainer"),
|
|
176797
176801
|
parent: rootEnv
|
|
176798
176802
|
});
|
|
176799
176803
|
this.options = options;
|
|
@@ -176806,8 +176810,8 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
176806
176810
|
}
|
|
176807
176811
|
construction;
|
|
176808
176812
|
async init() {
|
|
176809
|
-
const
|
|
176810
|
-
this.set(LoggerService,
|
|
176813
|
+
const logger194 = this.get(LoggerService);
|
|
176814
|
+
this.set(LoggerService, logger194);
|
|
176811
176815
|
this.set(AppStorage, new AppStorage(await this.load(StorageService)));
|
|
176812
176816
|
this.set(BridgeStorage, new BridgeStorage(await this.load(AppStorage)));
|
|
176813
176817
|
this.set(
|
|
@@ -176824,7 +176828,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
176824
176828
|
);
|
|
176825
176829
|
this.set(
|
|
176826
176830
|
HomeAssistantClient,
|
|
176827
|
-
new HomeAssistantClient(
|
|
176831
|
+
new HomeAssistantClient(logger194, this.options.homeAssistant)
|
|
176828
176832
|
);
|
|
176829
176833
|
this.set(
|
|
176830
176834
|
HomeAssistantConfig,
|
|
@@ -176832,7 +176836,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
176832
176836
|
);
|
|
176833
176837
|
this.set(
|
|
176834
176838
|
HomeAssistantActions,
|
|
176835
|
-
new HomeAssistantActions(
|
|
176839
|
+
new HomeAssistantActions(logger194, await this.load(HomeAssistantClient))
|
|
176836
176840
|
);
|
|
176837
176841
|
this.set(
|
|
176838
176842
|
HomeAssistantRegistry,
|
|
@@ -176853,7 +176857,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
176853
176857
|
this.set(
|
|
176854
176858
|
WebApi,
|
|
176855
176859
|
new WebApi(
|
|
176856
|
-
|
|
176860
|
+
logger194,
|
|
176857
176861
|
await this.load(BridgeService),
|
|
176858
176862
|
await this.load(HomeAssistantClient),
|
|
176859
176863
|
await this.load(HomeAssistantRegistry),
|
|
@@ -176878,7 +176882,7 @@ init_nodejs();
|
|
|
176878
176882
|
init_level_control();
|
|
176879
176883
|
|
|
176880
176884
|
// src/matter/patches/patch-level-control-tlv.ts
|
|
176881
|
-
var
|
|
176885
|
+
var logger193 = Logger.get("PatchLevelControlTlv");
|
|
176882
176886
|
function patchLevelControlTlv() {
|
|
176883
176887
|
let patched = 0;
|
|
176884
176888
|
const moveToLevelFields = LevelControl3.TlvMoveToLevelRequest.fieldDefinitions;
|
|
@@ -176892,11 +176896,11 @@ function patchLevelControlTlv() {
|
|
|
176892
176896
|
patched++;
|
|
176893
176897
|
}
|
|
176894
176898
|
if (patched > 0) {
|
|
176895
|
-
|
|
176899
|
+
logger193.info(
|
|
176896
176900
|
`Patched ${patched} LevelControl TLV schema(s): transitionTime is now optional (Google Home compatibility)`
|
|
176897
176901
|
);
|
|
176898
176902
|
} else {
|
|
176899
|
-
|
|
176903
|
+
logger193.warn(
|
|
176900
176904
|
"Failed to patch LevelControl TLV schemas \u2014 field definitions not found. Google Home brightness adjustment may not work."
|
|
176901
176905
|
);
|
|
176902
176906
|
}
|