From 523cd8249fde92b9cf7d1e3cbf922477fe510790 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sat, 1 Nov 2014 15:29:39 -0700 Subject: [PATCH] Use friendly_name for entityDisplay if available --- .../http/www_static/polymer/home-assistant-api.html | 8 +++++++- .../http/www_static/polymer/state-card.html | 11 +++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/homeassistant/components/http/www_static/polymer/home-assistant-api.html b/homeassistant/components/http/www_static/polymer/home-assistant-api.html index e08c57d4d46..39a611f1e38 100644 --- a/homeassistant/components/http/www_static/polymer/home-assistant-api.html +++ b/homeassistant/components/http/www_static/polymer/home-assistant-api.html @@ -98,8 +98,14 @@ var parts = state.entity_id.split("."); state.domain = parts[0]; state.entity = parts[1]; - state.entityDisplay = state.entity.replace(/_/g, " "); state.stateDisplay = state.state.replace(/_/g, " "); + state.canToggle = state.state == "on" || state.state == "off" + + if(state.attributes.friendly_name) { + state.entityDisplay = state.attributes.friendly_name; + } else { + state.entityDisplay = state.entity.replace(/_/g, " "); + } }, // call api methods diff --git a/homeassistant/components/http/www_static/polymer/state-card.html b/homeassistant/components/http/www_static/polymer/state-card.html index 9bb95a32b4b..7296840b466 100755 --- a/homeassistant/components/http/www_static/polymer/state-card.html +++ b/homeassistant/components/http/www_static/polymer/state-card.html @@ -88,12 +88,7 @@
- - + {{stateObj.entityDisplay}}
@@ -106,13 +101,13 @@