@riddix/hamh 2.1.0-alpha.820 → 2.1.0-alpha.821
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
|
@@ -132611,6 +132611,8 @@ WARNING: ${includeIdentity ? "This backup contains sensitive Matter identity dat
|
|
|
132611
132611
|
disableLockPin: config11.disableLockPin,
|
|
132612
132612
|
lockUsercodeService: config11.lockUsercodeService,
|
|
132613
132613
|
lockUsercodeSlot: config11.lockUsercodeSlot,
|
|
132614
|
+
lockPinMinLength: config11.lockPinMinLength,
|
|
132615
|
+
lockPinMaxLength: config11.lockPinMaxLength,
|
|
132614
132616
|
powerEntity: config11.powerEntity,
|
|
132615
132617
|
energyEntity: config11.energyEntity,
|
|
132616
132618
|
suctionLevelEntity: config11.suctionLevelEntity,
|
|
@@ -132764,6 +132766,8 @@ WARNING: ${includeIdentity ? "This backup contains sensitive Matter identity dat
|
|
|
132764
132766
|
disableLockPin: config11.disableLockPin,
|
|
132765
132767
|
lockUsercodeService: config11.lockUsercodeService,
|
|
132766
132768
|
lockUsercodeSlot: config11.lockUsercodeSlot,
|
|
132769
|
+
lockPinMinLength: config11.lockPinMinLength,
|
|
132770
|
+
lockPinMaxLength: config11.lockPinMaxLength,
|
|
132767
132771
|
powerEntity: config11.powerEntity,
|
|
132768
132772
|
energyEntity: config11.energyEntity,
|
|
132769
132773
|
suctionLevelEntity: config11.suctionLevelEntity,
|
|
@@ -133608,6 +133612,8 @@ function entityMappingApi(mappingStorage) {
|
|
|
133608
133612
|
disableLockPin: body.disableLockPin,
|
|
133609
133613
|
lockUsercodeService: body.lockUsercodeService,
|
|
133610
133614
|
lockUsercodeSlot: body.lockUsercodeSlot,
|
|
133615
|
+
lockPinMinLength: body.lockPinMinLength,
|
|
133616
|
+
lockPinMaxLength: body.lockPinMaxLength,
|
|
133611
133617
|
powerEntity: body.powerEntity,
|
|
133612
133618
|
energyEntity: body.energyEntity,
|
|
133613
133619
|
suctionLevelEntity: body.suctionLevelEntity,
|
|
@@ -134100,6 +134106,8 @@ function configToProfileEntry(config11) {
|
|
|
134100
134106
|
disableLockPin: config11.disableLockPin,
|
|
134101
134107
|
lockUsercodeService: config11.lockUsercodeService,
|
|
134102
134108
|
lockUsercodeSlot: config11.lockUsercodeSlot,
|
|
134109
|
+
lockPinMinLength: config11.lockPinMinLength,
|
|
134110
|
+
lockPinMaxLength: config11.lockPinMaxLength,
|
|
134103
134111
|
powerEntity: config11.powerEntity,
|
|
134104
134112
|
energyEntity: config11.energyEntity,
|
|
134105
134113
|
suctionLevelEntity: config11.suctionLevelEntity,
|
|
@@ -134231,6 +134239,8 @@ function mappingProfileApi(mappingStorage) {
|
|
|
134231
134239
|
disableLockPin: entry.disableLockPin,
|
|
134232
134240
|
lockUsercodeService: entry.lockUsercodeService,
|
|
134233
134241
|
lockUsercodeSlot: entry.lockUsercodeSlot,
|
|
134242
|
+
lockPinMinLength: entry.lockPinMinLength,
|
|
134243
|
+
lockPinMaxLength: entry.lockPinMaxLength,
|
|
134234
134244
|
powerEntity: entry.powerEntity,
|
|
134235
134245
|
energyEntity: entry.energyEntity,
|
|
134236
134246
|
suctionLevelEntity: entry.suctionLevelEntity,
|
|
@@ -138403,6 +138413,10 @@ var EntityMappingStorage = class extends Service {
|
|
|
138403
138413
|
this.mappings.set(request.bridgeId, bridgeMap);
|
|
138404
138414
|
}
|
|
138405
138415
|
const roomEntities = request.roomEntities?.filter((e) => e?.trim()) || [];
|
|
138416
|
+
const pinLengths = sanitizePinLengths(
|
|
138417
|
+
request.lockPinMinLength,
|
|
138418
|
+
request.lockPinMaxLength
|
|
138419
|
+
);
|
|
138406
138420
|
const config11 = {
|
|
138407
138421
|
entityId: request.entityId,
|
|
138408
138422
|
matterDeviceType: request.matterDeviceType,
|
|
@@ -138422,6 +138436,8 @@ var EntityMappingStorage = class extends Service {
|
|
|
138422
138436
|
disableLockPin: request.disableLockPin || void 0,
|
|
138423
138437
|
lockUsercodeService: request.lockUsercodeService?.trim() || void 0,
|
|
138424
138438
|
lockUsercodeSlot: sanitizeUsercodeSlot(request.lockUsercodeSlot),
|
|
138439
|
+
lockPinMinLength: pinLengths.min,
|
|
138440
|
+
lockPinMaxLength: pinLengths.max,
|
|
138425
138441
|
powerEntity: request.powerEntity?.trim() || void 0,
|
|
138426
138442
|
energyEntity: request.energyEntity?.trim() || void 0,
|
|
138427
138443
|
pressureEntity: request.pressureEntity?.trim() || void 0,
|
|
@@ -138451,7 +138467,7 @@ var EntityMappingStorage = class extends Service {
|
|
|
138451
138467
|
climateAutoMode: request.climateAutoMode || void 0,
|
|
138452
138468
|
composedEntities: request.composedEntities?.filter((e) => e.entityId?.trim()) ?? void 0
|
|
138453
138469
|
};
|
|
138454
|
-
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.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)) {
|
|
138470
|
+
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)) {
|
|
138455
138471
|
bridgeMap.delete(request.entityId);
|
|
138456
138472
|
} else {
|
|
138457
138473
|
bridgeMap.set(request.entityId, config11);
|
|
@@ -138491,6 +138507,24 @@ function sanitizeUsercodeSlot(value) {
|
|
|
138491
138507
|
}
|
|
138492
138508
|
return n;
|
|
138493
138509
|
}
|
|
138510
|
+
function sanitizePinLength(value) {
|
|
138511
|
+
if (value === void 0 || value === null || value === "") {
|
|
138512
|
+
return void 0;
|
|
138513
|
+
}
|
|
138514
|
+
const n = typeof value === "string" ? Number(value) : value;
|
|
138515
|
+
if (typeof n !== "number" || !Number.isInteger(n) || n < 1 || n > 20) {
|
|
138516
|
+
return void 0;
|
|
138517
|
+
}
|
|
138518
|
+
return n;
|
|
138519
|
+
}
|
|
138520
|
+
function sanitizePinLengths(min, max) {
|
|
138521
|
+
const lo = sanitizePinLength(min);
|
|
138522
|
+
const hi = sanitizePinLength(max);
|
|
138523
|
+
if ((lo ?? 4) > (hi ?? 8)) {
|
|
138524
|
+
return { min: void 0, max: void 0 };
|
|
138525
|
+
}
|
|
138526
|
+
return { min: lo, max: hi };
|
|
138527
|
+
}
|
|
138494
138528
|
function sanitizeDebounceMs(value) {
|
|
138495
138529
|
if (value === void 0 || value === null || value === "") {
|
|
138496
138530
|
return void 0;
|
|
@@ -164405,6 +164439,24 @@ function usercodePassthroughFrom(homeAssistant) {
|
|
|
164405
164439
|
callAction: (action) => homeAssistant.callAction(action)
|
|
164406
164440
|
};
|
|
164407
164441
|
}
|
|
164442
|
+
var DEFAULT_MIN_PIN_LENGTH = 4;
|
|
164443
|
+
var DEFAULT_MAX_PIN_LENGTH = 8;
|
|
164444
|
+
var PIN_LENGTH_SPEC_MIN = 1;
|
|
164445
|
+
var PIN_LENGTH_SPEC_MAX = 20;
|
|
164446
|
+
function clampPinLength(value) {
|
|
164447
|
+
if (value === void 0 || !Number.isInteger(value) || value < PIN_LENGTH_SPEC_MIN || value > PIN_LENGTH_SPEC_MAX) {
|
|
164448
|
+
return void 0;
|
|
164449
|
+
}
|
|
164450
|
+
return value;
|
|
164451
|
+
}
|
|
164452
|
+
function effectivePinCodeLengths(homeAssistant) {
|
|
164453
|
+
const min = clampPinLength(homeAssistant.state.mapping?.lockPinMinLength) ?? DEFAULT_MIN_PIN_LENGTH;
|
|
164454
|
+
const max = clampPinLength(homeAssistant.state.mapping?.lockPinMaxLength) ?? DEFAULT_MAX_PIN_LENGTH;
|
|
164455
|
+
if (min > max) {
|
|
164456
|
+
return { min: DEFAULT_MIN_PIN_LENGTH, max: DEFAULT_MAX_PIN_LENGTH };
|
|
164457
|
+
}
|
|
164458
|
+
return { min, max };
|
|
164459
|
+
}
|
|
164408
164460
|
function asFabricIndex(value) {
|
|
164409
164461
|
return value === void 0 || value === 0 ? null : FabricIndex3(value);
|
|
164410
164462
|
}
|
|
@@ -164663,6 +164715,7 @@ var LockServerWithPinBase = class extends PinCredentialBase {
|
|
|
164663
164715
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
164664
164716
|
const isPinDisabledByMapping = homeAssistant.state.mapping?.disableLockPin === true;
|
|
164665
164717
|
const hasPinConfigured = !isPinDisabledByMapping && hasStoredCredentialHelper(this.env, homeAssistant.entityId);
|
|
164718
|
+
const pinLengths = effectivePinCodeLengths(homeAssistant);
|
|
164666
164719
|
applyPatchState(this.state, {
|
|
164667
164720
|
lockState: this.state.config.getLockState(entity.state, this.agent),
|
|
164668
164721
|
lockType: DoorLock3.LockType.DeadBolt,
|
|
@@ -164682,8 +164735,8 @@ var LockServerWithPinBase = class extends PinCredentialBase {
|
|
|
164682
164735
|
numberOfPinUsersSupported: 1,
|
|
164683
164736
|
numberOfTotalUsersSupported: 1,
|
|
164684
164737
|
numberOfCredentialsSupportedPerUser: 1,
|
|
164685
|
-
maxPinCodeLength:
|
|
164686
|
-
minPinCodeLength:
|
|
164738
|
+
maxPinCodeLength: pinLengths.max,
|
|
164739
|
+
minPinCodeLength: pinLengths.min,
|
|
164687
164740
|
requirePinForRemoteOperation: hasPinConfigured
|
|
164688
164741
|
});
|
|
164689
164742
|
}
|
|
@@ -164836,6 +164889,7 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
164836
164889
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
164837
164890
|
const isPinDisabledByMapping = homeAssistant.state.mapping?.disableLockPin === true;
|
|
164838
164891
|
const hasPinConfigured = !isPinDisabledByMapping && hasStoredCredentialHelper(this.env, homeAssistant.entityId);
|
|
164892
|
+
const pinLengths = effectivePinCodeLengths(homeAssistant);
|
|
164839
164893
|
applyPatchState(this.state, {
|
|
164840
164894
|
lockState: this.state.config.getLockState(entity.state, this.agent),
|
|
164841
164895
|
lockType: DoorLock3.LockType.DeadBolt,
|
|
@@ -164855,8 +164909,8 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
164855
164909
|
numberOfPinUsersSupported: 1,
|
|
164856
164910
|
numberOfTotalUsersSupported: 1,
|
|
164857
164911
|
numberOfCredentialsSupportedPerUser: 1,
|
|
164858
|
-
maxPinCodeLength:
|
|
164859
|
-
minPinCodeLength:
|
|
164912
|
+
maxPinCodeLength: pinLengths.max,
|
|
164913
|
+
minPinCodeLength: pinLengths.min,
|
|
164860
164914
|
requirePinForRemoteOperation: hasPinConfigured
|
|
164861
164915
|
});
|
|
164862
164916
|
}
|