Skip to content

2.0: Rewrite for Home Assistant core, enterprise disks and a dashboard card - #1

Merged
ChristianHandy merged 3 commits into
mainfrom
core-ready
Oct 24, 2026
Merged

ChristianHandy merged 3 commits into
mainfrom
core-ready

Conversation

@ChristianHandy

Copy link
Copy Markdown
Owner

Warning

Not tested on real hardware yet. This draft is for testing on real servers before merging. Every disk type is covered by automated tests on sample smartctl output and a simulated SSH server, but version 2.0 has not run against a real disk. See the hardware table in the README.

What this changes

  • aiosmartctl library (library/): the SSH and smartctl code moves into an async, typed library based on asyncssh. Home Assistant core requires this split.
  • Enterprise hardware: SAS/SCSI disks, disks behind MegaRAID/PERC found with smartctl --scan-open, and controller disks listed by hand (HP Smart Array cciss, Areca, 3ware, aacraid). Also smartctl 6.x text output, sudo -n, standby disks that are not woken up, and multipath disks shown once.
  • Security: the SSH host key is shown for confirmation before credentials are sent, then pinned.
  • Integration rewritten to current core patterns: one device per host with its disks below it, entity translations and icons, reauthentication, reconfiguration, options and diagnostics.
  • Dashboard card in card/.
  • Core readiness: script/run_core_checks.sh copies the integration into a Home Assistant core checkout and runs core's checks (hassfest, ruff, codespell, prettier, yamllint, strict mypy, pylint, pytest). Everything passes at 100% coverage, both for all platforms and for the sensor-only first core PR. docs/CORE_SUBMISSION.md lists the remaining steps.

Breaking changes

See CHANGELOG.md. Existing hosts must re-enter credentials and confirm the host key, entity IDs change, health states become passed/warning/failed, and the report button and scan interval option are gone.

Testing on your hardware

aiosmartctl is not on PyPI yet, so Home Assistant cannot install the requirement from the manifest on its own:

  • Home Assistant Container/Core: pip install ./library into Home Assistant's Python environment, then copy custom_components/smart_monitor into /config/custom_components/.
  • HAOS: publish the library first (tag aiosmartctl-v0.1.0, see docs/CORE_SUBMISSION.md), or install it to TestPyPI.

Requires Home Assistant 2026.10 or newer.

Checklist:

  • SATA HDD/SSD and NVMe read correctly
  • SAS disk or disk behind a RAID controller (if available)
  • Sleeping disk stays asleep and keeps its values
  • Non-root user with sudo, and private key login
  • Host key confirmation shows the right fingerprint
  • Short self-test button
  • Dashboard card

If something looks wrong, attach smartctl --json -a <device> (add -d <type> for controller disks) and the integration's diagnostics.

🤖 Generated with Claude Code

ChristianHandy and others added 3 commits October 24, 2026 02:07
Restructure the repository so the integration can be submitted to Home
Assistant core and installed through HACS in the meantime.

- Move the SSH and smartctl code into aiosmartctl, an async library in
  library/ (asyncssh, typed, its own tests and PyPI release workflow).
- Support SAS/SCSI disks, disks behind MegaRAID/PERC found with
  smartctl --scan-open, manually listed controller disks (cciss, areca,
  3ware, aacraid), smartctl 6.x text output, sudo, and disks in standby.
- Rewrite the integration to current core patterns: runtime_data, entity
  descriptions, translations, icon translations, devices per host and
  disk, reauthentication, reconfiguration, options, diagnostics.
- Confirm and pin the SSH host key before sending credentials.
- Add the SMART Monitor dashboard card in card/.
- Add tests with 100% coverage, snapshot tests, and
  script/run_core_checks.sh, which runs core's hassfest, ruff, codespell,
  prettier, yamllint, mypy, pylint and pytest against a core checkout.
- Document the hardware test status: 2.0 has not yet been run on real
  hardware.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
setup-uv 10 no longer creates a virtual environment when only a Python
version is given, so uv pip install had nowhere to install. Core's
.prettierrc.js loads prettier-plugin-sort-json by name, which npx does
not make resolvable; install it into a local prefix and set NODE_PATH.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
syrupy and pytest-homeassistant-custom-component both define a
"snapshot" fixture. Which one pytest uses depends on plugin load order,
which differs between machines: on CI the plain syrupy fixture won, so
snapshots were looked up in __snapshots__ and reported as missing.
Define the fixture in conftest.py, which always takes precedence, as
Home Assistant core does. The core port drops it, since core already
provides it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ChristianHandy
ChristianHandy marked this pull request as ready for review October 24, 2026 14:25
@ChristianHandy
ChristianHandy merged commit e5b0002 into main Oct 24, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant