@riddix/hamh 2.1.0-alpha.826 → 2.1.0-alpha.827
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
|
@@ -132607,6 +132607,7 @@ WARNING: ${includeIdentity ? "This backup contains sensitive Matter identity dat
|
|
|
132607
132607
|
humidityEntity: config11.humidityEntity,
|
|
132608
132608
|
pressureEntity: config11.pressureEntity,
|
|
132609
132609
|
batteryEntity: config11.batteryEntity,
|
|
132610
|
+
disableBatteryMapping: config11.disableBatteryMapping,
|
|
132610
132611
|
roomEntities: config11.roomEntities,
|
|
132611
132612
|
disableLockPin: config11.disableLockPin,
|
|
132612
132613
|
lockUsercodeService: config11.lockUsercodeService,
|
|
@@ -132762,6 +132763,7 @@ WARNING: ${includeIdentity ? "This backup contains sensitive Matter identity dat
|
|
|
132762
132763
|
humidityEntity: config11.humidityEntity,
|
|
132763
132764
|
pressureEntity: config11.pressureEntity,
|
|
132764
132765
|
batteryEntity: config11.batteryEntity,
|
|
132766
|
+
disableBatteryMapping: config11.disableBatteryMapping,
|
|
132765
132767
|
roomEntities: config11.roomEntities,
|
|
132766
132768
|
disableLockPin: config11.disableLockPin,
|
|
132767
132769
|
lockUsercodeService: config11.lockUsercodeService,
|
|
@@ -133607,6 +133609,7 @@ function entityMappingApi(mappingStorage) {
|
|
|
133607
133609
|
humidityEntity: body.humidityEntity,
|
|
133608
133610
|
pressureEntity: body.pressureEntity,
|
|
133609
133611
|
batteryEntity: body.batteryEntity,
|
|
133612
|
+
disableBatteryMapping: body.disableBatteryMapping,
|
|
133610
133613
|
chargingStateEntity: body.chargingStateEntity,
|
|
133611
133614
|
roomEntities: body.roomEntities,
|
|
133612
133615
|
disableLockPin: body.disableLockPin,
|
|
@@ -134102,6 +134105,7 @@ function configToProfileEntry(config11) {
|
|
|
134102
134105
|
humidityEntity: config11.humidityEntity,
|
|
134103
134106
|
pressureEntity: config11.pressureEntity,
|
|
134104
134107
|
batteryEntity: config11.batteryEntity,
|
|
134108
|
+
disableBatteryMapping: config11.disableBatteryMapping,
|
|
134105
134109
|
roomEntities: config11.roomEntities,
|
|
134106
134110
|
disableLockPin: config11.disableLockPin,
|
|
134107
134111
|
lockUsercodeService: config11.lockUsercodeService,
|
|
@@ -134235,6 +134239,7 @@ function mappingProfileApi(mappingStorage) {
|
|
|
134235
134239
|
humidityEntity: entry.humidityEntity,
|
|
134236
134240
|
pressureEntity: entry.pressureEntity,
|
|
134237
134241
|
batteryEntity: entry.batteryEntity,
|
|
134242
|
+
disableBatteryMapping: entry.disableBatteryMapping,
|
|
134238
134243
|
roomEntities: entry.roomEntities,
|
|
134239
134244
|
disableLockPin: entry.disableLockPin,
|
|
134240
134245
|
lockUsercodeService: entry.lockUsercodeService,
|
|
@@ -138435,6 +138440,7 @@ var EntityMappingStorage = class extends Service {
|
|
|
138435
138440
|
temperatureEntity: request.temperatureEntity?.trim() || void 0,
|
|
138436
138441
|
humidityEntity: request.humidityEntity?.trim() || void 0,
|
|
138437
138442
|
batteryEntity: request.batteryEntity?.trim() || void 0,
|
|
138443
|
+
disableBatteryMapping: request.disableBatteryMapping || void 0,
|
|
138438
138444
|
chargingStateEntity: request.chargingStateEntity?.trim() || void 0,
|
|
138439
138445
|
roomEntities: roomEntities.length > 0 ? roomEntities : void 0,
|
|
138440
138446
|
disableLockPin: request.disableLockPin || void 0,
|
|
@@ -138471,7 +138477,7 @@ var EntityMappingStorage = class extends Service {
|
|
|
138471
138477
|
climateAutoMode: request.climateAutoMode || void 0,
|
|
138472
138478
|
composedEntities: request.composedEntities?.filter((e) => e.entityId?.trim()) ?? void 0
|
|
138473
138479
|
};
|
|
138474
|
-
if (!config11.matterDeviceType && !config11.customName && !config11.customProductName && !config11.customVendorName && !config11.customSerialNumber && config11.customVendorId === void 0 && config11.disabled !== true && !config11.filterLifeEntity && !config11.cleaningModeEntity && !config11.temperatureEntity && !config11.humidityEntity && !config11.batteryEntity && !config11.chargingStateEntity && !config11.roomEntities && !config11.disableLockPin && !config11.lockUsercodeService && config11.lockUsercodeSlot === void 0 && config11.lockPinMinLength === void 0 && config11.lockPinMaxLength === void 0 && !config11.powerEntity && !config11.energyEntity && !config11.pressureEntity && !config11.suctionLevelEntity && !config11.mopIntensityEntity && (!config11.customServiceAreas || config11.customServiceAreas.length === 0) && (!config11.customFanSpeedTags || Object.keys(config11.customFanSpeedTags).length === 0) && (!config11.fanWindPresets || (config11.fanWindPresets.natural?.length ?? 0) === 0 && (config11.fanWindPresets.sleep?.length ?? 0) === 0) && !config11.fanRestoreSpeedOnPowerOn && !config11.currentRoomEntity && !config11.cleanedAreaEntity && !config11.disableCustomAreaRoomModes && !config11.valetudoIdentifier && !config11.coverSwapOpenClose && !config11.coverExposeAsDimmableLight && !config11.selectExposeAsSwitch && !config11.selectSwitchOnOption && !config11.selectSwitchOffOption && !config11.coverSliderDebounceMs && !config11.updateThrottleMs && !config11.disableClimateOnOff && !config11.disableClimateFanControl && !config11.climateKeepModeOnIdle && !config11.climateExposeFan && !config11.climateAutoMode && (!config11.composedEntities || config11.composedEntities.length === 0)) {
|
|
138480
|
+
if (!config11.matterDeviceType && !config11.customName && !config11.customProductName && !config11.customVendorName && !config11.customSerialNumber && config11.customVendorId === void 0 && config11.disabled !== true && !config11.filterLifeEntity && !config11.cleaningModeEntity && !config11.temperatureEntity && !config11.humidityEntity && !config11.batteryEntity && !config11.disableBatteryMapping && !config11.chargingStateEntity && !config11.roomEntities && !config11.disableLockPin && !config11.lockUsercodeService && config11.lockUsercodeSlot === void 0 && config11.lockPinMinLength === void 0 && config11.lockPinMaxLength === void 0 && !config11.powerEntity && !config11.energyEntity && !config11.pressureEntity && !config11.suctionLevelEntity && !config11.mopIntensityEntity && (!config11.customServiceAreas || config11.customServiceAreas.length === 0) && (!config11.customFanSpeedTags || Object.keys(config11.customFanSpeedTags).length === 0) && (!config11.fanWindPresets || (config11.fanWindPresets.natural?.length ?? 0) === 0 && (config11.fanWindPresets.sleep?.length ?? 0) === 0) && !config11.fanRestoreSpeedOnPowerOn && !config11.currentRoomEntity && !config11.cleanedAreaEntity && !config11.disableCustomAreaRoomModes && !config11.valetudoIdentifier && !config11.coverSwapOpenClose && !config11.coverExposeAsDimmableLight && !config11.selectExposeAsSwitch && !config11.selectSwitchOnOption && !config11.selectSwitchOffOption && !config11.coverSliderDebounceMs && !config11.updateThrottleMs && !config11.disableClimateOnOff && !config11.disableClimateFanControl && !config11.climateKeepModeOnIdle && !config11.climateExposeFan && !config11.climateAutoMode && (!config11.composedEntities || config11.composedEntities.length === 0)) {
|
|
138475
138481
|
bridgeMap.delete(request.entityId);
|
|
138476
138482
|
} else {
|
|
138477
138483
|
bridgeMap.set(request.entityId, config11);
|
|
@@ -156992,7 +156998,9 @@ function createEndpointId(entityId, customName) {
|
|
|
156992
156998
|
function getMappedEntityIds(mapping) {
|
|
156993
156999
|
if (!mapping) return [];
|
|
156994
157000
|
const ids = [];
|
|
156995
|
-
if (mapping.batteryEntity
|
|
157001
|
+
if (mapping.batteryEntity && !mapping.disableBatteryMapping) {
|
|
157002
|
+
ids.push(mapping.batteryEntity);
|
|
157003
|
+
}
|
|
156996
157004
|
if (mapping.faultEntity) ids.push(mapping.faultEntity);
|
|
156997
157005
|
if (mapping.chargingStateEntity) ids.push(mapping.chargingStateEntity);
|
|
156998
157006
|
if (mapping.temperatureEntity) ids.push(mapping.temperatureEntity);
|
|
@@ -157683,6 +157691,9 @@ function PowerSourceServer2(config11) {
|
|
|
157683
157691
|
var defaultBatteryConfig = {
|
|
157684
157692
|
getBatteryPercent: (entity, agent) => {
|
|
157685
157693
|
const homeAssistant = agent.get(HomeAssistantEntityBehavior);
|
|
157694
|
+
if (homeAssistant.state.mapping?.disableBatteryMapping) {
|
|
157695
|
+
return null;
|
|
157696
|
+
}
|
|
157686
157697
|
const batteryEntity = homeAssistant.state.mapping?.batteryEntity;
|
|
157687
157698
|
if (batteryEntity) {
|
|
157688
157699
|
const stateProvider = agent.env.get(EntityStateProvider);
|
|
@@ -161532,6 +161543,9 @@ init_nodejs();
|
|
|
161532
161543
|
init_home_assistant_entity_behavior();
|
|
161533
161544
|
function getBatteryPercent(entity, agent) {
|
|
161534
161545
|
const homeAssistant = agent.get(HomeAssistantEntityBehavior);
|
|
161546
|
+
if (homeAssistant.state.mapping?.disableBatteryMapping) {
|
|
161547
|
+
return null;
|
|
161548
|
+
}
|
|
161535
161549
|
const batteryEntity = homeAssistant.state.mapping?.batteryEntity;
|
|
161536
161550
|
if (batteryEntity) {
|
|
161537
161551
|
const stateProvider = agent.env.get(EntityStateProvider);
|
|
@@ -168740,7 +168754,9 @@ init_dist();
|
|
|
168740
168754
|
// src/matter/endpoints/legacy/vacuum/behaviors/vacuum-battery.ts
|
|
168741
168755
|
init_home_assistant_entity_behavior();
|
|
168742
168756
|
function getVacuumBatteryPercent(entity, agent) {
|
|
168743
|
-
const
|
|
168757
|
+
const mapping = agent.get(HomeAssistantEntityBehavior).state.mapping;
|
|
168758
|
+
if (mapping?.disableBatteryMapping) return null;
|
|
168759
|
+
const mapped = mapping?.batteryEntity;
|
|
168744
168760
|
if (mapped) {
|
|
168745
168761
|
const battery = agent.env.get(EntityStateProvider).getBatteryPercent(mapped);
|
|
168746
168762
|
if (battery != null) return Math.max(0, Math.min(100, battery));
|
|
@@ -169931,6 +169947,16 @@ function WeatherDevice(homeAssistant) {
|
|
|
169931
169947
|
// src/matter/endpoints/legacy/create-legacy-endpoint-type.ts
|
|
169932
169948
|
var legacyLogger = Logger.get("LegacyEndpointType");
|
|
169933
169949
|
function createLegacyEndpointType(entity, mapping, areaName, options) {
|
|
169950
|
+
if (mapping?.disableBatteryMapping) {
|
|
169951
|
+
entity = {
|
|
169952
|
+
...entity,
|
|
169953
|
+
state: {
|
|
169954
|
+
...entity.state,
|
|
169955
|
+
attributes: stripBatteryAttributes(entity.state.attributes)
|
|
169956
|
+
}
|
|
169957
|
+
};
|
|
169958
|
+
mapping = { ...mapping, batteryEntity: void 0 };
|
|
169959
|
+
}
|
|
169934
169960
|
const domain = entity.entity_id.split(".")[0];
|
|
169935
169961
|
const customName = mapping?.customName;
|
|
169936
169962
|
let type;
|
|
@@ -169994,6 +170020,12 @@ function addFixedLabel(type, areaName) {
|
|
|
169994
170020
|
function hasPowerSource(type) {
|
|
169995
170021
|
return "powerSource" in type.behaviors;
|
|
169996
170022
|
}
|
|
170023
|
+
function stripBatteryAttributes(attributes9) {
|
|
170024
|
+
const stripped = { ...attributes9 };
|
|
170025
|
+
delete stripped.battery;
|
|
170026
|
+
delete stripped.battery_level;
|
|
170027
|
+
return stripped;
|
|
170028
|
+
}
|
|
169997
170029
|
function addPowerSource(type) {
|
|
169998
170030
|
const mutable = type;
|
|
169999
170031
|
if (typeof mutable.with === "function") {
|
|
@@ -170136,14 +170168,15 @@ var UserComposedEndpoint = class _UserComposedEndpoint extends Endpoint {
|
|
|
170136
170168
|
})
|
|
170137
170169
|
);
|
|
170138
170170
|
}
|
|
170139
|
-
|
|
170171
|
+
const hasParentBattery = !!config11.mapping?.batteryEntity && !config11.mapping?.disableBatteryMapping;
|
|
170172
|
+
if (hasParentBattery) {
|
|
170140
170173
|
parentType = parentType.with(DefaultPowerSourceServer);
|
|
170141
170174
|
}
|
|
170142
170175
|
const endpointId = createEndpointId5(primaryEntityId, config11.customName);
|
|
170143
170176
|
const parts = [];
|
|
170144
170177
|
const subEndpointMap = /* @__PURE__ */ new Map();
|
|
170145
170178
|
const mappedIds = [];
|
|
170146
|
-
if (config11.mapping?.batteryEntity) {
|
|
170179
|
+
if (hasParentBattery && config11.mapping?.batteryEntity) {
|
|
170147
170180
|
mappedIds.push(config11.mapping.batteryEntity);
|
|
170148
170181
|
}
|
|
170149
170182
|
let primaryMapping = config11.mapping;
|
|
@@ -170411,7 +170444,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
170411
170444
|
}
|
|
170412
170445
|
}
|
|
170413
170446
|
const isVacuum = entityId.startsWith("vacuum.");
|
|
170414
|
-
if ((registry2.isAutoBatteryMappingEnabled() || isVacuum) && !mapping?.batteryEntity) {
|
|
170447
|
+
if ((registry2.isAutoBatteryMappingEnabled() || isVacuum) && !mapping?.batteryEntity && !mapping?.disableBatteryMapping) {
|
|
170415
170448
|
const batteryEntityId = registry2.findBatteryEntityForDevice(
|
|
170416
170449
|
entity.device_id
|
|
170417
170450
|
);
|
|
@@ -170610,7 +170643,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
170610
170643
|
primaryEntityId: entityId,
|
|
170611
170644
|
humidityEntityId: effectiveMapping?.humidityEntity,
|
|
170612
170645
|
pressureEntityId: effectiveMapping?.pressureEntity,
|
|
170613
|
-
batteryEntityId: effectiveMapping?.batteryEntity,
|
|
170646
|
+
batteryEntityId: effectiveMapping?.disableBatteryMapping ? void 0 : effectiveMapping?.batteryEntity,
|
|
170614
170647
|
powerEntityId: effectiveMapping?.powerEntity,
|
|
170615
170648
|
energyEntityId: effectiveMapping?.energyEntity,
|
|
170616
170649
|
customName: effectiveMapping?.customName,
|
|
@@ -170629,7 +170662,7 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
|
|
|
170629
170662
|
primaryEntityId: entityId,
|
|
170630
170663
|
temperatureEntityId,
|
|
170631
170664
|
humidityEntityId,
|
|
170632
|
-
batteryEntityId: effectiveMapping?.batteryEntity,
|
|
170665
|
+
batteryEntityId: effectiveMapping?.disableBatteryMapping ? void 0 : effectiveMapping?.batteryEntity,
|
|
170633
170666
|
powerEntityId: effectiveMapping?.powerEntity,
|
|
170634
170667
|
energyEntityId: effectiveMapping?.energyEntity,
|
|
170635
170668
|
mapping: effectiveMapping,
|
|
@@ -173866,11 +173899,14 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
|
|
|
173866
173899
|
return void 0;
|
|
173867
173900
|
}
|
|
173868
173901
|
let effectiveMapping = mapping;
|
|
173902
|
+
if (mapping?.disableBatteryMapping && mapping.batteryEntity) {
|
|
173903
|
+
effectiveMapping = { ...mapping, batteryEntity: void 0 };
|
|
173904
|
+
}
|
|
173869
173905
|
logger243.info(
|
|
173870
173906
|
`${entityId}: device_id=${entity.device_id}, manualBattery=${mapping?.batteryEntity ?? "none"}`
|
|
173871
173907
|
);
|
|
173872
173908
|
if (entity.device_id) {
|
|
173873
|
-
if (!mapping?.batteryEntity) {
|
|
173909
|
+
if (!mapping?.batteryEntity && !mapping?.disableBatteryMapping) {
|
|
173874
173910
|
const batteryEntityId = registry2.findBatteryEntityForDevice(
|
|
173875
173911
|
entity.device_id
|
|
173876
173912
|
);
|