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,