mirror of
https://github.com/home-assistant/core.git
synced 2025-07-08 13:57:10 +00:00
Added support for unit_of_measurement
This commit is contained in:
parent
5770cc03a1
commit
2ec1f20a03
@ -31,6 +31,9 @@ ATTR_FRIENDLY_NAME = "friendly_name"
|
|||||||
# A picture to represent entity
|
# A picture to represent entity
|
||||||
ATTR_ENTITY_PICTURE = "entity_picture"
|
ATTR_ENTITY_PICTURE = "entity_picture"
|
||||||
|
|
||||||
|
# The unit of measurement if applicable
|
||||||
|
ATTR_UNIT_OF_MEASUREMENT = "unit_of_measurement"
|
||||||
|
|
||||||
STATE_ON = 'on'
|
STATE_ON = 'on'
|
||||||
STATE_OFF = 'off'
|
STATE_OFF = 'off'
|
||||||
STATE_HOME = 'home'
|
STATE_HOME = 'home'
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
""" DO NOT MODIFY. Auto-generated by build_frontend script """
|
""" DO NOT MODIFY. Auto-generated by build_frontend script """
|
||||||
VERSION = "6d353f9599942124690691fb22c115ee"
|
VERSION = "eed02673a7e36fe85f2fa021373d0156"
|
||||||
|
@ -20048,7 +20048,12 @@ core-item {
|
|||||||
Object.defineProperties(State.prototype, {
|
Object.defineProperties(State.prototype, {
|
||||||
"stateDisplay": {
|
"stateDisplay": {
|
||||||
get: function() {
|
get: function() {
|
||||||
return this.state.replace(/_/g, " ");
|
var state = this.state.replace(/_/g, " ");
|
||||||
|
if(this.attributes.unit_of_measurement) {
|
||||||
|
return state + " " + this.attributes.unit_of_measurement;
|
||||||
|
} else {
|
||||||
|
return state;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -37,7 +37,12 @@
|
|||||||
Object.defineProperties(State.prototype, {
|
Object.defineProperties(State.prototype, {
|
||||||
"stateDisplay": {
|
"stateDisplay": {
|
||||||
get: function() {
|
get: function() {
|
||||||
return this.state.replace(/_/g, " ");
|
var state = this.state.replace(/_/g, " ");
|
||||||
|
if(this.attributes.unit_of_measurement) {
|
||||||
|
return state + " " + this.attributes.unit_of_measurement;
|
||||||
|
} else {
|
||||||
|
return state;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user