From 03f9964c59b572d279b896dad50aa4e471e5aec5 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 31 Mar 2021 15:36:09 +0200 Subject: [PATCH] Fix max being undefined in automation (#8771) --- .../config/automation/manual-automation-editor.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/panels/config/automation/manual-automation-editor.ts b/src/panels/config/automation/manual-automation-editor.ts index e7a315341a..8828066792 100644 --- a/src/panels/config/automation/manual-automation-editor.ts +++ b/src/panels/config/automation/manual-automation-editor.ts @@ -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, }); }