From e14e27c01ab1725a132eb4ed33732b1902f25f75 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 21 Jan 2023 18:36:47 -1000 Subject: [PATCH] Remove unused fetchRecent/fetchRecentWS/fetchDate history data functions (#15146) * Add support for streaming history * Add support for streaming history * Add support for streaming history * Add support for streaming history * fixes * cleanup * redraw * naming is hard * drop cached history * backport * Convert history header/footer to use streaming history needs #15112 * Update map card to use streaming history Update map card to use streaming history Update map card to use streaming history Update map card to use streaming history Update map card to use streaming history Update map card to use streaming history Update map card to use streaming history * Remove unused fetchRecent/fetchRecentWS/fetchDate history data functions These call are no longer needed after * Update src/data/history.ts Co-authored-by: Paulus Schoutsen * Update src/data/history.ts Co-authored-by: Paulus Schoutsen * review * review * review * review * review * review * review * review * adjust * Revert "adjust" This reverts commit 6ba31da4a5a619a0da1bfbcfe18723de595e19aa. * move setInterval * Object.keys to for * refactor Co-authored-by: Paulus Schoutsen --- src/data/history.ts | 67 --------------------------------------------- 1 file changed, 67 deletions(-) diff --git a/src/data/history.ts b/src/data/history.ts index cbe57cc800..b4eb5e87ba 100644 --- a/src/data/history.ts +++ b/src/data/history.ts @@ -94,73 +94,6 @@ export const entityIdHistoryNeedsAttributes = ( !hass.states[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 => { - 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({ - 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 => - hass.callApi( - "GET", - `history/period/${startTime.toISOString()}?end_time=${endTime.toISOString()}&minimal_response${ - entityIds ? `&filter_entity_id=${entityIds.join(",")}` : `` - }` - ); - export const fetchDateWS = ( hass: HomeAssistant, startTime: Date,