diff --git a/src/panels/config/automation/condition/types/ha-automation-condition-numeric_state.ts b/src/panels/config/automation/condition/types/ha-automation-condition-numeric_state.ts index 0a9003c72e..a7458813db 100644 --- a/src/panels/config/automation/condition/types/ha-automation-condition-numeric_state.ts +++ b/src/panels/config/automation/condition/types/ha-automation-condition-numeric_state.ts @@ -237,15 +237,19 @@ export default class HaNumericStateCondition extends LitElement { private _valueChanged(ev: CustomEvent): void { ev.stopPropagation(); - const newTrigger = ev.detail.value; + const newCondition = ev.detail.value; - this._inputAboveIsEntity = newTrigger.mode_above === "input"; - this._inputBelowIsEntity = newTrigger.mode_below === "input"; + this._inputAboveIsEntity = newCondition.mode_above === "input"; + this._inputBelowIsEntity = newCondition.mode_below === "input"; - delete newTrigger.mode_above; - delete newTrigger.mode_below; + delete newCondition.mode_above; + delete newCondition.mode_below; - fireEvent(this, "value-changed", { value: newTrigger }); + if (newCondition.value_template === "") { + delete newCondition.value_template; + } + + fireEvent(this, "value-changed", { value: newCondition }); } private _computeLabelCallback = ( diff --git a/src/panels/config/automation/trigger/types/ha-automation-trigger-numeric_state.ts b/src/panels/config/automation/trigger/types/ha-automation-trigger-numeric_state.ts index 29cb0362cd..62315025a4 100644 --- a/src/panels/config/automation/trigger/types/ha-automation-trigger-numeric_state.ts +++ b/src/panels/config/automation/trigger/types/ha-automation-trigger-numeric_state.ts @@ -288,6 +288,10 @@ export class HaNumericStateTrigger extends LitElement { delete newTrigger.mode_above; delete newTrigger.mode_below; + if (newTrigger.value_template === "") { + delete newTrigger.value_template; + } + fireEvent(this, "value-changed", { value: newTrigger }); }