Resolves #254 Missed entities

This commit is contained in:
estevez-dev
2019-03-12 23:35:33 +02:00
parent 0ef2ebfe31
commit a08a056cff
9 changed files with 151 additions and 107 deletions

View File

@ -67,6 +67,7 @@ class Entity {
String state;
String displayState;
DateTime _lastUpdated;
bool missed = false;
List<Entity> childEntities = [];
List<String> attributesToShow = ["all"];
@ -97,6 +98,12 @@ class Entity {
update(rawData);
}
Entity.missed(String entityId) {
missed = true;
attributes = {"hidden": false};
this.entityId = entityId;
}
void update(Map rawData) {
attributes = rawData["attributes"] ?? {};
domain = rawData["entity_id"].split(".")[0];

View File

@ -14,10 +14,12 @@ class EntityWrapper {
String displayName,
this.uiAction
}) {
this.icon = icon ?? entity.icon;
this.displayName = displayName ?? entity.displayName;
if (this.uiAction == null) {
this.uiAction = EntityUIAction();
if (!entity.missed) {
this.icon = icon ?? entity.icon;
this.displayName = displayName ?? entity.displayName;
if (uiAction == null) {
uiAction = EntityUIAction();
}
}
}