Add 'state' option for secondary entity info on Entities card (#26201)

* add 'state' option for secondary entity info on Entities card

* Use formatEntityState instead of computeStateDisplay
This commit is contained in:
Tommy Goode 2025-07-17 09:02:09 -05:00 committed by GitHub
parent a10dbb64f0
commit ec6666a4ea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 9 additions and 2 deletions

View File

@ -73,6 +73,7 @@ export interface EntitiesCardEntityConfig extends EntityConfig {
| "last-triggered" | "last-triggered"
| "last-updated" | "last-updated"
| "position" | "position"
| "state"
| "tilt-position" | "tilt-position"
| "brightness"; | "brightness";
action_name?: string; action_name?: string;

View File

@ -146,7 +146,11 @@ export class HuiGenericEntityRow extends LitElement {
100 100
)} )}
%` %`
: nothing)} : this.config.secondary_info === "state"
? html`${this.hass.formatEntityState(
stateObj
)}`
: nothing)}
</div> </div>
` `
: nothing} : nothing}

View File

@ -19,6 +19,7 @@ const SECONDARY_INFO_VALUES = {
"last-updated": {}, "last-updated": {},
"last-triggered": { domains: ["automation", "script"] }, "last-triggered": { domains: ["automation", "script"] },
position: { domains: ["cover"] }, position: { domains: ["cover"] },
state: {},
"tilt-position": { domains: ["cover"] }, "tilt-position": { domains: ["cover"] },
brightness: { domains: ["light"] }, brightness: { domains: ["light"] },
}; };

View File

@ -7305,7 +7305,8 @@
"position": "Position", "position": "Position",
"tilt-position": "Tilt position", "tilt-position": "Tilt position",
"brightness": "Brightness", "brightness": "Brightness",
"last-updated": "Last updated" "last-updated": "Last updated",
"state": "State"
}, },
"entity_row": { "entity_row": {
"divider": "Divider", "divider": "Divider",