@riddix/hamh 2.1.0-alpha.747 → 2.1.0-alpha.749

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.
@@ -1077,11 +1077,11 @@ var init_DerCodec = __esm({
1077
1077
  return this.#encodeAsn1(4, value);
1078
1078
  }
1079
1079
  static #encodeSequence(object) {
1080
- const attributes8 = new Array();
1080
+ const attributes9 = new Array();
1081
1081
  for (const key in object) {
1082
- attributes8.push(this.encode(object[key]));
1082
+ attributes9.push(this.encode(object[key]));
1083
1083
  }
1084
- return this.#encodeAsn1(DerTag.Sequence, Bytes.concat(...attributes8));
1084
+ return this.#encodeAsn1(DerTag.Sequence, Bytes.concat(...attributes9));
1085
1085
  }
1086
1086
  static #encodeString(value) {
1087
1087
  return this.#encodeAsn1(12, Bytes.fromString(value));
@@ -54243,7 +54243,7 @@ var init_ClusterType = __esm({
54243
54243
  name: "Unknown",
54244
54244
  schema: new ClusterModel({ name: "Unknown" })
54245
54245
  };
54246
- function attributes8(model) {
54246
+ function attributes9(model) {
54247
54247
  const result = {};
54248
54248
  for (const attribute of model.attributes) {
54249
54249
  if (GLOBAL_IDS2.has(attribute.id) || attribute.isDisallowed || attribute.effectiveMetatype === void 0) {
@@ -54258,7 +54258,7 @@ var init_ClusterType = __esm({
54258
54258
  }
54259
54259
  return result;
54260
54260
  }
54261
- ClusterType2.attributes = attributes8;
54261
+ ClusterType2.attributes = attributes9;
54262
54262
  function commands4(model) {
54263
54263
  const result = {};
54264
54264
  for (const command of model.commands) {
@@ -66642,15 +66642,15 @@ function Read(optionsOrSelector, ...selectors) {
66642
66642
  if (cluster2 !== void 0) {
66643
66643
  prototype2.clusterId = cluster2.id;
66644
66644
  }
66645
- let { attributes: attributes8 } = selector;
66646
- if (attributes8 === void 0) {
66645
+ let { attributes: attributes9 } = selector;
66646
+ if (attributes9 === void 0) {
66647
66647
  attributeRequests.push(prototype2);
66648
66648
  return;
66649
66649
  }
66650
- if (!Array.isArray(attributes8)) {
66651
- attributes8 = [attributes8];
66650
+ if (!Array.isArray(attributes9)) {
66651
+ attributes9 = [attributes9];
66652
66652
  }
66653
- for (const specifier of attributes8) {
66653
+ for (const specifier of attributes9) {
66654
66654
  attributeRequests.push({ ...prototype2, attributeId: Specifier.attributeFor(cluster2, specifier).id });
66655
66655
  }
66656
66656
  }
@@ -69626,9 +69626,9 @@ function Write(optionsOrData, ...data) {
69626
69626
  interactionModelRevision,
69627
69627
  [Diagnostic.value]: () => {
69628
69628
  const items = data.flatMap((entry) => {
69629
- const { version: version2, value, endpoint, cluster: cluster2, attributes: attributes8 } = entry;
69629
+ const { version: version2, value, endpoint, cluster: cluster2, attributes: attributes9 } = entry;
69630
69630
  const valueString = Diagnostic.json(value);
69631
- const list3 = Array.isArray(attributes8) ? attributes8 : [attributes8];
69631
+ const list3 = Array.isArray(attributes9) ? attributes9 : [attributes9];
69632
69632
  const versionString = version2 !== void 0 ? `(version=${version2})` : "";
69633
69633
  return list3.map(
69634
69634
  (attribute) => Diagnostic.squash(
@@ -69655,12 +69655,12 @@ function Write(optionsOrData, ...data) {
69655
69655
  if (cluster2 === void 0) {
69656
69656
  throw new MalformedRequestError(`Write action must specify a cluster`);
69657
69657
  }
69658
- let { attributes: attributes8 } = data2;
69659
- if (attributes8 === void 0) {
69658
+ let { attributes: attributes9 } = data2;
69659
+ if (attributes9 === void 0) {
69660
69660
  throw new MalformedRequestError(`Write action must specify an attribute`);
69661
69661
  }
69662
- if (!Array.isArray(attributes8)) {
69663
- attributes8 = [attributes8];
69662
+ if (!Array.isArray(attributes9)) {
69663
+ attributes9 = [attributes9];
69664
69664
  }
69665
69665
  const { endpoint, value, version: dataVersion } = data2;
69666
69666
  const prototype2 = {
@@ -69671,7 +69671,7 @@ function Write(optionsOrData, ...data) {
69671
69671
  },
69672
69672
  dataVersion
69673
69673
  };
69674
- for (const specifier of attributes8) {
69674
+ for (const specifier of attributes9) {
69675
69675
  const clusterId3 = cluster2.id;
69676
69676
  const attribute = Specifier.attributeFor(cluster2, specifier);
69677
69677
  const { id: attributeId } = attribute;
@@ -95124,7 +95124,7 @@ function clusterTypeProtocolOf(backing) {
95124
95124
  wildcardPathFlags |= WildcardPathFlags2.skipCustomElements;
95125
95125
  }
95126
95126
  const attrList = Array();
95127
- const attributes8 = {
95127
+ const attributes9 = {
95128
95128
  [Symbol.iterator]: attrList[Symbol.iterator].bind(attrList)
95129
95129
  };
95130
95130
  const eventList = Array();
@@ -95195,7 +95195,7 @@ function clusterTypeProtocolOf(backing) {
95195
95195
  attr.quieter = true;
95196
95196
  }
95197
95197
  attrList.push(attr);
95198
- attributes8[id] = attr;
95198
+ attributes9[id] = attr;
95199
95199
  if (!member.effectiveConformance.isMandatory) {
95200
95200
  nonMandatorySupportedAttributes.add(id);
95201
95201
  }
@@ -95246,7 +95246,7 @@ function clusterTypeProtocolOf(backing) {
95246
95246
  const descriptor = {
95247
95247
  id: schema6.id,
95248
95248
  name: schema6.name,
95249
- attributes: attributes8,
95249
+ attributes: attributes9,
95250
95250
  events,
95251
95251
  commands: commands4,
95252
95252
  wildcardPathFlags
@@ -97822,11 +97822,11 @@ var init_ServerSubscription = __esm({
97822
97822
  if (this.#sendUpdateErrorCounter <= 2) {
97823
97823
  if (attributeFilter !== void 0) {
97824
97824
  for (const [endpointId, clusters] of Object.entries(attributeFilter)) {
97825
- for (const [clusterId3, attributes8] of Object.entries(clusters)) {
97825
+ for (const [clusterId3, attributes9] of Object.entries(clusters)) {
97826
97826
  this.#addOutstandingAttributes(
97827
97827
  EndpointNumber(parseInt(endpointId)),
97828
97828
  ClusterId(parseInt(clusterId3)),
97829
- Array.from(attributes8)
97829
+ Array.from(attributes9)
97830
97830
  );
97831
97831
  }
97832
97832
  }
@@ -114577,11 +114577,11 @@ var init_ClientBehaviorBacking = __esm({
114577
114577
  }
114578
114578
  const { attributeList, acceptedCommandList } = this.endpoint.stateOf(this.type);
114579
114579
  const schema6 = this.type.schema;
114580
- const attributes8 = /* @__PURE__ */ new Set();
114580
+ const attributes9 = /* @__PURE__ */ new Set();
114581
114581
  const attributeIds = new Set(attributeList);
114582
114582
  for (const attr of schema6.attributes) {
114583
114583
  if (attributeIds.has(attr.id)) {
114584
- attributes8.add(attr.propertyName);
114584
+ attributes9.add(attr.propertyName);
114585
114585
  }
114586
114586
  }
114587
114587
  const commands4 = /* @__PURE__ */ new Set();
@@ -114593,7 +114593,7 @@ var init_ClientBehaviorBacking = __esm({
114593
114593
  }
114594
114594
  return this.#elements = {
114595
114595
  features: schema6.supportedFeatures,
114596
- attributes: attributes8,
114596
+ attributes: attributes9,
114597
114597
  commands: commands4,
114598
114598
  events: /* @__PURE__ */ new Set()
114599
114599
  // Not published
@@ -127008,7 +127008,9 @@ function entityMappingApi(mappingStorage) {
127008
127008
  disableCustomAreaRoomModes: body.disableCustomAreaRoomModes,
127009
127009
  valetudoIdentifier: body.valetudoIdentifier,
127010
127010
  coverSwapOpenClose: body.coverSwapOpenClose,
127011
+ coverExposeAsDimmableLight: body.coverExposeAsDimmableLight,
127011
127012
  coverSliderDebounceMs: body.coverSliderDebounceMs,
127013
+ updateThrottleMs: body.updateThrottleMs,
127012
127014
  disableClimateOnOff: body.disableClimateOnOff,
127013
127015
  disableClimateFanControl: body.disableClimateFanControl,
127014
127016
  climateKeepModeOnIdle: body.climateKeepModeOnIdle,
@@ -131640,7 +131642,9 @@ var EntityMappingStorage = class extends Service {
131640
131642
  disableCustomAreaRoomModes: request.disableCustomAreaRoomModes || void 0,
131641
131643
  valetudoIdentifier: request.valetudoIdentifier?.trim() || void 0,
131642
131644
  coverSwapOpenClose: request.coverSwapOpenClose || void 0,
131645
+ coverExposeAsDimmableLight: request.coverExposeAsDimmableLight || void 0,
131643
131646
  coverSliderDebounceMs: sanitizeDebounceMs(request.coverSliderDebounceMs),
131647
+ updateThrottleMs: sanitizeThrottleMs(request.updateThrottleMs),
131644
131648
  disableClimateOnOff: request.disableClimateOnOff || void 0,
131645
131649
  disableClimateFanControl: request.disableClimateFanControl || void 0,
131646
131650
  climateKeepModeOnIdle: request.climateKeepModeOnIdle || void 0,
@@ -131648,7 +131652,7 @@ var EntityMappingStorage = class extends Service {
131648
131652
  climateAutoMode: request.climateAutoMode || void 0,
131649
131653
  composedEntities: request.composedEntities?.filter((e) => e.entityId?.trim()) ?? void 0
131650
131654
  };
131651
- 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.roomEntities && !config11.disableLockPin && !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.currentRoomEntity && !config11.cleanedAreaEntity && !config11.disableCustomAreaRoomModes && !config11.valetudoIdentifier && !config11.coverSwapOpenClose && !config11.coverSliderDebounceMs && !config11.disableClimateOnOff && !config11.disableClimateFanControl && !config11.climateKeepModeOnIdle && !config11.climateExposeFan && !config11.climateAutoMode && (!config11.composedEntities || config11.composedEntities.length === 0)) {
131655
+ 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.roomEntities && !config11.disableLockPin && !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.currentRoomEntity && !config11.cleanedAreaEntity && !config11.disableCustomAreaRoomModes && !config11.valetudoIdentifier && !config11.coverSwapOpenClose && !config11.coverExposeAsDimmableLight && !config11.coverSliderDebounceMs && !config11.updateThrottleMs && !config11.disableClimateOnOff && !config11.disableClimateFanControl && !config11.climateKeepModeOnIdle && !config11.climateExposeFan && !config11.climateAutoMode && (!config11.composedEntities || config11.composedEntities.length === 0)) {
131652
131656
  bridgeMap.delete(request.entityId);
131653
131657
  } else {
131654
131658
  bridgeMap.set(request.entityId, config11);
@@ -131688,6 +131692,16 @@ function sanitizeDebounceMs(value) {
131688
131692
  }
131689
131693
  return Math.min(5e3, Math.round(n));
131690
131694
  }
131695
+ function sanitizeThrottleMs(value) {
131696
+ if (value === void 0 || value === null || value === "") {
131697
+ return void 0;
131698
+ }
131699
+ const n = typeof value === "string" ? Number(value) : value;
131700
+ if (typeof n !== "number" || !Number.isFinite(n) || n <= 0) {
131701
+ return void 0;
131702
+ }
131703
+ return Math.min(6e4, Math.round(n));
131704
+ }
131691
131705
 
131692
131706
  // src/services/storage/lock-credential-storage.ts
131693
131707
  init_service();
@@ -132546,9 +132560,9 @@ var ScenesManagementServer = class extends ScenesManagementBase {
132546
132560
  #collectSceneAttributeValues() {
132547
132561
  const sceneValues = {};
132548
132562
  this.endpoint.act((agent) => {
132549
- for (const { name: clusterName, attributes: attributes8 } of this.internal.endpointSceneableBehaviors) {
132563
+ for (const { name: clusterName, attributes: attributes9 } of this.internal.endpointSceneableBehaviors) {
132550
132564
  const clusterState = agent[clusterName].state;
132551
- for (const attribute of attributes8) {
132565
+ for (const attribute of attributes9) {
132552
132566
  const attributeName = attribute.name;
132553
132567
  const currentValue = clusterState[attributeName];
132554
132568
  if (currentValue !== void 0) {
@@ -143308,16 +143322,16 @@ var AtomicWriteHandler = class _AtomicWriteHandler {
143308
143322
  if (attributeRequests.length === 0) {
143309
143323
  throw new StatusResponse.InvalidCommandError("No attribute requests provided");
143310
143324
  }
143311
- const attributes8 = /* @__PURE__ */ new Map();
143325
+ const attributes9 = /* @__PURE__ */ new Map();
143312
143326
  for (const attr of attributeRequests) {
143313
143327
  const [attributeName, _] = Object.entries(cluster2.cluster.attributes ?? {}).find(([_2, { id }]) => id === attr) ?? [];
143314
143328
  if (attributeName === void 0 || endpoint.stateOf(cluster2.id)[attr] === void 0) {
143315
143329
  throw new StatusResponse.InvalidCommandError(`Attribute ${attr} not supported by cluster`);
143316
143330
  }
143317
- if (attributes8.has(attr)) {
143331
+ if (attributes9.has(attr)) {
143318
143332
  throw new StatusResponse.InvalidCommandError("Duplicate attribute in attribute requests");
143319
143333
  }
143320
- attributes8.set(attr, attributeName);
143334
+ attributes9.set(attr, attributeName);
143321
143335
  }
143322
143336
  const existingState = this.#pendingWrites.find(
143323
143337
  (s) => PeerAddress.is(s.peerAddress, peerAddress) && s.endpoint.number == endpoint.number && s.clusterId === cluster2.cluster.id
@@ -143341,7 +143355,7 @@ var AtomicWriteHandler = class _AtomicWriteHandler {
143341
143355
  cluster2.cluster.id,
143342
143356
  attributeRequests,
143343
143357
  timeout,
143344
- attributes8,
143358
+ attributes9,
143345
143359
  initialValues
143346
143360
  );
143347
143361
  this.#pendingWrites.add(state);
@@ -147836,7 +147850,7 @@ var PluginManager = class {
147836
147850
  await this.onDeviceUnregistered?.(plugin.name, deviceId);
147837
147851
  pluginLogger.debug(`Unregistered device: ${deviceId}`);
147838
147852
  },
147839
- updateDeviceState: (deviceId, clusterId3, attributes8) => {
147853
+ updateDeviceState: (deviceId, clusterId3, attributes9) => {
147840
147854
  if (!devices.has(deviceId)) {
147841
147855
  pluginLogger.warn(
147842
147856
  `Cannot update state: device "${deviceId}" not found`
@@ -147847,7 +147861,7 @@ var PluginManager = class {
147847
147861
  plugin.name,
147848
147862
  deviceId,
147849
147863
  clusterId3,
147850
- attributes8
147864
+ attributes9
147851
147865
  );
147852
147866
  },
147853
147867
  registerDomainMapping: (mapping) => {
@@ -149077,10 +149091,54 @@ var AggregatorEndpoint2 = class extends Endpoint {
149077
149091
  // src/matter/endpoints/legacy/legacy-endpoint.ts
149078
149092
  init_dist();
149079
149093
  init_esm();
149080
- init_home_assistant_entity_behavior();
149081
149094
  import debounce6 from "debounce";
149082
149095
  import { isEqual } from "lodash-es";
149083
149096
 
149097
+ // src/utils/throttle-latest.ts
149098
+ function throttleLatest(fn, intervalMs) {
149099
+ let lastRun = Number.NEGATIVE_INFINITY;
149100
+ let timer;
149101
+ let pending;
149102
+ const run = (args) => {
149103
+ lastRun = Date.now();
149104
+ fn(...args);
149105
+ };
149106
+ const throttled = ((...args) => {
149107
+ const elapsed = Date.now() - lastRun;
149108
+ if (elapsed >= intervalMs) {
149109
+ if (timer) {
149110
+ clearTimeout(timer);
149111
+ timer = void 0;
149112
+ }
149113
+ pending = void 0;
149114
+ run(args);
149115
+ return;
149116
+ }
149117
+ pending = args;
149118
+ if (!timer) {
149119
+ timer = setTimeout(() => {
149120
+ timer = void 0;
149121
+ if (pending) {
149122
+ const next = pending;
149123
+ pending = void 0;
149124
+ run(next);
149125
+ }
149126
+ }, intervalMs - elapsed);
149127
+ }
149128
+ });
149129
+ throttled.clear = () => {
149130
+ if (timer) {
149131
+ clearTimeout(timer);
149132
+ timer = void 0;
149133
+ }
149134
+ pending = void 0;
149135
+ };
149136
+ return throttled;
149137
+ }
149138
+
149139
+ // src/matter/endpoints/legacy/legacy-endpoint.ts
149140
+ init_home_assistant_entity_behavior();
149141
+
149084
149142
  // src/matter/endpoints/entity-endpoint.ts
149085
149143
  init_esm7();
149086
149144
  var EntityEndpoint = class extends Endpoint {
@@ -150757,12 +150815,12 @@ var temperatureConfig = {
150757
150815
  getValue(entity, agent) {
150758
150816
  const fallbackUnit = agent.env.get(HomeAssistantConfig).unitSystem.temperature;
150759
150817
  const state = entity.state;
150760
- const attributes8 = entity.attributes;
150818
+ const attributes9 = entity.attributes;
150761
150819
  const temperature3 = state == null || Number.isNaN(+state) ? null : +state;
150762
150820
  if (temperature3 == null) return void 0;
150763
150821
  return Temperature.withUnit(
150764
150822
  temperature3,
150765
- attributes8.unit_of_measurement ?? fallbackUnit
150823
+ attributes9.unit_of_measurement ?? fallbackUnit
150766
150824
  );
150767
150825
  }
150768
150826
  };
@@ -151229,8 +151287,8 @@ function ClimateFanControlServer(rockSupport) {
151229
151287
  // src/matter/endpoints/legacy/climate/behaviors/climate-humidity-measurement-server.ts
151230
151288
  var humidityConfig2 = {
151231
151289
  getValue(entity) {
151232
- const attributes8 = entity.attributes;
151233
- const humidity = attributes8.current_humidity;
151290
+ const attributes9 = entity.attributes;
151291
+ const humidity = attributes9.current_humidity;
151234
151292
  if (humidity == null || Number.isNaN(+humidity)) {
151235
151293
  return null;
151236
151294
  }
@@ -152209,26 +152267,26 @@ function toMatterTemp(value) {
152209
152267
  return Math.round(num * 100);
152210
152268
  }
152211
152269
  function ClimateDevice(homeAssistantEntity, includeBasicInformation = true) {
152212
- const attributes8 = homeAssistantEntity.entity.state.attributes;
152213
- const supportedFeatures = attributes8.supported_features ?? 0;
152214
- const hasBatteryAttr = attributes8.battery_level != null || attributes8.battery != null;
152270
+ const attributes9 = homeAssistantEntity.entity.state.attributes;
152271
+ const supportedFeatures = attributes9.supported_features ?? 0;
152272
+ const hasBatteryAttr = attributes9.battery_level != null || attributes9.battery != null;
152215
152273
  const hasBatteryEntity = !!homeAssistantEntity.mapping?.batteryEntity;
152216
152274
  const hasBattery = hasBatteryAttr || hasBatteryEntity;
152217
152275
  const supportsCooling = coolingModes.some(
152218
- (mode) => attributes8.hvac_modes.includes(mode)
152276
+ (mode) => attributes9.hvac_modes.includes(mode)
152219
152277
  );
152220
152278
  const hasExplicitHeating = heatingModes.some(
152221
- (mode) => attributes8.hvac_modes.includes(mode)
152279
+ (mode) => attributes9.hvac_modes.includes(mode)
152222
152280
  );
152223
- const isAutoOnly = !hasExplicitHeating && !supportsCooling && autoOnlyMode.some((mode) => attributes8.hvac_modes.includes(mode));
152224
- const isVentilationOnly = !hasExplicitHeating && !supportsCooling && !isAutoOnly && ventilationOnlyModes.some((mode) => attributes8.hvac_modes.includes(mode));
152281
+ const isAutoOnly = !hasExplicitHeating && !supportsCooling && autoOnlyMode.some((mode) => attributes9.hvac_modes.includes(mode));
152282
+ const isVentilationOnly = !hasExplicitHeating && !supportsCooling && !isAutoOnly && ventilationOnlyModes.some((mode) => attributes9.hvac_modes.includes(mode));
152225
152283
  const supportsHeating = hasExplicitHeating || isAutoOnly || isVentilationOnly;
152226
152284
  if (!supportsCooling && !supportsHeating) {
152227
152285
  throw new InvalidDeviceError(
152228
- `Climates have to support at least one of: heat, cool, heat_cool, auto, fan_only, or dry. Found: [${attributes8.hvac_modes.join(", ")}]`
152286
+ `Climates have to support at least one of: heat, cool, heat_cool, auto, fan_only, or dry. Found: [${attributes9.hvac_modes.join(", ")}]`
152229
152287
  );
152230
152288
  }
152231
- const supportsHumidity = attributes8.current_humidity != null || testBit(supportedFeatures, ClimateDeviceFeature.TARGET_HUMIDITY);
152289
+ const supportsHumidity = attributes9.current_humidity != null || testBit(supportedFeatures, ClimateDeviceFeature.TARGET_HUMIDITY);
152232
152290
  const supportsOnOff = testBit(supportedFeatures, ClimateDeviceFeature.TURN_ON) && testBit(supportedFeatures, ClimateDeviceFeature.TURN_OFF) && homeAssistantEntity.mapping?.disableClimateOnOff !== true;
152233
152291
  const supportsFanMode = testBit(supportedFeatures, ClimateDeviceFeature.FAN_MODE) && homeAssistantEntity.mapping?.disableClimateFanControl !== true;
152234
152292
  const supportsVerticalSwing = testBit(
@@ -152239,22 +152297,22 @@ function ClimateDevice(homeAssistantEntity, includeBasicInformation = true) {
152239
152297
  supportedFeatures,
152240
152298
  ClimateDeviceFeature.SWING_HORIZONTAL_MODE
152241
152299
  );
152242
- const swingModesRockSupport = swingModesToRockSupport(attributes8.swing_modes);
152300
+ const swingModesRockSupport = swingModesToRockSupport(attributes9.swing_modes);
152243
152301
  const rockSupport = supportsVerticalSwing || supportsHorizontalSwing || swingModesRockSupport.rockLeftRight || swingModesRockSupport.rockUpDown ? {
152244
152302
  rockLeftRight: swingModesRockSupport.rockLeftRight || supportsHorizontalSwing || void 0,
152245
152303
  rockUpDown: swingModesRockSupport.rockUpDown || supportsVerticalSwing || void 0
152246
152304
  } : void 0;
152247
- const rawMinLimit = toMatterTemp(attributes8.min_temp) ?? 0;
152248
- const rawMaxLimit = toMatterTemp(attributes8.max_temp) ?? 5e3;
152305
+ const rawMinLimit = toMatterTemp(attributes9.min_temp) ?? 0;
152306
+ const rawMaxLimit = toMatterTemp(attributes9.max_temp) ?? 5e3;
152249
152307
  const minLimit = Math.min(rawMinLimit, rawMaxLimit);
152250
152308
  const maxLimit = Math.max(rawMinLimit, rawMaxLimit);
152251
152309
  const initialState = {
152252
152310
  // Pass actual current_temperature for initial state.
152253
152311
  // If unavailable (null/undefined), update() will fall back to the
152254
152312
  // target setpoint so controllers don't display 0°C.
152255
- localTemperature: toMatterTemp(attributes8.current_temperature),
152256
- occupiedHeatingSetpoint: toMatterTemp(attributes8.target_temp_low) ?? toMatterTemp(attributes8.temperature) ?? 2e3,
152257
- occupiedCoolingSetpoint: toMatterTemp(attributes8.target_temp_high) ?? toMatterTemp(attributes8.temperature) ?? 2400,
152313
+ localTemperature: toMatterTemp(attributes9.current_temperature),
152314
+ occupiedHeatingSetpoint: toMatterTemp(attributes9.target_temp_low) ?? toMatterTemp(attributes9.temperature) ?? 2e3,
152315
+ occupiedCoolingSetpoint: toMatterTemp(attributes9.target_temp_high) ?? toMatterTemp(attributes9.temperature) ?? 2400,
152258
152316
  // Use HA's actual min/max limits, fall back to wide range (0-50°C) if not
152259
152317
  // provided. Ordered above so min <= max always holds.
152260
152318
  minHeatSetpointLimit: minLimit,
@@ -152262,7 +152320,7 @@ function ClimateDevice(homeAssistantEntity, includeBasicInformation = true) {
152262
152320
  minCoolSetpointLimit: minLimit,
152263
152321
  maxCoolSetpointLimit: maxLimit
152264
152322
  };
152265
- const autoMode = supportsHeating && supportsCooling && attributes8.hvac_modes.includes(ClimateHvacMode.heat_cool) && (attributes8.hvac_modes.includes(ClimateHvacMode.heat) || attributes8.hvac_modes.includes(ClimateHvacMode.cool));
152323
+ const autoMode = supportsHeating && supportsCooling && attributes9.hvac_modes.includes(ClimateHvacMode.heat_cool) && (attributes9.hvac_modes.includes(ClimateHvacMode.heat) || attributes9.hvac_modes.includes(ClimateHvacMode.cool));
152266
152324
  return ClimateDeviceType(
152267
152325
  supportsOnOff,
152268
152326
  supportsHumidity,
@@ -152528,12 +152586,12 @@ var temperatureConfig2 = {
152528
152586
  getValue(entity, agent) {
152529
152587
  const fallbackUnit = agent.env.get(HomeAssistantConfig).unitSystem.temperature;
152530
152588
  const state = entity.state;
152531
- const attributes8 = entity.attributes;
152589
+ const attributes9 = entity.attributes;
152532
152590
  const temperature3 = state == null || Number.isNaN(+state) ? null : +state;
152533
152591
  if (temperature3 == null) return void 0;
152534
152592
  return Temperature.withUnit(
152535
152593
  temperature3,
152536
- attributes8.unit_of_measurement ?? fallbackUnit
152594
+ attributes9.unit_of_measurement ?? fallbackUnit
152537
152595
  );
152538
152596
  }
152539
152597
  };
@@ -152546,10 +152604,10 @@ var humidityConfig3 = {
152546
152604
  var pressureConfig = {
152547
152605
  getValue(entity) {
152548
152606
  const state = entity.state;
152549
- const attributes8 = entity.attributes;
152607
+ const attributes9 = entity.attributes;
152550
152608
  const pressure = state == null || Number.isNaN(+state) ? null : +state;
152551
152609
  if (pressure == null) return void 0;
152552
- return convertPressureToHpa(pressure, attributes8.unit_of_measurement);
152610
+ return convertPressureToHpa(pressure, attributes9.unit_of_measurement);
152553
152611
  }
152554
152612
  };
152555
152613
  var batteryConfig2 = {
@@ -152780,8 +152838,8 @@ init_esm();
152780
152838
  // src/matter/endpoints/legacy/air-purifier/index.ts
152781
152839
  init_dist();
152782
152840
  init_home_assistant_entity_behavior();
152783
- function hasFilterLifeSupport(attributes8, mapping) {
152784
- if (attributes8.filter_life != null || attributes8.filter_life_remaining != null || attributes8.filter_life_level != null) {
152841
+ function hasFilterLifeSupport(attributes9, mapping) {
152842
+ if (attributes9.filter_life != null || attributes9.filter_life_remaining != null || attributes9.filter_life_level != null) {
152785
152843
  return true;
152786
152844
  }
152787
152845
  if (mapping?.filterLifeEntity) {
@@ -152790,8 +152848,8 @@ function hasFilterLifeSupport(attributes8, mapping) {
152790
152848
  return false;
152791
152849
  }
152792
152850
  function AirPurifierEndpoint(homeAssistantEntity) {
152793
- const attributes8 = homeAssistantEntity.entity.state.attributes;
152794
- const supportedFeatures = attributes8.supported_features ?? 0;
152851
+ const attributes9 = homeAssistantEntity.entity.state.attributes;
152852
+ const supportedFeatures = attributes9.supported_features ?? 0;
152795
152853
  const mapping = homeAssistantEntity.mapping;
152796
152854
  const features3 = /* @__PURE__ */ new Set();
152797
152855
  if (testBit(supportedFeatures, FanDeviceFeature.SET_SPEED)) {
@@ -152807,7 +152865,7 @@ function AirPurifierEndpoint(homeAssistantEntity) {
152807
152865
  if (testBit(supportedFeatures, FanDeviceFeature.OSCILLATE)) {
152808
152866
  features3.add("Rocking");
152809
152867
  }
152810
- const presetModes = attributes8.preset_modes ?? [];
152868
+ const presetModes = attributes9.preset_modes ?? [];
152811
152869
  const hasWindModes = presetModes.some(
152812
152870
  (m) => m.toLowerCase() === "natural" || m.toLowerCase() === "nature" || m.toLowerCase() === "sleep"
152813
152871
  );
@@ -152821,7 +152879,7 @@ function AirPurifierEndpoint(homeAssistantEntity) {
152821
152879
  FanOnOffServer,
152822
152880
  FanFanControlServer.with(...features3)
152823
152881
  );
152824
- if (hasFilterLifeSupport(attributes8, mapping)) {
152882
+ if (hasFilterLifeSupport(attributes9, mapping)) {
152825
152883
  const deviceWithFilter = baseDevice.with(
152826
152884
  AirPurifierHepaFilterMonitoringServer
152827
152885
  );
@@ -153424,9 +153482,9 @@ var batteryTypes = /* @__PURE__ */ new Map([
153424
153482
  function BinarySensorDevice(homeAssistantEntity) {
153425
153483
  const entityId = homeAssistantEntity.entity.entity_id;
153426
153484
  const defaultDeviceType = OnOffSensorType;
153427
- const attributes8 = homeAssistantEntity.entity.state.attributes;
153428
- const deviceClass = attributes8.device_class;
153429
- const hasBatteryAttr = attributes8.battery_level != null || attributes8.battery != null;
153485
+ const attributes9 = homeAssistantEntity.entity.state.attributes;
153486
+ const deviceClass = attributes9.device_class;
153487
+ const hasBatteryAttr = attributes9.battery_level != null || attributes9.battery != null;
153430
153488
  const hasBatteryEntity = !!homeAssistantEntity.mapping?.batteryEntity;
153431
153489
  const hasBattery = hasBatteryAttr || hasBatteryEntity;
153432
153490
  let type = deviceClass && deviceClasses[deviceClass] ? deviceClasses[deviceClass] : defaultDeviceType;
@@ -153508,6 +153566,57 @@ init_dist();
153508
153566
  init_esm();
153509
153567
  init_home_assistant_entity_behavior();
153510
153568
 
153569
+ // src/matter/endpoints/legacy/cover/behaviors/cover-as-light.ts
153570
+ init_dist();
153571
+ init_home_assistant_entity_behavior();
153572
+ var attributes6 = (entity) => entity.attributes;
153573
+ function coverOpenness(entity) {
153574
+ const position = attributes6(entity).current_position;
153575
+ if (position != null) {
153576
+ return Math.min(1, Math.max(0, position / 100));
153577
+ }
153578
+ if (entity.state === CoverDeviceState.open) return 1;
153579
+ if (entity.state === CoverDeviceState.closed) return 0;
153580
+ return null;
153581
+ }
153582
+ function coverLevelAction(percent3, supportsPosition) {
153583
+ const position = Math.round(Math.min(1, Math.max(0, percent3)) * 100);
153584
+ if (supportsPosition) {
153585
+ return { action: "cover.set_cover_position", data: { position } };
153586
+ }
153587
+ return { action: position >= 50 ? "cover.open_cover" : "cover.close_cover" };
153588
+ }
153589
+ var supportsPositionControl = (agent) => {
153590
+ const entity = agent.get(HomeAssistantEntityBehavior).entity.state;
153591
+ const supportedFeatures = attributes6(entity).supported_features ?? 0;
153592
+ return (supportedFeatures & CoverSupportedFeatures.support_set_position) !== 0;
153593
+ };
153594
+ var CoverAsLightOnOffServer = OnOffServer2({
153595
+ isOn: (entity) => entity.state !== CoverDeviceState.closed,
153596
+ turnOn: () => ({ action: "cover.open_cover" }),
153597
+ turnOff: () => ({ action: "cover.close_cover" })
153598
+ });
153599
+ var CoverAsLightLevelControlServer = LevelControlServer2({
153600
+ getValuePercent: (entity) => coverOpenness(entity),
153601
+ moveToLevelPercent: (percent3, agent) => coverLevelAction(percent3, supportsPositionControl(agent))
153602
+ });
153603
+ var baseBehaviors = [
153604
+ IdentifyServer2,
153605
+ BasicInformationServer2,
153606
+ HomeAssistantEntityBehavior,
153607
+ GroupsServer,
153608
+ ScenesManagementServer,
153609
+ CoverAsLightOnOffServer,
153610
+ CoverAsLightLevelControlServer
153611
+ ];
153612
+ var CoverAsDimmableLightType = DimmableLightDevice.with(
153613
+ ...baseBehaviors
153614
+ );
153615
+ var CoverAsDimmableLightWithBatteryType = DimmableLightDevice.with(
153616
+ ...baseBehaviors,
153617
+ DefaultPowerSourceServer
153618
+ );
153619
+
153511
153620
  // src/matter/endpoints/legacy/cover/behaviors/cover-window-covering-server.ts
153512
153621
  init_dist();
153513
153622
  init_esm();
@@ -153860,7 +153969,7 @@ function adjustPositionForWriting(position, flags2, matterSemantics) {
153860
153969
 
153861
153970
  // src/matter/endpoints/legacy/cover/behaviors/cover-window-covering-server.ts
153862
153971
  var logger206 = Logger.get("CoverWindowCoveringServer");
153863
- var attributes6 = (entity) => entity.attributes;
153972
+ var attributes7 = (entity) => entity.attributes;
153864
153973
  var DEVICE_CLASS_TO_MATTER_TYPE = {
153865
153974
  curtain: {
153866
153975
  type: WindowCovering3.WindowCoveringType.Drapery,
@@ -153896,7 +154005,7 @@ var deviceClassMapping = (entity) => {
153896
154005
  if (typeof raw !== "string") return void 0;
153897
154006
  const mapping = DEVICE_CLASS_TO_MATTER_TYPE[raw.toLowerCase()];
153898
154007
  if (!mapping) return void 0;
153899
- const supportedFeatures = attributes6(entity).supported_features ?? 0;
154008
+ const supportedFeatures = attributes7(entity).supported_features ?? 0;
153900
154009
  const hasLift = (supportedFeatures & CoverSupportedFeatures.support_open) !== 0;
153901
154010
  const hasTilt = (supportedFeatures & CoverSupportedFeatures.support_open_tilt) !== 0;
153902
154011
  if (mapping.type === WindowCovering3.WindowCoveringType.TiltBlindTiltOnly) {
@@ -153946,20 +154055,20 @@ var shouldSwapOpenClose = (agent) => {
153946
154055
  const { featureFlags } = agent.env.get(BridgeDataProvider);
153947
154056
  return featureFlags?.coverSwapOpenClose === true;
153948
154057
  };
153949
- var supportsPositionControl = (agent) => {
154058
+ var supportsPositionControl2 = (agent) => {
153950
154059
  const homeAssistant = agent.get(HomeAssistantEntityBehavior);
153951
- const supportedFeatures = attributes6(homeAssistant.entity.state).supported_features ?? 0;
154060
+ const supportedFeatures = attributes7(homeAssistant.entity.state).supported_features ?? 0;
153952
154061
  return (supportedFeatures & CoverSupportedFeatures.support_set_position) !== 0;
153953
154062
  };
153954
154063
  var supportsTiltPositionControl = (agent) => {
153955
154064
  const homeAssistant = agent.get(HomeAssistantEntityBehavior);
153956
- const supportedFeatures = attributes6(homeAssistant.entity.state).supported_features ?? 0;
154065
+ const supportedFeatures = attributes7(homeAssistant.entity.state).supported_features ?? 0;
153957
154066
  return (supportedFeatures & CoverSupportedFeatures.support_set_tilt_position) !== 0;
153958
154067
  };
153959
154068
  var liftShouldUseTilt = (supportedFeatures) => (supportedFeatures & CoverSupportedFeatures.support_open) === 0 && (supportedFeatures & CoverSupportedFeatures.support_open_tilt) !== 0;
153960
154069
  var liftFallsBackToTilt = (agent) => {
153961
154070
  const homeAssistant = agent.get(HomeAssistantEntityBehavior);
153962
- const supportedFeatures = attributes6(homeAssistant.entity.state).supported_features ?? 0;
154071
+ const supportedFeatures = attributes7(homeAssistant.entity.state).supported_features ?? 0;
153963
154072
  return liftShouldUseTilt(supportedFeatures);
153964
154073
  };
153965
154074
  var openLiftAction = (agent) => ({
@@ -153995,7 +154104,7 @@ var setTiltPositionAction = (position, agent) => {
153995
154104
  };
153996
154105
  var config6 = {
153997
154106
  getCurrentLiftPosition: (entity, agent) => {
153998
- let position = attributes6(entity).current_position;
154107
+ let position = attributes7(entity).current_position;
153999
154108
  if (position == null) {
154000
154109
  const coverState = entity.state;
154001
154110
  position = coverState === CoverDeviceState.closed ? 0 : coverState === CoverDeviceState.open ? 100 : void 0;
@@ -154003,7 +154112,7 @@ var config6 = {
154003
154112
  return position == null ? null : adjustPositionForReading2(position, agent);
154004
154113
  },
154005
154114
  getCurrentTiltPosition: (entity, agent) => {
154006
- let position = attributes6(entity).current_tilt_position;
154115
+ let position = attributes7(entity).current_tilt_position;
154007
154116
  if (position == null) {
154008
154117
  const coverState = entity.state;
154009
154118
  position = coverState === CoverDeviceState.closed ? 0 : coverState === CoverDeviceState.open ? 100 : void 0;
@@ -154033,7 +154142,7 @@ var config6 = {
154033
154142
  if (liftFallsBackToTilt(agent)) {
154034
154143
  return setTiltPositionAction(position, agent);
154035
154144
  }
154036
- if (!supportsPositionControl(agent)) {
154145
+ if (!supportsPositionControl2(agent)) {
154037
154146
  const adjustedPosition = adjustPositionForWriting2(position, agent);
154038
154147
  const shouldOpen = adjustedPosition != null && adjustedPosition >= 50;
154039
154148
  const swapped = shouldSwapOpenClose(agent);
@@ -154080,7 +154189,7 @@ var CoverDeviceType = (supportedFeatures, hasBattery, entityId) => {
154080
154189
  logger207.info(
154081
154190
  `[${entityId}] Creating WindowCovering with features: [${[...features3].join(", ")}], supported_features=${supportedFeatures}`
154082
154191
  );
154083
- const baseBehaviors = [
154192
+ const baseBehaviors2 = [
154084
154193
  BasicInformationServer2,
154085
154194
  IdentifyServer2,
154086
154195
  HomeAssistantEntityBehavior,
@@ -154088,16 +154197,16 @@ var CoverDeviceType = (supportedFeatures, hasBattery, entityId) => {
154088
154197
  ];
154089
154198
  if (hasBattery) {
154090
154199
  return WindowCoveringDevice.with(
154091
- ...baseBehaviors,
154200
+ ...baseBehaviors2,
154092
154201
  DefaultPowerSourceServer
154093
154202
  );
154094
154203
  }
154095
- return WindowCoveringDevice.with(...baseBehaviors);
154204
+ return WindowCoveringDevice.with(...baseBehaviors2);
154096
154205
  };
154097
154206
  function CoverDevice(homeAssistantEntity) {
154098
154207
  const entityId = homeAssistantEntity.entity.entity_id;
154099
- const attributes8 = homeAssistantEntity.entity.state.attributes;
154100
- const hasBatteryAttr = attributes8.battery_level != null || attributes8.battery != null;
154208
+ const attributes9 = homeAssistantEntity.entity.state.attributes;
154209
+ const hasBatteryAttr = attributes9.battery_level != null || attributes9.battery != null;
154101
154210
  const hasBatteryEntity = !!homeAssistantEntity.mapping?.batteryEntity;
154102
154211
  const hasBattery = hasBatteryAttr || hasBatteryEntity;
154103
154212
  if (hasBattery) {
@@ -154109,8 +154218,13 @@ function CoverDevice(homeAssistantEntity) {
154109
154218
  `[${entityId}] Creating cover without battery (batteryAttr=${hasBatteryAttr}, batteryEntity=${homeAssistantEntity.mapping?.batteryEntity ?? "none"})`
154110
154219
  );
154111
154220
  }
154221
+ if (homeAssistantEntity.mapping?.coverExposeAsDimmableLight) {
154222
+ logger207.info(`[${entityId}] Exposing cover as a Dimmable Light (#372)`);
154223
+ const type = hasBattery ? CoverAsDimmableLightWithBatteryType : CoverAsDimmableLightType;
154224
+ return type.set({ homeAssistantEntity });
154225
+ }
154112
154226
  return CoverDeviceType(
154113
- attributes8.supported_features ?? 0,
154227
+ attributes9.supported_features ?? 0,
154114
154228
  hasBattery,
154115
154229
  entityId
154116
154230
  ).set({
@@ -154434,9 +154548,9 @@ function EventDevice(homeAssistantEntity) {
154434
154548
  init_dist();
154435
154549
  init_home_assistant_entity_behavior();
154436
154550
  function FanDevice2(homeAssistantEntity) {
154437
- const attributes8 = homeAssistantEntity.entity.state.attributes;
154438
- const supportedFeatures = attributes8.supported_features ?? 0;
154439
- const hasBatteryAttr = attributes8.battery_level != null || attributes8.battery != null;
154551
+ const attributes9 = homeAssistantEntity.entity.state.attributes;
154552
+ const supportedFeatures = attributes9.supported_features ?? 0;
154553
+ const hasBatteryAttr = attributes9.battery_level != null || attributes9.battery != null;
154440
154554
  const hasBatteryEntity = !!homeAssistantEntity.mapping?.batteryEntity;
154441
154555
  const hasBattery = hasBatteryAttr || hasBatteryEntity;
154442
154556
  const hasSetSpeed = testBit(supportedFeatures, FanDeviceFeature.SET_SPEED);
@@ -154444,7 +154558,7 @@ function FanDevice2(homeAssistantEntity) {
154444
154558
  supportedFeatures,
154445
154559
  FanDeviceFeature.PRESET_MODE
154446
154560
  );
154447
- const presetModes = attributes8.preset_modes ?? [];
154561
+ const presetModes = attributes9.preset_modes ?? [];
154448
154562
  const speedPresets = presetModes.filter((m) => m.toLowerCase() !== "auto");
154449
154563
  if (!hasSetSpeed && speedPresets.length === 0) {
154450
154564
  const onOffDevice = hasBattery ? OnOffPlugInUnitDevice.with(
@@ -154616,10 +154730,10 @@ var HumidifierWithAutoAndSensor = FanDevice.with(
154616
154730
  HumidifierHumidityMeasurementServer
154617
154731
  );
154618
154732
  function HumidifierDevice(homeAssistantEntity) {
154619
- const attributes8 = homeAssistantEntity.entity.state.attributes;
154620
- const availableModes = attributes8.available_modes ?? [];
154733
+ const attributes9 = homeAssistantEntity.entity.state.attributes;
154734
+ const availableModes = attributes9.available_modes ?? [];
154621
154735
  const supportsAuto = availableModes.some((m) => m.toLowerCase() === "auto");
154622
- const hasHumiditySensor = attributes8.current_humidity != null;
154736
+ const hasHumiditySensor = attributes9.current_humidity != null;
154623
154737
  if (supportsAuto && hasHumiditySensor) {
154624
154738
  return HumidifierWithAutoAndSensor.set({ homeAssistantEntity });
154625
154739
  }
@@ -155405,11 +155519,11 @@ function LawnMowerDevice(homeAssistantEntity) {
155405
155519
  if (homeAssistantEntity.entity.state === void 0) {
155406
155520
  return void 0;
155407
155521
  }
155408
- const attributes8 = homeAssistantEntity.entity.state.attributes;
155522
+ const attributes9 = homeAssistantEntity.entity.state.attributes;
155409
155523
  let device = LawnMowerEndpointType.with(
155410
155524
  createLawnMowerRvcRunModeServer()
155411
155525
  ).set({ homeAssistantEntity });
155412
- const hasBattery = homeAssistantEntity.mapping?.batteryEntity != null || attributes8.battery_level != null || attributes8.battery != null;
155526
+ const hasBattery = homeAssistantEntity.mapping?.batteryEntity != null || attributes9.battery_level != null || attributes9.battery != null;
155413
155527
  if (hasBattery) {
155414
155528
  device = device.with(DefaultPowerSourceServer);
155415
155529
  }
@@ -155930,8 +156044,8 @@ var colorModes = [
155930
156044
  LightDeviceColorMode.RGBWW
155931
156045
  ];
155932
156046
  function LightDevice(homeAssistantEntity) {
155933
- const attributes8 = homeAssistantEntity.entity.state.attributes;
155934
- const supportedColorModes = attributes8.supported_color_modes ?? [];
156047
+ const attributes9 = homeAssistantEntity.entity.state.attributes;
156048
+ const supportedColorModes = attributes9.supported_color_modes ?? [];
155935
156049
  const supportsBrightness = supportedColorModes.some(
155936
156050
  (mode) => brightnessModes.includes(mode)
155937
156051
  );
@@ -155941,7 +156055,7 @@ function LightDevice(homeAssistantEntity) {
155941
156055
  const supportsColorTemperature = supportedColorModes.includes(
155942
156056
  LightDeviceColorMode.COLOR_TEMP
155943
156057
  );
155944
- const hasBatteryAttr = attributes8.battery_level != null || attributes8.battery != null;
156058
+ const hasBatteryAttr = attributes9.battery_level != null || attributes9.battery != null;
155945
156059
  const hasBatteryEntity = !!homeAssistantEntity.mapping?.batteryEntity;
155946
156060
  const hasBattery = hasBatteryAttr || hasBatteryEntity;
155947
156061
  const deviceType = supportsColorControl || supportsColorTemperature ? ExtendedColorLightType(
@@ -156616,8 +156730,8 @@ var MediaPlayerKeypadInputServer = class extends KeypadInputServer {
156616
156730
  if (!homeAssistant.isAvailable) {
156617
156731
  return { status: KeypadInput3.Status.InvalidKeyInCurrentState };
156618
156732
  }
156619
- const attributes8 = homeAssistant.entity.state.attributes;
156620
- const features3 = attributes8.supported_features ?? 0;
156733
+ const attributes9 = homeAssistant.entity.state.attributes;
156734
+ const features3 = attributes9.supported_features ?? 0;
156621
156735
  const action = this.mapKeyToAction(request.keyCode, features3);
156622
156736
  if (!action) {
156623
156737
  logger214.debug(
@@ -156873,8 +156987,8 @@ var VideoPlayerEndpointType = BasicVideoPlayerDevice.with(
156873
156987
  MediaPlayerKeypadInputServer
156874
156988
  );
156875
156989
  function VideoPlayerDevice(homeAssistantEntity) {
156876
- const attributes8 = homeAssistantEntity.entity.state.attributes;
156877
- const supportedFeatures = attributes8.supported_features ?? 0;
156990
+ const attributes9 = homeAssistantEntity.entity.state.attributes;
156991
+ const supportedFeatures = attributes9.supported_features ?? 0;
156878
156992
  let device = VideoPlayerEndpointType;
156879
156993
  const supportsPower = testBit(supportedFeatures, MediaPlayerDeviceFeature.TURN_ON) && testBit(supportedFeatures, MediaPlayerDeviceFeature.TURN_OFF);
156880
156994
  if (supportsPower) {
@@ -157033,9 +157147,9 @@ function SpeakerLevelControlServer(config11) {
157033
157147
  // src/matter/endpoints/legacy/media-player/behaviors/media-player-level-control-server.ts
157034
157148
  var MediaPlayerLevelControlServer = SpeakerLevelControlServer({
157035
157149
  getValuePercent: (state) => {
157036
- const attributes8 = state.attributes;
157037
- if (attributes8.volume_level != null) {
157038
- return attributes8.volume_level;
157150
+ const attributes9 = state.attributes;
157151
+ if (attributes9.volume_level != null) {
157152
+ return attributes9.volume_level;
157039
157153
  }
157040
157154
  return 0;
157041
157155
  },
@@ -157069,15 +157183,15 @@ var SpeakerEndpointType = SpeakerDevice.with(
157069
157183
  HomeAssistantEntityBehavior
157070
157184
  );
157071
157185
  function MediaPlayerDevice(homeAssistantEntity) {
157072
- const attributes8 = homeAssistantEntity.entity.state.attributes;
157073
- if (attributes8.device_class === MediaPlayerDeviceClass.Tv) {
157186
+ const attributes9 = homeAssistantEntity.entity.state.attributes;
157187
+ if (attributes9.device_class === MediaPlayerDeviceClass.Tv) {
157074
157188
  return VideoPlayerDevice(homeAssistantEntity);
157075
157189
  }
157076
157190
  return SpeakerMediaPlayerDevice(homeAssistantEntity);
157077
157191
  }
157078
157192
  function SpeakerMediaPlayerDevice(homeAssistantEntity) {
157079
- const attributes8 = homeAssistantEntity.entity.state.attributes;
157080
- const supportedFeatures = attributes8.supported_features ?? 0;
157193
+ const attributes9 = homeAssistantEntity.entity.state.attributes;
157194
+ const supportedFeatures = attributes9.supported_features ?? 0;
157081
157195
  let device = SpeakerEndpointType;
157082
157196
  const supportsPower = testBit(supportedFeatures, MediaPlayerDeviceFeature.TURN_ON) && testBit(supportedFeatures, MediaPlayerDeviceFeature.TURN_OFF);
157083
157197
  const supportsMute = testBit(
@@ -157331,8 +157445,8 @@ var AirQualitySensorServerImpl = class extends AirQualityServerWithFeatures {
157331
157445
  return;
157332
157446
  }
157333
157447
  const state = entity.state.state;
157334
- const attributes8 = entity.state.attributes;
157335
- const deviceClass = attributes8.device_class;
157448
+ const attributes9 = entity.state.attributes;
157449
+ const deviceClass = attributes9.device_class;
157336
157450
  let airQuality = AirQuality3.AirQualityEnum.Unknown;
157337
157451
  if (state != null && !Number.isNaN(+state)) {
157338
157452
  const value = +state;
@@ -157664,12 +157778,12 @@ init_home_assistant_entity_behavior();
157664
157778
  var flowSensorConfig = {
157665
157779
  getValue(entity) {
157666
157780
  const state = entity.state;
157667
- const attributes8 = entity.attributes;
157781
+ const attributes9 = entity.attributes;
157668
157782
  const flow = state == null || Number.isNaN(+state) ? null : +state;
157669
157783
  if (flow == null) {
157670
157784
  return void 0;
157671
157785
  }
157672
- const unit = attributes8.unit_of_measurement?.toLowerCase();
157786
+ const unit = attributes9.unit_of_measurement?.toLowerCase();
157673
157787
  if (unit === "l/min") {
157674
157788
  return flow * 0.06;
157675
157789
  }
@@ -158147,12 +158261,12 @@ init_home_assistant_entity_behavior();
158147
158261
  var pressureSensorConfig = {
158148
158262
  getValue(entity) {
158149
158263
  const state = entity.state;
158150
- const attributes8 = entity.attributes;
158264
+ const attributes9 = entity.attributes;
158151
158265
  const pressure = state == null || Number.isNaN(+state) ? null : +state;
158152
158266
  if (pressure == null) {
158153
158267
  return void 0;
158154
158268
  }
158155
- return convertPressureToHpa(pressure, attributes8.unit_of_measurement);
158269
+ return convertPressureToHpa(pressure, attributes9.unit_of_measurement);
158156
158270
  }
158157
158271
  };
158158
158272
  var PressureSensorType = PressureSensorDevice.with(
@@ -158261,14 +158375,14 @@ var temperatureSensorConfig = {
158261
158375
  getValue(entity, agent) {
158262
158376
  const fallbackUnit = agent.env.get(HomeAssistantConfig).unitSystem.temperature;
158263
158377
  const state = entity.state;
158264
- const attributes8 = entity.attributes;
158378
+ const attributes9 = entity.attributes;
158265
158379
  const temperature3 = state == null || Number.isNaN(+state) ? null : +state;
158266
158380
  if (temperature3 == null) {
158267
158381
  return void 0;
158268
158382
  }
158269
158383
  return Temperature.withUnit(
158270
158384
  temperature3,
158271
- attributes8.unit_of_measurement ?? fallbackUnit
158385
+ attributes9.unit_of_measurement ?? fallbackUnit
158272
158386
  );
158273
158387
  }
158274
158388
  };
@@ -158312,8 +158426,8 @@ var TvocConcentrationMeasurementServerBase = TotalVolatileOrganicCompoundsConcen
158312
158426
  ConcentrationMeasurement3.Feature.NumericMeasurement
158313
158427
  );
158314
158428
  function getMeasurementUnit(entity) {
158315
- const attributes8 = entity.state.attributes;
158316
- if (attributes8.device_class === SensorDeviceClass.volatile_organic_compounds_parts) {
158429
+ const attributes9 = entity.state.attributes;
158430
+ if (attributes9.device_class === SensorDeviceClass.volatile_organic_compounds_parts) {
158317
158431
  return ConcentrationMeasurement3.MeasurementUnit.Ppb;
158318
158432
  }
158319
158433
  return ConcentrationMeasurement3.MeasurementUnit.Ugm3;
@@ -158398,8 +158512,8 @@ var TvocAirQualityServer = class extends TvocAirQualityServerBase {
158398
158512
  return;
158399
158513
  }
158400
158514
  const state = entity.state.state;
158401
- const attributes8 = entity.state.attributes;
158402
- const deviceClass = attributes8.device_class;
158515
+ const attributes9 = entity.state.attributes;
158516
+ const deviceClass = attributes9.device_class;
158403
158517
  let airQuality = AirQuality3.AirQualityEnum.Unknown;
158404
158518
  logger216.debug(
158405
158519
  `[${entity.entity_id}] TVOC update: state="${state}", device_class="${deviceClass}"`
@@ -158731,14 +158845,14 @@ var temperatureConfig3 = {
158731
158845
  getValue(entity, agent) {
158732
158846
  const fallbackUnit = agent.env.get(HomeAssistantConfig).unitSystem.temperature;
158733
158847
  const state = entity.state;
158734
- const attributes8 = entity.attributes;
158848
+ const attributes9 = entity.attributes;
158735
158849
  const temperature3 = state == null || Number.isNaN(+state) ? null : +state;
158736
158850
  if (temperature3 == null) {
158737
158851
  return void 0;
158738
158852
  }
158739
158853
  return Temperature.withUnit(
158740
158854
  temperature3,
158741
- attributes8.unit_of_measurement ?? fallbackUnit
158855
+ attributes9.unit_of_measurement ?? fallbackUnit
158742
158856
  );
158743
158857
  }
158744
158858
  };
@@ -158766,8 +158880,8 @@ var pressureConfig2 = {
158766
158880
  if (state) {
158767
158881
  const pressure = state.state == null || Number.isNaN(+state.state) ? null : +state.state;
158768
158882
  if (pressure != null) {
158769
- const attributes8 = state.attributes;
158770
- return convertPressureToHpa(pressure, attributes8.unit_of_measurement);
158883
+ const attributes9 = state.attributes;
158884
+ return convertPressureToHpa(pressure, attributes9.unit_of_measurement);
158771
158885
  }
158772
158886
  }
158773
158887
  }
@@ -158827,14 +158941,14 @@ var temperatureConfig4 = {
158827
158941
  getValue(entity, agent) {
158828
158942
  const fallbackUnit = agent.env.get(HomeAssistantConfig).unitSystem.temperature;
158829
158943
  const state = entity.state;
158830
- const attributes8 = entity.attributes;
158944
+ const attributes9 = entity.attributes;
158831
158945
  const temperature3 = state == null || Number.isNaN(+state) ? null : +state;
158832
158946
  if (temperature3 == null) {
158833
158947
  return void 0;
158834
158948
  }
158835
158949
  return Temperature.withUnit(
158836
158950
  temperature3,
158837
- attributes8.unit_of_measurement ?? fallbackUnit
158951
+ attributes9.unit_of_measurement ?? fallbackUnit
158838
158952
  );
158839
158953
  }
158840
158954
  };
@@ -158848,8 +158962,8 @@ var pressureConfig3 = {
158848
158962
  if (state) {
158849
158963
  const pressure = state.state == null || Number.isNaN(+state.state) ? null : +state.state;
158850
158964
  if (pressure != null) {
158851
- const attributes8 = state.attributes;
158852
- return convertPressureToHpa(pressure, attributes8.unit_of_measurement);
158965
+ const attributes9 = state.attributes;
158966
+ return convertPressureToHpa(pressure, attributes9.unit_of_measurement);
158853
158967
  }
158854
158968
  }
158855
158969
  }
@@ -158891,8 +159005,8 @@ var tempDt = { deviceType: DeviceTypeId(770), revision: 2 };
158891
159005
  var humidityDt = { deviceType: DeviceTypeId(775), revision: 2 };
158892
159006
  var pressureDt = { deviceType: DeviceTypeId(773), revision: 2 };
158893
159007
  function SensorDevice(homeAssistantEntity) {
158894
- const attributes8 = homeAssistantEntity.entity.state.attributes;
158895
- const deviceClass = attributes8.device_class;
159008
+ const attributes9 = homeAssistantEntity.entity.state.attributes;
159009
+ const deviceClass = attributes9.device_class;
158896
159010
  const mapping = homeAssistantEntity.mapping;
158897
159011
  if (deviceClass === SensorDeviceClass.temperature) {
158898
159012
  const hasHumidity = !!mapping?.humidityEntity;
@@ -159209,9 +159323,9 @@ var UNNAMED_ROOM_PATTERN = /^(Room|Raum|Zimmer|Chambre|Habitación|Stanza)\s+\d+
159209
159323
  function isUnnamedRoom(roomName) {
159210
159324
  return UNNAMED_ROOM_PATTERN.test(roomName.trim());
159211
159325
  }
159212
- function parseVacuumRooms(attributes8, includeUnnamedRooms = false) {
159326
+ function parseVacuumRooms(attributes9, includeUnnamedRooms = false) {
159213
159327
  floorCounter = 0;
159214
- const sources2 = [attributes8.rooms, attributes8.segments, attributes8.room_list];
159328
+ const sources2 = [attributes9.rooms, attributes9.segments, attributes9.room_list];
159215
159329
  for (const source of sources2) {
159216
159330
  let rooms = parseRoomData(source);
159217
159331
  if (rooms.length > 0) {
@@ -159221,7 +159335,7 @@ function parseVacuumRooms(attributes8, includeUnnamedRooms = false) {
159221
159335
  return rooms;
159222
159336
  }
159223
159337
  }
159224
- let mappingRooms = parseRoomMapping(attributes8.room_mapping);
159338
+ let mappingRooms = parseRoomMapping(attributes9.room_mapping);
159225
159339
  if (mappingRooms.length > 0) {
159226
159340
  if (!includeUnnamedRooms) {
159227
159341
  mappingRooms = mappingRooms.filter((room) => !isUnnamedRoom(room.name));
@@ -159255,11 +159369,11 @@ function getRoomIdFromMode(mode) {
159255
159369
  }
159256
159370
  return mode - ROOM_MODE_BASE2;
159257
159371
  }
159258
- function isXiaomiMiotVacuum(attributes8) {
159259
- if (Array.isArray(attributes8.room_mapping) && attributes8.room_mapping.length > 0) {
159372
+ function isXiaomiMiotVacuum(attributes9) {
159373
+ if (Array.isArray(attributes9.room_mapping) && attributes9.room_mapping.length > 0) {
159260
159374
  return true;
159261
159375
  }
159262
- const sources2 = [attributes8.rooms, attributes8.segments, attributes8.room_list];
159376
+ const sources2 = [attributes9.rooms, attributes9.segments, attributes9.room_list];
159263
159377
  for (const source of sources2) {
159264
159378
  if (Array.isArray(source) && source.length > 0 && typeof source[0] === "object" && source[0] !== null && "id" in source[0]) {
159265
159379
  return true;
@@ -159267,8 +159381,8 @@ function isXiaomiMiotVacuum(attributes8) {
159267
159381
  }
159268
159382
  return false;
159269
159383
  }
159270
- function isDreameVacuum(attributes8) {
159271
- const roomsData = attributes8.rooms;
159384
+ function isDreameVacuum(attributes9) {
159385
+ const roomsData = attributes9.rooms;
159272
159386
  if (!roomsData || typeof roomsData !== "object" || Array.isArray(roomsData)) {
159273
159387
  return false;
159274
159388
  }
@@ -159279,8 +159393,8 @@ function isDreameVacuum(attributes8) {
159279
159393
  }
159280
159394
  return false;
159281
159395
  }
159282
- function isRoborockVacuum(attributes8) {
159283
- const roomsData = attributes8.rooms;
159396
+ function isRoborockVacuum(attributes9) {
159397
+ const roomsData = attributes9.rooms;
159284
159398
  if (!roomsData || typeof roomsData !== "object" || Array.isArray(roomsData)) {
159285
159399
  return false;
159286
159400
  }
@@ -159290,8 +159404,8 @@ function isRoborockVacuum(attributes8) {
159290
159404
  ([key, value]) => /^\d+$/.test(key) && typeof value === "string"
159291
159405
  );
159292
159406
  }
159293
- function isEcovacsVacuum(attributes8) {
159294
- const roomsData = attributes8.rooms;
159407
+ function isEcovacsVacuum(attributes9) {
159408
+ const roomsData = attributes9.rooms;
159295
159409
  if (!roomsData || typeof roomsData !== "object" || Array.isArray(roomsData)) {
159296
159410
  return false;
159297
159411
  }
@@ -159474,9 +159588,9 @@ function roomsToAreas(rooms, maps = []) {
159474
159588
  }
159475
159589
  }));
159476
159590
  }
159477
- function buildRoomNameLookup(attributes8) {
159591
+ function buildRoomNameLookup(attributes9) {
159478
159592
  const lookup = /* @__PURE__ */ new Map();
159479
- const mapping = attributes8?.room_mapping;
159593
+ const mapping = attributes9?.room_mapping;
159480
159594
  if (!Array.isArray(mapping)) return lookup;
159481
159595
  for (const entry of mapping) {
159482
159596
  if (Array.isArray(entry) && entry.length >= 3 && (typeof entry[0] === "number" || typeof entry[0] === "string") && typeof entry[2] === "string") {
@@ -159488,8 +159602,8 @@ function buildRoomNameLookup(attributes8) {
159488
159602
  }
159489
159603
  return lookup;
159490
159604
  }
159491
- function buttonEntitiesToRooms(entityIds, attributes8) {
159492
- const nameLookup = buildRoomNameLookup(attributes8);
159605
+ function buttonEntitiesToRooms(entityIds, attributes9) {
159606
+ const nameLookup = buildRoomNameLookup(attributes9);
159493
159607
  return entityIds.map((entityId) => {
159494
159608
  const segmentMatch = entityId.match(/segment[_-]?(\d+)$/);
159495
159609
  if (segmentMatch && nameLookup.size > 0) {
@@ -159509,15 +159623,15 @@ function buttonEntitiesToRooms(entityIds, attributes8) {
159509
159623
  };
159510
159624
  });
159511
159625
  }
159512
- function createVacuumServiceAreaServer(attributes8, roomEntities, includeUnnamedRooms = false) {
159626
+ function createVacuumServiceAreaServer(attributes9, roomEntities, includeUnnamedRooms = false) {
159513
159627
  let rooms;
159514
159628
  if (roomEntities && roomEntities.length > 0) {
159515
- rooms = buttonEntitiesToRooms(roomEntities, attributes8);
159629
+ rooms = buttonEntitiesToRooms(roomEntities, attributes9);
159516
159630
  logger221.info(
159517
159631
  `Using ${rooms.length} button entities as rooms: ${rooms.map((r) => r.name).join(", ")}`
159518
159632
  );
159519
159633
  } else {
159520
- rooms = parseVacuumRooms(attributes8, includeUnnamedRooms);
159634
+ rooms = parseVacuumRooms(attributes9, includeUnnamedRooms);
159521
159635
  if (rooms.length > 0) {
159522
159636
  logger221.info(
159523
159637
  `Using ${rooms.length} rooms from attributes: ${rooms.map((r) => r.name).join(", ")}`
@@ -159627,7 +159741,7 @@ function buildValetudoSegmentAction(vacuumEntityId, segmentIds, valetudoIdentifi
159627
159741
  }
159628
159742
  };
159629
159743
  }
159630
- function buildSupportedModes2(attributes8, includeUnnamedRooms = false, customAreas, disableRoomModes = false) {
159744
+ function buildSupportedModes2(attributes9, includeUnnamedRooms = false, customAreas, disableRoomModes = false) {
159631
159745
  const modes = [
159632
159746
  {
159633
159747
  label: "Idle",
@@ -159656,7 +159770,7 @@ function buildSupportedModes2(attributes8, includeUnnamedRooms = false, customAr
159656
159770
  }
159657
159771
  }
159658
159772
  } else {
159659
- const rooms = parseVacuumRooms(attributes8, includeUnnamedRooms);
159773
+ const rooms = parseVacuumRooms(attributes9, includeUnnamedRooms);
159660
159774
  rooms.sort((a, b) => a.name.localeCompare(b.name));
159661
159775
  for (const room of rooms) {
159662
159776
  const modeValue = getRoomModeValue(room);
@@ -159785,11 +159899,11 @@ var vacuumRvcRunModeConfig = {
159785
159899
  return isCleaning ? 1 /* Cleaning */ : 0 /* Idle */;
159786
159900
  },
159787
159901
  getSupportedModes: (entity, agent) => {
159788
- const attributes8 = entity.attributes;
159902
+ const attributes9 = entity.attributes;
159789
159903
  const mapping = agent.get(HomeAssistantEntityBehavior).state.mapping;
159790
159904
  const customAreas = mapping?.customServiceAreas;
159791
159905
  return buildSupportedModes2(
159792
- attributes8,
159906
+ attributes9,
159793
159907
  false,
159794
159908
  customAreas && customAreas.length > 0 ? customAreas : void 0,
159795
159909
  mapping?.disableCustomAreaRoomModes
@@ -159803,7 +159917,7 @@ var vacuumRvcRunModeConfig = {
159803
159917
  if (selectedAreas.length > 0) {
159804
159918
  const homeAssistant = agent.get(HomeAssistantEntityBehavior);
159805
159919
  const entity = homeAssistant.entity;
159806
- const attributes8 = entity.state.attributes;
159920
+ const attributes9 = entity.state.attributes;
159807
159921
  const session = getSession(homeAssistant.endpoint);
159808
159922
  const customAreas = homeAssistant.state.mapping?.customServiceAreas;
159809
159923
  if (customAreas && customAreas.length > 0) {
@@ -159853,7 +159967,7 @@ var vacuumRvcRunModeConfig = {
159853
159967
  homeAssistant.state.mapping?.valetudoIdentifier
159854
159968
  );
159855
159969
  }
159856
- const rooms = parseVacuumRooms(attributes8);
159970
+ const rooms = parseVacuumRooms(attributes9);
159857
159971
  const roomIds = [];
159858
159972
  let targetMapName;
159859
159973
  for (const areaId of selectedAreas) {
@@ -159869,7 +159983,7 @@ var vacuumRvcRunModeConfig = {
159869
159983
  logger222.info(
159870
159984
  `Starting cleaning with selected areas: ${roomIds.join(", ")}`
159871
159985
  );
159872
- if (isDreameVacuum(attributes8)) {
159986
+ if (isDreameVacuum(attributes9)) {
159873
159987
  if (targetMapName) {
159874
159988
  const vacName = vacuumEntityId.replace("vacuum.", "");
159875
159989
  const selectedMapEntity = `select.${vacName}_selected_map`;
@@ -159889,7 +160003,7 @@ var vacuumRvcRunModeConfig = {
159889
160003
  }
159890
160004
  };
159891
160005
  }
159892
- if (isRoborockVacuum(attributes8) || isXiaomiMiotVacuum(attributes8)) {
160006
+ if (isRoborockVacuum(attributes9) || isXiaomiMiotVacuum(attributes9)) {
159893
160007
  return {
159894
160008
  action: "vacuum.send_command",
159895
160009
  data: {
@@ -159898,7 +160012,7 @@ var vacuumRvcRunModeConfig = {
159898
160012
  }
159899
160013
  };
159900
160014
  }
159901
- if (isEcovacsVacuum(attributes8)) {
160015
+ if (isEcovacsVacuum(attributes9)) {
159902
160016
  const roomIdStr = roomIds.join(",");
159903
160017
  logger222.info(
159904
160018
  `Ecovacs vacuum: Using spot_area for rooms: ${roomIdStr}`
@@ -159936,7 +160050,7 @@ var vacuumRvcRunModeConfig = {
159936
160050
  cleanRoom: (roomMode, agent) => {
159937
160051
  const homeAssistant = agent.get(HomeAssistantEntityBehavior);
159938
160052
  const entity = homeAssistant.entity;
159939
- const attributes8 = entity.state.attributes;
160053
+ const attributes9 = entity.state.attributes;
159940
160054
  logger222.info(`cleanRoom called: roomMode=${roomMode}`);
159941
160055
  const cleanAreaRooms = homeAssistant.state.mapping?.cleanAreaRooms;
159942
160056
  if (cleanAreaRooms && cleanAreaRooms.length > 0) {
@@ -159982,7 +160096,7 @@ var vacuumRvcRunModeConfig = {
159982
160096
  homeAssistant.state.mapping?.valetudoIdentifier
159983
160097
  );
159984
160098
  }
159985
- const rooms = parseVacuumRooms(attributes8);
160099
+ const rooms = parseVacuumRooms(attributes9);
159986
160100
  const numericIdFromMode = getRoomIdFromMode(roomMode);
159987
160101
  logger222.info(
159988
160102
  `cleanRoom: numericIdFromMode=${numericIdFromMode}, available rooms: ${JSON.stringify(rooms.map((r) => ({ id: r.id, name: r.name, modeValue: getRoomModeValue(r) })))}`
@@ -159990,7 +160104,7 @@ var vacuumRvcRunModeConfig = {
159990
160104
  const room = rooms.find((r) => getRoomModeValue(r) === roomMode);
159991
160105
  if (room) {
159992
160106
  const commandId3 = room.originalId ?? room.id;
159993
- if (isDreameVacuum(attributes8)) {
160107
+ if (isDreameVacuum(attributes9)) {
159994
160108
  if (room.mapName) {
159995
160109
  const vacuumName = vacuumEntityId.replace("vacuum.", "");
159996
160110
  const selectedMapEntity = `select.${vacuumName}_selected_map`;
@@ -160013,7 +160127,7 @@ var vacuumRvcRunModeConfig = {
160013
160127
  }
160014
160128
  };
160015
160129
  }
160016
- if (isRoborockVacuum(attributes8) || isXiaomiMiotVacuum(attributes8)) {
160130
+ if (isRoborockVacuum(attributes9) || isXiaomiMiotVacuum(attributes9)) {
160017
160131
  logger222.debug(
160018
160132
  `Using vacuum.send_command with app_segment_clean for room ${room.name} (commandId: ${commandId3}, id: ${room.id})`
160019
160133
  );
@@ -160025,7 +160139,7 @@ var vacuumRvcRunModeConfig = {
160025
160139
  }
160026
160140
  };
160027
160141
  }
160028
- if (isEcovacsVacuum(attributes8)) {
160142
+ if (isEcovacsVacuum(attributes9)) {
160029
160143
  const roomIdStr = String(commandId3);
160030
160144
  logger222.info(
160031
160145
  `Ecovacs vacuum: Using spot_area for room ${room.name} (id: ${roomIdStr})`
@@ -160049,12 +160163,12 @@ var vacuumRvcRunModeConfig = {
160049
160163
  return { action: "vacuum.start" };
160050
160164
  }
160051
160165
  };
160052
- function createVacuumRvcRunModeServer(attributes8, includeUnnamedRooms = false, customAreas, disableRoomModes = false) {
160053
- const allRooms = parseVacuumRooms(attributes8, true);
160054
- const rooms = includeUnnamedRooms ? allRooms : parseVacuumRooms(attributes8, false);
160166
+ function createVacuumRvcRunModeServer(attributes9, includeUnnamedRooms = false, customAreas, disableRoomModes = false) {
160167
+ const allRooms = parseVacuumRooms(attributes9, true);
160168
+ const rooms = includeUnnamedRooms ? allRooms : parseVacuumRooms(attributes9, false);
160055
160169
  const filteredCount = allRooms.length - rooms.length;
160056
160170
  const supportedModes2 = buildSupportedModes2(
160057
- attributes8,
160171
+ attributes9,
160058
160172
  includeUnnamedRooms,
160059
160173
  customAreas,
160060
160174
  disableRoomModes
@@ -160073,7 +160187,7 @@ function createVacuumRvcRunModeServer(attributes8, includeUnnamedRooms = false,
160073
160187
  }
160074
160188
  if (allRooms.length === 0) {
160075
160189
  logger222.debug(
160076
- `No rooms found. Attributes: rooms=${JSON.stringify(attributes8.rooms)}, segments=${JSON.stringify(attributes8.segments)}, room_list=${attributes8.room_list}`
160190
+ `No rooms found. Attributes: rooms=${JSON.stringify(attributes9.rooms)}, segments=${JSON.stringify(attributes9.segments)}, room_list=${attributes9.room_list}`
160077
160191
  );
160078
160192
  }
160079
160193
  return RvcRunModeServer2(vacuumRvcRunModeConfig, {
@@ -160137,8 +160251,8 @@ var VacuumPowerSourceServer = PowerSourceServer2({
160137
160251
  return Math.max(0, Math.min(100, battery));
160138
160252
  }
160139
160253
  }
160140
- const attributes8 = entity.attributes;
160141
- const batteryLevel = attributes8.battery_level ?? attributes8.battery;
160254
+ const attributes9 = entity.attributes;
160255
+ const batteryLevel = attributes9.battery_level ?? attributes9.battery;
160142
160256
  if (batteryLevel == null) {
160143
160257
  return null;
160144
160258
  }
@@ -160597,11 +160711,11 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
160597
160711
  const hasCleanTypes = !!cleaningModeOptions && cleaningModeOptions.length > 0;
160598
160712
  return {
160599
160713
  getCurrentMode: (entity, agent) => {
160600
- const attributes8 = entity.attributes;
160714
+ const attributes9 = entity.attributes;
160601
160715
  let cleanType = 0 /* Sweeping */;
160602
160716
  if (hasCleanTypes) {
160603
- if (attributes8.cleaning_mode) {
160604
- cleanType = parseCleanType(attributes8.cleaning_mode);
160717
+ if (attributes9.cleaning_mode) {
160718
+ cleanType = parseCleanType(attributes9.cleaning_mode);
160605
160719
  } else {
160606
160720
  const selectEntityId = getCleaningModeSelectEntity(agent);
160607
160721
  const { state } = readSelectEntity(selectEntityId, agent);
@@ -160617,7 +160731,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
160617
160731
  speedState = sel.state;
160618
160732
  entityOptions = sel.options;
160619
160733
  } else {
160620
- speedState = attributes8.fan_speed ?? void 0;
160734
+ speedState = attributes9.fan_speed ?? void 0;
160621
160735
  }
160622
160736
  let speedMode = fanSpeedToModeId(speedState, fanSpeedList);
160623
160737
  if (speedMode === void 0 && speedState && entityOptions) {
@@ -160852,12 +160966,12 @@ function createDefaultRvcCleanModeServer() {
160852
160966
  currentMode: MODE_VACUUM
160853
160967
  });
160854
160968
  }
160855
- function supportsCleaningModes(attributes8) {
160856
- return isDreameVacuum(attributes8) || isEcovacsVacuum(attributes8);
160969
+ function supportsCleaningModes(attributes9) {
160970
+ return isDreameVacuum(attributes9) || isEcovacsVacuum(attributes9);
160857
160971
  }
160858
- function resolveFanSpeedList(attributes8, suctionLevelEntity) {
160859
- if (attributes8.fan_speed_list && attributes8.fan_speed_list.length > 1) {
160860
- return attributes8.fan_speed_list;
160972
+ function resolveFanSpeedList(attributes9, suctionLevelEntity) {
160973
+ if (attributes9.fan_speed_list && attributes9.fan_speed_list.length > 1) {
160974
+ return attributes9.fan_speed_list;
160861
160975
  }
160862
160976
  if (suctionLevelEntity) {
160863
160977
  return ["quiet", "standard", "strong"];
@@ -160966,7 +161080,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
160966
161080
  return void 0;
160967
161081
  }
160968
161082
  const entityId = homeAssistantEntity.entity.entity_id;
160969
- const attributes8 = homeAssistantEntity.entity.state.attributes;
161083
+ const attributes9 = homeAssistantEntity.entity.state.attributes;
160970
161084
  const customAreas = homeAssistantEntity.mapping?.customServiceAreas;
160971
161085
  logger226.info(
160972
161086
  `Creating vacuum endpoint for ${entityId}, mapping: ${JSON.stringify(homeAssistantEntity.mapping ?? "none")}`
@@ -160974,7 +161088,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
160974
161088
  const cleanAreaRooms = homeAssistantEntity.mapping?.cleanAreaRooms;
160975
161089
  let device = VacuumEndpointType.with(
160976
161090
  cleanAreaRooms && cleanAreaRooms.length > 0 ? createCleanAreaRvcRunModeServer(cleanAreaRooms) : createVacuumRvcRunModeServer(
160977
- attributes8,
161091
+ attributes9,
160978
161092
  false,
160979
161093
  customAreas && customAreas.length > 0 ? customAreas : void 0,
160980
161094
  homeAssistantEntity.mapping?.disableCustomAreaRoomModes
@@ -160986,7 +161100,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
160986
161100
  }
160987
161101
  device = device.with(VacuumPowerSourceServer);
160988
161102
  const roomEntities = homeAssistantEntity.mapping?.roomEntities;
160989
- const rooms = parseVacuumRooms(attributes8);
161103
+ const rooms = parseVacuumRooms(attributes9);
160990
161104
  logger226.info(
160991
161105
  `${entityId}: customAreas=${customAreas?.length ?? 0}, roomEntities=${JSON.stringify(roomEntities ?? [])}, parsedRooms=${rooms.length}, cleanAreaRooms=${cleanAreaRooms?.length ?? 0}`
160992
161106
  );
@@ -161003,14 +161117,14 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
161003
161117
  } else if (rooms.length > 0 || roomEntities && roomEntities.length > 0) {
161004
161118
  logger226.info(`${entityId}: Adding ServiceArea (${rooms.length} rooms)`);
161005
161119
  device = device.with(
161006
- createVacuumServiceAreaServer(attributes8, roomEntities)
161120
+ createVacuumServiceAreaServer(attributes9, roomEntities)
161007
161121
  );
161008
161122
  } else {
161009
161123
  logger226.info(`${entityId}: Adding ServiceArea (default single-area)`);
161010
161124
  device = device.with(createDefaultServiceAreaServer());
161011
161125
  }
161012
161126
  const fanSpeedList = resolveFanSpeedList(
161013
- attributes8,
161127
+ attributes9,
161014
161128
  homeAssistantEntity.mapping?.suctionLevelEntity
161015
161129
  );
161016
161130
  const mopIntensityList = resolveMopIntensityList(
@@ -161022,7 +161136,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
161022
161136
  );
161023
161137
  device = device.with(
161024
161138
  createVacuumRvcCleanModeServer(
161025
- attributes8,
161139
+ attributes9,
161026
161140
  fanSpeedList,
161027
161141
  mopIntensityList,
161028
161142
  cleaningModeOptions,
@@ -161121,9 +161235,9 @@ init_home_assistant_entity_behavior();
161121
161235
 
161122
161236
  // src/matter/endpoints/legacy/water-heater/behaviors/water-heater-thermostat-server.ts
161123
161237
  var getUnit2 = (agent) => agent.env.get(HomeAssistantConfig).unitSystem.temperature;
161124
- var attributes7 = (entity) => entity.attributes;
161238
+ var attributes8 = (entity) => entity.attributes;
161125
161239
  var getTemp2 = (agent, entity, attributeName) => {
161126
- const temperature3 = attributes7(entity)[attributeName];
161240
+ const temperature3 = attributes8(entity)[attributeName];
161127
161241
  const unit = getUnit2(agent);
161128
161242
  if (temperature3 != null) {
161129
161243
  return Temperature.withUnit(+temperature3, unit);
@@ -161137,14 +161251,14 @@ var config10 = {
161137
161251
  getTargetHeatingTemperature: (entity, agent) => getTemp2(agent, entity, "temperature"),
161138
161252
  getTargetCoolingTemperature: (entity, agent) => getTemp2(agent, entity, "temperature"),
161139
161253
  getSystemMode: (entity) => {
161140
- const operationMode = attributes7(entity).operation_mode;
161254
+ const operationMode = attributes8(entity).operation_mode;
161141
161255
  if (operationMode === "off") {
161142
161256
  return Thermostat3.SystemMode.Off;
161143
161257
  }
161144
161258
  return Thermostat3.SystemMode.Heat;
161145
161259
  },
161146
161260
  getRunningMode: (entity) => {
161147
- const operationMode = attributes7(entity).operation_mode;
161261
+ const operationMode = attributes8(entity).operation_mode;
161148
161262
  if (operationMode === "off") {
161149
161263
  return Thermostat3.ThermostatRunningMode.Off;
161150
161264
  }
@@ -161211,14 +161325,14 @@ function toMatterTemp2(value) {
161211
161325
  return Math.round(num * 100);
161212
161326
  }
161213
161327
  function WaterHeaterDevice(homeAssistantEntity) {
161214
- const attributes8 = homeAssistantEntity.entity.state.attributes;
161328
+ const attributes9 = homeAssistantEntity.entity.state.attributes;
161215
161329
  logger227.debug(
161216
- `Creating device for ${homeAssistantEntity.entity.entity_id}, min_temp=${attributes8.min_temp}, max_temp=${attributes8.max_temp}`
161330
+ `Creating device for ${homeAssistantEntity.entity.entity_id}, min_temp=${attributes9.min_temp}, max_temp=${attributes9.max_temp}`
161217
161331
  );
161218
- const minLimit = toMatterTemp2(attributes8.min_temp) ?? 0;
161219
- const maxLimit = toMatterTemp2(attributes8.max_temp) ?? 12e3;
161220
- const currentTemp = toMatterTemp2(attributes8.current_temperature) ?? toMatterTemp2(attributes8.temperature) ?? 2100;
161221
- const heatingSetpoint = toMatterTemp2(attributes8.temperature) ?? 1e4;
161332
+ const minLimit = toMatterTemp2(attributes9.min_temp) ?? 0;
161333
+ const maxLimit = toMatterTemp2(attributes9.max_temp) ?? 12e3;
161334
+ const currentTemp = toMatterTemp2(attributes9.current_temperature) ?? toMatterTemp2(attributes9.temperature) ?? 2100;
161335
+ const heatingSetpoint = toMatterTemp2(attributes9.temperature) ?? 1e4;
161222
161336
  return WaterHeaterDeviceType.set({
161223
161337
  homeAssistantEntity,
161224
161338
  thermostat: {
@@ -161237,21 +161351,21 @@ init_home_assistant_entity_behavior();
161237
161351
  var temperatureConfig5 = {
161238
161352
  getValue(entity, agent) {
161239
161353
  const fallbackUnit = agent.env.get(HomeAssistantConfig).unitSystem.temperature;
161240
- const attributes8 = entity.attributes;
161241
- const temperature3 = attributes8.temperature;
161354
+ const attributes9 = entity.attributes;
161355
+ const temperature3 = attributes9.temperature;
161242
161356
  if (temperature3 == null || Number.isNaN(temperature3)) {
161243
161357
  return void 0;
161244
161358
  }
161245
161359
  return Temperature.withUnit(
161246
161360
  temperature3,
161247
- attributes8.temperature_unit ?? fallbackUnit
161361
+ attributes9.temperature_unit ?? fallbackUnit
161248
161362
  );
161249
161363
  }
161250
161364
  };
161251
161365
  var humidityConfig5 = {
161252
161366
  getValue(entity) {
161253
- const attributes8 = entity.attributes;
161254
- const humidity = attributes8.humidity;
161367
+ const attributes9 = entity.attributes;
161368
+ const humidity = attributes9.humidity;
161255
161369
  if (humidity == null || Number.isNaN(humidity)) {
161256
161370
  return null;
161257
161371
  }
@@ -161260,12 +161374,12 @@ var humidityConfig5 = {
161260
161374
  };
161261
161375
  var pressureConfig4 = {
161262
161376
  getValue(entity) {
161263
- const attributes8 = entity.attributes;
161264
- const pressure = attributes8.pressure;
161377
+ const attributes9 = entity.attributes;
161378
+ const pressure = attributes9.pressure;
161265
161379
  if (pressure == null || Number.isNaN(pressure)) {
161266
161380
  return void 0;
161267
161381
  }
161268
- return convertPressureToHpa(pressure, attributes8.pressure_unit);
161382
+ return convertPressureToHpa(pressure, attributes9.pressure_unit);
161269
161383
  }
161270
161384
  };
161271
161385
  var WeatherSensorType = TemperatureSensorDevice.with(
@@ -161976,11 +162090,17 @@ var LegacyEndpoint = class _LegacyEndpoint extends EntityEndpoint {
161976
162090
  }
161977
162091
  const customName = effectiveMapping?.customName;
161978
162092
  const mappedIds = getMappedEntityIds(effectiveMapping);
161979
- return new _LegacyEndpoint(type, entityId, customName, mappedIds);
162093
+ return new _LegacyEndpoint(
162094
+ type,
162095
+ entityId,
162096
+ customName,
162097
+ mappedIds,
162098
+ effectiveMapping?.updateThrottleMs
162099
+ );
161980
162100
  }
161981
- constructor(type, entityId, customName, mappedEntityIds) {
162101
+ constructor(type, entityId, customName, mappedEntityIds, throttleMs) {
161982
162102
  super(type, entityId, customName, mappedEntityIds);
161983
- this.flushUpdate = debounce6(this.flushPendingUpdate.bind(this), 50);
162103
+ this.flushUpdate = throttleMs && throttleMs > 50 ? throttleLatest(this.flushPendingUpdate.bind(this), throttleMs) : debounce6(this.flushPendingUpdate.bind(this), 50);
161984
162104
  }
161985
162105
  lastState;
161986
162106
  pendingMappedChange = false;
@@ -162547,7 +162667,7 @@ function processEvent(store, updates) {
162547
162667
  entityState = { ...entityState };
162548
162668
  const { "+": toAdd, "-": toRemove } = updates.c[entityId];
162549
162669
  const attributesChanged = toAdd?.a || toRemove?.a;
162550
- const attributes8 = attributesChanged ? { ...entityState.attributes } : entityState.attributes;
162670
+ const attributes9 = attributesChanged ? { ...entityState.attributes } : entityState.attributes;
162551
162671
  if (toAdd) {
162552
162672
  if (toAdd.s !== void 0) {
162553
162673
  entityState.state = toAdd.s;
@@ -162567,16 +162687,16 @@ function processEvent(store, updates) {
162567
162687
  entityState.last_updated = new Date(toAdd.lu * 1e3).toISOString();
162568
162688
  }
162569
162689
  if (toAdd.a) {
162570
- Object.assign(attributes8, toAdd.a);
162690
+ Object.assign(attributes9, toAdd.a);
162571
162691
  }
162572
162692
  }
162573
162693
  if (toRemove?.a) {
162574
162694
  for (const key of toRemove.a) {
162575
- delete attributes8[key];
162695
+ delete attributes9[key];
162576
162696
  }
162577
162697
  }
162578
162698
  if (attributesChanged) {
162579
- entityState.attributes = attributes8;
162699
+ entityState.attributes = attributes9;
162580
162700
  }
162581
162701
  state[entityId] = entityState;
162582
162702
  }
@@ -162881,7 +163001,7 @@ var BridgeEndpointManager = class extends Service {
162881
163001
  this.pluginEndpoints.delete(deviceId);
162882
163002
  }
162883
163003
  };
162884
- this.pluginManager.onDeviceStateUpdated = (pluginName, deviceId, clusterId3, attributes8) => {
163004
+ this.pluginManager.onDeviceStateUpdated = (pluginName, deviceId, clusterId3, attributes9) => {
162885
163005
  const endpoint = this.pluginEndpoints.get(deviceId);
162886
163006
  if (!endpoint) return;
162887
163007
  const behaviorType = endpoint.type.behaviors[clusterId3];
@@ -162892,7 +163012,7 @@ var BridgeEndpointManager = class extends Service {
162892
163012
  return;
162893
163013
  }
162894
163014
  this.pluginStateUpdating.add(deviceId);
162895
- endpoint.setStateOf(behaviorType, attributes8).catch((e) => {
163015
+ endpoint.setStateOf(behaviorType, attributes9).catch((e) => {
162896
163016
  this.log.warn(
162897
163017
  `Plugin "${pluginName}": failed to update "${clusterId3}" on "${deviceId}":`,
162898
163018
  e
@@ -164711,12 +164831,12 @@ function ServerModeVacuumDevice(homeAssistantEntity, includeOnOff = false, clean
164711
164831
  if (homeAssistantEntity.entity.state === void 0) {
164712
164832
  return void 0;
164713
164833
  }
164714
- const attributes8 = homeAssistantEntity.entity.state.attributes;
164834
+ const attributes9 = homeAssistantEntity.entity.state.attributes;
164715
164835
  const cleanAreaRooms = homeAssistantEntity.mapping?.cleanAreaRooms;
164716
164836
  const customAreas = homeAssistantEntity.mapping?.customServiceAreas;
164717
164837
  let device = ServerModeVacuumEndpointType.with(
164718
164838
  cleanAreaRooms && cleanAreaRooms.length > 0 ? createCleanAreaRvcRunModeServer(cleanAreaRooms) : createVacuumRvcRunModeServer(
164719
- attributes8,
164839
+ attributes9,
164720
164840
  false,
164721
164841
  customAreas && customAreas.length > 0 ? customAreas : void 0,
164722
164842
  homeAssistantEntity.mapping?.disableCustomAreaRoomModes
@@ -164727,20 +164847,20 @@ function ServerModeVacuumDevice(homeAssistantEntity, includeOnOff = false, clean
164727
164847
  }
164728
164848
  device = device.with(VacuumPowerSourceServer);
164729
164849
  const roomEntities = homeAssistantEntity.mapping?.roomEntities;
164730
- const rooms = parseVacuumRooms(attributes8);
164850
+ const rooms = parseVacuumRooms(attributes9);
164731
164851
  if (cleanAreaRooms && cleanAreaRooms.length > 0) {
164732
164852
  device = device.with(createCleanAreaServiceAreaServer(cleanAreaRooms));
164733
164853
  } else if (customAreas && customAreas.length > 0) {
164734
164854
  device = device.with(createCustomServiceAreaServer(customAreas));
164735
164855
  } else if (rooms.length > 0 || roomEntities && roomEntities.length > 0) {
164736
164856
  device = device.with(
164737
- createVacuumServiceAreaServer(attributes8, roomEntities)
164857
+ createVacuumServiceAreaServer(attributes9, roomEntities)
164738
164858
  );
164739
164859
  } else {
164740
164860
  device = device.with(createDefaultServiceAreaServer());
164741
164861
  }
164742
164862
  const fanSpeedList = resolveFanSpeedList(
164743
- attributes8,
164863
+ attributes9,
164744
164864
  homeAssistantEntity.mapping?.suctionLevelEntity
164745
164865
  );
164746
164866
  const mopIntensityList = resolveMopIntensityList(
@@ -164749,7 +164869,7 @@ function ServerModeVacuumDevice(homeAssistantEntity, includeOnOff = false, clean
164749
164869
  if (cleaningModeOptions || fanSpeedList || mopIntensityList) {
164750
164870
  device = device.with(
164751
164871
  createVacuumRvcCleanModeServer(
164752
- attributes8,
164872
+ attributes9,
164753
164873
  fanSpeedList,
164754
164874
  mopIntensityList,
164755
164875
  cleaningModeOptions,