mirror of
https://github.com/home-assistant/frontend.git
synced 2025-08-04 15:07:48 +00:00
review
This commit is contained in:
parent
e1d17f3d3a
commit
690e2a3aa9
@ -238,7 +238,6 @@ class HistoryStream {
|
|||||||
newHistory[entityId] = [];
|
newHistory[entityId] = [];
|
||||||
}
|
}
|
||||||
for (const entityId of Object.keys(newHistory)) {
|
for (const entityId of Object.keys(newHistory)) {
|
||||||
let purgeOld = entityId in this.combinedHistory;
|
|
||||||
if (
|
if (
|
||||||
entityId in this.combinedHistory &&
|
entityId in this.combinedHistory &&
|
||||||
entityId in streamMessage.states
|
entityId in streamMessage.states
|
||||||
@ -257,14 +256,13 @@ class HistoryStream {
|
|||||||
(a, b) => a.lu - b.lu
|
(a, b) => a.lu - b.lu
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
purgeOld = true;
|
|
||||||
} else if (entityId in this.combinedHistory) {
|
} else if (entityId in this.combinedHistory) {
|
||||||
newHistory[entityId] = this.combinedHistory[entityId];
|
newHistory[entityId] = this.combinedHistory[entityId];
|
||||||
purgeOld = true;
|
|
||||||
} else {
|
} else {
|
||||||
newHistory[entityId] = streamMessage.states[entityId];
|
newHistory[entityId] = streamMessage.states[entityId];
|
||||||
}
|
}
|
||||||
if (purgeOld) {
|
// Remove old history
|
||||||
|
if (entityId in this.combinedHistory) {
|
||||||
const entityHistory = newHistory[entityId];
|
const entityHistory = newHistory[entityId];
|
||||||
while (entityHistory[0].lu < purgeBeforePythonTime) {
|
while (entityHistory[0].lu < purgeBeforePythonTime) {
|
||||||
if (entityHistory.length > 1) {
|
if (entityHistory.length > 1) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user