Allows to define a custom "more info" dialog per entity (#1128)

This commit is contained in:
Malte Franken 2018-04-30 05:01:14 +10:00 committed by Paulus Schoutsen
parent 30555eda88
commit 3e90db5fa3
2 changed files with 8 additions and 1 deletions

View File

@ -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 }
);
}

View File

@ -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',