From 5159326a7b3d1ba29ae17a7861fa2eaa8c2c95f6 Mon Sep 17 00:00:00 2001 From: andrey-git Date: Wed, 25 Jan 2017 19:30:02 +0200 Subject: [PATCH] Show attribute in more-info of light and lock. (#179) * Show attribute in more-info of light and lock. * Use in weather card * Inline functions from hass-util Inline functions from hass-util now that ha-attributes is the only user. * Inline functions from hass-util * Weathrer's FILTER_KEYS is no longer needed. * Cache csv split --- src/cards/ha-weather-card.html | 25 +------- src/components/ha-attributes.html | 87 +++++++++++++++++++++++++++ src/more-infos/more-info-default.html | 64 +++----------------- src/more-infos/more-info-light.html | 3 + src/more-infos/more-info-lock.html | 2 + src/util/hass-util.html | 23 ------- 6 files changed, 103 insertions(+), 101 deletions(-) create mode 100644 src/components/ha-attributes.html diff --git a/src/cards/ha-weather-card.html b/src/cards/ha-weather-card.html index 49c2dbbfc9..eabf8d7b9a 100644 --- a/src/cards/ha-weather-card.html +++ b/src/cards/ha-weather-card.html @@ -5,7 +5,7 @@ - + + + + diff --git a/src/more-infos/more-info-default.html b/src/more-infos/more-info-default.html index 19a6772d56..65eaee7285 100644 --- a/src/more-infos/more-info-default.html +++ b/src/more-infos/more-info-default.html @@ -1,67 +1,21 @@ - + diff --git a/src/more-infos/more-info-light.html b/src/more-infos/more-info-light.html index 769bced6d3..d0f78e2661 100644 --- a/src/more-infos/more-info-light.html +++ b/src/more-infos/more-info-light.html @@ -7,6 +7,7 @@ + diff --git a/src/more-infos/more-info-lock.html b/src/more-infos/more-info-lock.html index 07c096abb6..0606f5ba55 100644 --- a/src/more-infos/more-info-lock.html +++ b/src/more-infos/more-info-lock.html @@ -2,6 +2,7 @@ + diff --git a/src/util/hass-util.html b/src/util/hass-util.html index 73b7f21244..5d69ca2756 100644 --- a/src/util/hass-util.html +++ b/src/util/hass-util.html @@ -341,27 +341,4 @@ window.hassUtil.stateIcon = function (state) { return window.hassUtil.domainIcon(state.domain, state.state); }; -window.hassUtil.computeDisplayAttributes = function (stateObj, filterKeys) { - if (!stateObj) { - return []; - } - - return Object.keys(stateObj.attributes).filter( - function (key) { return filterKeys.indexOf(key) === -1; }); -}; - -window.hassUtil.formatAttribute = function (attribute) { - return attribute.replace(/_/g, ' '); -}; - -window.hassUtil.formatAttributeValue = function (stateObj, attribute) { - var value = stateObj.attributes[attribute]; - - return Array.isArray(value) ? value.join(', ') : value; -}; - -window.hassUtil.computeAttribution = function (stateObj) { - return stateObj.attributes.attribution; -}; -