Skip to content

Commit

Permalink
Merge pull request #98 from karwosts/lit-responsive-updates
Browse files Browse the repository at this point in the history
Rerender card when config changes
  • Loading branch information
isabellaalstrom authored Apr 17, 2023
2 parents cfedd44 + 1a54350 commit 2e5547b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion grocy-chores-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,19 @@ class GrocyChoresCard extends LitElement {
}

set hass(hass) {
let allItems = [];
this._hass = hass;
this._processItems();
}


_processItems() {
let hass = this._hass;
let allItems = [];
this.entities = [];
this.entities_not_found = [];
if(!hass) {
return;
}
if (Array.isArray(this.config.entity)) {
for (let i = 0; i < this.config.entity.length; ++i) {
this.entities[i] = this.config.entity[i] in hass.states ? hass.states[this.config.entity[i]] : null;
Expand Down Expand Up @@ -116,6 +125,7 @@ class GrocyChoresCard extends LitElement {
throw new Error('Please define entity');
}
this.config = config;
this._processItems();
}

render() {
Expand Down

0 comments on commit 2e5547b

Please sign in to comment.