Update input-number-controller.js

refactored after Thomas review
This commit is contained in:
Matus Ivanecky 2019-07-10 14:11:07 +02:00 committed by Thomas Lovén
parent 0e8175b38d
commit 9b36cf25bb

View File

@ -14,10 +14,7 @@ export class InputNumberController extends Controller {
}
get string() {
if (typeof this.stateObj.attributes.unit_of_measurement === "undefined") {
this.stateObj.attributes.unit_of_measurement = "";
}
return `${parseFloat(this.stateObj.state)} ${this.stateObj.attributes.unit_of_measurement}`;
return `${parseFloat(this.stateObj.state)} ${this.stateObj.attributes.unit_of_measurement || ""}`.trim();
}
get isOff() {