diff --git a/src/common/entity/compute_state_display.ts b/src/common/entity/compute_state_display.ts
index aa6cf3f19c..91b7a606dc 100644
--- a/src/common/entity/compute_state_display.ts
+++ b/src/common/entity/compute_state_display.ts
@@ -63,7 +63,7 @@ export const computeStateDisplay = (
if (domain === "humidifier") {
if (compareState === "on" && stateObj.attributes.humidity) {
- return `${stateObj.attributes.humidity}%`;
+ return `${stateObj.attributes.humidity} %`;
}
}
diff --git a/src/panels/lovelace/cards/hui-gauge-card.ts b/src/panels/lovelace/cards/hui-gauge-card.ts
index 48e49d6432..f760bb2720 100644
--- a/src/panels/lovelace/cards/hui-gauge-card.ts
+++ b/src/panels/lovelace/cards/hui-gauge-card.ts
@@ -14,6 +14,7 @@ import { styleMap } from "lit-html/directives/style-map";
import { applyThemesOnElement } from "../../../common/dom/apply_themes_on_element";
import { fireEvent } from "../../../common/dom/fire_event";
import { computeStateName } from "../../../common/entity/compute_state_name";
+import { stateIcon } from "../../../common/entity/state_icon";
import { isValidEntityId } from "../../../common/entity/valid_entity_id";
import "../../../components/ha-card";
import "../../../components/ha-gauge";
@@ -139,8 +140,11 @@ class HuiGaugeCard extends LitElement implements LovelaceCard {
"--gauge-color": this._computeSeverity(state),
})}
>
-
- ${this._config.name || computeStateName(stateObj)}
+
+
+
+ ${this._config.name || computeStateName(stateObj)}
+
`;
@@ -232,13 +236,25 @@ class HuiGaugeCard extends LitElement implements LovelaceCard {
max-width: 250px;
}
+ .row {
+ display: flex;
+ justify-content: space-around;
+ margin-top: 4px;
+ align-items: center;
+ }
+
.name {
text-align: center;
line-height: initial;
- color: var(--primary-text-color);
+ color: var(--secondary-text-color);
width: 100%;
- font-size: 15px;
- margin-top: 8px;
+ font-size: 16px;
+ font-weight: 500;
+ }
+
+ ha-icon {
+ color: var(--state-icon-color, #44739e);
+ margin-right: 4px;
}
`;
}
diff --git a/src/panels/lovelace/cards/types.ts b/src/panels/lovelace/cards/types.ts
index 05330f9dbf..3c0d104639 100644
--- a/src/panels/lovelace/cards/types.ts
+++ b/src/panels/lovelace/cards/types.ts
@@ -115,6 +115,7 @@ export interface GaugeCardConfig extends LovelaceCardConfig {
max?: number;
severity?: SeverityConfig;
theme?: string;
+ icon?: string;
}
export interface ConfigEntity extends EntityConfig {
diff --git a/src/panels/lovelace/editor/config-elements/hui-gauge-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-gauge-card-editor.ts
index 613a278f01..da0147c5e2 100644
--- a/src/panels/lovelace/editor/config-elements/hui-gauge-card-editor.ts
+++ b/src/panels/lovelace/editor/config-elements/hui-gauge-card-editor.ts
@@ -12,8 +12,10 @@ import {
import { assert, number, object, optional, string } from "superstruct";
import { fireEvent } from "../../../../common/dom/fire_event";
import { computeRTLDirection } from "../../../../common/util/compute_rtl";
+import { stateIcon } from "../../../../common/entity/state_icon";
import "../../../../components/ha-formfield";
import "../../../../components/ha-switch";
+import "../../../../components/ha-icon-input";
import { HomeAssistant } from "../../../../types";
import { GaugeCardConfig, SeverityConfig } from "../../cards/types";
import "../../components/hui-entity-editor";
@@ -31,6 +33,7 @@ const cardConfigStruct = object({
max: optional(number()),
severity: optional(object()),
theme: optional(string()),
+ icon: optional(string()),
});
const includeDomains = ["sensor"];
@@ -75,6 +78,10 @@ export class HuiGaugeCardEditor extends LitElement
return this._config!.severity || undefined;
}
+ get _icon(): string {
+ return this._config!.icon || "";
+ }
+
protected render(): TemplateResult {
if (!this.hass || !this._config) {
return html``;
@@ -105,16 +112,30 @@ export class HuiGaugeCardEditor extends LitElement
.configValue=${"name"}
@value-changed="${this._valueChanged}"
>
-
+