From 182b8f809c6bbe236f3107b1a59d4a00b2845597 Mon Sep 17 00:00:00 2001 From: Mark Parker <11211952+msp1974@users.noreply.github.com> Date: Wed, 28 Sep 2022 16:40:08 +0100 Subject: [PATCH] Prevent service call error if preset_mode is null (#13825) --- .../more-info/controls/more-info-climate.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/dialogs/more-info/controls/more-info-climate.ts b/src/dialogs/more-info/controls/more-info-climate.ts index 2a66080055..03b94c3827 100644 --- a/src/dialogs/more-info/controls/more-info-climate.ts +++ b/src/dialogs/more-info/controls/more-info-climate.ts @@ -377,12 +377,14 @@ class MoreInfoClimate extends LitElement { private _handlePresetmodeChanged(ev) { const newVal = ev.target.value || null; - this._callServiceHelper( - this.stateObj!.attributes.preset_mode, - newVal, - "set_preset_mode", - { preset_mode: newVal } - ); + if (newVal) { + this._callServiceHelper( + this.stateObj!.attributes.preset_mode, + newVal, + "set_preset_mode", + { preset_mode: newVal } + ); + } } private async _callServiceHelper(