Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
dd9eff1
⬆️ Update SambaNas2
renovate[bot] May 8, 2026
9a29da5
Merge pull request #686 from dianlight/renovate/devrelease/sambanas2-…
dianlight May 8, 2026
618fa7e
✨ feat(be): Add check-protection-mode oneshot s6-rc.d service
dianlight May 16, 2026
0c4724a
🐛 fix(be): Fix protection mode boolean check
dianlight May 16, 2026
12759f3
✨ feat(fe): Show alert when Protection Mode enabled
dianlight May 16, 2026
e5ae5eb
Merge branch 'devrelease/sambanas2' of github.com:dianlight/hassio-ad…
dianlight May 16, 2026
4806685
🔧 chore(be): Bump SRAT to rc7, comment image, tweak socat log
dianlight May 17, 2026
96b92bd
🔧 chore(ha): Update Home Assistant client to 5.1.0
dianlight May 17, 2026
6f6ca9e
✨ feat(build): Uncomment image key in config.yaml if present
dianlight May 17, 2026
6f4fc93
🔧 chore(be): Bump SRAT and addon to rc8
dianlight May 25, 2026
d6e3f78
✨ feat(be+doc): Install smartmontools-sdk and set library path
dianlight May 26, 2026
788815c
🔧 chore(be+doc): Update changelog and use musl smartmon
dianlight May 27, 2026
398f08a
📝 docs(doc): Update Changelog to 2026.5.0-rc9
dianlight May 27, 2026
b6fd519
🔧 chore(be): Uncomment image in config
dianlight May 27, 2026
10eac5a
⬆️ Update SambaNas2 to v20.2.0
renovate[bot] Jun 9, 2026
7a58b6c
Merge pull request #700 from dianlight/renovate/devrelease/sambanas2-…
dianlight Jun 9, 2026
c22a4bb
🔧 chore(be): Prepare 2026.6.0-rc10 release
dianlight Jun 12, 2026
57bb964
Merge branch 'devrelease/sambanas2' of github.com:dianlight/hassio-ad…
dianlight Jun 12, 2026
9ef751e
🔧 chore: Bump version to 2026.7.0-rc11
dianlight Jul 12, 2026
6494948
ci(script) Commit all automatic changes for mergerelease in sambanas2
Jul 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/docker-image-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,18 @@ jobs:
yq -i ".name = \"${{ needs.setup.outputs.name }}\"" "$CONFIG_FILE"
echo "Updated name to ${{ needs.setup.outputs.name }}"

- name: Ensure image key is uncommented in config.yaml
if: needs.setup.outputs.has_scripts == 'true'
shell: bash
run: |
CONFIG_FILE="./${{ needs.setup.outputs.addon_dir }}/config.yaml"
if grep -Eq '^\s*#\s*image\s*:' "$CONFIG_FILE"; then
sed -E -i 's/^([[:space:]]*)#[[:space:]]*(image[[:space:]]*:.*)$/\1\2/' "$CONFIG_FILE"
echo "Uncommented image key in $CONFIG_FILE"
else
echo "No commented image key found in $CONFIG_FILE"
fi

- name: Run Addon custom scripts
if: needs.setup.outputs.has_scripts == 'true'
env:
Expand Down
146 changes: 143 additions & 3 deletions sambanas2/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,122 @@
# Changelog

## 2026.5.0-rc6
## 2026.7.0-rc11

### 🙏 Thanks

- Thanks to all the contributors and users that help to make this addon better.
- Special thanks to supporters and sponsors. With our support I was able to buy a copilot subscription to help me code faster and better.

### 🚨 Notes
- This is a release candidate version, it may contain bugs and issues. Use it at your own risk. It is not recommended to use this version in production environments.
- This version is not compatible with the previous SambaNas addon, it is a complete rewrite and refactor of the addon. It is recommended to backup your configuration before updating to this version.
- This version is only tested with Home Assistant OS and Supervised installations. It may not work properly with Home Assistant Core or Container installations.
- ***Your existing configuration may be lost when updating to this version. Please backup your configuration before updating.***


### 🐭 Features from SRAT [v2026.7.0-rc11](https://github.com/dianlight/srat)

#### 🔧 Chore

- **Migrate to TypeScript 7.0 RC** (Go-based `tsgo` compiler):
- Updated peer dependency to `typescript: ^7.0.1-rc`
- Updated `@typescript/native-preview` to `7.0.0-dev.20260701.1`
- Updated `tsconfig.json`, migration docs, and instruction files
- Patches `esModuleInterop` default and other TS 7.0 defaults

#### ✨ Features

- **HDIdle per-disk model** (Lab Mode feature): Replaced the global HDIdle
enable/disable toggle with a fully per-disk configuration model gated behind
Lab Mode (`experimental_lab_mode=true`). Key changes:
- **Per-disk enable/disable**: each physical disk has its own HDIdle record
(`enabled: yes|custom|no`); the service runs automatically when ≥1 disk is
enabled. The five global `Settings.hdidle_*` fields have been removed.
- **Dashboard suggestion badge**: HDDs that have not yet been configured show
an inline "Enable HDIdle?" badge in the disk I/O table (visible only in Lab
Mode). The badge provides **Ignore** (persists `suggestion_ignored=true`)
and **Enable** (navigates to the per-disk card in the Volumes page).
- **Non-rotational guard**: enabling HDIdle on an SSD/NVMe or a device with
unknown rotational type opens a confirm dialog; accepting persists
`force_enabled=true` so the warning does not repeat. The backend returns
HTTP 409 if the flag is missing, preventing accidental spindowns of SSDs.
- **Rotational detection**: `Disk.is_rotational` tri-state (HDD/SSD/unknown)
is now derived from `/sys/block/<dev>/queue/rotational` (sysfs primary) with
SMART `rotation_rate` as fallback. Unknown (e.g. USB enclosures) returns
`nil` — treated as non-rotational for safety.
- **Ignore-suggestion endpoint**: `POST /api/disk/{id}/hdidle/ignore-suggestion`
persists the badge dismissal per disk.
- **Adaptive polling**: the monitor goroutine polls every 60s when ≥1 disk is
spun-up and slows to 5min when all monitored disks are already spun-down.
The goroutine is never started when zero disks are enabled.
- **readOnly threading**: the per-disk settings card now correctly propagates
the `readOnly` flag from `VolumeDetailsPanel`.
- **mDNS Registration**: Added optional mDNS registration of the SRAT service for local network discovery. When enabled, the backend registers a `_srat._tcp` service with the system mDNS responder, advertising the service name, port, and metadata. This allows compatible clients to discover the SRAT service on the local network without manual configuration. The feature is controlled by a new `MDNSRegistration` boolean setting in the advanced settings section.

#### 🐛 Bug Fixes

- **HDIdle service permanently broken after first Stop()**: `Stop()` no longer
leaves `stopChan` non-nil after close. Subsequent `Start()` calls now succeed
(idempotent). Fixes a latent bug where the service refused to restart after
any config PUT.
- **Nested mutex deadlock** in `GetDeviceStatus`, `GetProcessStatus`, and
`observeDiskActivity`: calls to `IsRunning()` under an existing lock now read
`stopChan` directly to avoid the deadlock inherent in re-acquiring an
`RWMutex` that is not guaranteed reentrant.
- **`GetDeviceConfig` returned HTTP 500 when service disabled**: the guard
`!s.config.Enabled → ErrorHDIdleNotSupported` has been removed. The config
endpoint is now always available for inspection/configuration regardless of
whether the monitor goroutine is running.
- **`disk_id` injected unsanitised into file path**: `hdidle_handler.go` was
naïvely prefixing every `disk_id` with `/dev/disk/by-id/` without validation.
Replaced by `HDIdleServiceInterface.ResolveDevicePath()` which probes three
candidate paths (absolute `/dev/…`, by-id, kernel name) and rejects inputs
containing path-traversal characters.

#### 🔄 Breaking Changes

- `Settings.hdidle_enabled`, `hdidle_default_idle_time`, `hdidle_default_command_type`,
`hdidle_default_power_condition`, and `hdidle_ignore_spin_down_detection` have
been **removed** from the API and the DB (migration 00017 drops the
corresponding rows from the `properties` table).
- `POST /api/hdidle/start` and `POST /api/hdidle/stop` have been **removed**.
The service lifecycle is now fully automatic (driven by the per-disk records).
- `PATCH /api/disk/{id}/hdidle/config` has been **removed** (it was a dead spec
entry with no handler).

#### 🏗 Chore

- DB migration `00017` (`drop_global_hdidle_properties`): deletes the five
obsolete global HDIdle property rows. Down migration re-seeds them with their
original defaults for dev/test rollback.
- `events.PowerEvent` now carries a `Kind PowerEventKind` discriminant field
(`config` or `status`) so subscribers can branch without comparing zero-values.
- Two new `dto.HDIdleDevice` fields (`SuggestionIgnored`, `ForceEnabled`) and
matching GORM/generated-layer/converter updates. Schema columns are added by
GORM `AutoMigrate` on the next startup — no manual migration needed.
- `openapi.json` is **not regenerated** in this branch — it requires a working
Go toolchain and `go run ./cmd/srat-openapi`. **CI must run**
`go run ./cmd/srat-openapi -dir=backend/docs` and
`cd frontend && bun run gen:api` before merging to keep generated artifacts in
sync. Three hand-edited generated files (`config_to_dto_conv_gen.go`,
`dto_to_dbom_conv_gen.go`, `g/hdidle_device_config.go`) are aligned with their
source directives — a `go generate ./...` run will produce the same output.

#### 🔧 Maintenance

- **Multi-variant server release**: Release archives now ship three `srat-server` variants — `srat-server-static` (fully static, zero shared-library dependencies), `srat-server-musl` (dynamic linked against musl libc, built via Zig), and `srat-server-glib` (dynamic linked against glibc, built via CGO). The `srat-server` entry in the archive is a symlink that defaults to `srat-server-static`; the upgrade process automatically updates it to the best available variant for the running system (musl → glibc → static). `srat-openapi` is no longer included in release archives. `srat-cli` is always statically linked.


## 2026.6.0-rc10

### 🏗 Chore
- Update SRAT to v2026.6.0-rc10
- Update Base image to v21.0.0 (Alpine base image to v3.24.0)

### ✨ Features
- New 'Lab Mode' setting in Settings → General section to enable experimental features and configurations for advanced users and testers. When enabled, this setting allows access to features that are still in development or testing phases, providing early access to new functionality while clearly indicating that these features may be unstable or subject to change.

## 2026.5.0-rc9

### 🙏 Thanks

Expand All @@ -11,11 +127,35 @@
- This is a release candidate version, it may contain bugs and issues. Use it at your own risk. It is not recommended to use this version in production environments.
- This version is not compatible with the previous SambaNas addon, it is a complete rewrite and refactor of the addon. It is recommended to backup your configuration before updating to this version.
- This version is only tested with Home Assistant OS and Supervised installations. It may not work properly with Home Assistant Core or Container installations.
- ***Your existing configuration will be lost when updating to this version. Please backup your configuration before updating.***
- ***Your existing configuration may be lost when updating to this version. Please backup your configuration before updating.***
- ***If you need HDIdle support don't update and wait future releases.***
- ***If you need Avahi/mDNS support don't update and wait future releases.***

#### 🏗 Chore
### 🏗 Chore
- Update SRAT to v2026.5.0-rc9

### ✨ Features
- Install [smartmontools-sdk v7.5](https://github.com/dianlight/smartmontools-sdk) (`libsmartmon.a` + headers) providing in-process SMART device access without spawning a subprocess
- Set `LIBRARY_PATH` and `CPATH` environment variables for all container processes so that components linking against `libsmartmon` are automatically found
- Register `/etc/profile.d/smartmontools-sdk.sh` so interactive login shells also inherit the correct library and include paths

## 2026.5.0-rc8

### 🏗 Chore
- Update SRAT to v2026.5.0-rc8

## 2026.5.0-rc7

### 🏗 Chore
- Update SRAT to v2026.5.0-rc7
- Update homeassistant client to 5.1.0

### ✨ Features
- Add a allert when Protected Mode is enabled in Home Assistant (See [DOCS](DOCS.md) )

## 2026.5.0-rc6

### 🏗 Chore
- Update SRAT to v2026.5.0-rc6

## 2026.5.0-rc5
Expand Down
33 changes: 26 additions & 7 deletions sambanas2/DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ The following table compares the major functionalities available in SambaNAS and
|------------------------------------|:--------:|:---------:|
| **Network Sharing** | | |
| CIFS Volume Exporting | ✔️ | ✔️ |
| NFS Volume Exporting | ❌ | 🧪 🔌 (internal HA-addon use only) |
| NFS Volume Exporting | ❌ | 🧪 🔌 |
| SMB Multichannel Support | ✔️ | ✔️ |
| WSDD and WSDD2 Integration | ✔️ | ❌ |
| WSDD-Native | ❌ | ✔️ |
| Avahi/mDNS Support | ✔️ | 🚧 Soon (via component) |
| Avahi/mDNS Support | ✔️ | ❌ |
| HA mDNS Support | ❌ | 🧪 (via component) |
| Samba over QUIC Support | ❌ | 🧪 🔌 |
| **Volume Management** | | |
| Mounting additional volumes | ✔️ | ✔️ |
Expand All @@ -43,22 +44,22 @@ The following table compares the major functionalities available in SambaNAS and
| **Integration** | | |
| MQTT integration | ✔️ | ❌ |
| HA Native API Integration | ❌ | ✔️ |
| Component Integration | ❌ | 🚧 Soon |
| Component Integration | ❌ | 🧪 (limited) |
| **Disk Management** | | |
| SMART Monitoring | ✔️ | ✔️ |
| SMART Test Support | ❌ | ✔️ |
| Disk Spindown Support | ✔️ | 🚧 Soon |
| Per Disk Spindown Support | ❌ | 🚧 Soon |
| Disk Spindown Support | ✔️ | 🧪 |
| Per Disk Spindown Support | ❌ | 🧪 |
| **Filesystem Support** | | |
| Filesystem Checking | ❌ | 🚧 Soon |
| Filesystem Checking | ❌ | ✔️ |
| Advanced XFS Support | ❌ | 🚧 Soon |
| Advanced BTRFS Support | ❌ | 🚧 Soon |
| Advanced ZFS Support | ❌ | 🚧 Soon |
| **Other Features** | | |
| External Kernel Modules Support | ❌ | ✔️ |


> ✔️ = Supported  ❌ = Not Supported  🧪 = Experimental  🔌 = Only with extra kernel modules (see hasos_more_modules)  🚧 Soon = Coming in future versions  🔚 EOL = End of Life
> ✔️ = Supported  ❌ = Not Supported  🧪 = Experimental (Lab Mode)  🔌 = Only with extra kernel modules (see hasos_more_modules)  🚧 Soon = Coming in future versions  🔚 EOL = End of Life

## Installation

Expand Down Expand Up @@ -140,6 +141,24 @@ NFS services run under s6 supervision and the exports file is **automatically ma
- 🔌 Depending on your HAOS architecture/board, NFS functionality may require enabling `use_external_kernel_modules` to load extra kernel modules
- Changes made through SRAT are applied automatically without requiring an add-on restart

## SMART Monitoring and Disk Health

Samba NAS2 bundles the **[smartmontools-sdk](https://github.com/dianlight/smartmontools-sdk)** (`libsmartmon`) so that SMART queries are performed **in-process** — no subprocess is spawned to run `smartctl`. This provides:

- Faster and more efficient disk health queries
- Unified ATA/SATA, NVMe, and SCSI/SAS device support via a single native API
- Structured JSON output for integration with the SRAT web interface

The SDK is installed at build time:

| Path | Contents |
|---|---|
| `/usr/local/lib/libsmartmon.a` | Pre-built static library (smartmontools v7.5) |
| `/usr/local/include/smartmon/` | Public C++ headers |

`LIBRARY_PATH` and `CPATH` environment variables are automatically exported to all container processes and interactive shells so any component linking against `libsmartmon` finds the library without manual configuration.


## Configuration

Example configuration with all available options and their default values:
Expand Down
21 changes: 17 additions & 4 deletions sambanas2/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
ARG BUILD_FROM=ghcr.io/hassio-addons/base:20.1.0
ARG BUILD_FROM=ghcr.io/hassio-addons/base:21.0.0
ARG BUILD_DATE=""
ARG BUILD_DESCRIPTION=""
ARG BUILD_NAME=""
ARG BUILD_REF=""
ARG BUILD_REPOSITORY="dianlight/hassio-addons"
ARG BUILD_VERSION=""
ARG SAMBA_VERSION=distribution
ARG HA_CLI_VERSION=5.0.0
ARG HA_CLI_VERSION=5.1.0

# QUIC Builder Stage (only if SAMBA_VERSION is not "distribution")
# hadolint ignore=DL3006
Expand Down Expand Up @@ -151,13 +151,16 @@ ENV \
S6_CMD_WAIT_FOR_SERVICES=1 \
S6_KILL_GRACETIME=30000 \
S6_SYNC_DISKS=1 \
CPATH="/usr/local/include" \
LIBRARY_PATH="/usr/local/lib" \
TERM="xterm-256color"

# Setup base
ARG BUILD_ARCH=amd64
ARG HA_CLI_VERSION=5.0.0
ARG SRAT_VERSION=2026.5.0-rc6
ARG HA_CLI_VERSION=5.1.0
ARG SRAT_VERSION=2026.7.0-rc11
ARG SAMBA_VERSION=distribution
ARG SMARTMONTOOLS_SDK_VERSION=7.5

# Copy compiled binaries from builder stages
#COPY --from=builder_wsdd /usr/sbin/wsdd2 /usr/sbin/
Expand Down Expand Up @@ -290,6 +293,16 @@ RUN wget -qO- https://www.gershnik.com/alpine-repo/gershnik@hotmail.com-6643812
RUN curl -fsSL -o /usr/bin/ha "https://github.com/home-assistant/cli/releases/download/${HA_CLI_VERSION}/ha_${BUILD_ARCH}" \
&& chmod a+x /usr/bin/ha

# Download and install smartmontools-sdk
RUN curl -fsSL -o /tmp/smartmontools-sdk.tar.gz \
"https://github.com/dianlight/smartmontools-sdk/releases/download/v${SMARTMONTOOLS_SDK_VERSION}/libsmartmon-${SMARTMONTOOLS_SDK_VERSION}-linux-${BUILD_ARCH}-musl.tar.gz" \
&& tar -xzf /tmp/smartmontools-sdk.tar.gz -C /usr/local \
&& rm -f /tmp/smartmontools-sdk.tar.gz \
&& printf '%s\n' \
'export LIBRARY_PATH="/usr/local/lib${LIBRARY_PATH:+:$LIBRARY_PATH}"' \
'export CPATH="/usr/local/include${CPATH:+:$CPATH}"' \
> /etc/profile.d/smartmontools-sdk.sh

# Download and install SRAT
RUN SRAT_ARCH_SUFFIX="${BUILD_ARCH}"; \
if [ "${BUILD_ARCH}" = "amd64" ]; then \
Expand Down
11 changes: 0 additions & 11 deletions sambanas2/build.yaml

This file was deleted.

5 changes: 2 additions & 3 deletions sambanas2/config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Samba NAS2
version: 2026.5.0-rc6
version: 2026.7.0-rc11
slug: sambanas2
description: Expose Home Assistant disc with SMB/CIFS
url: https://github.com/dianlight/hassio-addons/tree/master/sambanas2
Expand Down Expand Up @@ -29,10 +29,9 @@ ingress_port: 0 # For add-ons on host network
ingress_entry: index.html
ingress_stream: true
panel_icon: mdi:folder-network
panel_title: Samba NAS2
#panel_title: Samba NAS2
panel_admin: true
discovery: ["srat"]

boot: auto
init: false
hassio_api: true
Expand Down
Loading
Loading