Missed the entities in the editors (#6443)

This commit is contained in:
Bram Kragten 2020-07-22 14:16:25 +02:00 committed by GitHub
parent 8c8673a272
commit f6fb2e4b1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 27 additions and 12 deletions

View File

@ -61,6 +61,8 @@ export class HuiHistoryGraphCard extends LitElement implements LovelaceCard {
private _interval?: number; private _interval?: number;
private _fetching = false;
public getCardSize(): number { public getCardSize(): number {
return 4; return 4;
} }
@ -138,6 +140,7 @@ export class HuiHistoryGraphCard extends LitElement implements LovelaceCard {
> >
<state-history-charts <state-history-charts
.hass=${this.hass} .hass=${this.hass}
.isLoadingData=${!this._stateHistory}
.historyData=${this._stateHistory} .historyData=${this._stateHistory}
.names=${this._names} .names=${this._names}
.upToNow=${true} .upToNow=${true}
@ -149,6 +152,11 @@ export class HuiHistoryGraphCard extends LitElement implements LovelaceCard {
} }
private async _getStateHistory(): Promise<void> { private async _getStateHistory(): Promise<void> {
if (this._fetching) {
return;
}
this._fetching = true;
try {
this._stateHistory = await getRecentWithCache( this._stateHistory = await getRecentWithCache(
this.hass!, this.hass!,
this._cacheConfig!.cacheKey, this._cacheConfig!.cacheKey,
@ -156,6 +164,9 @@ export class HuiHistoryGraphCard extends LitElement implements LovelaceCard {
this.hass!.localize, this.hass!.localize,
this.hass!.language this.hass!.language
); );
} finally {
this._fetching = false;
}
} }
private _clearInterval(): void { private _clearInterval(): void {

View File

@ -135,7 +135,8 @@ export class HuiEntitiesCardEditor extends LitElement
} }
if (ev.detail && ev.detail.entities) { if (ev.detail && ev.detail.entities) {
this._config.entities = ev.detail.entities; this._config = { ...this._config, entities: ev.detail.entities };
this._configEntities = processEditorEntities(this._config.entities); this._configEntities = processEditorEntities(this._config.entities);
} else if (target.configValue) { } else if (target.configValue) {
if (target.value === "") { if (target.value === "") {

View File

@ -193,7 +193,8 @@ export class HuiGlanceCardEditor extends LitElement
return; return;
} }
if (ev.detail && ev.detail.entities) { if (ev.detail && ev.detail.entities) {
this._config.entities = ev.detail.entities; this._config = { ...this._config, entities: ev.detail.entities };
this._configEntities = processEditorEntities(this._config.entities); this._configEntities = processEditorEntities(this._config.entities);
} else if (target.configValue) { } else if (target.configValue) {
if ( if (

View File

@ -136,7 +136,7 @@ export class HuiHistoryGraphCardEditor extends LitElement
} }
if (ev.detail && ev.detail.entities) { if (ev.detail && ev.detail.entities) {
this._config.entities = ev.detail.entities; this._config = { ...this._config, entities: ev.detail.entities };
this._configEntities = processEditorEntities(this._config.entities); this._configEntities = processEditorEntities(this._config.entities);
} else if (target.configValue) { } else if (target.configValue) {
if (target.value === "") { if (target.value === "") {

View File

@ -184,7 +184,8 @@ export class HuiMapCardEditor extends LitElement implements LovelaceCardEditor {
return; return;
} }
if (ev.detail && ev.detail.entities) { if (ev.detail && ev.detail.entities) {
this._config.entities = ev.detail.entities; this._config = { ...this._config, entities: ev.detail.entities };
this._configEntities = processEditorEntities(this._config.entities); this._configEntities = processEditorEntities(this._config.entities);
fireEvent(this, "config-changed", { config: this._config }); fireEvent(this, "config-changed", { config: this._config });
} }

View File

@ -251,7 +251,8 @@ export class HuiPictureGlanceCardEditor extends LitElement
} }
if (ev.detail && ev.detail.entities) { if (ev.detail && ev.detail.entities) {
this._config.entities = ev.detail.entities; this._config = { ...this._config, entities: ev.detail.entities };
this._configEntities = processEditorEntities(this._config.entities); this._configEntities = processEditorEntities(this._config.entities);
} else if (target.configValue) { } else if (target.configValue) {
if ( if (