diff --git a/src/components/chart/ha-chart-base.ts b/src/components/chart/ha-chart-base.ts index 1606fc07ba..ca49c02522 100644 --- a/src/components/chart/ha-chart-base.ts +++ b/src/components/chart/ha-chart-base.ts @@ -86,6 +86,7 @@ export default class HaChartBase extends LitElement { class=${classMap({ hidden: this._hiddenDatasets.has(index), })} + .title=${dataset.label} >
`; } diff --git a/src/components/entity/state-info.ts b/src/components/entity/state-info.ts index d9e2f2fe6d..cbc7b1c0f9 100644 --- a/src/components/entity/state-info.ts +++ b/src/components/entity/state-info.ts @@ -24,13 +24,15 @@ class StateInfo extends LitElement { return html``; } + const name = computeStateName(this.stateObj); + return html`
-
- ${computeStateName(this.stateObj)} +
+ ${name}
${this.inDialog ? html`
diff --git a/src/dialogs/more-info/ha-more-info-dialog.ts b/src/dialogs/more-info/ha-more-info-dialog.ts index b5c72f87da..e74420c9da 100644 --- a/src/dialogs/more-info/ha-more-info-dialog.ts +++ b/src/dialogs/more-info/ha-more-info-dialog.ts @@ -94,12 +94,14 @@ export class MoreInfoDialog extends LitElement { } const entityId = this._entityId; const stateObj = this.hass.states[entityId]; - const domain = computeDomain(entityId); if (!stateObj) { return html``; } + const domain = computeDomain(entityId); + const name = computeStateName(stateObj); + return html` -
- ${computeStateName(stateObj)} +
+ ${name}
${this.hass.user!.is_admin ? html` diff --git a/src/panels/lovelace/cards/hui-button-card.ts b/src/panels/lovelace/cards/hui-button-card.ts index cab1b8b652..6893279f1a 100644 --- a/src/panels/lovelace/cards/hui-button-card.ts +++ b/src/panels/lovelace/cards/hui-button-card.ts @@ -143,6 +143,10 @@ export class HuiButtonCard extends LitElement implements LovelaceCard { `; } + const name = this._config.show_name + ? this._config.name || (stateObj ? computeStateName(stateObj) : "") + : ""; + return html` - ${this._config.name || - (stateObj ? computeStateName(stateObj) : "")} - - ` + ? html`${name}` : ""} ${this._config.show_state && stateObj ? html` diff --git a/src/panels/lovelace/cards/hui-entity-card.ts b/src/panels/lovelace/cards/hui-entity-card.ts index d5db077ec0..d63d721a05 100644 --- a/src/panels/lovelace/cards/hui-entity-card.ts +++ b/src/panels/lovelace/cards/hui-entity-card.ts @@ -115,12 +115,12 @@ export class HuiEntityCard extends LitElement implements LovelaceCard { ? this._config.attribute in stateObj.attributes : !UNAVAILABLE_STATES.includes(stateObj.state); + const name = this._config.name || computeStateName(stateObj); + return html`
-
- ${this._config.name || computeStateName(stateObj)} -
+
${name}
-
- ${this._config.name || computeStateName(stateObj)} -
+
${name}
`; } diff --git a/src/panels/lovelace/cards/hui-glance-card.ts b/src/panels/lovelace/cards/hui-glance-card.ts index 40bfc833b8..fd1528c329 100644 --- a/src/panels/lovelace/cards/hui-glance-card.ts +++ b/src/panels/lovelace/cards/hui-glance-card.ts @@ -278,6 +278,8 @@ export class HuiGlanceCard extends LitElement implements LovelaceCard {
`; } + const name = entityConf.name ?? computeStateName(stateObj); + return html`
${this._config!.show_name - ? html` -
- ${"name" in entityConf - ? entityConf.name - : computeStateName(stateObj)} -
- ` + ? html`
${name}
` : ""} ${this._config!.show_icon ? html` diff --git a/src/panels/lovelace/cards/hui-humidifier-card.ts b/src/panels/lovelace/cards/hui-humidifier-card.ts index 1c418a259b..b1337abf0a 100644 --- a/src/panels/lovelace/cards/hui-humidifier-card.ts +++ b/src/panels/lovelace/cards/hui-humidifier-card.ts @@ -173,7 +173,7 @@ export class HuiHumidifierCard extends LitElement implements LovelaceCard {
-
${name}
+
${name}
`; diff --git a/src/panels/lovelace/cards/hui-light-card.ts b/src/panels/lovelace/cards/hui-light-card.ts index 3883815fa6..618f193010 100644 --- a/src/panels/lovelace/cards/hui-light-card.ts +++ b/src/panels/lovelace/cards/hui-light-card.ts @@ -96,6 +96,8 @@ export class HuiLightCard extends LitElement implements LovelaceCard { const brightness = Math.round((stateObj.attributes.brightness / 255) * 100) || 0; + const name = this._config.name ?? computeStateName(stateObj); + return html`
-
+
${UNAVAILABLE_STATES.includes(stateObj.state) ? html`
@@ -157,7 +159,7 @@ export class HuiLightCard extends LitElement implements LovelaceCard {
` : html`
%
`} - ${this._config.name || computeStateName(stateObj)} + ${name}
diff --git a/src/panels/lovelace/cards/hui-thermostat-card.ts b/src/panels/lovelace/cards/hui-thermostat-card.ts index 64c8dc7f07..d2869a5a4b 100644 --- a/src/panels/lovelace/cards/hui-thermostat-card.ts +++ b/src/panels/lovelace/cards/hui-thermostat-card.ts @@ -251,7 +251,7 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard {
-
+
${(stateObj.attributes.hvac_modes || []) .concat() diff --git a/src/panels/lovelace/cards/hui-weather-forecast-card.ts b/src/panels/lovelace/cards/hui-weather-forecast-card.ts index adce427921..7e6acae221 100644 --- a/src/panels/lovelace/cards/hui-weather-forecast-card.ts +++ b/src/panels/lovelace/cards/hui-weather-forecast-card.ts @@ -190,6 +190,7 @@ class HuiWeatherForecastCard extends LitElement implements LovelaceCard { } const weatherStateIcon = getWeatherStateIcon(stateObj.state, this); + const name = this._config.name ?? computeStateName(stateObj); return html` -
- ${this._config.name || computeStateName(stateObj)} -
+
${name}
diff --git a/src/panels/lovelace/components/hui-generic-entity-row.ts b/src/panels/lovelace/components/hui-generic-entity-row.ts index 9a1efd1c2a..b1554bfcdd 100644 --- a/src/panels/lovelace/components/hui-generic-entity-row.ts +++ b/src/panels/lovelace/components/hui-generic-entity-row.ts @@ -54,6 +54,7 @@ class HuiGenericEntityRow extends LitElement { !DOMAINS_HIDE_MORE_INFO.includes(computeDomain(this.config.entity))); const hasSecondary = this.secondaryText || this.config.secondary_info; + const name = this.config.name ?? computeStateName(stateObj); return html` - ${this.config.name || computeStateName(stateObj)} + ${name} ${hasSecondary ? html`
diff --git a/src/panels/lovelace/special-rows/hui-button-row.ts b/src/panels/lovelace/special-rows/hui-button-row.ts index c67887bee2..4292af6600 100644 --- a/src/panels/lovelace/special-rows/hui-button-row.ts +++ b/src/panels/lovelace/special-rows/hui-button-row.ts @@ -50,6 +50,9 @@ export class HuiButtonRow extends LitElement implements LovelaceRow { ? this.hass.states[this._config.entity] : undefined; + const name = + this._config.name ?? (stateObj ? computeStateName(stateObj) : ""); + return html`
-
- ${this._config.name || (stateObj ? computeStateName(stateObj) : "")} -
+
${name}
${this._config.label - ? html`
${this._config.label}
` + ? html` +
+ ${this._config.label} +
+ ` : html``} `; } diff --git a/src/panels/lovelace/special-rows/hui-text-row.ts b/src/panels/lovelace/special-rows/hui-text-row.ts index 6953de6102..b64d8a3842 100644 --- a/src/panels/lovelace/special-rows/hui-text-row.ts +++ b/src/panels/lovelace/special-rows/hui-text-row.ts @@ -22,8 +22,8 @@ class HuiTextRow extends LitElement implements LovelaceRow { return html` -
${this._config.name}
-
${this._config.text}
+
${this._config.name}
+
${this._config.text}
`; } diff --git a/src/panels/lovelace/special-rows/hui-weblink-row.ts b/src/panels/lovelace/special-rows/hui-weblink-row.ts index 3ff017470f..5af61bb49e 100644 --- a/src/panels/lovelace/special-rows/hui-weblink-row.ts +++ b/src/panels/lovelace/special-rows/hui-weblink-row.ts @@ -36,7 +36,7 @@ class HuiWeblinkRow extends LitElement implements LovelaceRow { ?download=${this._config.download} > -
${this._config.name}
+
${this._config.name}
`; }