mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-15 21:36:36 +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 = {
|
const stats = {
|
||||||
...(await fetchStatistics(
|
...(energyStatIds.length
|
||||||
hass!,
|
? await fetchStatistics(
|
||||||
startMinHour,
|
hass!,
|
||||||
end,
|
startMinHour,
|
||||||
energyStatIds,
|
end,
|
||||||
period,
|
energyStatIds,
|
||||||
energyUnits,
|
period,
|
||||||
["sum"]
|
energyUnits,
|
||||||
)),
|
["sum"]
|
||||||
...(await fetchStatistics(
|
)
|
||||||
hass!,
|
: {}),
|
||||||
startMinHour,
|
...(waterStatIds.length
|
||||||
end,
|
? await fetchStatistics(
|
||||||
waterStatIds,
|
hass!,
|
||||||
period,
|
startMinHour,
|
||||||
waterUnits,
|
end,
|
||||||
["sum"]
|
waterStatIds,
|
||||||
)),
|
period,
|
||||||
|
waterUnits,
|
||||||
|
["sum"]
|
||||||
|
)
|
||||||
|
: {}),
|
||||||
};
|
};
|
||||||
|
|
||||||
let statsCompare;
|
let statsCompare;
|
||||||
@ -441,24 +445,28 @@ const getEnergyData = async (
|
|||||||
endCompare = addMilliseconds(start, -1);
|
endCompare = addMilliseconds(start, -1);
|
||||||
|
|
||||||
statsCompare = {
|
statsCompare = {
|
||||||
...(await fetchStatistics(
|
...(energyStatIds.length
|
||||||
hass!,
|
? await fetchStatistics(
|
||||||
compareStartMinHour,
|
hass!,
|
||||||
endCompare,
|
compareStartMinHour,
|
||||||
energyStatIds,
|
endCompare,
|
||||||
period,
|
energyStatIds,
|
||||||
energyUnits,
|
period,
|
||||||
["sum"]
|
energyUnits,
|
||||||
)),
|
["sum"]
|
||||||
...(await fetchStatistics(
|
)
|
||||||
hass!,
|
: {}),
|
||||||
compareStartMinHour,
|
...(waterStatIds.length
|
||||||
endCompare,
|
? await fetchStatistics(
|
||||||
waterStatIds,
|
hass!,
|
||||||
period,
|
compareStartMinHour,
|
||||||
waterUnits,
|
endCompare,
|
||||||
["sum"]
|
waterStatIds,
|
||||||
)),
|
period,
|
||||||
|
waterUnits,
|
||||||
|
["sum"]
|
||||||
|
)
|
||||||
|
: {}),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user