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 authored and Thomas Lovén committed 2019-08-04 20:22:56 +02:00
1 parent d59d4f3f88
commit 0e8175b38d
1 file changed
+4 -1
+4 -1
View File
@@ -14,7 +14,10 @@ export class InputNumberController extends Controller {
} }
get string() { 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() { get isOff() {