@riddix/hamh 2.1.0-alpha.581 → 2.1.0-alpha.583

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.
@@ -152931,6 +152931,7 @@ var EntityMappingStorage = class extends Service {
152931
152931
  customName: request.customName?.trim() || void 0,
152932
152932
  customProductName: request.customProductName?.trim() || void 0,
152933
152933
  customVendorName: request.customVendorName?.trim() || void 0,
152934
+ customSerialNumber: request.customSerialNumber?.trim() || void 0,
152934
152935
  disabled: request.disabled,
152935
152936
  filterLifeEntity: request.filterLifeEntity?.trim() || void 0,
152936
152937
  cleaningModeEntity: request.cleaningModeEntity?.trim() || void 0,
@@ -152953,7 +152954,7 @@ var EntityMappingStorage = class extends Service {
152953
152954
  coverSwapOpenClose: request.coverSwapOpenClose || void 0,
152954
152955
  composedEntities: request.composedEntities?.filter((e) => e.entityId?.trim()) ?? void 0
152955
152956
  };
152956
- if (!config10.matterDeviceType && !config10.customName && !config10.customProductName && !config10.customVendorName && 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.currentRoomEntity && !config10.valetudoIdentifier && !config10.coverSwapOpenClose && (!config10.composedEntities || config10.composedEntities.length === 0)) {
152957
+ if (!config10.matterDeviceType && !config10.customName && !config10.customProductName && !config10.customVendorName && !config10.customSerialNumber && 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.currentRoomEntity && !config10.valetudoIdentifier && !config10.coverSwapOpenClose && (!config10.composedEntities || config10.composedEntities.length === 0)) {
152957
152958
  bridgeMap.delete(request.entityId);
152958
152959
  } else {
152959
152960
  bridgeMap.set(request.entityId, config10);
@@ -167911,10 +167912,7 @@ var BasicInformationServer2 = class extends BridgedDeviceBasicInformationServer
167911
167912
  softwareVersionString: ellipse(64, device?.sw_version),
167912
167913
  nodeLabel: ellipse(32, homeAssistant.state.customName) ?? ellipse(32, entity.state?.attributes?.friendly_name) ?? ellipse(32, entity.entity_id),
167913
167914
  reachable: entity.state?.state != null && entity.state.state !== "unavailable",
167914
- // The device serial number is available in `device?.serial_number`, but
167915
- // we're keeping it as the entity ID for now to avoid breaking existing
167916
- // deployments.
167917
- serialNumber: hash(32, entity.entity_id),
167915
+ serialNumber: ellipse(32, mapping?.customSerialNumber) ?? hash(32, entity.entity_id),
167918
167916
  // UniqueId helps controllers (especially Alexa) identify devices across
167919
167917
  // multiple fabric connections. Using MD5 hash of entity_id for stability.
167920
167918
  uniqueId: crypto6.createHash("md5").update(entity.entity_id).digest("hex").substring(0, 32)
@@ -172132,12 +172130,7 @@ var GenericSwitchServerBase = class extends FeaturedBase7 {
172132
172130
  await super.initialize();
172133
172131
  const homeAssistant = await this.agent.load(HomeAssistantEntityBehavior);
172134
172132
  const entityId = homeAssistant.entityId;
172135
- const attrs = homeAssistant.entity.state.attributes;
172136
- const maxPress = this.detectMultiPressMax(attrs.event_types ?? []);
172137
- this.state.multiPressMax = maxPress;
172138
- logger180.debug(
172139
- `[${entityId}] GenericSwitch initialized (multiPressMax: ${maxPress})`
172140
- );
172133
+ logger180.debug(`[${entityId}] GenericSwitch initialized`);
172141
172134
  this.reactTo(homeAssistant.onChange, this.handleEventChange);
172142
172135
  }
172143
172136
  handleEventChange() {
@@ -172205,14 +172198,6 @@ var GenericSwitchServerBase = class extends FeaturedBase7 {
172205
172198
  isLongRelease(lower) {
172206
172199
  return lower.includes("long") && lower.includes("release");
172207
172200
  }
172208
- detectMultiPressMax(eventTypes) {
172209
- let max = 1;
172210
- for (const et of eventTypes) {
172211
- const count = this.getPressCount(et.toLowerCase());
172212
- if (count > max) max = count;
172213
- }
172214
- return max;
172215
- }
172216
172201
  getPressCount(lower) {
172217
172202
  if (lower.includes("triple") || lower.includes("3_press") || lower.includes("three")) {
172218
172203
  return 3;