mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-14 21:06:34 +00:00
Fix stats data being fetched for all entities when there are no energy/water stat ids (#15428)
* Fix stats data being fetched for all entities when there are no energy/water stat ids I noticed the following query was being sent to the stats api since there were no water stat ids. Since it sent an empty list it enumerated everything ``` { type: "recorder/statistics_during_period", start_time: "2023-02-05T05:00:00.000Z", end_time: "2023-02-12T05:59:59.999Z" .... statistic_ids: [], type: "recorder/statistics_during_period" types: ["sum"] units: {volume: "gal"} } ``` * not python
This commit is contained in:
parent
4a10c722ab
commit
a325d32d09
@ -406,24 +406,28 @@ const getEnergyData = async (
|
||||
};
|
||||
|
||||
const stats = {
|
||||
...(await fetchStatistics(
|
||||
hass!,
|
||||
startMinHour,
|
||||
end,
|
||||
energyStatIds,
|
||||
period,
|
||||
energyUnits,
|
||||
["sum"]
|
||||
)),
|
||||
...(await fetchStatistics(
|
||||
hass!,
|
||||
startMinHour,
|
||||
end,
|
||||
waterStatIds,
|
||||
period,
|
||||
waterUnits,
|
||||
["sum"]
|
||||
)),
|
||||
...(energyStatIds.length
|
||||
? await fetchStatistics(
|
||||
hass!,
|
||||
startMinHour,
|
||||
end,
|
||||
energyStatIds,
|
||||
period,
|
||||
energyUnits,
|
||||
["sum"]
|
||||
)
|
||||
: {}),
|
||||
...(waterStatIds.length
|
||||
? await fetchStatistics(
|
||||
hass!,
|
||||
startMinHour,
|
||||
end,
|
||||
waterStatIds,
|
||||
period,
|
||||
waterUnits,
|
||||
["sum"]
|
||||
)
|
||||
: {}),
|
||||
};
|
||||
|
||||
let statsCompare;
|
||||
@ -441,24 +445,28 @@ const getEnergyData = async (
|
||||
endCompare = addMilliseconds(start, -1);
|
||||
|
||||
statsCompare = {
|
||||
...(await fetchStatistics(
|
||||
hass!,
|
||||
compareStartMinHour,
|
||||
endCompare,
|
||||
energyStatIds,
|
||||
period,
|
||||
energyUnits,
|
||||
["sum"]
|
||||
)),
|
||||
...(await fetchStatistics(
|
||||
hass!,
|
||||
compareStartMinHour,
|
||||
endCompare,
|
||||
waterStatIds,
|
||||
period,
|
||||
waterUnits,
|
||||
["sum"]
|
||||
)),
|
||||
...(energyStatIds.length
|
||||
? await fetchStatistics(
|
||||
hass!,
|
||||
compareStartMinHour,
|
||||
endCompare,
|
||||
energyStatIds,
|
||||
period,
|
||||
energyUnits,
|
||||
["sum"]
|
||||
)
|
||||
: {}),
|
||||
...(waterStatIds.length
|
||||
? await fetchStatistics(
|
||||
hass!,
|
||||
compareStartMinHour,
|
||||
endCompare,
|
||||
waterStatIds,
|
||||
period,
|
||||
waterUnits,
|
||||
["sum"]
|
||||
)
|
||||
: {}),
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user