${this._entitiesDialog!.map((entityConf) =>
this.renderEntity(entityConf, true)
)}
+
${this._entitiesToggle!.map((entityConf) =>
this.renderEntity(entityConf, false)
)}
@@ -166,7 +165,7 @@ class HuiPictureGlanceCard extends LitElement implements LovelaceCard {
}
private renderEntity(
- entityConf: ConfigEntity,
+ entityConf: PictureGlanceEntityConfig,
dialog: boolean
): TemplateResult {
const stateObj = this.hass!.states[entityConf.entity];
@@ -189,23 +188,38 @@ class HuiPictureGlanceCard extends LitElement implements LovelaceCard {
}
return html`
-
+
+ >
+ ${this._config!.show_state !== true && entityConf.show_state !== true
+ ? html`
+
+ `
+ : html`
+
+ ${computeStateDisplay(
+ this.hass!.localize,
+ stateObj,
+ this.hass!.language
+ )}
+
+ `}
+
`;
}
@@ -249,6 +263,7 @@ class HuiPictureGlanceCard extends LitElement implements LovelaceCard {
color: white;
display: flex;
justify-content: space-between;
+ flex-direction: row;
}
.box .title {
@@ -265,6 +280,30 @@ class HuiPictureGlanceCard extends LitElement implements LovelaceCard {
ha-icon.state-on {
color: white;
}
+ ha-icon.show-state {
+ width: 20px;
+ height: 20px;
+ padding-bottom: 4px;
+ padding-top: 4px;
+ }
+ .state {
+ display: block;
+ font-size: 12px;
+ text-align: center;
+ line-height: 12px;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
+ .row {
+ display: flex;
+ flex-direction: row;
+ }
+ .wrapper {
+ display: flex;
+ flex-direction: column;
+ width: 40px;
+ }
`;
}
}
diff --git a/src/panels/lovelace/cards/types.ts b/src/panels/lovelace/cards/types.ts
index fd02a0710e..fba27bf829 100644
--- a/src/panels/lovelace/cards/types.ts
+++ b/src/panels/lovelace/cards/types.ts
@@ -82,9 +82,14 @@ export interface ConfigEntity extends EntityConfig {
hold_action?: ActionConfig;
}
+export interface PictureGlanceEntityConfig extends ConfigEntity {
+ show_state?: boolean;
+}
+
export interface GlanceConfigEntity extends ConfigEntity {
show_last_changed?: boolean;
image?: string;
+ show_state?: boolean;
}
export interface GlanceCardConfig extends LovelaceCardConfig {
@@ -166,7 +171,7 @@ export interface PictureEntityCardConfig extends LovelaceCardConfig {
}
export interface PictureGlanceCardConfig extends LovelaceCardConfig {
- entities: EntityConfig[];
+ entities: PictureGlanceEntityConfig[];
title?: string;
image?: string;
camera_image?: string;
@@ -177,6 +182,7 @@ export interface PictureGlanceCardConfig extends LovelaceCardConfig {
entity?: string;
tap_action?: ActionConfig;
hold_action?: ActionConfig;
+ show_state?: boolean;
}
export interface PlantAttributeTarget extends EventTarget {