Fix removing entity in scene editor (#4241)

Fixes https://github.com/home-assistant/home-assistant-polymer/issues/4237
This commit is contained in:
Bram Kragten 2019-11-19 00:35:16 +01:00 committed by GitHub
parent 9f520d7628
commit 8a3b1d76a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -250,14 +250,14 @@ export class HaSceneEditor extends SubscribeMixin(LitElement) {
@click=${this._deleteDevice}
></paper-icon-button>
</div>
${device.entities.map((entity) => {
const stateObj = this.hass.states[entity];
${device.entities.map((entityId) => {
const stateObj = this.hass.states[entityId];
if (!stateObj) {
return html``;
}
return html`
<paper-icon-item
.entity=${stateObj.entity_id}
.entityId=${entityId}
@click=${this._showMoreInfo}
class="device-entity"
>
@ -313,14 +313,14 @@ export class HaSceneEditor extends SubscribeMixin(LitElement) {
"ui.panel.config.scene.editor.entities.without_device"
)}
>
${entities.map((entity) => {
const stateObj = this.hass.states[entity];
${entities.map((entityId) => {
const stateObj = this.hass.states[entityId];
if (!stateObj) {
return html``;
}
return html`
<paper-icon-item
.entity=${stateObj.entity_id}
.entityId=${entityId}
@click=${this._showMoreInfo}
class="device-entity"
>
@ -333,7 +333,7 @@ export class HaSceneEditor extends SubscribeMixin(LitElement) {
</paper-item-body>
<paper-icon-button
icon="hass:delete"
.entity=${entity}
.entityId=${entityId}
.title="${this.hass.localize(
"ui.panel.config.scene.editor.entities.delete"
)}"
@ -428,7 +428,7 @@ export class HaSceneEditor extends SubscribeMixin(LitElement) {
}
private _showMoreInfo(ev: Event) {
const entityId = (ev.currentTarget as any).entity;
const entityId = (ev.currentTarget as any).entityId;
fireEvent(this, "hass-more-info", { entityId });
}