Fix display name getting issue
This commit is contained in:
parent
9b5a0068fd
commit
b1e5e73278
@ -78,9 +78,21 @@ class Entity {
|
||||
chartType: EntityHistoryWidgetType.simple
|
||||
);
|
||||
|
||||
String get displayName =>
|
||||
attributes["friendly_name"] ??
|
||||
(attributes["name"] ?? (entityId != null && entityId.contains('.')) ? entityId.split(".")[1].replaceAll("_", " ") : "");
|
||||
String get displayName {
|
||||
if (attributes.containsKey('friendly_name')) {
|
||||
return attributes['friendly_name'];
|
||||
}
|
||||
if (attributes.containsKey('name')) {
|
||||
return attributes['name'];
|
||||
}
|
||||
if (entityId == null) {
|
||||
return "";
|
||||
}
|
||||
if (entityId.contains(".")) {
|
||||
return entityId.split(".")[1].replaceAll("_", " ");
|
||||
}
|
||||
return entityId;
|
||||
}
|
||||
|
||||
bool get isView =>
|
||||
(domain == "group") &&
|
||||
|
Reference in New Issue
Block a user