mirror of
https://github.com/home-assistant/frontend.git
synced 2025-08-03 14:37:47 +00:00
only get log book data from last time
This commit is contained in:
parent
cce5eb8dcf
commit
72e6c729c9
@ -33,6 +33,8 @@ export class MoreInfoHistory extends LitElement {
|
|||||||
|
|
||||||
private _historyRefreshInterval?: number;
|
private _historyRefreshInterval?: number;
|
||||||
|
|
||||||
|
private _lastLogbookDate?: Date;
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render(): TemplateResult {
|
||||||
if (!this.entityId) {
|
if (!this.entityId) {
|
||||||
return html``;
|
return html``;
|
||||||
@ -88,6 +90,7 @@ export class MoreInfoHistory extends LitElement {
|
|||||||
if (changedProps.has("entityId")) {
|
if (changedProps.has("entityId")) {
|
||||||
this._stateHistory = undefined;
|
this._stateHistory = undefined;
|
||||||
this._entries = undefined;
|
this._entries = undefined;
|
||||||
|
this._lastLogbookDate = undefined;
|
||||||
|
|
||||||
this._getStateHistory();
|
this._getStateHistory();
|
||||||
this._getLogBookData();
|
this._getLogBookData();
|
||||||
@ -115,15 +118,20 @@ export class MoreInfoHistory extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async _getLogBookData() {
|
private async _getLogBookData() {
|
||||||
const yesterday = new Date(new Date().getTime() - 24 * 60 * 60 * 1000);
|
const lastDate =
|
||||||
|
this._lastLogbookDate ||
|
||||||
|
new Date(new Date().getTime() - 24 * 60 * 60 * 1000);
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
|
|
||||||
this._entries = await getLogbookData(
|
this._entries = await getLogbookData(
|
||||||
this.hass,
|
this.hass,
|
||||||
yesterday.toISOString(),
|
lastDate.toISOString(),
|
||||||
now.toISOString(),
|
now.toISOString(),
|
||||||
this.entityId,
|
this.entityId,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this._lastLogbookDate = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _fetchPersonNames() {
|
private _fetchPersonNames() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user