diff --git a/src/data/backup.ts b/src/data/backup.ts
index 2cda20eb49..247cf8f3be 100644
--- a/src/data/backup.ts
+++ b/src/data/backup.ts
@@ -220,6 +220,11 @@ export const CLOUD_AGENT = "cloud.cloud";
export const isLocalAgent = (agentId: string) =>
[CORE_LOCAL_AGENT, HASSIO_LOCAL_AGENT].includes(agentId);
+export const isNetworkMountAgent = (agentId: string) => {
+ const [domain, name] = agentId.split(".");
+ return domain === "hassio" && name !== "local";
+};
+
export const computeBackupAgentName = (
localize: LocalizeFunc,
agentId: string,
@@ -229,6 +234,11 @@ export const computeBackupAgentName = (
return "This system";
}
const [domain, name] = agentId.split(".");
+
+ if (isNetworkMountAgent(agentId)) {
+ return name;
+ }
+
const domainName = domainToName(localize, domain);
// If there are multiple agents for a domain, show the name
@@ -242,7 +252,23 @@ export const computeBackupAgentName = (
export const compareAgents = (a: string, b: string) => {
const isLocalA = isLocalAgent(a);
const isLocalB = isLocalAgent(b);
- return isLocalA === isLocalB ? a.localeCompare(b) : isLocalA ? -1 : 1;
+ const isNetworkMountAgentA = isNetworkMountAgent(a);
+ const isNetworkMountAgentB = isNetworkMountAgent(b);
+
+ const getPriority = (isLocal: boolean, isNetworkMount: boolean) => {
+ if (isLocal) return 1;
+ if (isNetworkMount) return 2;
+ return 3;
+ };
+
+ const priorityA = getPriority(isLocalA, isNetworkMountAgentA);
+ const priorityB = getPriority(isLocalB, isNetworkMountAgentB);
+
+ if (priorityA !== priorityB) {
+ return priorityA - priorityB;
+ }
+
+ return a.localeCompare(b);
};
export const generateEncryptionKey = () => {
diff --git a/src/panels/config/backup/components/config/ha-backup-config-agents.ts b/src/panels/config/backup/components/config/ha-backup-config-agents.ts
index f20aa8878b..925b4f8f2d 100644
--- a/src/panels/config/backup/components/config/ha-backup-config-agents.ts
+++ b/src/panels/config/backup/components/config/ha-backup-config-agents.ts
@@ -1,4 +1,4 @@
-import { mdiHarddisk } from "@mdi/js";
+import { mdiHarddisk, mdiNas } from "@mdi/js";
import type { PropertyValues } from "lit";
import { css, html, LitElement, nothing } from "lit";
import { customElement, property, state } from "lit/decorators";
@@ -14,6 +14,7 @@ import {
computeBackupAgentName,
fetchBackupAgentsInfo,
isLocalAgent,
+ isNetworkMountAgent,
} from "../../../../../data/backup";
import type { CloudStatus } from "../../../../../data/cloud";
import type { HomeAssistant } from "../../../../../types";
@@ -52,6 +53,9 @@ class HaBackupConfigAgents extends LitElement {
if (agentId === CLOUD_AGENT) {
return "It stores one backup. The oldest backups are deleted.";
}
+ if (isNetworkMountAgent(agentId)) {
+ return "Network storage";
+ }
return "";
}
@@ -75,20 +79,27 @@ class HaBackupConfigAgents extends LitElement {
- `}
+ : isNetworkMountAgent(agentId)
+ ? html`
+
+ `}