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