Add serial number to the device info card (#18386)

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
Jan-Philipp Benecke 2023-10-25 06:32:24 +02:00 committed by GitHub
parent 464ecffda7
commit 7ce7cbb755
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 0 deletions

View File

@ -57,6 +57,7 @@ const DEVICES = [
sw_version: null,
hw_version: null,
via_device_id: null,
serial_number: null,
},
{
area_id: "backyard",
@ -74,6 +75,7 @@ const DEVICES = [
sw_version: null,
hw_version: null,
via_device_id: null,
serial_number: null,
},
{
area_id: null,
@ -91,6 +93,7 @@ const DEVICES = [
sw_version: null,
hw_version: null,
via_device_id: null,
serial_number: null,
},
];

View File

@ -53,6 +53,7 @@ const DEVICES = [
sw_version: null,
hw_version: null,
via_device_id: null,
serial_number: null,
},
{
area_id: "backyard",
@ -70,6 +71,7 @@ const DEVICES = [
sw_version: null,
hw_version: null,
via_device_id: null,
serial_number: null,
},
{
area_id: null,
@ -87,6 +89,7 @@ const DEVICES = [
sw_version: null,
hw_version: null,
via_device_id: null,
serial_number: null,
},
];

View File

@ -213,6 +213,7 @@ const createDeviceRegistryEntries = (
name: "Tag Reader",
sw_version: null,
hw_version: "1.0.0",
serial_number: "00_12_4B_00_22_98_88_7F",
id: "mock-device-id",
identifiers: [],
via_device_id: null,

View File

@ -20,6 +20,7 @@ export interface DeviceRegistryEntry {
name: string | null;
sw_version: string | null;
hw_version: string | null;
serial_number: string | null;
via_device_id: string | null;
area_id: string | null;
name_by_user: string | null;

View File

@ -96,6 +96,16 @@ export class HaDeviceCard extends LitElement {
</div>
`
: ""}
${this.device.serial_number
? html`
<div class="extra-info">
${this.hass.localize(
"ui.panel.config.integrations.config_entry.serial_number",
{ serial_number: this.device.serial_number }
)}
</div>
`
: ""}
<slot></slot>
</div>
<slot name="actions"></slot>

View File

@ -3613,6 +3613,7 @@
"firmware": "Firmware: {version}",
"hardware": "Hardware: {version}",
"version": "Version: {version}",
"serial_number": "Serial number: {serial_number}",
"unnamed_entry": "Unnamed entry",
"unknown_via_device": "Unknown device",
"area": "In {area}",