Skip to content

Commit

Permalink
Fix choose description when a non-list form of conditions is used (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
karwosts authored Sep 26, 2023
1 parent d794ec3 commit c69fb77
Showing 1 changed file with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,26 +82,23 @@ export class HaChooseAction extends LitElement implements ActionElement {
if (this.isExpanded(idx)) {
return "";
}
if (!option.conditions || option.conditions.length === 0) {
const conditions = ensureArray(option.conditions);
if (!conditions || conditions.length === 0) {
return this.hass.localize(
"ui.panel.config.automation.editor.actions.type.choose.no_conditions"
);
}
let str = "";
if (typeof option.conditions[0] === "string") {
str += option.conditions[0];
if (typeof conditions[0] === "string") {
str += conditions[0];
} else {
str += describeCondition(
option.conditions[0],
this.hass,
this._entityReg
);
str += describeCondition(conditions[0], this.hass, this._entityReg);
}
if (option.conditions.length > 1) {
if (conditions.length > 1) {
str += this.hass.localize(
"ui.panel.config.automation.editor.actions.type.choose.option_description_additional",
"numberOfAdditionalConditions",
option.conditions.length - 1
conditions.length - 1
);
}
return str;
Expand Down

0 comments on commit c69fb77

Please sign in to comment.