Add 'last seen' to BT advertisement montior (#24361)

* Add 'last seen' to BT advertisement montior

* use ha-relative-time
This commit is contained in:
karwosts 2025-02-24 07:29:34 -08:00 committed by GitHub
parent 9e1d64e728
commit cc04457d72
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 0 deletions

View File

@ -12,6 +12,7 @@ import type {
} from "../../../../../components/data-table/ha-data-table";
import "../../../../../components/ha-fab";
import "../../../../../components/ha-icon-button";
import "../../../../../components/ha-relative-time";
import type {
BluetoothDeviceData,
BluetoothScannersDetails,
@ -140,6 +141,18 @@ export class BluetoothAdvertisementMonitorPanel extends LitElement {
sortable: true,
defaultHidden: true,
},
time: {
title: localize("ui.panel.config.bluetooth.last_seen"),
filterable: false,
sortable: true,
defaultHidden: false,
template: (ad) =>
html`<ha-relative-time
.hass=${this.hass}
.datetime=${ad.datetime}
capitalize
></ha-relative-time>`,
},
rssi: {
title: localize("ui.panel.config.bluetooth.rssi"),
type: "numeric",
@ -167,6 +180,7 @@ export class BluetoothAdvertisementMonitorPanel extends LitElement {
scanner?.name ||
row.source,
device: device?.name_by_user || device?.name || undefined,
datetime: new Date(row.time * 1000),
};
})
);

View File

@ -5369,6 +5369,7 @@
"source": "Source",
"rssi": "RSSI",
"source_address": "Source address",
"last_seen": "Last seen",
"device": "Device",
"device_information": "Device information",
"advertisement_data": "Advertisement data",