Skip to content

Commit

Permalink
Fix for setConfig issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
gadgetchnnel committed Nov 19, 2020
1 parent d151aa9 commit 254e4e0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
4 changes: 2 additions & 2 deletions lovelace-card-templater.js

Large diffs are not rendered by default.

20 changes: 4 additions & 16 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,29 +165,16 @@ console.info(
if(this.haveEntitiesChanged())
{
this.getCardConfig(this._config.card ? this._config.card : this._config.entity_row).then(config =>{
if(config["type"] != this._cardConfig["type"]){
// If card type has been changed by template, recreate it.
this.applyStateTemplates().then(() => {
this.applyStateTemplates().then(() => {
this._cardConfig = config;
this.card = createCard(this._cardConfig);
setInterval(() => {
setTimeout(() => {
this.card.isPanel = (this._isPanel == true);
this.card.hass = this._mockHass;
this.requestUpdate();
}, 100);
});
}
else{
this.applyStateTemplates().then(() => {
this._cardConfig = config;
this.card.setConfig(config);
this.card.isPanel = (this._isPanel == true);
this.card.hass = this._mockHass;
this.requestUpdate();
});
}
}
);
});
}
else{
// Combine previously mocked states with any new state updates
Expand Down Expand Up @@ -239,6 +226,7 @@ console.info(
}
catch(err){
console.error("Error parsing template.", err);
console.log("Template", template);
return "Error!";
}
}
Expand Down

0 comments on commit 254e4e0

Please sign in to comment.