Fix map history (#6075)

This commit is contained in:
Bram Kragten 2020-06-01 16:07:06 +02:00 committed by GitHub
parent 49b4271a47
commit 19c13096dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -56,7 +56,8 @@ export const fetchRecent = (
startTime, startTime,
endTime, endTime,
skipInitialState = false, skipInitialState = false,
significantChangesOnly?: boolean significantChangesOnly?: boolean,
minimalResponse = true
): Promise<HassEntity[][]> => { ): Promise<HassEntity[][]> => {
let url = "history/period"; let url = "history/period";
if (startTime) { if (startTime) {
@ -72,7 +73,9 @@ export const fetchRecent = (
if (significantChangesOnly !== undefined) { if (significantChangesOnly !== undefined) {
url += `&significant_changes_only=${Number(significantChangesOnly)}`; url += `&significant_changes_only=${Number(significantChangesOnly)}`;
} }
url += "&minimal_response"; if (minimalResponse) {
url += "&minimal_response";
}
return hass.callApi("GET", url); return hass.callApi("GET", url);
}; };

View File

@ -581,6 +581,7 @@ class HuiMapCard extends LitElement implements LovelaceCard {
startTime.setHours(endTime.getHours() - this._config!.hours_to_show!); startTime.setHours(endTime.getHours() - this._config!.hours_to_show!);
const skipInitialState = false; const skipInitialState = false;
const significantChangesOnly = false; const significantChangesOnly = false;
const minimalResponse = false;
const stateHistory = await fetchRecent( const stateHistory = await fetchRecent(
this.hass, this.hass,
@ -588,7 +589,8 @@ class HuiMapCard extends LitElement implements LovelaceCard {
startTime, startTime,
endTime, endTime,
skipInitialState, skipInitialState,
significantChangesOnly significantChangesOnly,
minimalResponse
); );
if (stateHistory.length < 1) { if (stateHistory.length < 1) {