diff --git a/src/panels/config/devices/ha-config-device-page.ts b/src/panels/config/devices/ha-config-device-page.ts
index ee1d3653f2..984acc04fa 100644
--- a/src/panels/config/devices/ha-config-device-page.ts
+++ b/src/panels/config/devices/ha-config-device-page.ts
@@ -39,6 +39,7 @@ import {
findBatteryEntity,
updateEntityRegistryEntry,
} from "../../../data/entity_registry";
+import { domainToName } from "../../../data/integration";
import { SceneEntities, showSceneEditor } from "../../../data/scene";
import { findRelated, RelatedResult } from "../../../data/search";
import {
@@ -212,34 +213,53 @@ export class HaConfigDevicePage extends LitElement {
}
let links = await Promise.all(
- this._integrations(device, this.entries)
- .filter((entry) => entry.state === "loaded")
- .map(async (entry) => {
- const info = await fetchDiagnosticHandler(this.hass, entry.domain);
+ this._integrations(device, this.entries).map(async (entry) => {
+ if (entry.state !== "loaded") {
+ return false;
+ }
+ const info = await fetchDiagnosticHandler(this.hass, entry.domain);
- if (!info.handlers.device && !info.handlers.config_entry) {
- return "";
- }
- const link = info.handlers.device
+ if (!info.handlers.device && !info.handlers.config_entry) {
+ return false;
+ }
+ return {
+ link: info.handlers.device
? getDeviceDiagnosticsDownloadUrl(entry.entry_id, this.deviceId)
- : getConfigEntryDiagnosticsDownloadUrl(entry.entry_id);
- return html`
-
-
- ${this.hass.localize(
- `ui.panel.config.devices.download_diagnostics`
- )}
-
-
- `;
- })
+ : getConfigEntryDiagnosticsDownloadUrl(entry.entry_id),
+ domain: entry.domain,
+ };
+ })
);
+
+ links = links.filter(Boolean);
+
if (this._diagnosticDownloadLinks !== requestId) {
return;
}
- links = links.filter(Boolean);
if (links.length > 0) {
- this._diagnosticDownloadLinks = links;
+ this._diagnosticDownloadLinks = (
+ links as { link: string; domain: string }[]
+ ).map(
+ (link) => html`
+
+
+ ${links.length > 1
+ ? this.hass.localize(
+ `ui.panel.config.devices.download_diagnostics_integration`,
+ {
+ integration: domainToName(
+ this.hass.localize,
+ link.domain
+ ),
+ }
+ )
+ : this.hass.localize(
+ `ui.panel.config.devices.download_diagnostics`
+ )}
+
+
+ `
+ );
}
}
diff --git a/src/translations/en.json b/src/translations/en.json
index 2c64069e4c..e804716cf5 100755
--- a/src/translations/en.json
+++ b/src/translations/en.json
@@ -2231,6 +2231,7 @@
"open_configuration_url_device": "Visit device",
"open_configuration_url_service": "Visit service",
"download_diagnostics": "Download diagnostics",
+ "download_diagnostics_integration": "Download {integration} diagnostics",
"type": {
"device_heading": "Device",
"device": "device",