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
4 changed files with 9 additions and 2 deletions

View File

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

View File

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

View File

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

View File

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