From 3e90db5fa3f76abf4932ac3bc98aa3e11c5cd29d Mon Sep 17 00:00:00 2001 From: Malte Franken Date: Mon, 30 Apr 2018 05:01:14 +1000 Subject: [PATCH] Allows to define a custom "more info" dialog per entity (#1128) --- src/dialogs/more-info/controls/more-info-content.html | 8 +++++++- src/util/hass-attributes-util.html | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/dialogs/more-info/controls/more-info-content.html b/src/dialogs/more-info/controls/more-info-content.html index 9bde82a074..7235c50b9d 100644 --- a/src/dialogs/more-info/controls/more-info-content.html +++ b/src/dialogs/more-info/controls/more-info-content.html @@ -43,6 +43,7 @@ class MoreInfoContent extends Polymer.Element { } stateObjChanged(stateObj, hass) { + let moreInfoType; if (!stateObj || !hass) { if (this.lastChild) { this._detachedChild = this.lastChild; @@ -55,8 +56,13 @@ class MoreInfoContent extends Polymer.Element { this.appendChild(this._detachedChild); this._detachedChild = null; } + if (stateObj.attributes && 'custom_ui_more_info' in stateObj.attributes) { + moreInfoType = stateObj.attributes.custom_ui_more_info; + } else { + moreInfoType = 'more-info-' + window.hassUtil.stateMoreInfoType(stateObj); + } window.hassUtil.dynamicContentUpdater( - this, 'MORE-INFO-' + window.hassUtil.stateMoreInfoType(stateObj).toUpperCase(), + this, moreInfoType.toUpperCase(), { hass: hass, stateObj: stateObj } ); } diff --git a/src/util/hass-attributes-util.html b/src/util/hass-attributes-util.html index bdd91f91df..408659ed07 100644 --- a/src/util/hass-attributes-util.html +++ b/src/util/hass-attributes-util.html @@ -70,6 +70,7 @@ window.hassAttributeUtil.LOGIC_STATE_ATTRIBUTES = homebridge_name: { type: 'string' }, supported_features: undefined, attribution: undefined, + custom_ui_more_info: { type: 'string' }, custom_ui_state_card: { type: 'string' }, device_class: { type: 'array',