Show name for badges without config (#21588)

* Show name for badges without config

* also for state label type
This commit is contained in:
Bram Kragten 2024-08-05 17:12:28 +02:00 committed by GitHub
parent 3ba572ee37
commit 5c30c1647c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View File

@ -13,6 +13,7 @@ export const ensureBadgeConfig = (
return { return {
type: "entity", type: "entity",
entity: config, entity: config,
display_type: "complete",
}; };
} }
if ("type" in config && config.type) { if ("type" in config && config.type) {

View File

@ -58,7 +58,7 @@ export class HuiBadge extends ReactiveElement {
private _updateElement(config: LovelaceBadgeConfig) { private _updateElement(config: LovelaceBadgeConfig) {
if (config.type === "state-label") { if (config.type === "state-label") {
config = { ...config, type: "entity" }; config = { display_type: "complete", ...config, type: "entity" };
} }
if (!this._element) { if (!this._element) {
return; return;
@ -70,7 +70,7 @@ export class HuiBadge extends ReactiveElement {
private _loadElement(config: LovelaceBadgeConfig) { private _loadElement(config: LovelaceBadgeConfig) {
if (config.type === "state-label") { if (config.type === "state-label") {
config = { ...config, type: "entity" }; config = { display_type: "complete", ...config, type: "entity" };
} }
this._element = createBadgeElement(config); this._element = createBadgeElement(config);
this._elementConfig = config; this._elementConfig = config;