mirror of
https://github.com/home-assistant/frontend.git
synced 2025-08-02 14:07:55 +00:00
wip
This commit is contained in:
parent
97b6fc03b3
commit
77e05af465
@ -614,7 +614,9 @@ export const getEnergyDataCollection = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
energyCollectionKeys.push(options.key);
|
energyCollectionKeys.push(options.key);
|
||||||
|
|
||||||
let energyInfoAndCO2Signal: EnergyInfoAndCO2Signal | undefined;
|
let energyInfoAndCO2Signal: EnergyInfoAndCO2Signal | undefined;
|
||||||
|
let forceRefreshEnergyInfo: bool = false;
|
||||||
|
|
||||||
const collection = getCollection<EnergyData>(
|
const collection = getCollection<EnergyData>(
|
||||||
hass.connection,
|
hass.connection,
|
||||||
@ -643,13 +645,13 @@ export const getEnergyDataCollection = (
|
|||||||
}
|
}
|
||||||
nextFetch.setMinutes(20, 0, 0);
|
nextFetch.setMinutes(20, 0, 0);
|
||||||
|
|
||||||
collection._refreshTimeout = window.setTimeout(
|
collection._refreshTimeout = window.setTimeout(() => {
|
||||||
() => collection.refresh(),
|
forceRefreshEnergyInfo = true;
|
||||||
nextFetch.getTime() - Date.now()
|
collection.refresh();
|
||||||
);
|
}, nextFetch.getTime() - Date.now());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!energyInfoAndCO2Signal) {
|
if (!energyInfoAndCO2Signal || forceRefreshEnergyInfo) {
|
||||||
energyInfoAndCO2Signal = await getEnergyInfoAndCO2Signal(hass);
|
energyInfoAndCO2Signal = await getEnergyInfoAndCO2Signal(hass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user