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`)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 84/100
調査の方向性
Sources/Shared/Environment/DeviceBattery.swift から始めて、DeviceBattery(powerSourceDescription:) が電源フィールドからバッテリーセンサーの一意な ID をどのように構築するかを追ってください。issue で提案されているフォールバック順序を使います。ハードウェアのシリアル番号、次に空白を除去した後に空でないアクセサリー識別子、最後に名前です。既存のバッテリーテストを確認するか、ハードウェアのシリアル番号がなくアクセサリー識別子がある場合のテストを追加してください。issue に記載された名前の各パターンで ID が安定し、ハードウェアのシリアル番号があるデバイスでは現在の ID が維持されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- Swift
- スター
- 2.4k
- フォーク
- 583
- 平均マージ
- 1日 10時間
- マージ済み PR(30日)
- 82
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
home-assistant/iOS のほかの issue
-
Custom widget "URL" tap action shows "<host> is not a valid path" instead of opening the web addressオープンbug ios
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
home-assistant/iOS#6246 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
The label displayed in Control Center appears to be inverted relative to the current cover state.オープンbug ios
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
home-assistant/iOS#5989 ·
メンテナーはふだん 1 日以内に返信
-
bug ios
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
home-assistant/iOS#5844 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
home-assistant/iOS#5570 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 56/100
home-assistant/iOS#6327 ·
メンテナーはふだん 1 日以内に返信
home-assistant/iOS の issue をすべて見る
似ている issue
-
needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
manaflow-ai/cmux#68791 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
enhancement good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
codual-ai/designlane#56 ·
メンテナーはふだん 1 日以内に返信
-
apple
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
bug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
erkamyaman/unslop-anything#375 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
openwatersio/slackwater-ios#976 ·
メンテナーはふだん 1 日以内に返信