Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add model_id to device info card #21417

Merged
merged 3 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,7 +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 && !this.device.model
? html`<div class="model">${this.device.model_id}</div>`
piitaya marked this conversation as resolved.
Show resolved Hide resolved
joostlek marked this conversation as resolved.
Show resolved Hide resolved
: ""}
${this.device.manufacturer
? html`
Expand Down
Loading