Skip to content

Commit

Permalink
Added support for unit_of_measurement
Browse files Browse the repository at this point in the history
  • Loading branch information
balloob committed Nov 9, 2014
1 parent 5770cc0 commit 2ec1f20
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
3 changes: 3 additions & 0 deletions homeassistant/components/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
# A picture to represent entity
ATTR_ENTITY_PICTURE = "entity_picture"

# The unit of measurement if applicable
ATTR_UNIT_OF_MEASUREMENT = "unit_of_measurement"

STATE_ON = 'on'
STATE_OFF = 'off'
STATE_HOME = 'home'
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/http/frontend.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
""" DO NOT MODIFY. Auto-generated by build_frontend script """
VERSION = "6d353f9599942124690691fb22c115ee"
VERSION = "eed02673a7e36fe85f2fa021373d0156"
7 changes: 6 additions & 1 deletion homeassistant/components/http/www_static/frontend.html
Original file line number Diff line number Diff line change
Expand Up @@ -20048,7 +20048,12 @@ <h1>{{heading}}</h1>
Object.defineProperties(State.prototype, {
"stateDisplay": {
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;
}
}
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@
Object.defineProperties(State.prototype, {
"stateDisplay": {
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;
}
}
},

Expand Down

0 comments on commit 2ec1f20

Please sign in to comment.