Skip to content

Commit

Permalink
V2025.01.02b20
Browse files Browse the repository at this point in the history
Another try at resolving custom card issue #103
  • Loading branch information
petergridge authored Jan 7, 2025
1 parent 30b19ba commit 4bc065a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion custom_components/irrigationprogram/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"iot_class": "local_polling",
"issue_tracker": "https://github.com/petergridge/irrigation-v5/issues",
"requirements": [],
"version": "V2025.01.02b1"
"version": "V2025.01.02b20"
}
12 changes: 4 additions & 8 deletions custom_components/irrigationprogram/www/irrigation-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class IrrigationCard extends HTMLElement {


setConfig(config) {
if (this.lastChild) this.removeChild(this.lastChild);
if (this.lastElementChild) this.removeChild(this.lastElementChild);
const cardConfig = Object.assign({}, config);
if (!cardConfig.card) cardConfig.card = {};
if (!cardConfig.card.type) cardConfig.card.type = "entities";
Expand Down Expand Up @@ -33,21 +33,18 @@ class IrrigationCard extends HTMLElement {
let doErrors = [];
let validconfig = "invalid";

let zones = hass.states[config.program].attributes["zones"];

let zones = [];
let entities = [];

console.log("editor:constructor()");

const x = hass.states[config.program];
if (!x) {
config.card.title = "ERR";
validconfig == "invalid";
doErrors.push({
type: "section",
label: "Program: not found",
label: "Program: Select a program",
});
config.card.title = "ERROR: " + config.program;
} else {
validconfig = "valid";
}
Expand Down Expand Up @@ -310,7 +307,7 @@ class IrrigationCard extends HTMLElement {
}

getCardSize() {
return "getCardSize" in this.lastChild ? this.lastChild.getCardSize() : 1;
return "getCardSize" in this.lastElementChild ? this.lastElementChild.getCardSize() : 1;
}
}

Expand Down Expand Up @@ -430,7 +427,6 @@ class IrrigationCardEditor extends HTMLElement {
select.add(newOption);
}
}

}

doBuildEntityOptions(program, entities) {
Expand Down

0 comments on commit 4bc065a

Please sign in to comment.