ability to show attribute instead of state in picture-glance (#4958)

This commit is contained in:
Ian Richardson 2020-03-11 03:01:00 -05:00 committed by GitHub
parent 3338459139
commit 5dbcd1f726
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 5 deletions

View File

@ -272,11 +272,17 @@ class HuiPictureGlanceCard extends LitElement implements LovelaceCard {
`
: html`
<div class="state">
${computeStateDisplay(
this.hass!.localize,
stateObj,
this.hass!.language
)}
${entityConf.attribute
? html`
${entityConf.prefix}${stateObj.attributes[
entityConf.attribute
]}${entityConf.suffix}
`
: computeStateDisplay(
this.hass!.localize,
stateObj,
this.hass!.language
)}
</div>
`}
</div>

View File

@ -97,6 +97,9 @@ export interface ConfigEntity extends EntityConfig {
export interface PictureGlanceEntityConfig extends ConfigEntity {
show_state?: boolean;
attribute?: string;
prefix?: string;
suffix?: string;
}
export interface GlanceConfigEntity extends ConfigEntity {