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:
parent
d59d4f3f88
commit
0e8175b38d
@ -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() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user