From 402d44384351353370c2a7c4fe10e4ca8dcef70a Mon Sep 17 00:00:00 2001 From: Jan-Philipp Benecke Date: Wed, 25 Oct 2023 11:47:54 +0200 Subject: [PATCH] Add mac and bluetooth address to the device info card (#18392) Co-authored-by: Paul Bottein --- .../devices/device-detail/ha-device-info-card.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/panels/config/devices/device-detail/ha-device-info-card.ts b/src/panels/config/devices/device-detail/ha-device-info-card.ts index 03818c1fe0..011adbe3da 100644 --- a/src/panels/config/devices/device-detail/ha-device-info-card.ts +++ b/src/panels/config/devices/device-detail/ha-device-info-card.ts @@ -9,6 +9,7 @@ import { import { haStyle } from "../../../../resources/styles"; import { HomeAssistant } from "../../../../types"; import { loadDeviceRegistryDetailDialog } from "../device-registry-detail/show-dialog-device-registry-detail"; +import { titleCase } from "../../../../common/string/title-case"; @customElement("ha-device-info-card") export class HaDeviceCard extends LitElement { @@ -106,6 +107,14 @@ export class HaDeviceCard extends LitElement { ` : ""} + ${this._getAddresses().map( + ([type, value]) => html` +
+ ${type === "mac" ? "MAC" : titleCase(type)}: + ${value.toUpperCase()} +
+ ` + )} @@ -113,6 +122,12 @@ export class HaDeviceCard extends LitElement { `; } + protected _getAddresses() { + return this.device.connections.filter( + (conn) => conn[0] === "mac" || conn[0] === "bluetooth" + ); + } + protected firstUpdated(changedProps) { super.firstUpdated(changedProps); loadDeviceRegistryDetailDialog();