@riddix/hamh 2.1.0-alpha.520 → 2.1.0-alpha.522
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(logger204) {
|
|
1747
|
+
this.#logger = logger204;
|
|
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, logger204, 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 = logger204;
|
|
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 logger204 = Logger.get(subject.constructor.name);
|
|
5542
|
+
logger204.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 logger204 = loggers.get(facility);
|
|
136002
|
+
if (!logger204) {
|
|
136003
|
+
loggers.set(facility, logger204 = Logger.get(facility));
|
|
136004
136004
|
}
|
|
136005
|
-
|
|
136005
|
+
logger204[level](Diagnostic.via(id || "(anon)"), message);
|
|
136006
136006
|
}
|
|
136007
136007
|
Api2.log = log;
|
|
136008
136008
|
function logRequest(facility, id, method, target) {
|
|
@@ -147221,10 +147221,10 @@ var init_home_assistant_actions = __esm({
|
|
|
147221
147221
|
circuitBreakerResetMs: 3e4
|
|
147222
147222
|
};
|
|
147223
147223
|
HomeAssistantActions = class extends Service {
|
|
147224
|
-
constructor(
|
|
147224
|
+
constructor(logger204, client, config10) {
|
|
147225
147225
|
super("HomeAssistantActions");
|
|
147226
147226
|
this.client = client;
|
|
147227
|
-
this.log =
|
|
147227
|
+
this.log = logger204.get(this);
|
|
147228
147228
|
this.config = { ...defaultConfig, ...config10 };
|
|
147229
147229
|
this.circuitBreaker = new CircuitBreaker(
|
|
147230
147230
|
this.config.circuitBreakerThreshold,
|
|
@@ -147596,10 +147596,10 @@ var DiagnosticService = class {
|
|
|
147596
147596
|
};
|
|
147597
147597
|
|
|
147598
147598
|
// src/api/access-log.ts
|
|
147599
|
-
function accessLogger(
|
|
147599
|
+
function accessLogger(logger204) {
|
|
147600
147600
|
return (req, res, next) => {
|
|
147601
147601
|
res.on("finish", () => {
|
|
147602
|
-
|
|
147602
|
+
logger204.debug(
|
|
147603
147603
|
`${req.method} ${decodeURI(req.originalUrl)} ${res.statusCode} ${res.statusMessage} from ${req.socket.remoteAddress}`
|
|
147604
147604
|
);
|
|
147605
147605
|
});
|
|
@@ -151095,7 +151095,7 @@ var WebSocketApi = class {
|
|
|
151095
151095
|
|
|
151096
151096
|
// src/api/web-api.ts
|
|
151097
151097
|
var WebApi = class extends Service {
|
|
151098
|
-
constructor(
|
|
151098
|
+
constructor(logger204, bridgeService, haClient, haRegistry, bridgeStorage, mappingStorage, lockCredentialStorage, settingsStorage, backupService, props) {
|
|
151099
151099
|
super("WebApi");
|
|
151100
151100
|
this.bridgeService = bridgeService;
|
|
151101
151101
|
this.haClient = haClient;
|
|
@@ -151106,8 +151106,8 @@ var WebApi = class extends Service {
|
|
|
151106
151106
|
this.settingsStorage = settingsStorage;
|
|
151107
151107
|
this.backupService = backupService;
|
|
151108
151108
|
this.props = props;
|
|
151109
|
-
this.logger =
|
|
151110
|
-
this.log =
|
|
151109
|
+
this.logger = logger204;
|
|
151110
|
+
this.log = logger204.get(this);
|
|
151111
151111
|
this.accessLogger = accessLogger(this.log.createChild("Access Log"));
|
|
151112
151112
|
this.startTime = Date.now();
|
|
151113
151113
|
this.wsApi = new WebSocketApi(
|
|
@@ -151545,12 +151545,12 @@ var CustomStorage = class extends StorageBackendDisk {
|
|
|
151545
151545
|
|
|
151546
151546
|
// src/core/app/storage.ts
|
|
151547
151547
|
function storage(environment, options) {
|
|
151548
|
-
const
|
|
151548
|
+
const logger204 = environment.get(LoggerService).get("CustomStorage");
|
|
151549
151549
|
const location2 = resolveStorageLocation(options.location);
|
|
151550
151550
|
fs8.mkdirSync(location2, { recursive: true });
|
|
151551
151551
|
const storageService = environment.get(StorageService);
|
|
151552
151552
|
storageService.location = location2;
|
|
151553
|
-
storageService.factory = (ns) => new CustomStorage(
|
|
151553
|
+
storageService.factory = (ns) => new CustomStorage(logger204, path8.resolve(location2, ns));
|
|
151554
151554
|
}
|
|
151555
151555
|
function resolveStorageLocation(storageLocation) {
|
|
151556
151556
|
const homedir = os3.homedir();
|
|
@@ -152100,10 +152100,10 @@ import {
|
|
|
152100
152100
|
getConfig
|
|
152101
152101
|
} from "home-assistant-js-websocket";
|
|
152102
152102
|
var HomeAssistantClient = class extends Service {
|
|
152103
|
-
constructor(
|
|
152103
|
+
constructor(logger204, options) {
|
|
152104
152104
|
super("HomeAssistantClient");
|
|
152105
152105
|
this.options = options;
|
|
152106
|
-
this.log =
|
|
152106
|
+
this.log = logger204.get(this);
|
|
152107
152107
|
}
|
|
152108
152108
|
static Options = /* @__PURE__ */ Symbol.for("HomeAssistantClientProps");
|
|
152109
152109
|
_connection;
|
|
@@ -152696,9 +152696,10 @@ var EntityMappingStorage = class extends Service {
|
|
|
152696
152696
|
) ?? void 0,
|
|
152697
152697
|
customFanSpeedTags: request.customFanSpeedTags && Object.keys(request.customFanSpeedTags).length > 0 ? request.customFanSpeedTags : void 0,
|
|
152698
152698
|
valetudoIdentifier: request.valetudoIdentifier?.trim() || void 0,
|
|
152699
|
-
coverSwapOpenClose: request.coverSwapOpenClose || void 0
|
|
152699
|
+
coverSwapOpenClose: request.coverSwapOpenClose || void 0,
|
|
152700
|
+
composedEntities: request.composedEntities?.filter((e) => e.entityId?.trim()) ?? void 0
|
|
152700
152701
|
};
|
|
152701
|
-
if (!config10.matterDeviceType && !config10.customName && config10.disabled !== true && !config10.filterLifeEntity && !config10.cleaningModeEntity && !config10.temperatureEntity && !config10.humidityEntity && !config10.batteryEntity && !config10.roomEntities && !config10.disableLockPin && !config10.powerEntity && !config10.energyEntity && !config10.pressureEntity && !config10.suctionLevelEntity && !config10.mopIntensityEntity && (!config10.customServiceAreas || config10.customServiceAreas.length === 0) && (!config10.customFanSpeedTags || Object.keys(config10.customFanSpeedTags).length === 0) && !config10.valetudoIdentifier && !config10.coverSwapOpenClose) {
|
|
152702
|
+
if (!config10.matterDeviceType && !config10.customName && config10.disabled !== true && !config10.filterLifeEntity && !config10.cleaningModeEntity && !config10.temperatureEntity && !config10.humidityEntity && !config10.batteryEntity && !config10.roomEntities && !config10.disableLockPin && !config10.powerEntity && !config10.energyEntity && !config10.pressureEntity && !config10.suctionLevelEntity && !config10.mopIntensityEntity && (!config10.customServiceAreas || config10.customServiceAreas.length === 0) && (!config10.customFanSpeedTags || Object.keys(config10.customFanSpeedTags).length === 0) && !config10.valetudoIdentifier && !config10.coverSwapOpenClose && (!config10.composedEntities || config10.composedEntities.length === 0)) {
|
|
152702
152703
|
bridgeMap.delete(request.entityId);
|
|
152703
152704
|
} else {
|
|
152704
152705
|
bridgeMap.set(request.entityId, config10);
|
|
@@ -166868,10 +166869,10 @@ function ensureCommissioningConfig(server) {
|
|
|
166868
166869
|
var AUTO_FORCE_SYNC_INTERVAL_MS = 9e4;
|
|
166869
166870
|
var DEAD_SESSION_TIMEOUT_MS = 6e4;
|
|
166870
166871
|
var Bridge = class {
|
|
166871
|
-
constructor(env,
|
|
166872
|
+
constructor(env, logger204, dataProvider, endpointManager) {
|
|
166872
166873
|
this.dataProvider = dataProvider;
|
|
166873
166874
|
this.endpointManager = endpointManager;
|
|
166874
|
-
this.log =
|
|
166875
|
+
this.log = logger204.get(`Bridge / ${dataProvider.id}`);
|
|
166875
166876
|
this.server = new BridgeServerNode(
|
|
166876
166877
|
env,
|
|
166877
166878
|
this.dataProvider,
|
|
@@ -167316,7 +167317,7 @@ var AggregatorEndpoint2 = class extends Endpoint {
|
|
|
167316
167317
|
init_dist();
|
|
167317
167318
|
init_esm();
|
|
167318
167319
|
init_home_assistant_entity_behavior();
|
|
167319
|
-
import
|
|
167320
|
+
import debounce5 from "debounce";
|
|
167320
167321
|
|
|
167321
167322
|
// src/matter/endpoints/entity-endpoint.ts
|
|
167322
167323
|
init_esm7();
|
|
@@ -167359,6 +167360,11 @@ function getMappedEntityIds(mapping) {
|
|
|
167359
167360
|
if (mapping.filterLifeEntity) ids.push(mapping.filterLifeEntity);
|
|
167360
167361
|
if (mapping.powerEntity) ids.push(mapping.powerEntity);
|
|
167361
167362
|
if (mapping.energyEntity) ids.push(mapping.energyEntity);
|
|
167363
|
+
if (mapping.composedEntities) {
|
|
167364
|
+
for (const sub of mapping.composedEntities) {
|
|
167365
|
+
if (sub.entityId) ids.push(sub.entityId);
|
|
167366
|
+
}
|
|
167367
|
+
}
|
|
167362
167368
|
return ids;
|
|
167363
167369
|
}
|
|
167364
167370
|
|
|
@@ -169196,6 +169202,12 @@ var ComposedSensorEndpoint = class _ComposedSensorEndpoint extends Endpoint {
|
|
|
169196
169202
|
}
|
|
169197
169203
|
};
|
|
169198
169204
|
|
|
169205
|
+
// src/matter/endpoints/composed/user-composed-endpoint.ts
|
|
169206
|
+
init_esm();
|
|
169207
|
+
init_esm7();
|
|
169208
|
+
import debounce4 from "debounce";
|
|
169209
|
+
init_home_assistant_entity_behavior();
|
|
169210
|
+
|
|
169199
169211
|
// src/matter/endpoints/legacy/air-purifier/index.ts
|
|
169200
169212
|
init_dist();
|
|
169201
169213
|
init_home_assistant_entity_behavior();
|
|
@@ -171012,6 +171024,22 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
171012
171024
|
);
|
|
171013
171025
|
const currentTilt100ths = currentTilt != null ? currentTilt * 100 : null;
|
|
171014
171026
|
const isStopped = movementStatus === MovementStatus.Stopped;
|
|
171027
|
+
const inferTarget = (current100ths, existing100ths) => {
|
|
171028
|
+
if (isStopped) return current100ths;
|
|
171029
|
+
if (movementStatus === MovementStatus.Opening) {
|
|
171030
|
+
if (existing100ths != null && current100ths != null && existing100ths < current100ths) {
|
|
171031
|
+
return existing100ths;
|
|
171032
|
+
}
|
|
171033
|
+
return 0;
|
|
171034
|
+
}
|
|
171035
|
+
if (movementStatus === MovementStatus.Closing) {
|
|
171036
|
+
if (existing100ths != null && current100ths != null && existing100ths > current100ths) {
|
|
171037
|
+
return existing100ths;
|
|
171038
|
+
}
|
|
171039
|
+
return 1e4;
|
|
171040
|
+
}
|
|
171041
|
+
return existing100ths ?? current100ths;
|
|
171042
|
+
};
|
|
171015
171043
|
logger175.debug(
|
|
171016
171044
|
`Cover update for ${entity.entity_id}: state=${state.state}, lift=${currentLift}%, tilt=${currentTilt}%, movement=${MovementStatus[movementStatus]}`
|
|
171017
171045
|
);
|
|
@@ -171038,14 +171066,18 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
171038
171066
|
...this.features.positionAwareLift ? {
|
|
171039
171067
|
currentPositionLiftPercentage: currentLift,
|
|
171040
171068
|
currentPositionLiftPercent100ths: currentLift100ths,
|
|
171041
|
-
|
|
171042
|
-
|
|
171069
|
+
targetPositionLiftPercent100ths: inferTarget(
|
|
171070
|
+
currentLift100ths,
|
|
171071
|
+
this.state.targetPositionLiftPercent100ths
|
|
171072
|
+
)
|
|
171043
171073
|
} : {},
|
|
171044
171074
|
...this.features.positionAwareTilt ? {
|
|
171045
171075
|
currentPositionTiltPercentage: currentTilt,
|
|
171046
171076
|
currentPositionTiltPercent100ths: currentTilt100ths,
|
|
171047
|
-
|
|
171048
|
-
|
|
171077
|
+
targetPositionTiltPercent100ths: inferTarget(
|
|
171078
|
+
currentTilt100ths,
|
|
171079
|
+
this.state.targetPositionTiltPercent100ths
|
|
171080
|
+
)
|
|
171049
171081
|
} : {}
|
|
171050
171082
|
}
|
|
171051
171083
|
);
|
|
@@ -177888,8 +177920,190 @@ var matterDeviceTypeFactories = {
|
|
|
177888
177920
|
})
|
|
177889
177921
|
};
|
|
177890
177922
|
|
|
177923
|
+
// src/matter/endpoints/composed/user-composed-endpoint.ts
|
|
177924
|
+
var logger198 = Logger.get("UserComposedEndpoint");
|
|
177925
|
+
function createEndpointId4(entityId, customName) {
|
|
177926
|
+
const baseName = customName || entityId;
|
|
177927
|
+
return baseName.replace(/\./g, "_").replace(/\s+/g, "_");
|
|
177928
|
+
}
|
|
177929
|
+
function buildEntityPayload3(registry2, entityId) {
|
|
177930
|
+
const state = registry2.initialState(entityId);
|
|
177931
|
+
if (!state) return void 0;
|
|
177932
|
+
const entity = registry2.entity(entityId);
|
|
177933
|
+
const deviceRegistry = registry2.deviceOf(entityId);
|
|
177934
|
+
return {
|
|
177935
|
+
entity_id: entityId,
|
|
177936
|
+
state,
|
|
177937
|
+
registry: entity,
|
|
177938
|
+
deviceRegistry
|
|
177939
|
+
};
|
|
177940
|
+
}
|
|
177941
|
+
var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
177942
|
+
entityId;
|
|
177943
|
+
mappedEntityIds;
|
|
177944
|
+
subEndpoints = /* @__PURE__ */ new Map();
|
|
177945
|
+
lastStates = /* @__PURE__ */ new Map();
|
|
177946
|
+
debouncedUpdates = /* @__PURE__ */ new Map();
|
|
177947
|
+
static async create(config10) {
|
|
177948
|
+
const { registry: registry2, primaryEntityId, composedEntities } = config10;
|
|
177949
|
+
const primaryPayload = buildEntityPayload3(registry2, primaryEntityId);
|
|
177950
|
+
if (!primaryPayload) return void 0;
|
|
177951
|
+
let parentType = BridgedNodeEndpoint.with(
|
|
177952
|
+
BasicInformationServer2,
|
|
177953
|
+
IdentifyServer2,
|
|
177954
|
+
HomeAssistantEntityBehavior
|
|
177955
|
+
);
|
|
177956
|
+
if (config10.areaName) {
|
|
177957
|
+
const truncatedName = config10.areaName.length > 16 ? config10.areaName.substring(0, 16) : config10.areaName;
|
|
177958
|
+
parentType = parentType.with(
|
|
177959
|
+
FixedLabelServer.set({
|
|
177960
|
+
labelList: [{ label: "room", value: truncatedName }]
|
|
177961
|
+
})
|
|
177962
|
+
);
|
|
177963
|
+
}
|
|
177964
|
+
const endpointId = createEndpointId4(primaryEntityId, config10.customName);
|
|
177965
|
+
const parts = [];
|
|
177966
|
+
const subEndpointMap = /* @__PURE__ */ new Map();
|
|
177967
|
+
const mappedIds = [];
|
|
177968
|
+
const primaryType = createLegacyEndpointType(
|
|
177969
|
+
primaryPayload,
|
|
177970
|
+
config10.mapping,
|
|
177971
|
+
void 0,
|
|
177972
|
+
{ vacuumOnOff: registry2.isVacuumOnOffEnabled() }
|
|
177973
|
+
);
|
|
177974
|
+
if (!primaryType) {
|
|
177975
|
+
logger198.warn(
|
|
177976
|
+
`Cannot create endpoint type for primary entity ${primaryEntityId}`
|
|
177977
|
+
);
|
|
177978
|
+
return void 0;
|
|
177979
|
+
}
|
|
177980
|
+
const primarySub = new Endpoint(primaryType, {
|
|
177981
|
+
id: `${endpointId}_primary`
|
|
177982
|
+
});
|
|
177983
|
+
parts.push(primarySub);
|
|
177984
|
+
subEndpointMap.set(primaryEntityId, primarySub);
|
|
177985
|
+
for (let i = 0; i < composedEntities.length; i++) {
|
|
177986
|
+
const sub = composedEntities[i];
|
|
177987
|
+
if (!sub.entityId) continue;
|
|
177988
|
+
const subPayload = buildEntityPayload3(registry2, sub.entityId);
|
|
177989
|
+
if (!subPayload) {
|
|
177990
|
+
logger198.warn(
|
|
177991
|
+
`Cannot find entity state for composed sub-entity ${sub.entityId}`
|
|
177992
|
+
);
|
|
177993
|
+
continue;
|
|
177994
|
+
}
|
|
177995
|
+
const subMapping = {
|
|
177996
|
+
entityId: sub.entityId,
|
|
177997
|
+
matterDeviceType: sub.matterDeviceType
|
|
177998
|
+
};
|
|
177999
|
+
const subType = createLegacyEndpointType(subPayload, subMapping);
|
|
178000
|
+
if (!subType) {
|
|
178001
|
+
logger198.warn(
|
|
178002
|
+
`Cannot create endpoint type for composed sub-entity ${sub.entityId}`
|
|
178003
|
+
);
|
|
178004
|
+
continue;
|
|
178005
|
+
}
|
|
178006
|
+
const subEndpoint = new Endpoint(subType, {
|
|
178007
|
+
id: `${endpointId}_sub_${i}`
|
|
178008
|
+
});
|
|
178009
|
+
parts.push(subEndpoint);
|
|
178010
|
+
subEndpointMap.set(sub.entityId, subEndpoint);
|
|
178011
|
+
mappedIds.push(sub.entityId);
|
|
178012
|
+
}
|
|
178013
|
+
if (parts.length < 2) {
|
|
178014
|
+
logger198.warn(
|
|
178015
|
+
`User composed device ${primaryEntityId}: only ${parts.length} sub-endpoint(s), need at least 2 (primary + one sub-entity). Falling back to standalone.`
|
|
178016
|
+
);
|
|
178017
|
+
return void 0;
|
|
178018
|
+
}
|
|
178019
|
+
const parentTypeWithState = parentType.set({
|
|
178020
|
+
homeAssistantEntity: {
|
|
178021
|
+
entity: primaryPayload,
|
|
178022
|
+
customName: config10.customName,
|
|
178023
|
+
mapping: config10.mapping
|
|
178024
|
+
}
|
|
178025
|
+
});
|
|
178026
|
+
const endpoint = new _UserComposedEndpoint(
|
|
178027
|
+
parentTypeWithState,
|
|
178028
|
+
primaryEntityId,
|
|
178029
|
+
endpointId,
|
|
178030
|
+
parts,
|
|
178031
|
+
mappedIds
|
|
178032
|
+
);
|
|
178033
|
+
endpoint.subEndpoints = subEndpointMap;
|
|
178034
|
+
const labels = parts.map(
|
|
178035
|
+
(_, i) => i === 0 ? primaryEntityId.split(".")[0] : composedEntities[i - 1]?.entityId?.split(".")[0] ?? "?"
|
|
178036
|
+
).join("+");
|
|
178037
|
+
logger198.info(
|
|
178038
|
+
`Created user composed device ${primaryEntityId}: ${parts.length} sub-endpoint(s) [${labels}]`
|
|
178039
|
+
);
|
|
178040
|
+
return endpoint;
|
|
178041
|
+
}
|
|
178042
|
+
constructor(type, entityId, id, parts, mappedEntityIds) {
|
|
178043
|
+
super(type, { id, parts });
|
|
178044
|
+
this.entityId = entityId;
|
|
178045
|
+
this.mappedEntityIds = mappedEntityIds;
|
|
178046
|
+
}
|
|
178047
|
+
async updateStates(states) {
|
|
178048
|
+
this.scheduleUpdate(this, this.entityId, states);
|
|
178049
|
+
for (const [entityId, sub] of this.subEndpoints) {
|
|
178050
|
+
this.scheduleUpdate(sub, entityId, states);
|
|
178051
|
+
}
|
|
178052
|
+
}
|
|
178053
|
+
scheduleUpdate(endpoint, entityId, states) {
|
|
178054
|
+
const state = states[entityId];
|
|
178055
|
+
if (!state) return;
|
|
178056
|
+
const key = endpoint === this ? `_parent_:${entityId}` : entityId;
|
|
178057
|
+
const stateJson = JSON.stringify({
|
|
178058
|
+
s: state.state,
|
|
178059
|
+
a: state.attributes
|
|
178060
|
+
});
|
|
178061
|
+
if (this.lastStates.get(key) === stateJson) return;
|
|
178062
|
+
this.lastStates.set(key, stateJson);
|
|
178063
|
+
let debouncedFn = this.debouncedUpdates.get(key);
|
|
178064
|
+
if (!debouncedFn) {
|
|
178065
|
+
debouncedFn = debounce4(
|
|
178066
|
+
(ep, s) => this.flushUpdate(ep, s),
|
|
178067
|
+
50
|
|
178068
|
+
);
|
|
178069
|
+
this.debouncedUpdates.set(key, debouncedFn);
|
|
178070
|
+
}
|
|
178071
|
+
debouncedFn(endpoint, state);
|
|
178072
|
+
}
|
|
178073
|
+
async flushUpdate(endpoint, state) {
|
|
178074
|
+
try {
|
|
178075
|
+
await endpoint.construction.ready;
|
|
178076
|
+
} catch {
|
|
178077
|
+
return;
|
|
178078
|
+
}
|
|
178079
|
+
try {
|
|
178080
|
+
const current = endpoint.stateOf(HomeAssistantEntityBehavior).entity;
|
|
178081
|
+
await endpoint.setStateOf(HomeAssistantEntityBehavior, {
|
|
178082
|
+
entity: { ...current, state }
|
|
178083
|
+
});
|
|
178084
|
+
} catch (error) {
|
|
178085
|
+
if (error instanceof TransactionDestroyedError || error instanceof DestroyedDependencyError) {
|
|
178086
|
+
return;
|
|
178087
|
+
}
|
|
178088
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
178089
|
+
if (errorMessage.includes(
|
|
178090
|
+
"Endpoint storage inaccessible because endpoint is not a node and is not owned by another endpoint"
|
|
178091
|
+
)) {
|
|
178092
|
+
return;
|
|
178093
|
+
}
|
|
178094
|
+
throw error;
|
|
178095
|
+
}
|
|
178096
|
+
}
|
|
178097
|
+
async delete() {
|
|
178098
|
+
for (const fn of this.debouncedUpdates.values()) {
|
|
178099
|
+
fn.clear();
|
|
178100
|
+
}
|
|
178101
|
+
await super.delete();
|
|
178102
|
+
}
|
|
178103
|
+
};
|
|
178104
|
+
|
|
177891
178105
|
// src/matter/endpoints/legacy/legacy-endpoint.ts
|
|
177892
|
-
var
|
|
178106
|
+
var logger199 = Logger.get("LegacyEndpoint");
|
|
177893
178107
|
var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
177894
178108
|
static async create(registry2, entityId, mapping) {
|
|
177895
178109
|
const deviceRegistry = registry2.deviceOf(entityId);
|
|
@@ -177899,25 +178113,25 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
177899
178113
|
return;
|
|
177900
178114
|
}
|
|
177901
178115
|
if (registry2.isAutoBatteryMappingEnabled() && registry2.isBatteryEntityUsed(entityId)) {
|
|
177902
|
-
|
|
178116
|
+
logger199.debug(
|
|
177903
178117
|
`Skipping ${entityId} - already auto-assigned as battery to another device`
|
|
177904
178118
|
);
|
|
177905
178119
|
return;
|
|
177906
178120
|
}
|
|
177907
178121
|
if (registry2.isAutoHumidityMappingEnabled() && registry2.isHumidityEntityUsed(entityId)) {
|
|
177908
|
-
|
|
178122
|
+
logger199.debug(
|
|
177909
178123
|
`Skipping ${entityId} - already auto-assigned as humidity to a temperature sensor`
|
|
177910
178124
|
);
|
|
177911
178125
|
return;
|
|
177912
178126
|
}
|
|
177913
178127
|
if (registry2.isAutoPressureMappingEnabled() && registry2.isPressureEntityUsed(entityId)) {
|
|
177914
|
-
|
|
178128
|
+
logger199.debug(
|
|
177915
178129
|
`Skipping ${entityId} - already auto-assigned as pressure to a temperature sensor`
|
|
177916
178130
|
);
|
|
177917
178131
|
return;
|
|
177918
178132
|
}
|
|
177919
178133
|
if (registry2.isAutoComposedDevicesEnabled() && registry2.isComposedSubEntityUsed(entityId)) {
|
|
177920
|
-
|
|
178134
|
+
logger199.debug(
|
|
177921
178135
|
`Skipping ${entityId} - already consumed by a composed device`
|
|
177922
178136
|
);
|
|
177923
178137
|
return;
|
|
@@ -177937,7 +178151,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
177937
178151
|
humidityEntity: humidityEntityId
|
|
177938
178152
|
};
|
|
177939
178153
|
registry2.markHumidityEntityUsed(humidityEntityId);
|
|
177940
|
-
|
|
178154
|
+
logger199.debug(
|
|
177941
178155
|
`Auto-assigned humidity ${humidityEntityId} to ${entityId}`
|
|
177942
178156
|
);
|
|
177943
178157
|
}
|
|
@@ -177956,7 +178170,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
177956
178170
|
pressureEntity: pressureEntityId
|
|
177957
178171
|
};
|
|
177958
178172
|
registry2.markPressureEntityUsed(pressureEntityId);
|
|
177959
|
-
|
|
178173
|
+
logger199.debug(
|
|
177960
178174
|
`Auto-assigned pressure ${pressureEntityId} to ${entityId}`
|
|
177961
178175
|
);
|
|
177962
178176
|
}
|
|
@@ -177974,7 +178188,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
177974
178188
|
batteryEntity: batteryEntityId
|
|
177975
178189
|
};
|
|
177976
178190
|
registry2.markBatteryEntityUsed(batteryEntityId);
|
|
177977
|
-
|
|
178191
|
+
logger199.debug(
|
|
177978
178192
|
`Auto-assigned battery ${batteryEntityId} to ${entityId}`
|
|
177979
178193
|
);
|
|
177980
178194
|
}
|
|
@@ -177992,7 +178206,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
177992
178206
|
powerEntity: powerEntityId
|
|
177993
178207
|
};
|
|
177994
178208
|
registry2.markPowerEntityUsed(powerEntityId);
|
|
177995
|
-
|
|
178209
|
+
logger199.debug(`Auto-assigned power ${powerEntityId} to ${entityId}`);
|
|
177996
178210
|
}
|
|
177997
178211
|
}
|
|
177998
178212
|
}
|
|
@@ -178009,7 +178223,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178009
178223
|
energyEntity: energyEntityId
|
|
178010
178224
|
};
|
|
178011
178225
|
registry2.markEnergyEntityUsed(energyEntityId);
|
|
178012
|
-
|
|
178226
|
+
logger199.debug(
|
|
178013
178227
|
`Auto-assigned energy ${energyEntityId} to ${entityId}`
|
|
178014
178228
|
);
|
|
178015
178229
|
}
|
|
@@ -178025,7 +178239,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178025
178239
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
178026
178240
|
cleaningModeEntity: vacuumEntities.cleaningModeEntity
|
|
178027
178241
|
};
|
|
178028
|
-
|
|
178242
|
+
logger199.debug(
|
|
178029
178243
|
`Auto-assigned cleaningMode ${vacuumEntities.cleaningModeEntity} to ${entityId}`
|
|
178030
178244
|
);
|
|
178031
178245
|
}
|
|
@@ -178035,7 +178249,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178035
178249
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
178036
178250
|
suctionLevelEntity: vacuumEntities.suctionLevelEntity
|
|
178037
178251
|
};
|
|
178038
|
-
|
|
178252
|
+
logger199.debug(
|
|
178039
178253
|
`Auto-assigned suctionLevel ${vacuumEntities.suctionLevelEntity} to ${entityId}`
|
|
178040
178254
|
);
|
|
178041
178255
|
}
|
|
@@ -178045,7 +178259,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178045
178259
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
178046
178260
|
mopIntensityEntity: vacuumEntities.mopIntensityEntity
|
|
178047
178261
|
};
|
|
178048
|
-
|
|
178262
|
+
logger199.debug(
|
|
178049
178263
|
`Auto-assigned mopIntensity ${vacuumEntities.mopIntensityEntity} to ${entityId}`
|
|
178050
178264
|
);
|
|
178051
178265
|
}
|
|
@@ -178060,7 +178274,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178060
178274
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
178061
178275
|
cleanAreaRooms
|
|
178062
178276
|
};
|
|
178063
|
-
|
|
178277
|
+
logger199.debug(
|
|
178064
178278
|
`Using ${cleanAreaRooms.length} HA areas via CLEAN_AREA for ${entityId}`
|
|
178065
178279
|
);
|
|
178066
178280
|
}
|
|
@@ -178081,7 +178295,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178081
178295
|
rooms: roomsObj
|
|
178082
178296
|
}
|
|
178083
178297
|
};
|
|
178084
|
-
|
|
178298
|
+
logger199.debug(
|
|
178085
178299
|
`Auto-detected ${valetudoRooms.length} Valetudo segments for ${entityId}`
|
|
178086
178300
|
);
|
|
178087
178301
|
} else {
|
|
@@ -178098,7 +178312,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178098
178312
|
rooms: roomsObj
|
|
178099
178313
|
}
|
|
178100
178314
|
};
|
|
178101
|
-
|
|
178315
|
+
logger199.debug(
|
|
178102
178316
|
`Auto-detected ${roborockRooms.length} Roborock rooms for ${entityId}`
|
|
178103
178317
|
);
|
|
178104
178318
|
}
|
|
@@ -178106,6 +178320,23 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178106
178320
|
}
|
|
178107
178321
|
}
|
|
178108
178322
|
}
|
|
178323
|
+
if (registry2.isAutoComposedDevicesEnabled() && effectiveMapping?.composedEntities && effectiveMapping.composedEntities.length > 0) {
|
|
178324
|
+
const composedAreaName = registry2.getAreaName(entityId);
|
|
178325
|
+
const composed = await UserComposedEndpoint.create({
|
|
178326
|
+
registry: registry2,
|
|
178327
|
+
primaryEntityId: entityId,
|
|
178328
|
+
mapping: effectiveMapping,
|
|
178329
|
+
composedEntities: effectiveMapping.composedEntities,
|
|
178330
|
+
customName: effectiveMapping?.customName,
|
|
178331
|
+
areaName: composedAreaName
|
|
178332
|
+
});
|
|
178333
|
+
if (composed) {
|
|
178334
|
+
return composed;
|
|
178335
|
+
}
|
|
178336
|
+
logger199.warn(
|
|
178337
|
+
`User composed device creation failed for ${entityId}, falling back to standalone`
|
|
178338
|
+
);
|
|
178339
|
+
}
|
|
178109
178340
|
if (registry2.isAutoComposedDevicesEnabled()) {
|
|
178110
178341
|
const attrs = state.attributes;
|
|
178111
178342
|
if (entityId.startsWith("sensor.") && attrs.device_class === SensorDeviceClass.temperature && (effectiveMapping?.humidityEntity || effectiveMapping?.pressureEntity)) {
|
|
@@ -178180,7 +178411,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178180
178411
|
}
|
|
178181
178412
|
constructor(type, entityId, customName, mappedEntityIds) {
|
|
178182
178413
|
super(type, entityId, customName, mappedEntityIds);
|
|
178183
|
-
this.flushUpdate =
|
|
178414
|
+
this.flushUpdate = debounce5(this.flushPendingUpdate.bind(this), 50);
|
|
178184
178415
|
}
|
|
178185
178416
|
lastState;
|
|
178186
178417
|
pendingMappedChange = false;
|
|
@@ -178197,11 +178428,11 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
178197
178428
|
}
|
|
178198
178429
|
if (mappedChanged) {
|
|
178199
178430
|
this.pendingMappedChange = true;
|
|
178200
|
-
|
|
178431
|
+
logger199.debug(
|
|
178201
178432
|
`Mapped entity change detected for ${this.entityId}, forcing update`
|
|
178202
178433
|
);
|
|
178203
178434
|
}
|
|
178204
|
-
|
|
178435
|
+
logger199.debug(
|
|
178205
178436
|
`State update received for ${this.entityId}: state=${state.state}`
|
|
178206
178437
|
);
|
|
178207
178438
|
this.lastState = state;
|
|
@@ -178245,7 +178476,7 @@ import {
|
|
|
178245
178476
|
getCollection
|
|
178246
178477
|
} from "home-assistant-js-websocket";
|
|
178247
178478
|
import { atLeastHaVersion } from "home-assistant-js-websocket/dist/util.js";
|
|
178248
|
-
var
|
|
178479
|
+
var logger200 = Logger.get("SubscribeEntities");
|
|
178249
178480
|
function processEvent(store, updates) {
|
|
178250
178481
|
const state = { ...store.state };
|
|
178251
178482
|
if (updates.a) {
|
|
@@ -178271,7 +178502,7 @@ function processEvent(store, updates) {
|
|
|
178271
178502
|
for (const entityId in updates.c) {
|
|
178272
178503
|
let entityState = state[entityId];
|
|
178273
178504
|
if (!entityState) {
|
|
178274
|
-
|
|
178505
|
+
logger200.warn("Received state update for unknown entity", entityId);
|
|
178275
178506
|
continue;
|
|
178276
178507
|
}
|
|
178277
178508
|
entityState = { ...entityState };
|
|
@@ -178341,7 +178572,7 @@ var subscribeEntities = (conn, onChange, entityIds) => entitiesColl(conn, entity
|
|
|
178341
178572
|
|
|
178342
178573
|
// src/services/bridges/entity-isolation-service.ts
|
|
178343
178574
|
init_esm();
|
|
178344
|
-
var
|
|
178575
|
+
var logger201 = Logger.get("EntityIsolation");
|
|
178345
178576
|
var EntityIsolationServiceImpl = class {
|
|
178346
178577
|
isolatedEntities = /* @__PURE__ */ new Map();
|
|
178347
178578
|
isolationCallbacks = /* @__PURE__ */ new Map();
|
|
@@ -178406,13 +178637,13 @@ var EntityIsolationServiceImpl = class {
|
|
|
178406
178637
|
}
|
|
178407
178638
|
const parsed = this.parseEndpointPath(msg);
|
|
178408
178639
|
if (!parsed) {
|
|
178409
|
-
|
|
178640
|
+
logger201.warn("Could not parse entity from error:", msg);
|
|
178410
178641
|
return false;
|
|
178411
178642
|
}
|
|
178412
178643
|
const { bridgeId, entityName } = parsed;
|
|
178413
178644
|
const callback = this.isolationCallbacks.get(bridgeId);
|
|
178414
178645
|
if (!callback) {
|
|
178415
|
-
|
|
178646
|
+
logger201.warn(
|
|
178416
178647
|
`No isolation callback registered for bridge ${bridgeId}, entity: ${entityName}`
|
|
178417
178648
|
);
|
|
178418
178649
|
return false;
|
|
@@ -178423,14 +178654,14 @@ var EntityIsolationServiceImpl = class {
|
|
|
178423
178654
|
}
|
|
178424
178655
|
const reason = `${classification}. Entity isolated to protect bridge stability.`;
|
|
178425
178656
|
this.isolatedEntities.set(key, { entityId: entityName, reason });
|
|
178426
|
-
|
|
178657
|
+
logger201.warn(
|
|
178427
178658
|
`Isolating entity "${entityName}" from bridge ${bridgeId} due to: ${reason}`
|
|
178428
178659
|
);
|
|
178429
178660
|
try {
|
|
178430
178661
|
await callback(entityName);
|
|
178431
178662
|
return true;
|
|
178432
178663
|
} catch (e) {
|
|
178433
|
-
|
|
178664
|
+
logger201.error(`Failed to isolate entity ${entityName}:`, e);
|
|
178434
178665
|
return false;
|
|
178435
178666
|
}
|
|
178436
178667
|
}
|
|
@@ -178729,8 +178960,15 @@ var BridgeEndpointManager = class extends Service {
|
|
|
178729
178960
|
this.entityIds = this.registry.entityIds;
|
|
178730
178961
|
if (this.registry.isAutoComposedDevicesEnabled()) {
|
|
178731
178962
|
for (const eid of this.entityIds) {
|
|
178732
|
-
if (!eid.startsWith("fan.")) continue;
|
|
178733
178963
|
const m = this.getEntityMapping(eid);
|
|
178964
|
+
if (m?.composedEntities) {
|
|
178965
|
+
for (const sub of m.composedEntities) {
|
|
178966
|
+
if (sub.entityId) {
|
|
178967
|
+
this.registry.markComposedSubEntityUsed(sub.entityId);
|
|
178968
|
+
}
|
|
178969
|
+
}
|
|
178970
|
+
}
|
|
178971
|
+
if (!eid.startsWith("fan.")) continue;
|
|
178734
178972
|
const matterType = m?.matterDeviceType ?? "fan";
|
|
178735
178973
|
if (matterType !== "air_purifier") continue;
|
|
178736
178974
|
const ent = this.registry.entity(eid);
|
|
@@ -179584,11 +179822,11 @@ init_dist();
|
|
|
179584
179822
|
var AUTO_FORCE_SYNC_INTERVAL_MS2 = 9e4;
|
|
179585
179823
|
var DEAD_SESSION_TIMEOUT_MS2 = 6e4;
|
|
179586
179824
|
var ServerModeBridge = class {
|
|
179587
|
-
constructor(
|
|
179825
|
+
constructor(logger204, dataProvider, endpointManager, server) {
|
|
179588
179826
|
this.dataProvider = dataProvider;
|
|
179589
179827
|
this.endpointManager = endpointManager;
|
|
179590
179828
|
this.server = server;
|
|
179591
|
-
this.log =
|
|
179829
|
+
this.log = logger204.get(`ServerModeBridge / ${dataProvider.id}`);
|
|
179592
179830
|
}
|
|
179593
179831
|
log;
|
|
179594
179832
|
status = {
|
|
@@ -180013,7 +180251,7 @@ init_service();
|
|
|
180013
180251
|
// src/matter/endpoints/server-mode-vacuum-endpoint.ts
|
|
180014
180252
|
init_esm();
|
|
180015
180253
|
init_home_assistant_entity_behavior();
|
|
180016
|
-
import
|
|
180254
|
+
import debounce6 from "debounce";
|
|
180017
180255
|
|
|
180018
180256
|
// src/matter/endpoints/legacy/vacuum/server-mode-vacuum-device.ts
|
|
180019
180257
|
init_home_assistant_entity_behavior();
|
|
@@ -180077,7 +180315,7 @@ function ServerModeVacuumDevice(homeAssistantEntity, includeOnOff = false, clean
|
|
|
180077
180315
|
}
|
|
180078
180316
|
|
|
180079
180317
|
// src/matter/endpoints/server-mode-vacuum-endpoint.ts
|
|
180080
|
-
var
|
|
180318
|
+
var logger202 = Logger.get("ServerModeVacuumEndpoint");
|
|
180081
180319
|
var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEndpoint {
|
|
180082
180320
|
static async create(registry2, entityId, mapping) {
|
|
180083
180321
|
const deviceRegistry = registry2.deviceOf(entityId);
|
|
@@ -180087,7 +180325,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180087
180325
|
return void 0;
|
|
180088
180326
|
}
|
|
180089
180327
|
let effectiveMapping = mapping;
|
|
180090
|
-
|
|
180328
|
+
logger202.info(
|
|
180091
180329
|
`${entityId}: device_id=${entity.device_id}, manualBattery=${mapping?.batteryEntity ?? "none"}`
|
|
180092
180330
|
);
|
|
180093
180331
|
if (entity.device_id) {
|
|
@@ -180102,15 +180340,15 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180102
180340
|
batteryEntity: batteryEntityId
|
|
180103
180341
|
};
|
|
180104
180342
|
registry2.markBatteryEntityUsed(batteryEntityId);
|
|
180105
|
-
|
|
180343
|
+
logger202.info(`${entityId}: Auto-assigned battery ${batteryEntityId}`);
|
|
180106
180344
|
} else {
|
|
180107
180345
|
const attrs = state.attributes;
|
|
180108
180346
|
if (attrs.battery_level != null || attrs.battery != null) {
|
|
180109
|
-
|
|
180347
|
+
logger202.info(
|
|
180110
180348
|
`${entityId}: No battery entity found, using battery attribute from vacuum state`
|
|
180111
180349
|
);
|
|
180112
180350
|
} else {
|
|
180113
|
-
|
|
180351
|
+
logger202.warn(
|
|
180114
180352
|
`${entityId}: No battery entity found for device ${entity.device_id}`
|
|
180115
180353
|
);
|
|
180116
180354
|
}
|
|
@@ -180125,7 +180363,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180125
180363
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
180126
180364
|
cleaningModeEntity: vacuumEntities.cleaningModeEntity
|
|
180127
180365
|
};
|
|
180128
|
-
|
|
180366
|
+
logger202.info(
|
|
180129
180367
|
`${entityId}: Auto-assigned cleaningMode ${vacuumEntities.cleaningModeEntity}`
|
|
180130
180368
|
);
|
|
180131
180369
|
}
|
|
@@ -180135,7 +180373,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180135
180373
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
180136
180374
|
suctionLevelEntity: vacuumEntities.suctionLevelEntity
|
|
180137
180375
|
};
|
|
180138
|
-
|
|
180376
|
+
logger202.info(
|
|
180139
180377
|
`${entityId}: Auto-assigned suctionLevel ${vacuumEntities.suctionLevelEntity}`
|
|
180140
180378
|
);
|
|
180141
180379
|
}
|
|
@@ -180145,7 +180383,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180145
180383
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
180146
180384
|
mopIntensityEntity: vacuumEntities.mopIntensityEntity
|
|
180147
180385
|
};
|
|
180148
|
-
|
|
180386
|
+
logger202.info(
|
|
180149
180387
|
`${entityId}: Auto-assigned mopIntensity ${vacuumEntities.mopIntensityEntity}`
|
|
180150
180388
|
);
|
|
180151
180389
|
}
|
|
@@ -180160,7 +180398,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180160
180398
|
entityId: effectiveMapping?.entityId ?? entityId,
|
|
180161
180399
|
cleanAreaRooms
|
|
180162
180400
|
};
|
|
180163
|
-
|
|
180401
|
+
logger202.info(
|
|
180164
180402
|
`${entityId}: Using ${cleanAreaRooms.length} HA areas via CLEAN_AREA`
|
|
180165
180403
|
);
|
|
180166
180404
|
}
|
|
@@ -180181,7 +180419,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180181
180419
|
rooms: roomsObj
|
|
180182
180420
|
}
|
|
180183
180421
|
};
|
|
180184
|
-
|
|
180422
|
+
logger202.info(
|
|
180185
180423
|
`${entityId}: Auto-detected ${valetudoRooms.length} Valetudo segments`
|
|
180186
180424
|
);
|
|
180187
180425
|
} else {
|
|
@@ -180198,14 +180436,14 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180198
180436
|
rooms: roomsObj
|
|
180199
180437
|
}
|
|
180200
180438
|
};
|
|
180201
|
-
|
|
180439
|
+
logger202.info(
|
|
180202
180440
|
`${entityId}: Auto-detected ${roborockRooms.length} Roborock rooms`
|
|
180203
180441
|
);
|
|
180204
180442
|
}
|
|
180205
180443
|
}
|
|
180206
180444
|
}
|
|
180207
180445
|
} else {
|
|
180208
|
-
|
|
180446
|
+
logger202.warn(`${entityId}: No device_id \u2014 cannot auto-assign battery`);
|
|
180209
180447
|
}
|
|
180210
180448
|
const payload = {
|
|
180211
180449
|
entity_id: entityId,
|
|
@@ -180255,7 +180493,7 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180255
180493
|
flushUpdate;
|
|
180256
180494
|
constructor(type, entityId, customName, mappedEntityIds) {
|
|
180257
180495
|
super(type, entityId, customName, mappedEntityIds);
|
|
180258
|
-
this.flushUpdate =
|
|
180496
|
+
this.flushUpdate = debounce6(this.flushPendingUpdate.bind(this), 50);
|
|
180259
180497
|
}
|
|
180260
180498
|
async delete() {
|
|
180261
180499
|
this.flushUpdate.clear();
|
|
@@ -180269,11 +180507,11 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
180269
180507
|
}
|
|
180270
180508
|
if (mappedChanged) {
|
|
180271
180509
|
this.pendingMappedChange = true;
|
|
180272
|
-
|
|
180510
|
+
logger202.debug(
|
|
180273
180511
|
`Mapped entity change detected for ${this.entityId}, forcing update`
|
|
180274
180512
|
);
|
|
180275
180513
|
}
|
|
180276
|
-
|
|
180514
|
+
logger202.debug(
|
|
180277
180515
|
`State update received for ${this.entityId}: state=${state.state}`
|
|
180278
180516
|
);
|
|
180279
180517
|
this.lastState = state;
|
|
@@ -180687,10 +180925,10 @@ var BridgeEnvironmentFactory = class extends BridgeFactory {
|
|
|
180687
180925
|
// src/core/ioc/app-environment.ts
|
|
180688
180926
|
var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
180689
180927
|
constructor(rootEnv, options) {
|
|
180690
|
-
const
|
|
180928
|
+
const logger204 = rootEnv.get(LoggerService);
|
|
180691
180929
|
super({
|
|
180692
180930
|
id: "App",
|
|
180693
|
-
log:
|
|
180931
|
+
log: logger204.get("AppContainer"),
|
|
180694
180932
|
parent: rootEnv
|
|
180695
180933
|
});
|
|
180696
180934
|
this.options = options;
|
|
@@ -180703,8 +180941,8 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
180703
180941
|
}
|
|
180704
180942
|
construction;
|
|
180705
180943
|
async init() {
|
|
180706
|
-
const
|
|
180707
|
-
this.set(LoggerService,
|
|
180944
|
+
const logger204 = this.get(LoggerService);
|
|
180945
|
+
this.set(LoggerService, logger204);
|
|
180708
180946
|
this.set(AppStorage, new AppStorage(await this.load(StorageService)));
|
|
180709
180947
|
this.set(BridgeStorage, new BridgeStorage(await this.load(AppStorage)));
|
|
180710
180948
|
this.set(
|
|
@@ -180721,7 +180959,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
180721
180959
|
);
|
|
180722
180960
|
this.set(
|
|
180723
180961
|
HomeAssistantClient,
|
|
180724
|
-
new HomeAssistantClient(
|
|
180962
|
+
new HomeAssistantClient(logger204, this.options.homeAssistant)
|
|
180725
180963
|
);
|
|
180726
180964
|
this.set(
|
|
180727
180965
|
HomeAssistantConfig,
|
|
@@ -180729,7 +180967,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
180729
180967
|
);
|
|
180730
180968
|
this.set(
|
|
180731
180969
|
HomeAssistantActions,
|
|
180732
|
-
new HomeAssistantActions(
|
|
180970
|
+
new HomeAssistantActions(logger204, await this.load(HomeAssistantClient))
|
|
180733
180971
|
);
|
|
180734
180972
|
this.set(
|
|
180735
180973
|
HomeAssistantRegistry,
|
|
@@ -180765,7 +181003,7 @@ var AppEnvironment = class _AppEnvironment extends EnvironmentBase {
|
|
|
180765
181003
|
this.set(
|
|
180766
181004
|
WebApi,
|
|
180767
181005
|
new WebApi(
|
|
180768
|
-
|
|
181006
|
+
logger204,
|
|
180769
181007
|
await this.load(BridgeService),
|
|
180770
181008
|
await this.load(HomeAssistantClient),
|
|
180771
181009
|
await this.load(HomeAssistantRegistry),
|
|
@@ -180791,7 +181029,7 @@ init_nodejs();
|
|
|
180791
181029
|
init_level_control();
|
|
180792
181030
|
|
|
180793
181031
|
// src/matter/patches/patch-level-control-tlv.ts
|
|
180794
|
-
var
|
|
181032
|
+
var logger203 = Logger.get("PatchLevelControlTlv");
|
|
180795
181033
|
function patchLevelControlTlv() {
|
|
180796
181034
|
let patched = 0;
|
|
180797
181035
|
const moveToLevelFields = LevelControl3.TlvMoveToLevelRequest.fieldDefinitions;
|
|
@@ -180805,11 +181043,11 @@ function patchLevelControlTlv() {
|
|
|
180805
181043
|
patched++;
|
|
180806
181044
|
}
|
|
180807
181045
|
if (patched > 0) {
|
|
180808
|
-
|
|
181046
|
+
logger203.info(
|
|
180809
181047
|
`Patched ${patched} LevelControl TLV schema(s): transitionTime is now optional (Google Home compatibility)`
|
|
180810
181048
|
);
|
|
180811
181049
|
} else {
|
|
180812
|
-
|
|
181050
|
+
logger203.warn(
|
|
180813
181051
|
"Failed to patch LevelControl TLV schemas \u2014 field definitions not found. Google Home brightness adjustment may not work."
|
|
180814
181052
|
);
|
|
180815
181053
|
}
|