Update input-number-controller.js

Hello Thomas, 

I would like to use unit_of_measurements also for input_number.

I would do it this way, if you confortable with this. Later we could refactor also other controllers which are taking it from config, not from entity attributes and combine both approaches.

What is your opinion for it ?
This commit is contained in:
Matus Ivanecky 2019-07-07 02:28:43 +02:00 committed by Thomas Lovén
parent d59d4f3f88
commit 0e8175b38d

View File

@ -14,7 +14,10 @@ export class InputNumberController extends Controller {
}
get string() {
return `${parseFloat(this.stateObj.state)}`;
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}`;
}
get isOff() {