Skip to content

Commit c366696

Browse files
committed
v0.4.20-beta: beta launch — new screenshots, CONTRIBUTING, SECURITY, beta badge
1 parent 5ca00f7 commit c366696

13 files changed

Lines changed: 147 additions & 9 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ __pycache__/
1818

1919
# Local
2020
revisions/
21+
temp/
2122

2223
# OS
2324
.DS_Store

CONTRIBUTING.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Contributing to SMART Sniffer
2+
3+
Thanks for your interest in contributing! SMART Sniffer is in beta and we welcome bug reports, drive compatibility data, and code contributions.
4+
5+
## Reporting Bugs
6+
7+
[Open an issue](https://github.com/DAB-LABS/smart-sniffer/issues) with:
8+
9+
- What you expected to happen vs. what actually happened
10+
- Your setup: OS, HA version, agent version, how the agent was installed
11+
- Relevant logs from the agent (`journalctl -u smartha-agent -f` on Linux) or HA (Settings > System > Logs)
12+
13+
## Submitting Drive Data
14+
15+
The most valuable contribution you can make is a `smartctl` dump from a drive we haven't tested against. This helps us catch manufacturer-specific attribute name variants that would otherwise be invisible.
16+
17+
```bash
18+
sudo smartctl -a --json /dev/sdX > my-drive-dump.json
19+
```
20+
21+
Attach the JSON file to an issue or PR. Feel free to redact the serial number if you prefer. The fields we care about most are the attribute names and the JSON structure, not identifying information.
22+
23+
See [docs/smart-attribute-name-variants.md](docs/smart-attribute-name-variants.md) for the current mapping and known gaps.
24+
25+
## Development Setup
26+
27+
### Agent (Go)
28+
29+
```bash
30+
cd agent
31+
go build -o smartha-agent .
32+
sudo ./smartha-agent --port 9099
33+
```
34+
35+
Requires Go 1.22+ and `smartmontools` installed.
36+
37+
### Integration (Python / Home Assistant)
38+
39+
Copy `custom_components/smart_sniffer/` into your HA development instance's `custom_components/` directory. Restart HA to pick up changes.
40+
41+
For testing without real drives, use the [Mock Agent](docs/mock-agent.md):
42+
43+
```bash
44+
python3 tools/mock-agent.py --port 9100 --preload sata_hdd,nvme,usb_blocked
45+
```
46+
47+
### Key Files
48+
49+
| File | What it does |
50+
|------|-------------|
51+
| `agent/main.go` | HTTP server, smartctl execution, caching, mDNS |
52+
| `agent/config.go` | Config loading (YAML + CLI flags) |
53+
| `custom_components/smart_sniffer/attention.py` | Attention state classification logic |
54+
| `custom_components/smart_sniffer/sensor.py` | All sensor entities + extraction |
55+
| `custom_components/smart_sniffer/coordinator.py` | Data polling + notification lifecycle |
56+
| `custom_components/smart_sniffer/config_flow.py` | HA config flow + Zeroconf discovery |
57+
58+
## Pull Requests
59+
60+
1. Fork the repo and create a branch from `main`
61+
2. Make your changes
62+
3. Test against the mock agent if touching the integration
63+
4. Test with `go build` if touching the agent
64+
5. Open a PR with a clear description of what and why
65+
66+
Keep PRs focused — one feature or fix per PR. If you're planning something large, open an issue first to discuss the approach.
67+
68+
## Code Style
69+
70+
- **Go agent:** Standard `gofmt` formatting
71+
- **Python integration:** Follow existing patterns in the codebase. Type hints are used throughout. No external dependencies (stdlib + HA core only).
72+
73+
## What's Needed
74+
75+
Check the [roadmap](README.md#roadmap) and [known issues](docs/build-journal.md#known-issues--tech-debt) for ideas. Some areas where help is especially welcome:
76+
77+
- **Windows testing**`install.ps1` builds but hasn't been validated end-to-end
78+
- **SAS/SCSI drive support** — we need `smartctl -a --json` dumps from SAS drives
79+
- **Drive-specific `smartctl` dumps** — any manufacturer or model we haven't seen
80+
- **Integration icons** — design help for the HA brands repo PR

README.md

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
<p align="center">
99
<a href="https://github.com/DAB-LABS/smart-sniffer/releases/latest"><img src="https://img.shields.io/github/v/release/DAB-LABS/smart-sniffer?style=flat-square" alt="Release"></a>
10+
<img src="https://img.shields.io/badge/status-beta-orange?style=flat-square" alt="Beta">
1011
<a href="https://github.com/DAB-LABS/smart-sniffer/actions/workflows/release.yml"><img src="https://img.shields.io/github/actions/workflow/status/DAB-LABS/smart-sniffer/release.yml?style=flat-square&label=build" alt="Build"></a>
1112
<a href="LICENSE"><img src="https://img.shields.io/github/license/DAB-LABS/smart-sniffer?style=flat-square" alt="License"></a>
1213
</p>
@@ -114,20 +115,36 @@ Every drive on the machine appears as its own HA device.
114115

115116
<table>
116117
<tr>
117-
<td align="center"><strong>SATA SSD — Sensors</strong></td>
118-
<td align="center"><strong>Apple NVMe — Sensors</strong></td>
118+
<td align="center"><strong>NVMe SSD — Sensors</strong></td>
119+
<td align="center"><strong>NVMe SSD — Diagnostics</strong></td>
119120
</tr>
120121
<tr>
121-
<td><img src="images/sensors-samsung-screenshot.png" width="320"></td>
122-
<td><img src="images/sensors-apple-screenshot.png" width="320"></td>
122+
<td><img src="images/nvme-sensors.png" width="300"></td>
123+
<td><img src="images/nvme-diagnostics.png" width="300"></td>
123124
</tr>
124125
<tr>
126+
<td align="center"><strong>SATA SSD — Sensors</strong></td>
125127
<td align="center"><strong>SATA SSD — Diagnostics</strong></td>
126-
<td align="center"><strong>Apple NVMe — Diagnostics</strong></td>
127128
</tr>
128129
<tr>
129-
<td><img src="images/diag-samsung-screenshot.png" width="320"></td>
130-
<td><img src="images/diag-apple-screenshot.png" width="320"></td>
130+
<td><img src="images/sata-ssd-sensors.png" width="300"></td>
131+
<td><img src="images/sata-ssd-diagnostics.png" width="300"></td>
132+
</tr>
133+
<tr>
134+
<td align="center"><strong>Attention: YES (Critical)</strong></td>
135+
<td align="center"><strong>Trigger Reason in Diagnostics</strong></td>
136+
</tr>
137+
<tr>
138+
<td><img src="images/attention-yes-sensors.png" width="300"></td>
139+
<td><img src="images/attention-yes-diagnostics.png" width="300"></td>
140+
</tr>
141+
<tr>
142+
<td align="center"><strong>Attention: MAYBE (Warning)</strong></td>
143+
<td align="center"><strong>Warning Reason in Diagnostics</strong></td>
144+
</tr>
145+
<tr>
146+
<td><img src="images/attention-maybe-sensors.png" width="300"></td>
147+
<td><img src="images/attention-maybe-diagnostics.png" width="300"></td>
131148
</tr>
132149
</table>
133150

@@ -289,9 +306,21 @@ Binaries output to `agent/build/`.
289306
- [ ] Configurable alert thresholds via options flow
290307
- [ ] SAS/SCSI drive support
291308

309+
## Testing
310+
311+
The integration has been tested against the included [Mock Agent](docs/mock-agent.md) — a standalone Python tool that simulates a `smartha-agent` with fully controllable fake drives. It serves the same API as the real agent, with a web dashboard for changing SMART attributes in real time. Useful for validating attention state transitions, notification behavior, and new drive types without waiting for real hardware to degrade.
312+
313+
```bash
314+
python3 tools/mock-agent.py --port 9100 --preload sata_hdd,nvme,usb_blocked
315+
```
316+
317+
Point the HA integration at `localhost:9100` and you're testing.
318+
292319
## Contributing
293320

294-
Found a bug? Have a drive that isn't mapping correctly? [Open an issue.](https://github.com/DAB-LABS/smart-sniffer/issues) Drive-specific `smartctl -a --json` output samples are especially welcome — they help us catch manufacturer name variants we haven't seen yet.
321+
Found a bug? Have a drive that isn't mapping correctly? See [CONTRIBUTING.md](CONTRIBUTING.md) for how to help.
322+
323+
Drive-specific `smartctl -a --json` output samples are especially welcome — they help us catch manufacturer name variants we haven't seen yet.
295324

296325
---
297326

SECURITY.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Security Policy
2+
3+
## Reporting a Vulnerability
4+
5+
If you discover a security vulnerability in SMART Sniffer, please report it responsibly.
6+
7+
**Email:** david.a.bailey@gmail.com
8+
9+
**Do not** open a public GitHub issue for security vulnerabilities. Please use email so we can assess and address the issue before public disclosure.
10+
11+
## What to Include
12+
13+
- Description of the vulnerability
14+
- Steps to reproduce
15+
- Potential impact
16+
- Suggested fix (if you have one)
17+
18+
## Scope
19+
20+
SMART Sniffer handles bearer token authentication between the agent and Home Assistant integration. Security-relevant areas include:
21+
22+
- **Token handling** in the Go agent (`agent/main.go`) and HA integration (`coordinator.py`, `config_flow.py`)
23+
- **HTTP server** exposure — the agent listens on a configurable port and serves drive health data
24+
- **Installer scripts** (`install.sh`, `install.ps1`) — these run with elevated privileges and download binaries from GitHub
25+
26+
## Response
27+
28+
We aim to acknowledge reports within 48 hours and provide a fix or mitigation plan within 7 days for confirmed vulnerabilities.

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.3.0",
12+
"version": "0.4.20",
1313
"zeroconf": [{"type": "_smartha._tcp.local."}]
1414
}
71.2 KB
Loading

images/attention-maybe-sensors.png

42.3 KB
Loading
70.5 KB
Loading

images/attention-yes-sensors.png

40.7 KB
Loading

images/nvme-diagnostics.png

67.5 KB
Loading

0 commit comments

Comments
 (0)