macOS: USB UPS battery sensors get a new unique ID whenever the UPS name is read differently (no `Hardware Serial Number`; serial is in `Accessory Identifier`)
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 84/100
Línea de trabajo
Empieza por Sources/Shared/Environment/DeviceBattery.swift y sigue cómo DeviceBattery(powerSourceDescription:) construye el ID único del sensor de batería a partir de los campos de la fuente de alimentación. Usa el orden de alternativas sugerido en el issue: número de serie del hardware, después un identificador de accesorio recortado y no vacío, y luego el nombre. Revisa las pruebas de batería existentes o añade cobertura para los casos en que falte el número de serie del hardware y haya un identificador de accesorio; se considera terminado cuando los IDs se mantienen estables entre las variantes de nombre descritas en el issue y los dispositivos con números de serie del hardware conservan sus IDs actuales.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Does the issue also happen in Safari?
Not applicable (native app feature)
The problem
On macOS, a USB UPS (APC Back-UPS ES 600M1) gets a new …_level / …_state sensor pair every few boots. I now have 5 pairs for one UPS. Each new pair is created disabled, so automations reading the old pair silently stop getting updates.
Cause: DeviceBattery(powerSourceDescription:) builds uniqueID from kIOPSHardwareSerialNumberKey, falling back to kIOPSNameKey. For USB/HID UPS units, macOS never sets Hardware Serial Number. Apple's HID UPS plug-in (IOHIDFamily/IOHIDLib/IOHIDUPSClass.m) sets Name from the HID product string and puts the HID serial in "Accessory Identifier" (kIOPSAccessoryIdentifierKey, private IOPSKeysPrivate.h). So the ID comes from the name, and macOS sometimes reads the name cut short. My five unique IDs are all truncations of one string:
Back-UPS ES 600M1 FW:928.a11 .D USB FW:a10
Back-UPS ES 600M1 FW:928.a11 .D USB FW:a
Back-UPS ES 600M1 FW:928.a11 .D USB F
Back-UPS ES 600M1 FW:928.a11 .D USB
Back-UPS ES 600M1 FW:928.a11 .D
Accessory Identifier holds the same value (0B25XXXXXXXX ) on every variant. Live IOPSCopyPowerSourcesInfo output:
Name = "Back-UPS ES 600M1 FW:928.a11 .D USB FW:a10 "
Hardware Serial Number = (absent)
Accessory Identifier = "0B25XXXXXXXX "
Power Source ID = 52625408 (changes every boot; not usable)
Type = "UPS"
Transport Type = "USB"
Vendor ID = 1309
Product ID = 2
Suggested fix: fall back to info["Accessory Identifier"] (trimmed, non-empty) before the name in Sources/Shared/Environment/DeviceBattery.swift. Devices that report a serial keep their current IDs. Affected users get one new pair once, then no more drift. #3120 covers the stale entities this leaves behind; this issue is about why they keep appearing.
Which platform has the issue?
macOS
Which device model are you using?
Mac mini (Mac16,10)
Which OS version is the device running?
macOS 27.2.1
What version of the app has the issue?
2026.10.3 (2026.3322)
What was the last working version of the app?
No response
What version of Home Assistant Core are you running?
core-2026.11.3
Steps to reproduce
- Connect a USB HID UPS that has no
Hardware Serial Number(e.g. APC Back-UPS ES series) to a Mac running the companion app. - Reboot the Mac several times, or unplug and replug the UPS USB cable.
- Check the device's sensors in HA: a new
<name> Level/<name> Statepair appears whenever the name is read differently.
Expected behavior
One stable sensor pair per physical UPS, keyed on its serial (Accessory Identifier), across reboots and USB reconnects.
Did you upload your companion app logs through the form above?
No
- Lenguaje dominante
- Swift
- Estrellas
- 2.4k
- Forks
- 583
- Merge medio
- 1 d 10 h
- PR fusionados (30 d)
- 82
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de home-assistant/iOS
-
Custom widget "URL" tap action shows "<host> is not a valid path" instead of opening the web addressAbiertobug ios
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
home-assistant/iOS#6246 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
The label displayed in Control Center appears to be inverted relative to the current cover state.Abiertobug ios
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
home-assistant/iOS#5989 ·
Los mantenedores suelen responder en 1 día
-
bug ios
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
home-assistant/iOS#5844 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
home-assistant/iOS#5570 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 56/100
home-assistant/iOS#6327 ·
Los mantenedores suelen responder en 1 día
Todos los issues de home-assistant/iOS
Issues similares
-
needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
manaflow-ai/cmux#68791 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
enhancement good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
codual-ai/designlane#56 ·
Los mantenedores suelen responder en 1 día
-
apple
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
bug good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
erkamyaman/unslop-anything#375 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
openwatersio/slackwater-ios#976 ·
Los mantenedores suelen responder en 1 día