Skip to content

Commit fb17f93

Browse files
committed
v0.4.29: fix wear leveling reading raw value instead of normalized percentage (#7)
1 parent 7e52700 commit fb17f93

5 files changed

Lines changed: 41 additions & 12 deletions

File tree

.github/workflows/release.yml

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,30 @@ jobs:
4848
sha256sum smartha-agent-* > checksums.txt
4949
cat checksums.txt
5050
51+
- name: Extract changelog for this version
52+
id: changelog
53+
run: |
54+
# Extract the section for the current version from CHANGELOG.md.
55+
# Grabs everything between the first "## v*" heading and the next one.
56+
NOTES=$(awk '
57+
/^## v/ { if (found) exit; found=1; next }
58+
found { print }
59+
' CHANGELOG.md)
60+
# Write to a step output using a heredoc delimiter to preserve newlines.
61+
{
62+
echo "NOTES<<CHANGELOG_EOF"
63+
echo "$NOTES"
64+
echo "CHANGELOG_EOF"
65+
} >> "$GITHUB_OUTPUT"
66+
5167
- name: Create GitHub Release
5268
uses: softprops/action-gh-release@v2
5369
with:
54-
name: SMART Sniffer Agent v${{ steps.version.outputs.VERSION }}
70+
name: SMART Sniffer v${{ steps.version.outputs.VERSION }}
5571
body: |
56-
## SMART Sniffer Agent v${{ steps.version.outputs.VERSION }}
57-
58-
<!-- 🔴 IMPORTANT: Replace this section with version-specific changes before tagging. -->
59-
<!-- Example: -->
60-
<!-- ### What's New -->
61-
<!-- - **Raspberry Pi support** — armv7 binary now included for Pi 2/3/4 (32-bit OS) -->
62-
<!-- - **Seagate fix** — resolved false Command Timeout alerts on Seagate/OEM drives -->
72+
${{ steps.changelog.outputs.NOTES }}
6373
64-
### What's New
65-
See the [CHANGELOG](https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md) for details on this release.
74+
📋 [Full Changelog](https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md)
6675
6776
---
6877
@@ -71,7 +80,7 @@ jobs:
7180
```bash
7281
curl -sSL https://raw.githubusercontent.com/${{ github.repository }}/main/install.sh | sudo bash
7382
```
74-
Run this on each machine where the agent is installed. The installer detects your existing configuration and offers to keep it — just press Enter to upgrade in place.
83+
The installer detects your existing configuration and offers to keep it — just press Enter to upgrade in place.
7584
7685
---
7786

CHANGELOG.md

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

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

5+
## v0.4.29 — 2026-03-25
6+
7+
### Fixed
8+
- **Wear Leveling / Percentage Used showing raw write count instead of percentage** — ATA wear-related attributes (`Media_Wearout_Indicator`, `SSD_Life_Left`, `Percent_Lifetime_Remain`, etc.) were reading the `RAW_VALUE` column from smartctl, which contains a vendor-specific counter (e.g., 1569 total writes). Now reads the normalized `VALUE` column (0–100), which is the actual percentage remaining. Fixes drives incorrectly showing values like "1,568%" instead of "100%". ([#7](https://github.com/DAB-LABS/smart-sniffer/issues/7))
9+
10+
### Changed
11+
- **README: scan interval documentation** — agent configuration section now documents Go duration syntax (`30s`, `5m`, `1h`, `24h`) and notes that each poll wakes spun-down drives
12+
- **README: roadmap additions** — per-drive scan intervals, standby-aware polling, and YAML-based attribute definitions added to roadmap
13+
514
## v0.4.28 — 2026-03-24
615

716
### Added

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,9 @@ Binaries output to `agent/build/`.
313313
- [ ] Custom Lovelace card
314314
- [ ] Temperature-based attention triggers (absolute threshold + trend over time)
315315
- [ ] Configurable alert thresholds via options flow
316+
- [ ] Per-drive scan intervals
317+
- [ ] Standby-aware polling (`smartctl -n standby`)
318+
- [ ] YAML-based SMART attribute definitions (vendor field mapping, transforms, units)
316319
- [ ] SAS/SCSI drive support
317320

318321
## Testing

custom_components/smart_sniffer/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
"iot_class": "local_polling",
1010
"issue_tracker": "https://github.com/DAB-LABS/smart-sniffer/issues",
1111
"requirements": [],
12-
"version": "0.4.28",
12+
"version": "0.4.29",
1313
"zeroconf": [{"type": "_smartha._tcp.local."}]
1414
}

custom_components/smart_sniffer/sensor.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,14 @@ def _extract_attribute(drive_data: dict[str, Any], key: str) -> Any | None:
324324
):
325325
return raw_value & 0xFFFF
326326

327+
# Wear-leveling attributes: the normalized VALUE column
328+
# (0–100) is the correct percentage. RAW_VALUE is a
329+
# vendor-specific counter (total writes, erase cycles,
330+
# etc.) that can be in the thousands.
331+
# See: https://github.com/DAB-LABS/smart-sniffer/issues/7
332+
if key == "wear_leveling_count":
333+
return attr.get("value")
334+
327335
return raw_value
328336
return raw
329337

0 commit comments

Comments
 (0)