mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Try to fix history graph for lovelace (#1523)
* Try to fix history graph for lovelace * Reset interval * Sort * Lint
This commit is contained in:
parent
ec9a259fc0
commit
fdbaa3908a
@ -25,14 +25,14 @@ class HuiHistoryGraphCard extends PolymerElement {
|
|||||||
hass="[[hass]]"
|
hass="[[hass]]"
|
||||||
filter-type="recent-entity"
|
filter-type="recent-entity"
|
||||||
entity-id="[[_entities]]"
|
entity-id="[[_entities]]"
|
||||||
data="{{stateHistory}}"
|
data="{{_stateHistory}}"
|
||||||
is-loading="{{stateHistoryLoading}}"
|
is-loading="{{_stateHistoryLoading}}"
|
||||||
cache-config="[[_computeCacheConfig(_config)]]"
|
cache-config="[[_cacheConfig]]"
|
||||||
></ha-state-history-data>
|
></ha-state-history-data>
|
||||||
<state-history-charts
|
<state-history-charts
|
||||||
hass="[[hass]]"
|
hass="[[hass]]"
|
||||||
history-data="[[stateHistory]]"
|
history-data="[[_stateHistory]]"
|
||||||
is-loading-data="[[stateHistoryLoading]]"
|
is-loading-data="[[_stateHistoryLoading]]"
|
||||||
names="[[_names]]"
|
names="[[_names]]"
|
||||||
up-to-now
|
up-to-now
|
||||||
no-single
|
no-single
|
||||||
@ -45,12 +45,12 @@ class HuiHistoryGraphCard extends PolymerElement {
|
|||||||
return {
|
return {
|
||||||
hass: Object,
|
hass: Object,
|
||||||
_config: Object,
|
_config: Object,
|
||||||
stateHistory: {
|
_names: Object,
|
||||||
type: Object,
|
_entities: Array,
|
||||||
},
|
|
||||||
_names: Array,
|
_stateHistory: Object,
|
||||||
_entities: Object,
|
_stateHistoryLoading: Boolean,
|
||||||
stateHistoryLoading: Boolean,
|
_cacheConfig: Object
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,16 +71,16 @@ class HuiHistoryGraphCard extends PolymerElement {
|
|||||||
_names[entity.entity] = entity.name;
|
_names[entity.entity] = entity.name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this._entities = _entities;
|
|
||||||
this._names = _names;
|
|
||||||
}
|
|
||||||
|
|
||||||
_computeCacheConfig(config) {
|
this.setProperties({
|
||||||
return {
|
_cacheConfig: {
|
||||||
cacheKey: config.entities,
|
cacheKey: _entities.sort().join(),
|
||||||
hoursToShow: config.hours_to_show || 24,
|
hoursToShow: config.hours_to_show || 24,
|
||||||
refresh: config.refresh_interval || 0
|
refresh: config.refresh_interval || 0
|
||||||
};
|
},
|
||||||
|
_entities,
|
||||||
|
_names
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user