Skip to content

Commit 5cc7491

Browse files
committed
feat: surface extra SMART attribute variants as diagnostic entities
When a drive reports multiple attributes from the same consolidated mapping (e.g. both Wear_Leveling_Count and Remaining_Lifetime_Perc), only the winner populates the curated sensor. The remaining variants now appear as disabled-by-default diagnostic entities instead of being silently suppressed. Closes the design question from Forum Post #25 (devzor). Both ship gates met: devzor confirmed Option 1, IOT7712 seconded.
1 parent 3ddf467 commit 5cc7491

2 files changed

Lines changed: 36 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22

33
All notable changes to SMART Sniffer are documented here.
44

5+
## v0.5.14 -- 2026-05-30
6+
7+
Integration-only release. No agent or installer changes.
8+
9+
### Fixed
10+
- **Multi-variant SMART attributes no longer silently hidden** -- drives that report multiple attributes from the same consolidated sensor group (e.g. both Wear_Leveling_Count and Remaining_Lifetime_Perc) previously only showed the first match. The other variants were suppressed by the diagnostic entity loop because they were considered "already covered." Now only the winning variant is suppressed -- the rest surface as disabled-by-default diagnostic entities like any other uncovered attribute. Most drives report a single variant and see no change. Drives with multiple variants (common on Silicon Motion controller SSDs, some WD/HGST enterprise drives) now expose the full picture.
11+
12+
### Upgrade Notes
13+
- **Integration-only update.** Update via HACS or manually replace `custom_components/smart_sniffer/`. No agent update needed.
14+
- **Multi-variant drive users:** after updating, check your drive's device page -- you may see new disabled diagnostic entities for attributes that were previously hidden. Enable the ones you care about.
15+
516
## v0.5.13 -- 2026-05-20
617

718
Agent-only release. No integration or installer changes.

custom_components/smart_sniffer/sensor.py

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,10 +462,33 @@ async def async_setup_entry(
462462
# Created disabled by default -- power users enable what they need.
463463
ata_table = smart_data.get("ata_smart_attributes", {}).get("table", [])
464464
if is_ata and ata_table:
465-
# Collect attribute names already covered by curated sensors
465+
# Build a per-drive "covered names" set: for each curated
466+
# sensor, only suppress the single name variant that actually
467+
# wins the lookup in _extract_attribute (which iterates the
468+
# drive's attribute table in order and returns the first
469+
# match). Other variants from the same consolidation list
470+
# stay eligible to become diagnostic entities.
471+
#
472+
# This matters for multi-variant drives like the Transcend
473+
# MTS952T (Silicon Motion) which reports BOTH attribute 177
474+
# (Wear_Leveling_Count) AND 169 (Remaining_Lifetime_Perc).
475+
# Without per-drive detection, the global union of all
476+
# variant names would suppress 169 even though only 177
477+
# won the consolidated sensor.
478+
_attr_position = {
479+
attr.get("name", ""): i
480+
for i, attr in enumerate(ata_table)
481+
if attr.get("name")
482+
}
466483
_covered_names: set[str] = set()
467484
for _desc in SENSOR_DESCRIPTIONS:
468-
_covered_names.update(ATA_NAME_MAP.get(_desc.key, []))
485+
candidates = ATA_NAME_MAP.get(_desc.key, [])
486+
present = [n for n in candidates if n in _attr_position]
487+
if present:
488+
# Match _extract_attribute's "first in drive-table
489+
# order" rule so the same variant wins in both paths.
490+
winner = min(present, key=lambda n: _attr_position[n])
491+
_covered_names.add(winner)
469492

470493
_seen_ids: set[int] = set()
471494
for attr in ata_table:

0 commit comments

Comments
 (0)