Skip to content

Commit

Permalink
Add fallback for devices without name (#23513)
Browse files Browse the repository at this point in the history
  • Loading branch information
bramkragten authored Dec 30, 2024
1 parent 94c03be commit 6b039a1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/components/device/ha-device-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,9 @@ export class HaDevicePicker extends LitElement {

return {
id: device.id,
name: name,
name:
name ||
this.hass.localize("ui.components.device-picker.unnamed_device"),
area:
device.area_id && areas[device.area_id]
? areas[device.area_id].name
Expand Down
4 changes: 3 additions & 1 deletion src/dialogs/quick-bar/ha-quick-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,9 @@ export class QuickBar extends LitElement {
? this.hass.areas[device.area_id]
: undefined;
const deviceItem = {
primaryText: computeDeviceName(device, this.hass),
primaryText:
computeDeviceName(device, this.hass) ||
this.hass.localize("ui.components.device-picker.unnamed_device"),
deviceId: device.id,
area: area?.name,
action: () => navigate(`/config/devices/device/${device.id}`),
Expand Down
1 change: 1 addition & 0 deletions src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,7 @@
"no_devices": "You don't have any devices",
"no_match": "No matching devices found",
"device": "Device",
"unnamed_device": "Unnamed device",
"no_area": "No area"
},
"category-picker": {
Expand Down

0 comments on commit 6b039a1

Please sign in to comment.