Prevent service call error if preset_mode is null (#13825)

This commit is contained in:
Mark Parker 2022-09-28 16:40:08 +01:00 committed by GitHub
parent 8e4bebb694
commit 182b8f809c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -377,6 +377,7 @@ class MoreInfoClimate extends LitElement {
private _handlePresetmodeChanged(ev) { private _handlePresetmodeChanged(ev) {
const newVal = ev.target.value || null; const newVal = ev.target.value || null;
if (newVal) {
this._callServiceHelper( this._callServiceHelper(
this.stateObj!.attributes.preset_mode, this.stateObj!.attributes.preset_mode,
newVal, newVal,
@ -384,6 +385,7 @@ class MoreInfoClimate extends LitElement {
{ preset_mode: newVal } { preset_mode: newVal }
); );
} }
}
private async _callServiceHelper( private async _callServiceHelper(
oldVal: unknown, oldVal: unknown,