Fix ha-state-badge name in picture element card (#19703)

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
Paul Bottein 2024-02-07 10:15:10 +01:00 committed by GitHub
parent 3c744c09f1
commit d1592bf262
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 6 additions and 4 deletions

View File

@ -133,9 +133,9 @@ export class HaStateLabelBadge extends LitElement {
entityState,
this._timerTimeRemaining
)}
.description=${this.showName === false
? undefined
: this.name ?? computeStateName(entityState)}
.description=${this.showName
? this.name ?? computeStateName(entityState)
: undefined}
>
${!image && showIcon
? html`<ha-state-icon

View File

@ -34,7 +34,7 @@ export class HuiStateLabelBadge extends LitElement implements LovelaceBadge {
.name=${this._config.name}
.icon=${this._config.icon}
.image=${this._config.image}
.showName=${this._config.show_name}
.showName=${this._config.show_name ?? true}
@action=${this._handleAction}
.actionHandler=${actionHandler({
hasHold: hasAction(this._config!.hold_action),

View File

@ -17,6 +17,7 @@ export interface StateLabelBadgeConfig extends LovelaceBadgeConfig {
name?: string;
icon?: string;
image?: string;
show_name?: boolean;
tap_action?: ActionConfig;
hold_action?: ActionConfig;
double_tap_action?: ActionConfig;

View File

@ -58,6 +58,7 @@ export class HuiStateBadgeElement
: this._config.title === null
? ""
: this._config.title}
showName
@action=${this._handleAction}
.actionHandler=${actionHandler({
hasHold: hasAction(this._config!.hold_action),