mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 07:16:39 +00:00
This reverts commit d88670034a7c272ec0b9ad545eff173a03f9a09c.
This commit is contained in:
parent
c55720c933
commit
d7cb4cb537
@ -12,14 +12,6 @@ export interface RecorderInfo {
|
||||
thread_running: boolean;
|
||||
}
|
||||
|
||||
export interface RecordedEntities {
|
||||
entity_ids: string[];
|
||||
}
|
||||
export interface RecordedExcludedEntities {
|
||||
recorded_ids: string[];
|
||||
excluded_ids: string[];
|
||||
}
|
||||
|
||||
export type StatisticType = "change" | "state" | "sum" | "min" | "max" | "mean";
|
||||
|
||||
export interface Statistics {
|
||||
@ -332,25 +324,3 @@ export const getDisplayUnit = (
|
||||
|
||||
export const isExternalStatistic = (statisticsId: string): boolean =>
|
||||
statisticsId.includes(":");
|
||||
|
||||
let recordedExcludedEntitiesCache: RecordedExcludedEntities | undefined;
|
||||
|
||||
export const getRecordedExcludedEntities = async (
|
||||
hass: HomeAssistant
|
||||
): Promise<RecordedExcludedEntities> => {
|
||||
if (recordedExcludedEntitiesCache) {
|
||||
return recordedExcludedEntitiesCache;
|
||||
}
|
||||
const recordedEntities = await hass.callWS<RecordedEntities>({
|
||||
type: "recorder/recorded_entities",
|
||||
});
|
||||
|
||||
recordedExcludedEntitiesCache = {
|
||||
recorded_ids: recordedEntities.entity_ids,
|
||||
excluded_ids: Object.keys(hass.states).filter(
|
||||
(id) => !recordedEntities.entity_ids.includes(id)
|
||||
),
|
||||
};
|
||||
|
||||
return recordedExcludedEntitiesCache;
|
||||
};
|
||||
|
@ -6,7 +6,6 @@ import {
|
||||
} from "@mdi/js";
|
||||
import { ActionDetail } from "@material/mwc-list";
|
||||
import { differenceInHours } from "date-fns";
|
||||
import { HassEntity } from "home-assistant-js-websocket";
|
||||
import {
|
||||
HassServiceTarget,
|
||||
UnsubscribeFunc,
|
||||
@ -46,11 +45,7 @@ import {
|
||||
computeHistory,
|
||||
subscribeHistory,
|
||||
} from "../../data/history";
|
||||
import {
|
||||
fetchStatistics,
|
||||
Statistics,
|
||||
getRecordedExcludedEntities,
|
||||
} from "../../data/recorder";
|
||||
import { Statistics, fetchStatistics } from "../../data/recorder";
|
||||
import {
|
||||
expandAreaTarget,
|
||||
expandDeviceTarget,
|
||||
@ -100,8 +95,6 @@ class HaPanelHistory extends LitElement {
|
||||
|
||||
private _interval?: number;
|
||||
|
||||
private _excludedEntities?: string[];
|
||||
|
||||
public constructor() {
|
||||
super();
|
||||
|
||||
@ -192,7 +185,6 @@ class HaPanelHistory extends LitElement {
|
||||
.hass=${this.hass}
|
||||
.value=${this._targetPickerValue}
|
||||
.disabled=${this._isLoading}
|
||||
.entityFilter=${this._entityFilter}
|
||||
addOnTop
|
||||
@value-changed=${this._targetsChanged}
|
||||
></ha-target-picker>
|
||||
@ -219,10 +211,6 @@ class HaPanelHistory extends LitElement {
|
||||
`;
|
||||
}
|
||||
|
||||
private _entityFilter = (entity: HassEntity): boolean =>
|
||||
!this._excludedEntities ||
|
||||
!this._excludedEntities.includes(entity.entity_id);
|
||||
|
||||
private mergeHistoryResults(
|
||||
ltsResult: HistoryResult,
|
||||
historyResult: HistoryResult
|
||||
@ -374,17 +362,8 @@ class HaPanelHistory extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
private async _getRecordedExcludedEntities() {
|
||||
const { recorded_ids: _recordedIds, excluded_ids: excludedIds } =
|
||||
await getRecordedExcludedEntities(this.hass);
|
||||
this._excludedEntities = excludedIds;
|
||||
}
|
||||
|
||||
protected firstUpdated(changedProps: PropertyValues) {
|
||||
super.firstUpdated(changedProps);
|
||||
|
||||
this._getRecordedExcludedEntities();
|
||||
|
||||
const searchParams = extractSearchParamsObject();
|
||||
if (searchParams.back === "1" && history.length > 1) {
|
||||
this._showBack = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user