@riddix/hamh 2.1.0-alpha.496 → 2.1.0-alpha.498

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.
@@ -176304,10 +176304,14 @@ var VacuumPowerSourceServer = PowerSourceServer2({
176304
176304
  }
176305
176305
  const attributes7 = entity.attributes;
176306
176306
  const batteryLevel = attributes7.battery_level ?? attributes7.battery;
176307
- if (batteryLevel == null || typeof batteryLevel !== "number") {
176307
+ if (batteryLevel == null) {
176308
176308
  return null;
176309
176309
  }
176310
- return batteryLevel;
176310
+ if (typeof batteryLevel === "number") {
176311
+ return batteryLevel;
176312
+ }
176313
+ const parsed = Number.parseFloat(String(batteryLevel));
176314
+ return Number.isNaN(parsed) ? null : parsed;
176311
176315
  },
176312
176316
  isCharging(entity) {
176313
176317
  const state = entity.state;
@@ -179809,9 +179813,16 @@ var ServerModeVacuumEndpoint = class _ServerModeVacuumEndpoint extends EntityEnd
179809
179813
  registry2.markBatteryEntityUsed(batteryEntityId);
179810
179814
  logger201.info(`${entityId}: Auto-assigned battery ${batteryEntityId}`);
179811
179815
  } else {
179812
- logger201.warn(
179813
- `${entityId}: No battery entity found for device ${entity.device_id}`
179814
- );
179816
+ const attrs = state.attributes;
179817
+ if (attrs.battery_level != null || attrs.battery != null) {
179818
+ logger201.info(
179819
+ `${entityId}: No battery entity found, using battery attribute from vacuum state`
179820
+ );
179821
+ } else {
179822
+ logger201.warn(
179823
+ `${entityId}: No battery entity found for device ${entity.device_id}`
179824
+ );
179825
+ }
179815
179826
  }
179816
179827
  }
179817
179828
  const vacuumEntities = registry2.findVacuumSelectEntities(