Skip to content

Commit

Permalink
Add serial number to the device info card (#18386)
Browse files Browse the repository at this point in the history
Co-authored-by: Bram Kragten <[email protected]>
Co-authored-by: Franck Nijhof <[email protected]>
Co-authored-by: Franck Nijhof <[email protected]>
  • Loading branch information
4 people authored Oct 25, 2023
1 parent 464ecff commit 7ce7cbb
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions gallery/src/pages/components/ha-form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const DEVICES = [
sw_version: null,
hw_version: null,
via_device_id: null,
serial_number: null,
},
{
area_id: "backyard",
Expand All @@ -74,6 +75,7 @@ const DEVICES = [
sw_version: null,
hw_version: null,
via_device_id: null,
serial_number: null,
},
{
area_id: null,
Expand All @@ -91,6 +93,7 @@ const DEVICES = [
sw_version: null,
hw_version: null,
via_device_id: null,
serial_number: null,
},
];

Expand Down
3 changes: 3 additions & 0 deletions gallery/src/pages/components/ha-selector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const DEVICES = [
sw_version: null,
hw_version: null,
via_device_id: null,
serial_number: null,
},
{
area_id: "backyard",
Expand All @@ -70,6 +71,7 @@ const DEVICES = [
sw_version: null,
hw_version: null,
via_device_id: null,
serial_number: null,
},
{
area_id: null,
Expand All @@ -87,6 +89,7 @@ const DEVICES = [
sw_version: null,
hw_version: null,
via_device_id: null,
serial_number: null,
},
];

Expand Down
1 change: 1 addition & 0 deletions gallery/src/pages/misc/integration-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/data/device_registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 10 additions & 0 deletions src/panels/config/devices/device-detail/ha-device-info-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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}",
Expand Down

0 comments on commit 7ce7cbb

Please sign in to comment.