Fix max being undefined in automation (#8771)

This commit is contained in:
Bram Kragten 2021-03-31 15:36:09 +02:00 committed by GitHub
parent f159219d2c
commit 03f9964c59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -279,12 +279,17 @@ export class HaManualAutomationEditor extends LitElement {
if (mode === this.config!.mode) {
return;
}
const value = {
...this.config!,
mode,
};
if (!MODES_MAX.includes(mode)) {
delete value.max;
}
fireEvent(this, "value-changed", {
value: {
...this.config!,
mode,
max: !MODES_MAX.includes(mode) ? undefined : this.config.max,
},
value,
});
}