mirror of
https://github.com/home-assistant/frontend.git
synced 2025-08-05 23:47:54 +00:00
Remove unused fetchRecent/fetchRecentWS/fetchDate history data functions
These call are no longer needed after
This commit is contained in:
parent
21f58356bd
commit
d57cf65edc
@ -94,73 +94,6 @@ export const entityIdHistoryNeedsAttributes = (
|
|||||||
!hass.states[entityId] ||
|
!hass.states[entityId] ||
|
||||||
NEED_ATTRIBUTE_DOMAINS.includes(computeDomain(entityId));
|
NEED_ATTRIBUTE_DOMAINS.includes(computeDomain(entityId));
|
||||||
|
|
||||||
export const fetchRecent = (
|
|
||||||
hass: HomeAssistant,
|
|
||||||
entityId: string,
|
|
||||||
startTime: Date,
|
|
||||||
endTime: Date,
|
|
||||||
skipInitialState = false,
|
|
||||||
significantChangesOnly?: boolean,
|
|
||||||
minimalResponse = true,
|
|
||||||
noAttributes?: boolean
|
|
||||||
): Promise<HassEntity[][]> => {
|
|
||||||
let url = "history/period";
|
|
||||||
if (startTime) {
|
|
||||||
url += "/" + startTime.toISOString();
|
|
||||||
}
|
|
||||||
url += "?filter_entity_id=" + entityId;
|
|
||||||
if (endTime) {
|
|
||||||
url += "&end_time=" + endTime.toISOString();
|
|
||||||
}
|
|
||||||
if (skipInitialState) {
|
|
||||||
url += "&skip_initial_state";
|
|
||||||
}
|
|
||||||
if (significantChangesOnly !== undefined) {
|
|
||||||
url += `&significant_changes_only=${Number(significantChangesOnly)}`;
|
|
||||||
}
|
|
||||||
if (minimalResponse) {
|
|
||||||
url += "&minimal_response";
|
|
||||||
}
|
|
||||||
if (noAttributes) {
|
|
||||||
url += "&no_attributes";
|
|
||||||
}
|
|
||||||
return hass.callApi("GET", url);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const fetchRecentWS = (
|
|
||||||
hass: HomeAssistant,
|
|
||||||
entityIds: string[],
|
|
||||||
startTime: Date,
|
|
||||||
endTime: Date,
|
|
||||||
skipInitialState = false,
|
|
||||||
significantChangesOnly?: boolean,
|
|
||||||
minimalResponse = true,
|
|
||||||
noAttributes?: boolean
|
|
||||||
) =>
|
|
||||||
hass.callWS<HistoryStates>({
|
|
||||||
type: "history/history_during_period",
|
|
||||||
start_time: startTime.toISOString(),
|
|
||||||
end_time: endTime.toISOString(),
|
|
||||||
significant_changes_only: significantChangesOnly || false,
|
|
||||||
include_start_time_state: !skipInitialState,
|
|
||||||
minimal_response: minimalResponse,
|
|
||||||
no_attributes: noAttributes || false,
|
|
||||||
entity_ids: entityIds,
|
|
||||||
});
|
|
||||||
|
|
||||||
export const fetchDate = (
|
|
||||||
hass: HomeAssistant,
|
|
||||||
startTime: Date,
|
|
||||||
endTime: Date,
|
|
||||||
entityIds: string[]
|
|
||||||
): Promise<HassEntity[][]> =>
|
|
||||||
hass.callApi(
|
|
||||||
"GET",
|
|
||||||
`history/period/${startTime.toISOString()}?end_time=${endTime.toISOString()}&minimal_response${
|
|
||||||
entityIds ? `&filter_entity_id=${entityIds.join(",")}` : ``
|
|
||||||
}`
|
|
||||||
);
|
|
||||||
|
|
||||||
export const fetchDateWS = (
|
export const fetchDateWS = (
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
startTime: Date,
|
startTime: Date,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user