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 03bbdad91e..0602d6fa00 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 @@ -7,6 +7,7 @@ import "../../../../components/ha-card"; import type { DeviceRegistryEntry } from "../../../../data/device_registry"; import { haStyle } from "../../../../resources/styles"; import type { HomeAssistant } from "../../../../types"; +import { createSearchParam } from "../../../../common/url/search-params"; @customElement("ha-device-info-card") export class HaDeviceCard extends LitElement { @@ -102,8 +103,16 @@ export class HaDeviceCard extends LitElement { ${this._getAddresses().map( ([type, value]) => html`
- ${type === "mac" ? "MAC" : titleCase(type)}: - ${value.toUpperCase()} + ${type === "bluetooth" + ? html`${titleCase(type)} + ${value.toUpperCase()}` + : html`${type === "mac" ? "MAC" : titleCase(type)}: + ${value.toUpperCase()}`}
` )} diff --git a/src/panels/config/integrations/integration-panels/bluetooth/bluetooth-advertisement-monitor.ts b/src/panels/config/integrations/integration-panels/bluetooth/bluetooth-advertisement-monitor.ts index c9de84adbd..5bcd7389f4 100644 --- a/src/panels/config/integrations/integration-panels/bluetooth/bluetooth-advertisement-monitor.ts +++ b/src/panels/config/integrations/integration-panels/bluetooth/bluetooth-advertisement-monitor.ts @@ -1,5 +1,5 @@ import type { UnsubscribeFunc } from "home-assistant-js-websocket"; -import type { CSSResultGroup, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult, PropertyValues } from "lit"; import { html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; @@ -10,6 +10,7 @@ import type { DataTableColumnContainer, RowClickedEvent, } from "../../../../../components/data-table/ha-data-table"; +import { extractSearchParamsObject } from "../../../../../common/url/search-params"; import "../../../../../components/ha-fab"; import "../../../../../components/ha-icon-button"; import "../../../../../components/ha-relative-time"; @@ -33,6 +34,8 @@ export class BluetoothAdvertisementMonitorPanel extends LitElement { @property({ attribute: false }) public route!: Route; + @property({ attribute: false }) public address?: string; + @property({ type: Boolean }) public narrow = false; @property({ attribute: "is-wide", type: Boolean }) public isWide = false; @@ -104,6 +107,20 @@ export class BluetoothAdvertisementMonitorPanel extends LitElement { } } + protected willUpdate(changedProps: PropertyValues) { + super.willUpdate(changedProps); + + if (this.hasUpdated) { + return; + } + + const searchParams = extractSearchParamsObject(); + const address = searchParams.address; + if (address) { + this.address = address; + } + } + private _columns = memoizeOne( (localize: LocalizeFunc): DataTableColumnContainer => { const columns: DataTableColumnContainer = { @@ -198,6 +215,7 @@ export class BluetoothAdvertisementMonitorPanel extends LitElement { .initialCollapsedGroups=${this._activeCollapsed} @grouping-changed=${this._handleGroupingChanged} @collapsed-changed=${this._handleCollapseChanged} + filter=${this.address || ""} clickable > `;