@riddix/hamh 2.1.0-alpha.540 → 2.1.0-alpha.541

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.
@@ -171790,19 +171790,24 @@ var CoverWindowCoveringServer = WindowCoveringServer2(config5);
171790
171790
 
171791
171791
  // src/matter/endpoints/legacy/cover/index.ts
171792
171792
  var logger179 = Logger.get("CoverDevice");
171793
- var CoverDeviceType = (supportedFeatures, hasBattery, entityId) => {
171793
+ var DISCRETE_COVER_CLASSES = /* @__PURE__ */ new Set(["garage", "gate"]);
171794
+ var CoverDeviceType = (supportedFeatures, hasBattery, entityId, isDiscrete) => {
171794
171795
  const features2 = /* @__PURE__ */ new Set();
171795
171796
  if (testBit(supportedFeatures, CoverSupportedFeatures.support_open)) {
171796
171797
  features2.add("Lift");
171797
171798
  features2.add("PositionAwareLift");
171798
- features2.add("AbsolutePosition");
171799
+ if (!isDiscrete) {
171800
+ features2.add("AbsolutePosition");
171801
+ }
171799
171802
  } else {
171800
171803
  logger179.warn(
171801
171804
  `[${entityId}] Cover has no support_open feature (supported_features=${supportedFeatures}), adding Lift anyway`
171802
171805
  );
171803
171806
  features2.add("Lift");
171804
171807
  features2.add("PositionAwareLift");
171805
- features2.add("AbsolutePosition");
171808
+ if (!isDiscrete) {
171809
+ features2.add("AbsolutePosition");
171810
+ }
171806
171811
  }
171807
171812
  if (testBit(supportedFeatures, CoverSupportedFeatures.support_open_tilt)) {
171808
171813
  features2.add("Tilt");
@@ -171846,10 +171851,18 @@ function CoverDevice(homeAssistantEntity) {
171846
171851
  `[${entityId}] Creating cover without battery (batteryAttr=${hasBatteryAttr}, batteryEntity=${homeAssistantEntity.mapping?.batteryEntity ?? "none"})`
171847
171852
  );
171848
171853
  }
171854
+ const deviceClass = attributes7.device_class;
171855
+ const isDiscrete = typeof deviceClass === "string" && DISCRETE_COVER_CLASSES.has(deviceClass.toLowerCase());
171856
+ if (isDiscrete) {
171857
+ logger179.info(
171858
+ `[${entityId}] Garage/gate cover (device_class=${deviceClass}): using discrete Open/Close mode`
171859
+ );
171860
+ }
171849
171861
  return CoverDeviceType(
171850
171862
  attributes7.supported_features ?? 0,
171851
171863
  hasBattery,
171852
- entityId
171864
+ entityId,
171865
+ isDiscrete
171853
171866
  ).set({
171854
171867
  homeAssistantEntity
171855
171868
  });