From fb2e1e5ebb3b320877af839b85f7f16a93f7859c Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Wed, 8 May 2019 19:57:03 -0700 Subject: [PATCH] Trim text --- .../lovelace/entity-rows/hui-input-select-entity-row.ts | 8 ++------ src/state-summary/state-card-input_select.ts | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/panels/lovelace/entity-rows/hui-input-select-entity-row.ts b/src/panels/lovelace/entity-rows/hui-input-select-entity-row.ts index ef4ac3f22c..cda3d1d66e 100644 --- a/src/panels/lovelace/entity-rows/hui-input-select-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-input-select-entity-row.ts @@ -123,18 +123,14 @@ class HuiInputSelectEntityRow extends LitElement implements EntityRow { private _selectedChanged(ev): void { const stateObj = this.hass!.states[this._config!.entity]; - const option = ev.detail.item.innerText; + const option = ev.target.selectedItem.innerText.trim(); if (option === stateObj.state) { return; } forwardHaptic("light"); - setInputSelectOption( - this.hass!, - stateObj.entity_id, - ev.target.selectedItem.innerText - ); + setInputSelectOption(this.hass!, stateObj.entity_id, option); } } diff --git a/src/state-summary/state-card-input_select.ts b/src/state-summary/state-card-input_select.ts index 19befdfb29..5566c27a6c 100644 --- a/src/state-summary/state-card-input_select.ts +++ b/src/state-summary/state-card-input_select.ts @@ -58,7 +58,7 @@ class StateCardInputSelect extends LitElement { private async _selectedOptionChanged( ev: PolymerIronSelectEvent ) { - const option = ev.detail.item.innerText; + const option = ev.detail.item.innerText.trim(); if (option === this.stateObj.state) { return; }