@riddix/hamh 2.1.0-alpha.820 → 2.1.0-alpha.822
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;
|
|
@@ -161777,6 +161811,20 @@ function getCoverDebounce(endpoint) {
|
|
|
161777
161811
|
}
|
|
161778
161812
|
return st;
|
|
161779
161813
|
}
|
|
161814
|
+
function clearPendingLift(st) {
|
|
161815
|
+
if (st.liftTimer) {
|
|
161816
|
+
clearTimeout(st.liftTimer);
|
|
161817
|
+
st.liftTimer = null;
|
|
161818
|
+
}
|
|
161819
|
+
st.pendingLift = null;
|
|
161820
|
+
}
|
|
161821
|
+
function clearPendingTilt(st) {
|
|
161822
|
+
if (st.tiltTimer) {
|
|
161823
|
+
clearTimeout(st.tiltTimer);
|
|
161824
|
+
st.tiltTimer = null;
|
|
161825
|
+
}
|
|
161826
|
+
st.pendingTilt = null;
|
|
161827
|
+
}
|
|
161780
161828
|
var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedBase6 {
|
|
161781
161829
|
// Written and read within one synchronous command (upOrOpen fires lift then
|
|
161782
161830
|
// tilt on the same instance), so these stay as instance fields (#246).
|
|
@@ -161802,14 +161850,8 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
161802
161850
|
async [Symbol.asyncDispose]() {
|
|
161803
161851
|
const st = coverDebounce.get(this.endpoint);
|
|
161804
161852
|
if (st) {
|
|
161805
|
-
|
|
161806
|
-
|
|
161807
|
-
}
|
|
161808
|
-
if (st.tiltTimer) {
|
|
161809
|
-
clearTimeout(st.tiltTimer);
|
|
161810
|
-
}
|
|
161811
|
-
st.pendingLift = null;
|
|
161812
|
-
st.pendingTilt = null;
|
|
161853
|
+
clearPendingLift(st);
|
|
161854
|
+
clearPendingTilt(st);
|
|
161813
161855
|
coverDebounce.delete(this.endpoint);
|
|
161814
161856
|
}
|
|
161815
161857
|
await super[Symbol.asyncDispose]();
|
|
@@ -161974,16 +162016,21 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
161974
162016
|
}
|
|
161975
162017
|
}
|
|
161976
162018
|
handleStopMovement() {
|
|
162019
|
+
const st = getCoverDebounce(this.endpoint);
|
|
162020
|
+
clearPendingLift(st);
|
|
162021
|
+
clearPendingTilt(st);
|
|
161977
162022
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
161978
162023
|
homeAssistant.callAction(this.state.config.stopCover(void 0, this.agent));
|
|
161979
162024
|
}
|
|
161980
162025
|
handleLiftOpen() {
|
|
162026
|
+
clearPendingLift(getCoverDebounce(this.endpoint));
|
|
161981
162027
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
161982
162028
|
const action = this.state.config.openCoverLift(void 0, this.agent);
|
|
161983
162029
|
logger216.info(`handleLiftOpen: calling action=${action.action}`);
|
|
161984
162030
|
homeAssistant.callAction(action);
|
|
161985
162031
|
}
|
|
161986
162032
|
handleLiftClose() {
|
|
162033
|
+
clearPendingLift(getCoverDebounce(this.endpoint));
|
|
161987
162034
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
161988
162035
|
const action = this.state.config.closeCoverLift(void 0, this.agent);
|
|
161989
162036
|
logger216.info(`handleLiftClose: calling action=${action.action}`);
|
|
@@ -162029,12 +162076,18 @@ var WindowCoveringServerBase = class _WindowCoveringServerBase extends FeaturedB
|
|
|
162029
162076
|
}, debounceMs);
|
|
162030
162077
|
}
|
|
162031
162078
|
handleTiltOpen() {
|
|
162079
|
+
const st = getCoverDebounce(this.endpoint);
|
|
162080
|
+
clearPendingTilt(st);
|
|
162081
|
+
if (st.pendingLift?.action.action.includes("tilt")) clearPendingLift(st);
|
|
162032
162082
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
162033
162083
|
homeAssistant.callAction(
|
|
162034
162084
|
this.state.config.openCoverTilt(void 0, this.agent)
|
|
162035
162085
|
);
|
|
162036
162086
|
}
|
|
162037
162087
|
handleTiltClose() {
|
|
162088
|
+
const st = getCoverDebounce(this.endpoint);
|
|
162089
|
+
clearPendingTilt(st);
|
|
162090
|
+
if (st.pendingLift?.action.action.includes("tilt")) clearPendingLift(st);
|
|
162038
162091
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
162039
162092
|
homeAssistant.callAction(
|
|
162040
162093
|
this.state.config.closeCoverTilt(void 0, this.agent)
|
|
@@ -164405,6 +164458,24 @@ function usercodePassthroughFrom(homeAssistant) {
|
|
|
164405
164458
|
callAction: (action) => homeAssistant.callAction(action)
|
|
164406
164459
|
};
|
|
164407
164460
|
}
|
|
164461
|
+
var DEFAULT_MIN_PIN_LENGTH = 4;
|
|
164462
|
+
var DEFAULT_MAX_PIN_LENGTH = 8;
|
|
164463
|
+
var PIN_LENGTH_SPEC_MIN = 1;
|
|
164464
|
+
var PIN_LENGTH_SPEC_MAX = 20;
|
|
164465
|
+
function clampPinLength(value) {
|
|
164466
|
+
if (value === void 0 || !Number.isInteger(value) || value < PIN_LENGTH_SPEC_MIN || value > PIN_LENGTH_SPEC_MAX) {
|
|
164467
|
+
return void 0;
|
|
164468
|
+
}
|
|
164469
|
+
return value;
|
|
164470
|
+
}
|
|
164471
|
+
function effectivePinCodeLengths(homeAssistant) {
|
|
164472
|
+
const min = clampPinLength(homeAssistant.state.mapping?.lockPinMinLength) ?? DEFAULT_MIN_PIN_LENGTH;
|
|
164473
|
+
const max = clampPinLength(homeAssistant.state.mapping?.lockPinMaxLength) ?? DEFAULT_MAX_PIN_LENGTH;
|
|
164474
|
+
if (min > max) {
|
|
164475
|
+
return { min: DEFAULT_MIN_PIN_LENGTH, max: DEFAULT_MAX_PIN_LENGTH };
|
|
164476
|
+
}
|
|
164477
|
+
return { min, max };
|
|
164478
|
+
}
|
|
164408
164479
|
function asFabricIndex(value) {
|
|
164409
164480
|
return value === void 0 || value === 0 ? null : FabricIndex3(value);
|
|
164410
164481
|
}
|
|
@@ -164663,6 +164734,7 @@ var LockServerWithPinBase = class extends PinCredentialBase {
|
|
|
164663
164734
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
164664
164735
|
const isPinDisabledByMapping = homeAssistant.state.mapping?.disableLockPin === true;
|
|
164665
164736
|
const hasPinConfigured = !isPinDisabledByMapping && hasStoredCredentialHelper(this.env, homeAssistant.entityId);
|
|
164737
|
+
const pinLengths = effectivePinCodeLengths(homeAssistant);
|
|
164666
164738
|
applyPatchState(this.state, {
|
|
164667
164739
|
lockState: this.state.config.getLockState(entity.state, this.agent),
|
|
164668
164740
|
lockType: DoorLock3.LockType.DeadBolt,
|
|
@@ -164682,8 +164754,8 @@ var LockServerWithPinBase = class extends PinCredentialBase {
|
|
|
164682
164754
|
numberOfPinUsersSupported: 1,
|
|
164683
164755
|
numberOfTotalUsersSupported: 1,
|
|
164684
164756
|
numberOfCredentialsSupportedPerUser: 1,
|
|
164685
|
-
maxPinCodeLength:
|
|
164686
|
-
minPinCodeLength:
|
|
164757
|
+
maxPinCodeLength: pinLengths.max,
|
|
164758
|
+
minPinCodeLength: pinLengths.min,
|
|
164687
164759
|
requirePinForRemoteOperation: hasPinConfigured
|
|
164688
164760
|
});
|
|
164689
164761
|
}
|
|
@@ -164836,6 +164908,7 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
164836
164908
|
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
164837
164909
|
const isPinDisabledByMapping = homeAssistant.state.mapping?.disableLockPin === true;
|
|
164838
164910
|
const hasPinConfigured = !isPinDisabledByMapping && hasStoredCredentialHelper(this.env, homeAssistant.entityId);
|
|
164911
|
+
const pinLengths = effectivePinCodeLengths(homeAssistant);
|
|
164839
164912
|
applyPatchState(this.state, {
|
|
164840
164913
|
lockState: this.state.config.getLockState(entity.state, this.agent),
|
|
164841
164914
|
lockType: DoorLock3.LockType.DeadBolt,
|
|
@@ -164855,8 +164928,8 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
164855
164928
|
numberOfPinUsersSupported: 1,
|
|
164856
164929
|
numberOfTotalUsersSupported: 1,
|
|
164857
164930
|
numberOfCredentialsSupportedPerUser: 1,
|
|
164858
|
-
maxPinCodeLength:
|
|
164859
|
-
minPinCodeLength:
|
|
164931
|
+
maxPinCodeLength: pinLengths.max,
|
|
164932
|
+
minPinCodeLength: pinLengths.min,
|
|
164860
164933
|
requirePinForRemoteOperation: hasPinConfigured
|
|
164861
164934
|
});
|
|
164862
164935
|
}
|