diff --git a/src/panels/lovelace/cards/hui-todo-list-card.ts b/src/panels/lovelace/cards/hui-todo-list-card.ts index f2d38bc64f83..68af5f2b5914 100644 --- a/src/panels/lovelace/cards/hui-todo-list-card.ts +++ b/src/panels/lovelace/cards/hui-todo-list-card.ts @@ -135,10 +135,14 @@ export class HuiTodoListCard public hassSubscribe(): Promise[] { return [ - this.hass!.connection.subscribeEvents( - () => this._fetchData(), - "shopping_list_updated" - ), + this.hass!.connection.subscribeEvents(() => { + if ( + this._entityId && + this.hass!.entities[this._entityId]?.platform === "shopping_list" + ) { + this._fetchData(); + } + }, "shopping_list_updated"), ]; } @@ -159,6 +163,15 @@ export class HuiTodoListCard ) { applyThemesOnElement(this, this.hass.themes, this._config.theme); } + + if ( + this._entityId && + oldHass && + oldHass.states[this._entityId] !== this.hass.states[this._entityId] && + this.hass.entities[this._entityId]?.platform !== "shopping_list" + ) { + this._fetchData(); + } } protected render() {