Handle not defined entities (#6898)

This commit is contained in:
Bram Kragten 2020-09-09 22:55:43 +02:00 committed by GitHub
parent e0bdef98a6
commit eb96dd4803
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View File

@ -103,7 +103,9 @@ class CloudAlexa extends LitElement {
this._entities.forEach((entity) => {
const stateObj = this.hass.states[entity.entity_id];
const config = this._entityConfigs[entity.entity_id] || {};
const config = this._entityConfigs[entity.entity_id] || {
should_expose: null,
};
const isExposed = emptyFilter
? this._configIsExposed(entity.entity_id, config)
: filterFunc(entity.entity_id);
@ -319,9 +321,7 @@ class CloudAlexa extends LitElement {
}
private _configIsExposed(entityId: string, config: AlexaEntityConfig) {
return config.should_expose === null
? this._configIsDomainExposed(entityId)
: config.should_expose;
return config.should_expose ?? this._configIsDomainExposed(entityId);
}
private async _exposeChanged(ev: CustomEvent<ActionDetail>) {

View File

@ -109,7 +109,9 @@ class CloudGoogleAssistant extends LitElement {
this._entities.forEach((entity) => {
const stateObj = this.hass.states[entity.entity_id];
const config = this._entityConfigs[entity.entity_id] || {};
const config = this._entityConfigs[entity.entity_id] || {
should_expose: null,
};
const isExposed = emptyFilter
? this._configIsExposed(entity.entity_id, config)
: filterFunc(entity.entity_id);
@ -324,9 +326,7 @@ class CloudGoogleAssistant extends LitElement {
}
private _configIsExposed(entityId: string, config: GoogleEntityConfig) {
return config.should_expose === null
? this._configIsDomainExposed(entityId)
: config.should_expose;
return config.should_expose ?? this._configIsDomainExposed(entityId);
}
private async _fetchData() {