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

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,6 +127008,7 @@ 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,
127012
127013
  disableClimateOnOff: body.disableClimateOnOff,
127013
127014
  disableClimateFanControl: body.disableClimateFanControl,
@@ -131640,6 +131641,7 @@ var EntityMappingStorage = class extends Service {
131640
131641
  disableCustomAreaRoomModes: request.disableCustomAreaRoomModes || void 0,
131641
131642
  valetudoIdentifier: request.valetudoIdentifier?.trim() || void 0,
131642
131643
  coverSwapOpenClose: request.coverSwapOpenClose || void 0,
131644
+ coverExposeAsDimmableLight: request.coverExposeAsDimmableLight || void 0,
131643
131645
  coverSliderDebounceMs: sanitizeDebounceMs(request.coverSliderDebounceMs),
131644
131646
  disableClimateOnOff: request.disableClimateOnOff || void 0,
131645
131647
  disableClimateFanControl: request.disableClimateFanControl || void 0,
@@ -131648,7 +131650,7 @@ var EntityMappingStorage = class extends Service {
131648
131650
  climateAutoMode: request.climateAutoMode || void 0,
131649
131651
  composedEntities: request.composedEntities?.filter((e) => e.entityId?.trim()) ?? void 0
131650
131652
  };
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)) {
131653
+ 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.disableClimateOnOff && !config11.disableClimateFanControl && !config11.climateKeepModeOnIdle && !config11.climateExposeFan && !config11.climateAutoMode && (!config11.composedEntities || config11.composedEntities.length === 0)) {
131652
131654
  bridgeMap.delete(request.entityId);
131653
131655
  } else {
131654
131656
  bridgeMap.set(request.entityId, config11);
@@ -132546,9 +132548,9 @@ var ScenesManagementServer = class extends ScenesManagementBase {
132546
132548
  #collectSceneAttributeValues() {
132547
132549
  const sceneValues = {};
132548
132550
  this.endpoint.act((agent) => {
132549
- for (const { name: clusterName, attributes: attributes8 } of this.internal.endpointSceneableBehaviors) {
132551
+ for (const { name: clusterName, attributes: attributes9 } of this.internal.endpointSceneableBehaviors) {
132550
132552
  const clusterState = agent[clusterName].state;
132551
- for (const attribute of attributes8) {
132553
+ for (const attribute of attributes9) {
132552
132554
  const attributeName = attribute.name;
132553
132555
  const currentValue = clusterState[attributeName];
132554
132556
  if (currentValue !== void 0) {
@@ -143308,16 +143310,16 @@ var AtomicWriteHandler = class _AtomicWriteHandler {
143308
143310
  if (attributeRequests.length === 0) {
143309
143311
  throw new StatusResponse.InvalidCommandError("No attribute requests provided");
143310
143312
  }
143311
- const attributes8 = /* @__PURE__ */ new Map();
143313
+ const attributes9 = /* @__PURE__ */ new Map();
143312
143314
  for (const attr of attributeRequests) {
143313
143315
  const [attributeName, _] = Object.entries(cluster2.cluster.attributes ?? {}).find(([_2, { id }]) => id === attr) ?? [];
143314
143316
  if (attributeName === void 0 || endpoint.stateOf(cluster2.id)[attr] === void 0) {
143315
143317
  throw new StatusResponse.InvalidCommandError(`Attribute ${attr} not supported by cluster`);
143316
143318
  }
143317
- if (attributes8.has(attr)) {
143319
+ if (attributes9.has(attr)) {
143318
143320
  throw new StatusResponse.InvalidCommandError("Duplicate attribute in attribute requests");
143319
143321
  }
143320
- attributes8.set(attr, attributeName);
143322
+ attributes9.set(attr, attributeName);
143321
143323
  }
143322
143324
  const existingState = this.#pendingWrites.find(
143323
143325
  (s) => PeerAddress.is(s.peerAddress, peerAddress) && s.endpoint.number == endpoint.number && s.clusterId === cluster2.cluster.id
@@ -143341,7 +143343,7 @@ var AtomicWriteHandler = class _AtomicWriteHandler {
143341
143343
  cluster2.cluster.id,
143342
143344
  attributeRequests,
143343
143345
  timeout,
143344
- attributes8,
143346
+ attributes9,
143345
143347
  initialValues
143346
143348
  );
143347
143349
  this.#pendingWrites.add(state);
@@ -147836,7 +147838,7 @@ var PluginManager = class {
147836
147838
  await this.onDeviceUnregistered?.(plugin.name, deviceId);
147837
147839
  pluginLogger.debug(`Unregistered device: ${deviceId}`);
147838
147840
  },
147839
- updateDeviceState: (deviceId, clusterId3, attributes8) => {
147841
+ updateDeviceState: (deviceId, clusterId3, attributes9) => {
147840
147842
  if (!devices.has(deviceId)) {
147841
147843
  pluginLogger.warn(
147842
147844
  `Cannot update state: device "${deviceId}" not found`
@@ -147847,7 +147849,7 @@ var PluginManager = class {
147847
147849
  plugin.name,
147848
147850
  deviceId,
147849
147851
  clusterId3,
147850
- attributes8
147852
+ attributes9
147851
147853
  );
147852
147854
  },
147853
147855
  registerDomainMapping: (mapping) => {
@@ -150757,12 +150759,12 @@ var temperatureConfig = {
150757
150759
  getValue(entity, agent) {
150758
150760
  const fallbackUnit = agent.env.get(HomeAssistantConfig).unitSystem.temperature;
150759
150761
  const state = entity.state;
150760
- const attributes8 = entity.attributes;
150762
+ const attributes9 = entity.attributes;
150761
150763
  const temperature3 = state == null || Number.isNaN(+state) ? null : +state;
150762
150764
  if (temperature3 == null) return void 0;
150763
150765
  return Temperature.withUnit(
150764
150766
  temperature3,
150765
- attributes8.unit_of_measurement ?? fallbackUnit
150767
+ attributes9.unit_of_measurement ?? fallbackUnit
150766
150768
  );
150767
150769
  }
150768
150770
  };
@@ -151229,8 +151231,8 @@ function ClimateFanControlServer(rockSupport) {
151229
151231
  // src/matter/endpoints/legacy/climate/behaviors/climate-humidity-measurement-server.ts
151230
151232
  var humidityConfig2 = {
151231
151233
  getValue(entity) {
151232
- const attributes8 = entity.attributes;
151233
- const humidity = attributes8.current_humidity;
151234
+ const attributes9 = entity.attributes;
151235
+ const humidity = attributes9.current_humidity;
151234
151236
  if (humidity == null || Number.isNaN(+humidity)) {
151235
151237
  return null;
151236
151238
  }
@@ -152209,26 +152211,26 @@ function toMatterTemp(value) {
152209
152211
  return Math.round(num * 100);
152210
152212
  }
152211
152213
  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;
152214
+ const attributes9 = homeAssistantEntity.entity.state.attributes;
152215
+ const supportedFeatures = attributes9.supported_features ?? 0;
152216
+ const hasBatteryAttr = attributes9.battery_level != null || attributes9.battery != null;
152215
152217
  const hasBatteryEntity = !!homeAssistantEntity.mapping?.batteryEntity;
152216
152218
  const hasBattery = hasBatteryAttr || hasBatteryEntity;
152217
152219
  const supportsCooling = coolingModes.some(
152218
- (mode) => attributes8.hvac_modes.includes(mode)
152220
+ (mode) => attributes9.hvac_modes.includes(mode)
152219
152221
  );
152220
152222
  const hasExplicitHeating = heatingModes.some(
152221
- (mode) => attributes8.hvac_modes.includes(mode)
152223
+ (mode) => attributes9.hvac_modes.includes(mode)
152222
152224
  );
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));
152225
+ const isAutoOnly = !hasExplicitHeating && !supportsCooling && autoOnlyMode.some((mode) => attributes9.hvac_modes.includes(mode));
152226
+ const isVentilationOnly = !hasExplicitHeating && !supportsCooling && !isAutoOnly && ventilationOnlyModes.some((mode) => attributes9.hvac_modes.includes(mode));
152225
152227
  const supportsHeating = hasExplicitHeating || isAutoOnly || isVentilationOnly;
152226
152228
  if (!supportsCooling && !supportsHeating) {
152227
152229
  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(", ")}]`
152230
+ `Climates have to support at least one of: heat, cool, heat_cool, auto, fan_only, or dry. Found: [${attributes9.hvac_modes.join(", ")}]`
152229
152231
  );
152230
152232
  }
152231
- const supportsHumidity = attributes8.current_humidity != null || testBit(supportedFeatures, ClimateDeviceFeature.TARGET_HUMIDITY);
152233
+ const supportsHumidity = attributes9.current_humidity != null || testBit(supportedFeatures, ClimateDeviceFeature.TARGET_HUMIDITY);
152232
152234
  const supportsOnOff = testBit(supportedFeatures, ClimateDeviceFeature.TURN_ON) && testBit(supportedFeatures, ClimateDeviceFeature.TURN_OFF) && homeAssistantEntity.mapping?.disableClimateOnOff !== true;
152233
152235
  const supportsFanMode = testBit(supportedFeatures, ClimateDeviceFeature.FAN_MODE) && homeAssistantEntity.mapping?.disableClimateFanControl !== true;
152234
152236
  const supportsVerticalSwing = testBit(
@@ -152239,22 +152241,22 @@ function ClimateDevice(homeAssistantEntity, includeBasicInformation = true) {
152239
152241
  supportedFeatures,
152240
152242
  ClimateDeviceFeature.SWING_HORIZONTAL_MODE
152241
152243
  );
152242
- const swingModesRockSupport = swingModesToRockSupport(attributes8.swing_modes);
152244
+ const swingModesRockSupport = swingModesToRockSupport(attributes9.swing_modes);
152243
152245
  const rockSupport = supportsVerticalSwing || supportsHorizontalSwing || swingModesRockSupport.rockLeftRight || swingModesRockSupport.rockUpDown ? {
152244
152246
  rockLeftRight: swingModesRockSupport.rockLeftRight || supportsHorizontalSwing || void 0,
152245
152247
  rockUpDown: swingModesRockSupport.rockUpDown || supportsVerticalSwing || void 0
152246
152248
  } : void 0;
152247
- const rawMinLimit = toMatterTemp(attributes8.min_temp) ?? 0;
152248
- const rawMaxLimit = toMatterTemp(attributes8.max_temp) ?? 5e3;
152249
+ const rawMinLimit = toMatterTemp(attributes9.min_temp) ?? 0;
152250
+ const rawMaxLimit = toMatterTemp(attributes9.max_temp) ?? 5e3;
152249
152251
  const minLimit = Math.min(rawMinLimit, rawMaxLimit);
152250
152252
  const maxLimit = Math.max(rawMinLimit, rawMaxLimit);
152251
152253
  const initialState = {
152252
152254
  // Pass actual current_temperature for initial state.
152253
152255
  // If unavailable (null/undefined), update() will fall back to the
152254
152256
  // 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,
152257
+ localTemperature: toMatterTemp(attributes9.current_temperature),
152258
+ occupiedHeatingSetpoint: toMatterTemp(attributes9.target_temp_low) ?? toMatterTemp(attributes9.temperature) ?? 2e3,
152259
+ occupiedCoolingSetpoint: toMatterTemp(attributes9.target_temp_high) ?? toMatterTemp(attributes9.temperature) ?? 2400,
152258
152260
  // Use HA's actual min/max limits, fall back to wide range (0-50°C) if not
152259
152261
  // provided. Ordered above so min <= max always holds.
152260
152262
  minHeatSetpointLimit: minLimit,
@@ -152262,7 +152264,7 @@ function ClimateDevice(homeAssistantEntity, includeBasicInformation = true) {
152262
152264
  minCoolSetpointLimit: minLimit,
152263
152265
  maxCoolSetpointLimit: maxLimit
152264
152266
  };
152265
- const autoMode = supportsHeating && supportsCooling && attributes8.hvac_modes.includes(ClimateHvacMode.heat_cool) && (attributes8.hvac_modes.includes(ClimateHvacMode.heat) || attributes8.hvac_modes.includes(ClimateHvacMode.cool));
152267
+ const autoMode = supportsHeating && supportsCooling && attributes9.hvac_modes.includes(ClimateHvacMode.heat_cool) && (attributes9.hvac_modes.includes(ClimateHvacMode.heat) || attributes9.hvac_modes.includes(ClimateHvacMode.cool));
152266
152268
  return ClimateDeviceType(
152267
152269
  supportsOnOff,
152268
152270
  supportsHumidity,
@@ -152528,12 +152530,12 @@ var temperatureConfig2 = {
152528
152530
  getValue(entity, agent) {
152529
152531
  const fallbackUnit = agent.env.get(HomeAssistantConfig).unitSystem.temperature;
152530
152532
  const state = entity.state;
152531
- const attributes8 = entity.attributes;
152533
+ const attributes9 = entity.attributes;
152532
152534
  const temperature3 = state == null || Number.isNaN(+state) ? null : +state;
152533
152535
  if (temperature3 == null) return void 0;
152534
152536
  return Temperature.withUnit(
152535
152537
  temperature3,
152536
- attributes8.unit_of_measurement ?? fallbackUnit
152538
+ attributes9.unit_of_measurement ?? fallbackUnit
152537
152539
  );
152538
152540
  }
152539
152541
  };
@@ -152546,10 +152548,10 @@ var humidityConfig3 = {
152546
152548
  var pressureConfig = {
152547
152549
  getValue(entity) {
152548
152550
  const state = entity.state;
152549
- const attributes8 = entity.attributes;
152551
+ const attributes9 = entity.attributes;
152550
152552
  const pressure = state == null || Number.isNaN(+state) ? null : +state;
152551
152553
  if (pressure == null) return void 0;
152552
- return convertPressureToHpa(pressure, attributes8.unit_of_measurement);
152554
+ return convertPressureToHpa(pressure, attributes9.unit_of_measurement);
152553
152555
  }
152554
152556
  };
152555
152557
  var batteryConfig2 = {
@@ -152780,8 +152782,8 @@ init_esm();
152780
152782
  // src/matter/endpoints/legacy/air-purifier/index.ts
152781
152783
  init_dist();
152782
152784
  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) {
152785
+ function hasFilterLifeSupport(attributes9, mapping) {
152786
+ if (attributes9.filter_life != null || attributes9.filter_life_remaining != null || attributes9.filter_life_level != null) {
152785
152787
  return true;
152786
152788
  }
152787
152789
  if (mapping?.filterLifeEntity) {
@@ -152790,8 +152792,8 @@ function hasFilterLifeSupport(attributes8, mapping) {
152790
152792
  return false;
152791
152793
  }
152792
152794
  function AirPurifierEndpoint(homeAssistantEntity) {
152793
- const attributes8 = homeAssistantEntity.entity.state.attributes;
152794
- const supportedFeatures = attributes8.supported_features ?? 0;
152795
+ const attributes9 = homeAssistantEntity.entity.state.attributes;
152796
+ const supportedFeatures = attributes9.supported_features ?? 0;
152795
152797
  const mapping = homeAssistantEntity.mapping;
152796
152798
  const features3 = /* @__PURE__ */ new Set();
152797
152799
  if (testBit(supportedFeatures, FanDeviceFeature.SET_SPEED)) {
@@ -152807,7 +152809,7 @@ function AirPurifierEndpoint(homeAssistantEntity) {
152807
152809
  if (testBit(supportedFeatures, FanDeviceFeature.OSCILLATE)) {
152808
152810
  features3.add("Rocking");
152809
152811
  }
152810
- const presetModes = attributes8.preset_modes ?? [];
152812
+ const presetModes = attributes9.preset_modes ?? [];
152811
152813
  const hasWindModes = presetModes.some(
152812
152814
  (m) => m.toLowerCase() === "natural" || m.toLowerCase() === "nature" || m.toLowerCase() === "sleep"
152813
152815
  );
@@ -152821,7 +152823,7 @@ function AirPurifierEndpoint(homeAssistantEntity) {
152821
152823
  FanOnOffServer,
152822
152824
  FanFanControlServer.with(...features3)
152823
152825
  );
152824
- if (hasFilterLifeSupport(attributes8, mapping)) {
152826
+ if (hasFilterLifeSupport(attributes9, mapping)) {
152825
152827
  const deviceWithFilter = baseDevice.with(
152826
152828
  AirPurifierHepaFilterMonitoringServer
152827
152829
  );
@@ -153424,9 +153426,9 @@ var batteryTypes = /* @__PURE__ */ new Map([
153424
153426
  function BinarySensorDevice(homeAssistantEntity) {
153425
153427
  const entityId = homeAssistantEntity.entity.entity_id;
153426
153428
  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;
153429
+ const attributes9 = homeAssistantEntity.entity.state.attributes;
153430
+ const deviceClass = attributes9.device_class;
153431
+ const hasBatteryAttr = attributes9.battery_level != null || attributes9.battery != null;
153430
153432
  const hasBatteryEntity = !!homeAssistantEntity.mapping?.batteryEntity;
153431
153433
  const hasBattery = hasBatteryAttr || hasBatteryEntity;
153432
153434
  let type = deviceClass && deviceClasses[deviceClass] ? deviceClasses[deviceClass] : defaultDeviceType;
@@ -153508,6 +153510,57 @@ init_dist();
153508
153510
  init_esm();
153509
153511
  init_home_assistant_entity_behavior();
153510
153512
 
153513
+ // src/matter/endpoints/legacy/cover/behaviors/cover-as-light.ts
153514
+ init_dist();
153515
+ init_home_assistant_entity_behavior();
153516
+ var attributes6 = (entity) => entity.attributes;
153517
+ function coverOpenness(entity) {
153518
+ const position = attributes6(entity).current_position;
153519
+ if (position != null) {
153520
+ return Math.min(1, Math.max(0, position / 100));
153521
+ }
153522
+ if (entity.state === CoverDeviceState.open) return 1;
153523
+ if (entity.state === CoverDeviceState.closed) return 0;
153524
+ return null;
153525
+ }
153526
+ function coverLevelAction(percent3, supportsPosition) {
153527
+ const position = Math.round(Math.min(1, Math.max(0, percent3)) * 100);
153528
+ if (supportsPosition) {
153529
+ return { action: "cover.set_cover_position", data: { position } };
153530
+ }
153531
+ return { action: position >= 50 ? "cover.open_cover" : "cover.close_cover" };
153532
+ }
153533
+ var supportsPositionControl = (agent) => {
153534
+ const entity = agent.get(HomeAssistantEntityBehavior).entity.state;
153535
+ const supportedFeatures = attributes6(entity).supported_features ?? 0;
153536
+ return (supportedFeatures & CoverSupportedFeatures.support_set_position) !== 0;
153537
+ };
153538
+ var CoverAsLightOnOffServer = OnOffServer2({
153539
+ isOn: (entity) => entity.state !== CoverDeviceState.closed,
153540
+ turnOn: () => ({ action: "cover.open_cover" }),
153541
+ turnOff: () => ({ action: "cover.close_cover" })
153542
+ });
153543
+ var CoverAsLightLevelControlServer = LevelControlServer2({
153544
+ getValuePercent: (entity) => coverOpenness(entity),
153545
+ moveToLevelPercent: (percent3, agent) => coverLevelAction(percent3, supportsPositionControl(agent))
153546
+ });
153547
+ var baseBehaviors = [
153548
+ IdentifyServer2,
153549
+ BasicInformationServer2,
153550
+ HomeAssistantEntityBehavior,
153551
+ GroupsServer,
153552
+ ScenesManagementServer,
153553
+ CoverAsLightOnOffServer,
153554
+ CoverAsLightLevelControlServer
153555
+ ];
153556
+ var CoverAsDimmableLightType = DimmableLightDevice.with(
153557
+ ...baseBehaviors
153558
+ );
153559
+ var CoverAsDimmableLightWithBatteryType = DimmableLightDevice.with(
153560
+ ...baseBehaviors,
153561
+ DefaultPowerSourceServer
153562
+ );
153563
+
153511
153564
  // src/matter/endpoints/legacy/cover/behaviors/cover-window-covering-server.ts
153512
153565
  init_dist();
153513
153566
  init_esm();
@@ -153860,7 +153913,7 @@ function adjustPositionForWriting(position, flags2, matterSemantics) {
153860
153913
 
153861
153914
  // src/matter/endpoints/legacy/cover/behaviors/cover-window-covering-server.ts
153862
153915
  var logger206 = Logger.get("CoverWindowCoveringServer");
153863
- var attributes6 = (entity) => entity.attributes;
153916
+ var attributes7 = (entity) => entity.attributes;
153864
153917
  var DEVICE_CLASS_TO_MATTER_TYPE = {
153865
153918
  curtain: {
153866
153919
  type: WindowCovering3.WindowCoveringType.Drapery,
@@ -153896,7 +153949,7 @@ var deviceClassMapping = (entity) => {
153896
153949
  if (typeof raw !== "string") return void 0;
153897
153950
  const mapping = DEVICE_CLASS_TO_MATTER_TYPE[raw.toLowerCase()];
153898
153951
  if (!mapping) return void 0;
153899
- const supportedFeatures = attributes6(entity).supported_features ?? 0;
153952
+ const supportedFeatures = attributes7(entity).supported_features ?? 0;
153900
153953
  const hasLift = (supportedFeatures & CoverSupportedFeatures.support_open) !== 0;
153901
153954
  const hasTilt = (supportedFeatures & CoverSupportedFeatures.support_open_tilt) !== 0;
153902
153955
  if (mapping.type === WindowCovering3.WindowCoveringType.TiltBlindTiltOnly) {
@@ -153946,20 +153999,20 @@ var shouldSwapOpenClose = (agent) => {
153946
153999
  const { featureFlags } = agent.env.get(BridgeDataProvider);
153947
154000
  return featureFlags?.coverSwapOpenClose === true;
153948
154001
  };
153949
- var supportsPositionControl = (agent) => {
154002
+ var supportsPositionControl2 = (agent) => {
153950
154003
  const homeAssistant = agent.get(HomeAssistantEntityBehavior);
153951
- const supportedFeatures = attributes6(homeAssistant.entity.state).supported_features ?? 0;
154004
+ const supportedFeatures = attributes7(homeAssistant.entity.state).supported_features ?? 0;
153952
154005
  return (supportedFeatures & CoverSupportedFeatures.support_set_position) !== 0;
153953
154006
  };
153954
154007
  var supportsTiltPositionControl = (agent) => {
153955
154008
  const homeAssistant = agent.get(HomeAssistantEntityBehavior);
153956
- const supportedFeatures = attributes6(homeAssistant.entity.state).supported_features ?? 0;
154009
+ const supportedFeatures = attributes7(homeAssistant.entity.state).supported_features ?? 0;
153957
154010
  return (supportedFeatures & CoverSupportedFeatures.support_set_tilt_position) !== 0;
153958
154011
  };
153959
154012
  var liftShouldUseTilt = (supportedFeatures) => (supportedFeatures & CoverSupportedFeatures.support_open) === 0 && (supportedFeatures & CoverSupportedFeatures.support_open_tilt) !== 0;
153960
154013
  var liftFallsBackToTilt = (agent) => {
153961
154014
  const homeAssistant = agent.get(HomeAssistantEntityBehavior);
153962
- const supportedFeatures = attributes6(homeAssistant.entity.state).supported_features ?? 0;
154015
+ const supportedFeatures = attributes7(homeAssistant.entity.state).supported_features ?? 0;
153963
154016
  return liftShouldUseTilt(supportedFeatures);
153964
154017
  };
153965
154018
  var openLiftAction = (agent) => ({
@@ -153995,7 +154048,7 @@ var setTiltPositionAction = (position, agent) => {
153995
154048
  };
153996
154049
  var config6 = {
153997
154050
  getCurrentLiftPosition: (entity, agent) => {
153998
- let position = attributes6(entity).current_position;
154051
+ let position = attributes7(entity).current_position;
153999
154052
  if (position == null) {
154000
154053
  const coverState = entity.state;
154001
154054
  position = coverState === CoverDeviceState.closed ? 0 : coverState === CoverDeviceState.open ? 100 : void 0;
@@ -154003,7 +154056,7 @@ var config6 = {
154003
154056
  return position == null ? null : adjustPositionForReading2(position, agent);
154004
154057
  },
154005
154058
  getCurrentTiltPosition: (entity, agent) => {
154006
- let position = attributes6(entity).current_tilt_position;
154059
+ let position = attributes7(entity).current_tilt_position;
154007
154060
  if (position == null) {
154008
154061
  const coverState = entity.state;
154009
154062
  position = coverState === CoverDeviceState.closed ? 0 : coverState === CoverDeviceState.open ? 100 : void 0;
@@ -154033,7 +154086,7 @@ var config6 = {
154033
154086
  if (liftFallsBackToTilt(agent)) {
154034
154087
  return setTiltPositionAction(position, agent);
154035
154088
  }
154036
- if (!supportsPositionControl(agent)) {
154089
+ if (!supportsPositionControl2(agent)) {
154037
154090
  const adjustedPosition = adjustPositionForWriting2(position, agent);
154038
154091
  const shouldOpen = adjustedPosition != null && adjustedPosition >= 50;
154039
154092
  const swapped = shouldSwapOpenClose(agent);
@@ -154080,7 +154133,7 @@ var CoverDeviceType = (supportedFeatures, hasBattery, entityId) => {
154080
154133
  logger207.info(
154081
154134
  `[${entityId}] Creating WindowCovering with features: [${[...features3].join(", ")}], supported_features=${supportedFeatures}`
154082
154135
  );
154083
- const baseBehaviors = [
154136
+ const baseBehaviors2 = [
154084
154137
  BasicInformationServer2,
154085
154138
  IdentifyServer2,
154086
154139
  HomeAssistantEntityBehavior,
@@ -154088,16 +154141,16 @@ var CoverDeviceType = (supportedFeatures, hasBattery, entityId) => {
154088
154141
  ];
154089
154142
  if (hasBattery) {
154090
154143
  return WindowCoveringDevice.with(
154091
- ...baseBehaviors,
154144
+ ...baseBehaviors2,
154092
154145
  DefaultPowerSourceServer
154093
154146
  );
154094
154147
  }
154095
- return WindowCoveringDevice.with(...baseBehaviors);
154148
+ return WindowCoveringDevice.with(...baseBehaviors2);
154096
154149
  };
154097
154150
  function CoverDevice(homeAssistantEntity) {
154098
154151
  const entityId = homeAssistantEntity.entity.entity_id;
154099
- const attributes8 = homeAssistantEntity.entity.state.attributes;
154100
- const hasBatteryAttr = attributes8.battery_level != null || attributes8.battery != null;
154152
+ const attributes9 = homeAssistantEntity.entity.state.attributes;
154153
+ const hasBatteryAttr = attributes9.battery_level != null || attributes9.battery != null;
154101
154154
  const hasBatteryEntity = !!homeAssistantEntity.mapping?.batteryEntity;
154102
154155
  const hasBattery = hasBatteryAttr || hasBatteryEntity;
154103
154156
  if (hasBattery) {
@@ -154109,8 +154162,13 @@ function CoverDevice(homeAssistantEntity) {
154109
154162
  `[${entityId}] Creating cover without battery (batteryAttr=${hasBatteryAttr}, batteryEntity=${homeAssistantEntity.mapping?.batteryEntity ?? "none"})`
154110
154163
  );
154111
154164
  }
154165
+ if (homeAssistantEntity.mapping?.coverExposeAsDimmableLight) {
154166
+ logger207.info(`[${entityId}] Exposing cover as a Dimmable Light (#372)`);
154167
+ const type = hasBattery ? CoverAsDimmableLightWithBatteryType : CoverAsDimmableLightType;
154168
+ return type.set({ homeAssistantEntity });
154169
+ }
154112
154170
  return CoverDeviceType(
154113
- attributes8.supported_features ?? 0,
154171
+ attributes9.supported_features ?? 0,
154114
154172
  hasBattery,
154115
154173
  entityId
154116
154174
  ).set({
@@ -154434,9 +154492,9 @@ function EventDevice(homeAssistantEntity) {
154434
154492
  init_dist();
154435
154493
  init_home_assistant_entity_behavior();
154436
154494
  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;
154495
+ const attributes9 = homeAssistantEntity.entity.state.attributes;
154496
+ const supportedFeatures = attributes9.supported_features ?? 0;
154497
+ const hasBatteryAttr = attributes9.battery_level != null || attributes9.battery != null;
154440
154498
  const hasBatteryEntity = !!homeAssistantEntity.mapping?.batteryEntity;
154441
154499
  const hasBattery = hasBatteryAttr || hasBatteryEntity;
154442
154500
  const hasSetSpeed = testBit(supportedFeatures, FanDeviceFeature.SET_SPEED);
@@ -154444,7 +154502,7 @@ function FanDevice2(homeAssistantEntity) {
154444
154502
  supportedFeatures,
154445
154503
  FanDeviceFeature.PRESET_MODE
154446
154504
  );
154447
- const presetModes = attributes8.preset_modes ?? [];
154505
+ const presetModes = attributes9.preset_modes ?? [];
154448
154506
  const speedPresets = presetModes.filter((m) => m.toLowerCase() !== "auto");
154449
154507
  if (!hasSetSpeed && speedPresets.length === 0) {
154450
154508
  const onOffDevice = hasBattery ? OnOffPlugInUnitDevice.with(
@@ -154616,10 +154674,10 @@ var HumidifierWithAutoAndSensor = FanDevice.with(
154616
154674
  HumidifierHumidityMeasurementServer
154617
154675
  );
154618
154676
  function HumidifierDevice(homeAssistantEntity) {
154619
- const attributes8 = homeAssistantEntity.entity.state.attributes;
154620
- const availableModes = attributes8.available_modes ?? [];
154677
+ const attributes9 = homeAssistantEntity.entity.state.attributes;
154678
+ const availableModes = attributes9.available_modes ?? [];
154621
154679
  const supportsAuto = availableModes.some((m) => m.toLowerCase() === "auto");
154622
- const hasHumiditySensor = attributes8.current_humidity != null;
154680
+ const hasHumiditySensor = attributes9.current_humidity != null;
154623
154681
  if (supportsAuto && hasHumiditySensor) {
154624
154682
  return HumidifierWithAutoAndSensor.set({ homeAssistantEntity });
154625
154683
  }
@@ -155405,11 +155463,11 @@ function LawnMowerDevice(homeAssistantEntity) {
155405
155463
  if (homeAssistantEntity.entity.state === void 0) {
155406
155464
  return void 0;
155407
155465
  }
155408
- const attributes8 = homeAssistantEntity.entity.state.attributes;
155466
+ const attributes9 = homeAssistantEntity.entity.state.attributes;
155409
155467
  let device = LawnMowerEndpointType.with(
155410
155468
  createLawnMowerRvcRunModeServer()
155411
155469
  ).set({ homeAssistantEntity });
155412
- const hasBattery = homeAssistantEntity.mapping?.batteryEntity != null || attributes8.battery_level != null || attributes8.battery != null;
155470
+ const hasBattery = homeAssistantEntity.mapping?.batteryEntity != null || attributes9.battery_level != null || attributes9.battery != null;
155413
155471
  if (hasBattery) {
155414
155472
  device = device.with(DefaultPowerSourceServer);
155415
155473
  }
@@ -155930,8 +155988,8 @@ var colorModes = [
155930
155988
  LightDeviceColorMode.RGBWW
155931
155989
  ];
155932
155990
  function LightDevice(homeAssistantEntity) {
155933
- const attributes8 = homeAssistantEntity.entity.state.attributes;
155934
- const supportedColorModes = attributes8.supported_color_modes ?? [];
155991
+ const attributes9 = homeAssistantEntity.entity.state.attributes;
155992
+ const supportedColorModes = attributes9.supported_color_modes ?? [];
155935
155993
  const supportsBrightness = supportedColorModes.some(
155936
155994
  (mode) => brightnessModes.includes(mode)
155937
155995
  );
@@ -155941,7 +155999,7 @@ function LightDevice(homeAssistantEntity) {
155941
155999
  const supportsColorTemperature = supportedColorModes.includes(
155942
156000
  LightDeviceColorMode.COLOR_TEMP
155943
156001
  );
155944
- const hasBatteryAttr = attributes8.battery_level != null || attributes8.battery != null;
156002
+ const hasBatteryAttr = attributes9.battery_level != null || attributes9.battery != null;
155945
156003
  const hasBatteryEntity = !!homeAssistantEntity.mapping?.batteryEntity;
155946
156004
  const hasBattery = hasBatteryAttr || hasBatteryEntity;
155947
156005
  const deviceType = supportsColorControl || supportsColorTemperature ? ExtendedColorLightType(
@@ -156616,8 +156674,8 @@ var MediaPlayerKeypadInputServer = class extends KeypadInputServer {
156616
156674
  if (!homeAssistant.isAvailable) {
156617
156675
  return { status: KeypadInput3.Status.InvalidKeyInCurrentState };
156618
156676
  }
156619
- const attributes8 = homeAssistant.entity.state.attributes;
156620
- const features3 = attributes8.supported_features ?? 0;
156677
+ const attributes9 = homeAssistant.entity.state.attributes;
156678
+ const features3 = attributes9.supported_features ?? 0;
156621
156679
  const action = this.mapKeyToAction(request.keyCode, features3);
156622
156680
  if (!action) {
156623
156681
  logger214.debug(
@@ -156873,8 +156931,8 @@ var VideoPlayerEndpointType = BasicVideoPlayerDevice.with(
156873
156931
  MediaPlayerKeypadInputServer
156874
156932
  );
156875
156933
  function VideoPlayerDevice(homeAssistantEntity) {
156876
- const attributes8 = homeAssistantEntity.entity.state.attributes;
156877
- const supportedFeatures = attributes8.supported_features ?? 0;
156934
+ const attributes9 = homeAssistantEntity.entity.state.attributes;
156935
+ const supportedFeatures = attributes9.supported_features ?? 0;
156878
156936
  let device = VideoPlayerEndpointType;
156879
156937
  const supportsPower = testBit(supportedFeatures, MediaPlayerDeviceFeature.TURN_ON) && testBit(supportedFeatures, MediaPlayerDeviceFeature.TURN_OFF);
156880
156938
  if (supportsPower) {
@@ -157033,9 +157091,9 @@ function SpeakerLevelControlServer(config11) {
157033
157091
  // src/matter/endpoints/legacy/media-player/behaviors/media-player-level-control-server.ts
157034
157092
  var MediaPlayerLevelControlServer = SpeakerLevelControlServer({
157035
157093
  getValuePercent: (state) => {
157036
- const attributes8 = state.attributes;
157037
- if (attributes8.volume_level != null) {
157038
- return attributes8.volume_level;
157094
+ const attributes9 = state.attributes;
157095
+ if (attributes9.volume_level != null) {
157096
+ return attributes9.volume_level;
157039
157097
  }
157040
157098
  return 0;
157041
157099
  },
@@ -157069,15 +157127,15 @@ var SpeakerEndpointType = SpeakerDevice.with(
157069
157127
  HomeAssistantEntityBehavior
157070
157128
  );
157071
157129
  function MediaPlayerDevice(homeAssistantEntity) {
157072
- const attributes8 = homeAssistantEntity.entity.state.attributes;
157073
- if (attributes8.device_class === MediaPlayerDeviceClass.Tv) {
157130
+ const attributes9 = homeAssistantEntity.entity.state.attributes;
157131
+ if (attributes9.device_class === MediaPlayerDeviceClass.Tv) {
157074
157132
  return VideoPlayerDevice(homeAssistantEntity);
157075
157133
  }
157076
157134
  return SpeakerMediaPlayerDevice(homeAssistantEntity);
157077
157135
  }
157078
157136
  function SpeakerMediaPlayerDevice(homeAssistantEntity) {
157079
- const attributes8 = homeAssistantEntity.entity.state.attributes;
157080
- const supportedFeatures = attributes8.supported_features ?? 0;
157137
+ const attributes9 = homeAssistantEntity.entity.state.attributes;
157138
+ const supportedFeatures = attributes9.supported_features ?? 0;
157081
157139
  let device = SpeakerEndpointType;
157082
157140
  const supportsPower = testBit(supportedFeatures, MediaPlayerDeviceFeature.TURN_ON) && testBit(supportedFeatures, MediaPlayerDeviceFeature.TURN_OFF);
157083
157141
  const supportsMute = testBit(
@@ -157331,8 +157389,8 @@ var AirQualitySensorServerImpl = class extends AirQualityServerWithFeatures {
157331
157389
  return;
157332
157390
  }
157333
157391
  const state = entity.state.state;
157334
- const attributes8 = entity.state.attributes;
157335
- const deviceClass = attributes8.device_class;
157392
+ const attributes9 = entity.state.attributes;
157393
+ const deviceClass = attributes9.device_class;
157336
157394
  let airQuality = AirQuality3.AirQualityEnum.Unknown;
157337
157395
  if (state != null && !Number.isNaN(+state)) {
157338
157396
  const value = +state;
@@ -157664,12 +157722,12 @@ init_home_assistant_entity_behavior();
157664
157722
  var flowSensorConfig = {
157665
157723
  getValue(entity) {
157666
157724
  const state = entity.state;
157667
- const attributes8 = entity.attributes;
157725
+ const attributes9 = entity.attributes;
157668
157726
  const flow = state == null || Number.isNaN(+state) ? null : +state;
157669
157727
  if (flow == null) {
157670
157728
  return void 0;
157671
157729
  }
157672
- const unit = attributes8.unit_of_measurement?.toLowerCase();
157730
+ const unit = attributes9.unit_of_measurement?.toLowerCase();
157673
157731
  if (unit === "l/min") {
157674
157732
  return flow * 0.06;
157675
157733
  }
@@ -158147,12 +158205,12 @@ init_home_assistant_entity_behavior();
158147
158205
  var pressureSensorConfig = {
158148
158206
  getValue(entity) {
158149
158207
  const state = entity.state;
158150
- const attributes8 = entity.attributes;
158208
+ const attributes9 = entity.attributes;
158151
158209
  const pressure = state == null || Number.isNaN(+state) ? null : +state;
158152
158210
  if (pressure == null) {
158153
158211
  return void 0;
158154
158212
  }
158155
- return convertPressureToHpa(pressure, attributes8.unit_of_measurement);
158213
+ return convertPressureToHpa(pressure, attributes9.unit_of_measurement);
158156
158214
  }
158157
158215
  };
158158
158216
  var PressureSensorType = PressureSensorDevice.with(
@@ -158261,14 +158319,14 @@ var temperatureSensorConfig = {
158261
158319
  getValue(entity, agent) {
158262
158320
  const fallbackUnit = agent.env.get(HomeAssistantConfig).unitSystem.temperature;
158263
158321
  const state = entity.state;
158264
- const attributes8 = entity.attributes;
158322
+ const attributes9 = entity.attributes;
158265
158323
  const temperature3 = state == null || Number.isNaN(+state) ? null : +state;
158266
158324
  if (temperature3 == null) {
158267
158325
  return void 0;
158268
158326
  }
158269
158327
  return Temperature.withUnit(
158270
158328
  temperature3,
158271
- attributes8.unit_of_measurement ?? fallbackUnit
158329
+ attributes9.unit_of_measurement ?? fallbackUnit
158272
158330
  );
158273
158331
  }
158274
158332
  };
@@ -158312,8 +158370,8 @@ var TvocConcentrationMeasurementServerBase = TotalVolatileOrganicCompoundsConcen
158312
158370
  ConcentrationMeasurement3.Feature.NumericMeasurement
158313
158371
  );
158314
158372
  function getMeasurementUnit(entity) {
158315
- const attributes8 = entity.state.attributes;
158316
- if (attributes8.device_class === SensorDeviceClass.volatile_organic_compounds_parts) {
158373
+ const attributes9 = entity.state.attributes;
158374
+ if (attributes9.device_class === SensorDeviceClass.volatile_organic_compounds_parts) {
158317
158375
  return ConcentrationMeasurement3.MeasurementUnit.Ppb;
158318
158376
  }
158319
158377
  return ConcentrationMeasurement3.MeasurementUnit.Ugm3;
@@ -158398,8 +158456,8 @@ var TvocAirQualityServer = class extends TvocAirQualityServerBase {
158398
158456
  return;
158399
158457
  }
158400
158458
  const state = entity.state.state;
158401
- const attributes8 = entity.state.attributes;
158402
- const deviceClass = attributes8.device_class;
158459
+ const attributes9 = entity.state.attributes;
158460
+ const deviceClass = attributes9.device_class;
158403
158461
  let airQuality = AirQuality3.AirQualityEnum.Unknown;
158404
158462
  logger216.debug(
158405
158463
  `[${entity.entity_id}] TVOC update: state="${state}", device_class="${deviceClass}"`
@@ -158731,14 +158789,14 @@ var temperatureConfig3 = {
158731
158789
  getValue(entity, agent) {
158732
158790
  const fallbackUnit = agent.env.get(HomeAssistantConfig).unitSystem.temperature;
158733
158791
  const state = entity.state;
158734
- const attributes8 = entity.attributes;
158792
+ const attributes9 = entity.attributes;
158735
158793
  const temperature3 = state == null || Number.isNaN(+state) ? null : +state;
158736
158794
  if (temperature3 == null) {
158737
158795
  return void 0;
158738
158796
  }
158739
158797
  return Temperature.withUnit(
158740
158798
  temperature3,
158741
- attributes8.unit_of_measurement ?? fallbackUnit
158799
+ attributes9.unit_of_measurement ?? fallbackUnit
158742
158800
  );
158743
158801
  }
158744
158802
  };
@@ -158766,8 +158824,8 @@ var pressureConfig2 = {
158766
158824
  if (state) {
158767
158825
  const pressure = state.state == null || Number.isNaN(+state.state) ? null : +state.state;
158768
158826
  if (pressure != null) {
158769
- const attributes8 = state.attributes;
158770
- return convertPressureToHpa(pressure, attributes8.unit_of_measurement);
158827
+ const attributes9 = state.attributes;
158828
+ return convertPressureToHpa(pressure, attributes9.unit_of_measurement);
158771
158829
  }
158772
158830
  }
158773
158831
  }
@@ -158827,14 +158885,14 @@ var temperatureConfig4 = {
158827
158885
  getValue(entity, agent) {
158828
158886
  const fallbackUnit = agent.env.get(HomeAssistantConfig).unitSystem.temperature;
158829
158887
  const state = entity.state;
158830
- const attributes8 = entity.attributes;
158888
+ const attributes9 = entity.attributes;
158831
158889
  const temperature3 = state == null || Number.isNaN(+state) ? null : +state;
158832
158890
  if (temperature3 == null) {
158833
158891
  return void 0;
158834
158892
  }
158835
158893
  return Temperature.withUnit(
158836
158894
  temperature3,
158837
- attributes8.unit_of_measurement ?? fallbackUnit
158895
+ attributes9.unit_of_measurement ?? fallbackUnit
158838
158896
  );
158839
158897
  }
158840
158898
  };
@@ -158848,8 +158906,8 @@ var pressureConfig3 = {
158848
158906
  if (state) {
158849
158907
  const pressure = state.state == null || Number.isNaN(+state.state) ? null : +state.state;
158850
158908
  if (pressure != null) {
158851
- const attributes8 = state.attributes;
158852
- return convertPressureToHpa(pressure, attributes8.unit_of_measurement);
158909
+ const attributes9 = state.attributes;
158910
+ return convertPressureToHpa(pressure, attributes9.unit_of_measurement);
158853
158911
  }
158854
158912
  }
158855
158913
  }
@@ -158891,8 +158949,8 @@ var tempDt = { deviceType: DeviceTypeId(770), revision: 2 };
158891
158949
  var humidityDt = { deviceType: DeviceTypeId(775), revision: 2 };
158892
158950
  var pressureDt = { deviceType: DeviceTypeId(773), revision: 2 };
158893
158951
  function SensorDevice(homeAssistantEntity) {
158894
- const attributes8 = homeAssistantEntity.entity.state.attributes;
158895
- const deviceClass = attributes8.device_class;
158952
+ const attributes9 = homeAssistantEntity.entity.state.attributes;
158953
+ const deviceClass = attributes9.device_class;
158896
158954
  const mapping = homeAssistantEntity.mapping;
158897
158955
  if (deviceClass === SensorDeviceClass.temperature) {
158898
158956
  const hasHumidity = !!mapping?.humidityEntity;
@@ -159209,9 +159267,9 @@ var UNNAMED_ROOM_PATTERN = /^(Room|Raum|Zimmer|Chambre|Habitación|Stanza)\s+\d+
159209
159267
  function isUnnamedRoom(roomName) {
159210
159268
  return UNNAMED_ROOM_PATTERN.test(roomName.trim());
159211
159269
  }
159212
- function parseVacuumRooms(attributes8, includeUnnamedRooms = false) {
159270
+ function parseVacuumRooms(attributes9, includeUnnamedRooms = false) {
159213
159271
  floorCounter = 0;
159214
- const sources2 = [attributes8.rooms, attributes8.segments, attributes8.room_list];
159272
+ const sources2 = [attributes9.rooms, attributes9.segments, attributes9.room_list];
159215
159273
  for (const source of sources2) {
159216
159274
  let rooms = parseRoomData(source);
159217
159275
  if (rooms.length > 0) {
@@ -159221,7 +159279,7 @@ function parseVacuumRooms(attributes8, includeUnnamedRooms = false) {
159221
159279
  return rooms;
159222
159280
  }
159223
159281
  }
159224
- let mappingRooms = parseRoomMapping(attributes8.room_mapping);
159282
+ let mappingRooms = parseRoomMapping(attributes9.room_mapping);
159225
159283
  if (mappingRooms.length > 0) {
159226
159284
  if (!includeUnnamedRooms) {
159227
159285
  mappingRooms = mappingRooms.filter((room) => !isUnnamedRoom(room.name));
@@ -159255,11 +159313,11 @@ function getRoomIdFromMode(mode) {
159255
159313
  }
159256
159314
  return mode - ROOM_MODE_BASE2;
159257
159315
  }
159258
- function isXiaomiMiotVacuum(attributes8) {
159259
- if (Array.isArray(attributes8.room_mapping) && attributes8.room_mapping.length > 0) {
159316
+ function isXiaomiMiotVacuum(attributes9) {
159317
+ if (Array.isArray(attributes9.room_mapping) && attributes9.room_mapping.length > 0) {
159260
159318
  return true;
159261
159319
  }
159262
- const sources2 = [attributes8.rooms, attributes8.segments, attributes8.room_list];
159320
+ const sources2 = [attributes9.rooms, attributes9.segments, attributes9.room_list];
159263
159321
  for (const source of sources2) {
159264
159322
  if (Array.isArray(source) && source.length > 0 && typeof source[0] === "object" && source[0] !== null && "id" in source[0]) {
159265
159323
  return true;
@@ -159267,8 +159325,8 @@ function isXiaomiMiotVacuum(attributes8) {
159267
159325
  }
159268
159326
  return false;
159269
159327
  }
159270
- function isDreameVacuum(attributes8) {
159271
- const roomsData = attributes8.rooms;
159328
+ function isDreameVacuum(attributes9) {
159329
+ const roomsData = attributes9.rooms;
159272
159330
  if (!roomsData || typeof roomsData !== "object" || Array.isArray(roomsData)) {
159273
159331
  return false;
159274
159332
  }
@@ -159279,8 +159337,8 @@ function isDreameVacuum(attributes8) {
159279
159337
  }
159280
159338
  return false;
159281
159339
  }
159282
- function isRoborockVacuum(attributes8) {
159283
- const roomsData = attributes8.rooms;
159340
+ function isRoborockVacuum(attributes9) {
159341
+ const roomsData = attributes9.rooms;
159284
159342
  if (!roomsData || typeof roomsData !== "object" || Array.isArray(roomsData)) {
159285
159343
  return false;
159286
159344
  }
@@ -159290,8 +159348,8 @@ function isRoborockVacuum(attributes8) {
159290
159348
  ([key, value]) => /^\d+$/.test(key) && typeof value === "string"
159291
159349
  );
159292
159350
  }
159293
- function isEcovacsVacuum(attributes8) {
159294
- const roomsData = attributes8.rooms;
159351
+ function isEcovacsVacuum(attributes9) {
159352
+ const roomsData = attributes9.rooms;
159295
159353
  if (!roomsData || typeof roomsData !== "object" || Array.isArray(roomsData)) {
159296
159354
  return false;
159297
159355
  }
@@ -159474,9 +159532,9 @@ function roomsToAreas(rooms, maps = []) {
159474
159532
  }
159475
159533
  }));
159476
159534
  }
159477
- function buildRoomNameLookup(attributes8) {
159535
+ function buildRoomNameLookup(attributes9) {
159478
159536
  const lookup = /* @__PURE__ */ new Map();
159479
- const mapping = attributes8?.room_mapping;
159537
+ const mapping = attributes9?.room_mapping;
159480
159538
  if (!Array.isArray(mapping)) return lookup;
159481
159539
  for (const entry of mapping) {
159482
159540
  if (Array.isArray(entry) && entry.length >= 3 && (typeof entry[0] === "number" || typeof entry[0] === "string") && typeof entry[2] === "string") {
@@ -159488,8 +159546,8 @@ function buildRoomNameLookup(attributes8) {
159488
159546
  }
159489
159547
  return lookup;
159490
159548
  }
159491
- function buttonEntitiesToRooms(entityIds, attributes8) {
159492
- const nameLookup = buildRoomNameLookup(attributes8);
159549
+ function buttonEntitiesToRooms(entityIds, attributes9) {
159550
+ const nameLookup = buildRoomNameLookup(attributes9);
159493
159551
  return entityIds.map((entityId) => {
159494
159552
  const segmentMatch = entityId.match(/segment[_-]?(\d+)$/);
159495
159553
  if (segmentMatch && nameLookup.size > 0) {
@@ -159509,15 +159567,15 @@ function buttonEntitiesToRooms(entityIds, attributes8) {
159509
159567
  };
159510
159568
  });
159511
159569
  }
159512
- function createVacuumServiceAreaServer(attributes8, roomEntities, includeUnnamedRooms = false) {
159570
+ function createVacuumServiceAreaServer(attributes9, roomEntities, includeUnnamedRooms = false) {
159513
159571
  let rooms;
159514
159572
  if (roomEntities && roomEntities.length > 0) {
159515
- rooms = buttonEntitiesToRooms(roomEntities, attributes8);
159573
+ rooms = buttonEntitiesToRooms(roomEntities, attributes9);
159516
159574
  logger221.info(
159517
159575
  `Using ${rooms.length} button entities as rooms: ${rooms.map((r) => r.name).join(", ")}`
159518
159576
  );
159519
159577
  } else {
159520
- rooms = parseVacuumRooms(attributes8, includeUnnamedRooms);
159578
+ rooms = parseVacuumRooms(attributes9, includeUnnamedRooms);
159521
159579
  if (rooms.length > 0) {
159522
159580
  logger221.info(
159523
159581
  `Using ${rooms.length} rooms from attributes: ${rooms.map((r) => r.name).join(", ")}`
@@ -159627,7 +159685,7 @@ function buildValetudoSegmentAction(vacuumEntityId, segmentIds, valetudoIdentifi
159627
159685
  }
159628
159686
  };
159629
159687
  }
159630
- function buildSupportedModes2(attributes8, includeUnnamedRooms = false, customAreas, disableRoomModes = false) {
159688
+ function buildSupportedModes2(attributes9, includeUnnamedRooms = false, customAreas, disableRoomModes = false) {
159631
159689
  const modes = [
159632
159690
  {
159633
159691
  label: "Idle",
@@ -159656,7 +159714,7 @@ function buildSupportedModes2(attributes8, includeUnnamedRooms = false, customAr
159656
159714
  }
159657
159715
  }
159658
159716
  } else {
159659
- const rooms = parseVacuumRooms(attributes8, includeUnnamedRooms);
159717
+ const rooms = parseVacuumRooms(attributes9, includeUnnamedRooms);
159660
159718
  rooms.sort((a, b) => a.name.localeCompare(b.name));
159661
159719
  for (const room of rooms) {
159662
159720
  const modeValue = getRoomModeValue(room);
@@ -159785,11 +159843,11 @@ var vacuumRvcRunModeConfig = {
159785
159843
  return isCleaning ? 1 /* Cleaning */ : 0 /* Idle */;
159786
159844
  },
159787
159845
  getSupportedModes: (entity, agent) => {
159788
- const attributes8 = entity.attributes;
159846
+ const attributes9 = entity.attributes;
159789
159847
  const mapping = agent.get(HomeAssistantEntityBehavior).state.mapping;
159790
159848
  const customAreas = mapping?.customServiceAreas;
159791
159849
  return buildSupportedModes2(
159792
- attributes8,
159850
+ attributes9,
159793
159851
  false,
159794
159852
  customAreas && customAreas.length > 0 ? customAreas : void 0,
159795
159853
  mapping?.disableCustomAreaRoomModes
@@ -159803,7 +159861,7 @@ var vacuumRvcRunModeConfig = {
159803
159861
  if (selectedAreas.length > 0) {
159804
159862
  const homeAssistant = agent.get(HomeAssistantEntityBehavior);
159805
159863
  const entity = homeAssistant.entity;
159806
- const attributes8 = entity.state.attributes;
159864
+ const attributes9 = entity.state.attributes;
159807
159865
  const session = getSession(homeAssistant.endpoint);
159808
159866
  const customAreas = homeAssistant.state.mapping?.customServiceAreas;
159809
159867
  if (customAreas && customAreas.length > 0) {
@@ -159853,7 +159911,7 @@ var vacuumRvcRunModeConfig = {
159853
159911
  homeAssistant.state.mapping?.valetudoIdentifier
159854
159912
  );
159855
159913
  }
159856
- const rooms = parseVacuumRooms(attributes8);
159914
+ const rooms = parseVacuumRooms(attributes9);
159857
159915
  const roomIds = [];
159858
159916
  let targetMapName;
159859
159917
  for (const areaId of selectedAreas) {
@@ -159869,7 +159927,7 @@ var vacuumRvcRunModeConfig = {
159869
159927
  logger222.info(
159870
159928
  `Starting cleaning with selected areas: ${roomIds.join(", ")}`
159871
159929
  );
159872
- if (isDreameVacuum(attributes8)) {
159930
+ if (isDreameVacuum(attributes9)) {
159873
159931
  if (targetMapName) {
159874
159932
  const vacName = vacuumEntityId.replace("vacuum.", "");
159875
159933
  const selectedMapEntity = `select.${vacName}_selected_map`;
@@ -159889,7 +159947,7 @@ var vacuumRvcRunModeConfig = {
159889
159947
  }
159890
159948
  };
159891
159949
  }
159892
- if (isRoborockVacuum(attributes8) || isXiaomiMiotVacuum(attributes8)) {
159950
+ if (isRoborockVacuum(attributes9) || isXiaomiMiotVacuum(attributes9)) {
159893
159951
  return {
159894
159952
  action: "vacuum.send_command",
159895
159953
  data: {
@@ -159898,7 +159956,7 @@ var vacuumRvcRunModeConfig = {
159898
159956
  }
159899
159957
  };
159900
159958
  }
159901
- if (isEcovacsVacuum(attributes8)) {
159959
+ if (isEcovacsVacuum(attributes9)) {
159902
159960
  const roomIdStr = roomIds.join(",");
159903
159961
  logger222.info(
159904
159962
  `Ecovacs vacuum: Using spot_area for rooms: ${roomIdStr}`
@@ -159936,7 +159994,7 @@ var vacuumRvcRunModeConfig = {
159936
159994
  cleanRoom: (roomMode, agent) => {
159937
159995
  const homeAssistant = agent.get(HomeAssistantEntityBehavior);
159938
159996
  const entity = homeAssistant.entity;
159939
- const attributes8 = entity.state.attributes;
159997
+ const attributes9 = entity.state.attributes;
159940
159998
  logger222.info(`cleanRoom called: roomMode=${roomMode}`);
159941
159999
  const cleanAreaRooms = homeAssistant.state.mapping?.cleanAreaRooms;
159942
160000
  if (cleanAreaRooms && cleanAreaRooms.length > 0) {
@@ -159982,7 +160040,7 @@ var vacuumRvcRunModeConfig = {
159982
160040
  homeAssistant.state.mapping?.valetudoIdentifier
159983
160041
  );
159984
160042
  }
159985
- const rooms = parseVacuumRooms(attributes8);
160043
+ const rooms = parseVacuumRooms(attributes9);
159986
160044
  const numericIdFromMode = getRoomIdFromMode(roomMode);
159987
160045
  logger222.info(
159988
160046
  `cleanRoom: numericIdFromMode=${numericIdFromMode}, available rooms: ${JSON.stringify(rooms.map((r) => ({ id: r.id, name: r.name, modeValue: getRoomModeValue(r) })))}`
@@ -159990,7 +160048,7 @@ var vacuumRvcRunModeConfig = {
159990
160048
  const room = rooms.find((r) => getRoomModeValue(r) === roomMode);
159991
160049
  if (room) {
159992
160050
  const commandId3 = room.originalId ?? room.id;
159993
- if (isDreameVacuum(attributes8)) {
160051
+ if (isDreameVacuum(attributes9)) {
159994
160052
  if (room.mapName) {
159995
160053
  const vacuumName = vacuumEntityId.replace("vacuum.", "");
159996
160054
  const selectedMapEntity = `select.${vacuumName}_selected_map`;
@@ -160013,7 +160071,7 @@ var vacuumRvcRunModeConfig = {
160013
160071
  }
160014
160072
  };
160015
160073
  }
160016
- if (isRoborockVacuum(attributes8) || isXiaomiMiotVacuum(attributes8)) {
160074
+ if (isRoborockVacuum(attributes9) || isXiaomiMiotVacuum(attributes9)) {
160017
160075
  logger222.debug(
160018
160076
  `Using vacuum.send_command with app_segment_clean for room ${room.name} (commandId: ${commandId3}, id: ${room.id})`
160019
160077
  );
@@ -160025,7 +160083,7 @@ var vacuumRvcRunModeConfig = {
160025
160083
  }
160026
160084
  };
160027
160085
  }
160028
- if (isEcovacsVacuum(attributes8)) {
160086
+ if (isEcovacsVacuum(attributes9)) {
160029
160087
  const roomIdStr = String(commandId3);
160030
160088
  logger222.info(
160031
160089
  `Ecovacs vacuum: Using spot_area for room ${room.name} (id: ${roomIdStr})`
@@ -160049,12 +160107,12 @@ var vacuumRvcRunModeConfig = {
160049
160107
  return { action: "vacuum.start" };
160050
160108
  }
160051
160109
  };
160052
- function createVacuumRvcRunModeServer(attributes8, includeUnnamedRooms = false, customAreas, disableRoomModes = false) {
160053
- const allRooms = parseVacuumRooms(attributes8, true);
160054
- const rooms = includeUnnamedRooms ? allRooms : parseVacuumRooms(attributes8, false);
160110
+ function createVacuumRvcRunModeServer(attributes9, includeUnnamedRooms = false, customAreas, disableRoomModes = false) {
160111
+ const allRooms = parseVacuumRooms(attributes9, true);
160112
+ const rooms = includeUnnamedRooms ? allRooms : parseVacuumRooms(attributes9, false);
160055
160113
  const filteredCount = allRooms.length - rooms.length;
160056
160114
  const supportedModes2 = buildSupportedModes2(
160057
- attributes8,
160115
+ attributes9,
160058
160116
  includeUnnamedRooms,
160059
160117
  customAreas,
160060
160118
  disableRoomModes
@@ -160073,7 +160131,7 @@ function createVacuumRvcRunModeServer(attributes8, includeUnnamedRooms = false,
160073
160131
  }
160074
160132
  if (allRooms.length === 0) {
160075
160133
  logger222.debug(
160076
- `No rooms found. Attributes: rooms=${JSON.stringify(attributes8.rooms)}, segments=${JSON.stringify(attributes8.segments)}, room_list=${attributes8.room_list}`
160134
+ `No rooms found. Attributes: rooms=${JSON.stringify(attributes9.rooms)}, segments=${JSON.stringify(attributes9.segments)}, room_list=${attributes9.room_list}`
160077
160135
  );
160078
160136
  }
160079
160137
  return RvcRunModeServer2(vacuumRvcRunModeConfig, {
@@ -160137,8 +160195,8 @@ var VacuumPowerSourceServer = PowerSourceServer2({
160137
160195
  return Math.max(0, Math.min(100, battery));
160138
160196
  }
160139
160197
  }
160140
- const attributes8 = entity.attributes;
160141
- const batteryLevel = attributes8.battery_level ?? attributes8.battery;
160198
+ const attributes9 = entity.attributes;
160199
+ const batteryLevel = attributes9.battery_level ?? attributes9.battery;
160142
160200
  if (batteryLevel == null) {
160143
160201
  return null;
160144
160202
  }
@@ -160597,11 +160655,11 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
160597
160655
  const hasCleanTypes = !!cleaningModeOptions && cleaningModeOptions.length > 0;
160598
160656
  return {
160599
160657
  getCurrentMode: (entity, agent) => {
160600
- const attributes8 = entity.attributes;
160658
+ const attributes9 = entity.attributes;
160601
160659
  let cleanType = 0 /* Sweeping */;
160602
160660
  if (hasCleanTypes) {
160603
- if (attributes8.cleaning_mode) {
160604
- cleanType = parseCleanType(attributes8.cleaning_mode);
160661
+ if (attributes9.cleaning_mode) {
160662
+ cleanType = parseCleanType(attributes9.cleaning_mode);
160605
160663
  } else {
160606
160664
  const selectEntityId = getCleaningModeSelectEntity(agent);
160607
160665
  const { state } = readSelectEntity(selectEntityId, agent);
@@ -160617,7 +160675,7 @@ function createCleanModeConfig(fanSpeedList, mopIntensityList, cleaningModeOptio
160617
160675
  speedState = sel.state;
160618
160676
  entityOptions = sel.options;
160619
160677
  } else {
160620
- speedState = attributes8.fan_speed ?? void 0;
160678
+ speedState = attributes9.fan_speed ?? void 0;
160621
160679
  }
160622
160680
  let speedMode = fanSpeedToModeId(speedState, fanSpeedList);
160623
160681
  if (speedMode === void 0 && speedState && entityOptions) {
@@ -160852,12 +160910,12 @@ function createDefaultRvcCleanModeServer() {
160852
160910
  currentMode: MODE_VACUUM
160853
160911
  });
160854
160912
  }
160855
- function supportsCleaningModes(attributes8) {
160856
- return isDreameVacuum(attributes8) || isEcovacsVacuum(attributes8);
160913
+ function supportsCleaningModes(attributes9) {
160914
+ return isDreameVacuum(attributes9) || isEcovacsVacuum(attributes9);
160857
160915
  }
160858
- function resolveFanSpeedList(attributes8, suctionLevelEntity) {
160859
- if (attributes8.fan_speed_list && attributes8.fan_speed_list.length > 1) {
160860
- return attributes8.fan_speed_list;
160916
+ function resolveFanSpeedList(attributes9, suctionLevelEntity) {
160917
+ if (attributes9.fan_speed_list && attributes9.fan_speed_list.length > 1) {
160918
+ return attributes9.fan_speed_list;
160861
160919
  }
160862
160920
  if (suctionLevelEntity) {
160863
160921
  return ["quiet", "standard", "strong"];
@@ -160966,7 +161024,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
160966
161024
  return void 0;
160967
161025
  }
160968
161026
  const entityId = homeAssistantEntity.entity.entity_id;
160969
- const attributes8 = homeAssistantEntity.entity.state.attributes;
161027
+ const attributes9 = homeAssistantEntity.entity.state.attributes;
160970
161028
  const customAreas = homeAssistantEntity.mapping?.customServiceAreas;
160971
161029
  logger226.info(
160972
161030
  `Creating vacuum endpoint for ${entityId}, mapping: ${JSON.stringify(homeAssistantEntity.mapping ?? "none")}`
@@ -160974,7 +161032,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
160974
161032
  const cleanAreaRooms = homeAssistantEntity.mapping?.cleanAreaRooms;
160975
161033
  let device = VacuumEndpointType.with(
160976
161034
  cleanAreaRooms && cleanAreaRooms.length > 0 ? createCleanAreaRvcRunModeServer(cleanAreaRooms) : createVacuumRvcRunModeServer(
160977
- attributes8,
161035
+ attributes9,
160978
161036
  false,
160979
161037
  customAreas && customAreas.length > 0 ? customAreas : void 0,
160980
161038
  homeAssistantEntity.mapping?.disableCustomAreaRoomModes
@@ -160986,7 +161044,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
160986
161044
  }
160987
161045
  device = device.with(VacuumPowerSourceServer);
160988
161046
  const roomEntities = homeAssistantEntity.mapping?.roomEntities;
160989
- const rooms = parseVacuumRooms(attributes8);
161047
+ const rooms = parseVacuumRooms(attributes9);
160990
161048
  logger226.info(
160991
161049
  `${entityId}: customAreas=${customAreas?.length ?? 0}, roomEntities=${JSON.stringify(roomEntities ?? [])}, parsedRooms=${rooms.length}, cleanAreaRooms=${cleanAreaRooms?.length ?? 0}`
160992
161050
  );
@@ -161003,14 +161061,14 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
161003
161061
  } else if (rooms.length > 0 || roomEntities && roomEntities.length > 0) {
161004
161062
  logger226.info(`${entityId}: Adding ServiceArea (${rooms.length} rooms)`);
161005
161063
  device = device.with(
161006
- createVacuumServiceAreaServer(attributes8, roomEntities)
161064
+ createVacuumServiceAreaServer(attributes9, roomEntities)
161007
161065
  );
161008
161066
  } else {
161009
161067
  logger226.info(`${entityId}: Adding ServiceArea (default single-area)`);
161010
161068
  device = device.with(createDefaultServiceAreaServer());
161011
161069
  }
161012
161070
  const fanSpeedList = resolveFanSpeedList(
161013
- attributes8,
161071
+ attributes9,
161014
161072
  homeAssistantEntity.mapping?.suctionLevelEntity
161015
161073
  );
161016
161074
  const mopIntensityList = resolveMopIntensityList(
@@ -161022,7 +161080,7 @@ function VacuumDevice(homeAssistantEntity, includeOnOff = false, cleaningModeOpt
161022
161080
  );
161023
161081
  device = device.with(
161024
161082
  createVacuumRvcCleanModeServer(
161025
- attributes8,
161083
+ attributes9,
161026
161084
  fanSpeedList,
161027
161085
  mopIntensityList,
161028
161086
  cleaningModeOptions,
@@ -161121,9 +161179,9 @@ init_home_assistant_entity_behavior();
161121
161179
 
161122
161180
  // src/matter/endpoints/legacy/water-heater/behaviors/water-heater-thermostat-server.ts
161123
161181
  var getUnit2 = (agent) => agent.env.get(HomeAssistantConfig).unitSystem.temperature;
161124
- var attributes7 = (entity) => entity.attributes;
161182
+ var attributes8 = (entity) => entity.attributes;
161125
161183
  var getTemp2 = (agent, entity, attributeName) => {
161126
- const temperature3 = attributes7(entity)[attributeName];
161184
+ const temperature3 = attributes8(entity)[attributeName];
161127
161185
  const unit = getUnit2(agent);
161128
161186
  if (temperature3 != null) {
161129
161187
  return Temperature.withUnit(+temperature3, unit);
@@ -161137,14 +161195,14 @@ var config10 = {
161137
161195
  getTargetHeatingTemperature: (entity, agent) => getTemp2(agent, entity, "temperature"),
161138
161196
  getTargetCoolingTemperature: (entity, agent) => getTemp2(agent, entity, "temperature"),
161139
161197
  getSystemMode: (entity) => {
161140
- const operationMode = attributes7(entity).operation_mode;
161198
+ const operationMode = attributes8(entity).operation_mode;
161141
161199
  if (operationMode === "off") {
161142
161200
  return Thermostat3.SystemMode.Off;
161143
161201
  }
161144
161202
  return Thermostat3.SystemMode.Heat;
161145
161203
  },
161146
161204
  getRunningMode: (entity) => {
161147
- const operationMode = attributes7(entity).operation_mode;
161205
+ const operationMode = attributes8(entity).operation_mode;
161148
161206
  if (operationMode === "off") {
161149
161207
  return Thermostat3.ThermostatRunningMode.Off;
161150
161208
  }
@@ -161211,14 +161269,14 @@ function toMatterTemp2(value) {
161211
161269
  return Math.round(num * 100);
161212
161270
  }
161213
161271
  function WaterHeaterDevice(homeAssistantEntity) {
161214
- const attributes8 = homeAssistantEntity.entity.state.attributes;
161272
+ const attributes9 = homeAssistantEntity.entity.state.attributes;
161215
161273
  logger227.debug(
161216
- `Creating device for ${homeAssistantEntity.entity.entity_id}, min_temp=${attributes8.min_temp}, max_temp=${attributes8.max_temp}`
161274
+ `Creating device for ${homeAssistantEntity.entity.entity_id}, min_temp=${attributes9.min_temp}, max_temp=${attributes9.max_temp}`
161217
161275
  );
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;
161276
+ const minLimit = toMatterTemp2(attributes9.min_temp) ?? 0;
161277
+ const maxLimit = toMatterTemp2(attributes9.max_temp) ?? 12e3;
161278
+ const currentTemp = toMatterTemp2(attributes9.current_temperature) ?? toMatterTemp2(attributes9.temperature) ?? 2100;
161279
+ const heatingSetpoint = toMatterTemp2(attributes9.temperature) ?? 1e4;
161222
161280
  return WaterHeaterDeviceType.set({
161223
161281
  homeAssistantEntity,
161224
161282
  thermostat: {
@@ -161237,21 +161295,21 @@ init_home_assistant_entity_behavior();
161237
161295
  var temperatureConfig5 = {
161238
161296
  getValue(entity, agent) {
161239
161297
  const fallbackUnit = agent.env.get(HomeAssistantConfig).unitSystem.temperature;
161240
- const attributes8 = entity.attributes;
161241
- const temperature3 = attributes8.temperature;
161298
+ const attributes9 = entity.attributes;
161299
+ const temperature3 = attributes9.temperature;
161242
161300
  if (temperature3 == null || Number.isNaN(temperature3)) {
161243
161301
  return void 0;
161244
161302
  }
161245
161303
  return Temperature.withUnit(
161246
161304
  temperature3,
161247
- attributes8.temperature_unit ?? fallbackUnit
161305
+ attributes9.temperature_unit ?? fallbackUnit
161248
161306
  );
161249
161307
  }
161250
161308
  };
161251
161309
  var humidityConfig5 = {
161252
161310
  getValue(entity) {
161253
- const attributes8 = entity.attributes;
161254
- const humidity = attributes8.humidity;
161311
+ const attributes9 = entity.attributes;
161312
+ const humidity = attributes9.humidity;
161255
161313
  if (humidity == null || Number.isNaN(humidity)) {
161256
161314
  return null;
161257
161315
  }
@@ -161260,12 +161318,12 @@ var humidityConfig5 = {
161260
161318
  };
161261
161319
  var pressureConfig4 = {
161262
161320
  getValue(entity) {
161263
- const attributes8 = entity.attributes;
161264
- const pressure = attributes8.pressure;
161321
+ const attributes9 = entity.attributes;
161322
+ const pressure = attributes9.pressure;
161265
161323
  if (pressure == null || Number.isNaN(pressure)) {
161266
161324
  return void 0;
161267
161325
  }
161268
- return convertPressureToHpa(pressure, attributes8.pressure_unit);
161326
+ return convertPressureToHpa(pressure, attributes9.pressure_unit);
161269
161327
  }
161270
161328
  };
161271
161329
  var WeatherSensorType = TemperatureSensorDevice.with(
@@ -162547,7 +162605,7 @@ function processEvent(store, updates) {
162547
162605
  entityState = { ...entityState };
162548
162606
  const { "+": toAdd, "-": toRemove } = updates.c[entityId];
162549
162607
  const attributesChanged = toAdd?.a || toRemove?.a;
162550
- const attributes8 = attributesChanged ? { ...entityState.attributes } : entityState.attributes;
162608
+ const attributes9 = attributesChanged ? { ...entityState.attributes } : entityState.attributes;
162551
162609
  if (toAdd) {
162552
162610
  if (toAdd.s !== void 0) {
162553
162611
  entityState.state = toAdd.s;
@@ -162567,16 +162625,16 @@ function processEvent(store, updates) {
162567
162625
  entityState.last_updated = new Date(toAdd.lu * 1e3).toISOString();
162568
162626
  }
162569
162627
  if (toAdd.a) {
162570
- Object.assign(attributes8, toAdd.a);
162628
+ Object.assign(attributes9, toAdd.a);
162571
162629
  }
162572
162630
  }
162573
162631
  if (toRemove?.a) {
162574
162632
  for (const key of toRemove.a) {
162575
- delete attributes8[key];
162633
+ delete attributes9[key];
162576
162634
  }
162577
162635
  }
162578
162636
  if (attributesChanged) {
162579
- entityState.attributes = attributes8;
162637
+ entityState.attributes = attributes9;
162580
162638
  }
162581
162639
  state[entityId] = entityState;
162582
162640
  }
@@ -162881,7 +162939,7 @@ var BridgeEndpointManager = class extends Service {
162881
162939
  this.pluginEndpoints.delete(deviceId);
162882
162940
  }
162883
162941
  };
162884
- this.pluginManager.onDeviceStateUpdated = (pluginName, deviceId, clusterId3, attributes8) => {
162942
+ this.pluginManager.onDeviceStateUpdated = (pluginName, deviceId, clusterId3, attributes9) => {
162885
162943
  const endpoint = this.pluginEndpoints.get(deviceId);
162886
162944
  if (!endpoint) return;
162887
162945
  const behaviorType = endpoint.type.behaviors[clusterId3];
@@ -162892,7 +162950,7 @@ var BridgeEndpointManager = class extends Service {
162892
162950
  return;
162893
162951
  }
162894
162952
  this.pluginStateUpdating.add(deviceId);
162895
- endpoint.setStateOf(behaviorType, attributes8).catch((e) => {
162953
+ endpoint.setStateOf(behaviorType, attributes9).catch((e) => {
162896
162954
  this.log.warn(
162897
162955
  `Plugin "${pluginName}": failed to update "${clusterId3}" on "${deviceId}":`,
162898
162956
  e
@@ -164711,12 +164769,12 @@ function ServerModeVacuumDevice(homeAssistantEntity, includeOnOff = false, clean
164711
164769
  if (homeAssistantEntity.entity.state === void 0) {
164712
164770
  return void 0;
164713
164771
  }
164714
- const attributes8 = homeAssistantEntity.entity.state.attributes;
164772
+ const attributes9 = homeAssistantEntity.entity.state.attributes;
164715
164773
  const cleanAreaRooms = homeAssistantEntity.mapping?.cleanAreaRooms;
164716
164774
  const customAreas = homeAssistantEntity.mapping?.customServiceAreas;
164717
164775
  let device = ServerModeVacuumEndpointType.with(
164718
164776
  cleanAreaRooms && cleanAreaRooms.length > 0 ? createCleanAreaRvcRunModeServer(cleanAreaRooms) : createVacuumRvcRunModeServer(
164719
- attributes8,
164777
+ attributes9,
164720
164778
  false,
164721
164779
  customAreas && customAreas.length > 0 ? customAreas : void 0,
164722
164780
  homeAssistantEntity.mapping?.disableCustomAreaRoomModes
@@ -164727,20 +164785,20 @@ function ServerModeVacuumDevice(homeAssistantEntity, includeOnOff = false, clean
164727
164785
  }
164728
164786
  device = device.with(VacuumPowerSourceServer);
164729
164787
  const roomEntities = homeAssistantEntity.mapping?.roomEntities;
164730
- const rooms = parseVacuumRooms(attributes8);
164788
+ const rooms = parseVacuumRooms(attributes9);
164731
164789
  if (cleanAreaRooms && cleanAreaRooms.length > 0) {
164732
164790
  device = device.with(createCleanAreaServiceAreaServer(cleanAreaRooms));
164733
164791
  } else if (customAreas && customAreas.length > 0) {
164734
164792
  device = device.with(createCustomServiceAreaServer(customAreas));
164735
164793
  } else if (rooms.length > 0 || roomEntities && roomEntities.length > 0) {
164736
164794
  device = device.with(
164737
- createVacuumServiceAreaServer(attributes8, roomEntities)
164795
+ createVacuumServiceAreaServer(attributes9, roomEntities)
164738
164796
  );
164739
164797
  } else {
164740
164798
  device = device.with(createDefaultServiceAreaServer());
164741
164799
  }
164742
164800
  const fanSpeedList = resolveFanSpeedList(
164743
- attributes8,
164801
+ attributes9,
164744
164802
  homeAssistantEntity.mapping?.suctionLevelEntity
164745
164803
  );
164746
164804
  const mopIntensityList = resolveMopIntensityList(
@@ -164749,7 +164807,7 @@ function ServerModeVacuumDevice(homeAssistantEntity, includeOnOff = false, clean
164749
164807
  if (cleaningModeOptions || fanSpeedList || mopIntensityList) {
164750
164808
  device = device.with(
164751
164809
  createVacuumRvcCleanModeServer(
164752
- attributes8,
164810
+ attributes9,
164753
164811
  fanSpeedList,
164754
164812
  mopIntensityList,
164755
164813
  cleaningModeOptions,