Skip to content

Commit

Permalink
Add model_id to device info card (#21417)
Browse files Browse the repository at this point in the history
* Add model_id to device info card

* Update src/panels/config/devices/device-detail/ha-device-info-card.ts

Co-authored-by: Paul Bottein <[email protected]>

* Add model_id to device info card

---------

Co-authored-by: Paul Bottein <[email protected]>
  • Loading branch information
joostlek and piitaya authored Jul 17, 2024
1 parent 7468ab9 commit 30d0293
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 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 @@ -53,6 +53,7 @@ const DEVICES = [
identifiers: [["demo", "volume1"] as [string, string]],
manufacturer: null,
model: null,
model_id: null,
name_by_user: null,
name: "Dishwasher",
sw_version: null,
Expand All @@ -72,6 +73,7 @@ const DEVICES = [
identifiers: [["demo", "pwm1"] as [string, string]],
manufacturer: null,
model: null,
model_id: null,
name_by_user: null,
name: "Lamp",
sw_version: null,
Expand All @@ -91,6 +93,7 @@ const DEVICES = [
identifiers: [["demo", "pwm1"] as [string, string]],
manufacturer: null,
model: null,
model_id: null,
name_by_user: "User name",
name: "Technical name",
sw_version: 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 = [
identifiers: [["demo", "volume1"] as [string, string]],
manufacturer: null,
model: null,
model_id: null,
name_by_user: null,
name: "Dishwasher",
sw_version: null,
Expand All @@ -72,6 +73,7 @@ const DEVICES = [
identifiers: [["demo", "pwm1"] as [string, string]],
manufacturer: null,
model: null,
model_id: null,
name_by_user: null,
name: "Lamp",
sw_version: null,
Expand All @@ -91,6 +93,7 @@ const DEVICES = [
identifiers: [["demo", "pwm1"] as [string, string]],
manufacturer: null,
model: null,
model_id: null,
name_by_user: "User name",
name: "Technical name",
sw_version: 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 @@ -215,6 +215,7 @@ const createDeviceRegistryEntries = (
connections: [],
manufacturer: "ESPHome",
model: "Mock Device",
model_id: "ABC-001",
name: "Tag Reader",
sw_version: null,
hw_version: "1.0.0",
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 {
identifiers: Array<[string, string]>;
manufacturer: string | null;
model: string | null;
model_id: string | null;
name: string | null;
labels: string[];
sw_version: string | null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,13 @@ export class HaDeviceCard extends LitElement {
>
<div class="card-content">
${this.device.model
? html`<div class="model">${this.device.model}</div>`
: ""}
? html`<div class="model">
${this.device.model}
${this.device.model_id ? html`(${this.device.model_id})` : ""}
</div>`
: this.device.model_id
? html`<div class="model">${this.device.model_id}</div>`
: ""}
${this.device.manufacturer
? html`
<div class="manuf">
Expand Down

0 comments on commit 30d0293

Please sign in to comment.