mirror of
https://github.com/home-assistant/frontend.git
synced 2025-08-04 15:07:48 +00:00
backport
This commit is contained in:
parent
c467ef82ea
commit
ec844560af
@ -17,6 +17,8 @@ const NEED_ATTRIBUTE_DOMAINS = [
|
|||||||
"input_datetime",
|
"input_datetime",
|
||||||
"thermostat",
|
"thermostat",
|
||||||
"water_heater",
|
"water_heater",
|
||||||
|
"person",
|
||||||
|
"device_tracker",
|
||||||
];
|
];
|
||||||
const LINE_ATTRIBUTES_TO_KEEP = [
|
const LINE_ATTRIBUTES_TO_KEEP = [
|
||||||
"temperature",
|
"temperature",
|
||||||
@ -68,7 +70,7 @@ export interface HistoryStates {
|
|||||||
[entityId: string]: EntityHistoryState[];
|
[entityId: string]: EntityHistoryState[];
|
||||||
}
|
}
|
||||||
|
|
||||||
interface EntityHistoryState {
|
export interface EntityHistoryState {
|
||||||
/** state */
|
/** state */
|
||||||
s: string;
|
s: string;
|
||||||
/** attributes */
|
/** attributes */
|
||||||
@ -285,7 +287,9 @@ export const subscribeHistoryStatesTimeWindow = (
|
|||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
callbackFunction: (data: HistoryStates) => void,
|
callbackFunction: (data: HistoryStates) => void,
|
||||||
hoursToShow: number,
|
hoursToShow: number,
|
||||||
entityIds: string[]
|
entityIds: string[],
|
||||||
|
minimalResponse = true,
|
||||||
|
significantChangesOnly = true
|
||||||
): Promise<() => Promise<void>> => {
|
): Promise<() => Promise<void>> => {
|
||||||
const params = {
|
const params = {
|
||||||
type: "history/stream",
|
type: "history/stream",
|
||||||
@ -293,7 +297,8 @@ export const subscribeHistoryStatesTimeWindow = (
|
|||||||
start_time: new Date(
|
start_time: new Date(
|
||||||
new Date().getTime() - 60 * 60 * hoursToShow * 1000
|
new Date().getTime() - 60 * 60 * hoursToShow * 1000
|
||||||
).toISOString(),
|
).toISOString(),
|
||||||
minimal_response: true,
|
minimal_response: minimalResponse,
|
||||||
|
significant_changes_only: significantChangesOnly,
|
||||||
no_attributes: !entityIds.some((entityId) =>
|
no_attributes: !entityIds.some((entityId) =>
|
||||||
entityIdHistoryNeedsAttributes(hass, entityId)
|
entityIdHistoryNeedsAttributes(hass, entityId)
|
||||||
),
|
),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user