diff --git a/src/common/entity/compute_state_display.ts b/src/common/entity/compute_state_display.ts index c3f1013c6e..10de4cb847 100644 --- a/src/common/entity/compute_state_display.ts +++ b/src/common/entity/compute_state_display.ts @@ -57,7 +57,7 @@ export const computeStateDisplay = ( if (domain === "humidifier") { if (stateObj.state === "on" && stateObj.attributes.humidity) { - return `${stateObj.attributes.humidity} %`; + return `${stateObj.attributes.humidity}%`; } } diff --git a/src/components/entity/ha-entity-humidifier.ts b/src/components/entity/ha-entity-humidifier.ts deleted file mode 100644 index ac6603e499..0000000000 --- a/src/components/entity/ha-entity-humidifier.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { css, CSSResult, html, TemplateResult } from "lit-element"; -import { HaEntityToggle } from "./ha-entity-toggle"; - -class HaEntityHumidifier extends HaEntityToggle { - protected render(): TemplateResult { - if (!this.stateObj) { - return super.render(); - } - - return html` -
- ${this.stateObj.attributes.mode - ? html` - ${this.hass!.localize( - `state_attributes.humidifier.mode.${this.stateObj.attributes.mode}` - ) || this.stateObj.attributes.mode} - ` - : ""} -
- ${this.stateObj.attributes.humidity - ? html`${this.stateObj.attributes.humidity} %` - : ""} -
-
- - ${super.render()} - `; - } - - static get styles(): CSSResult { - return css` - :host { - display: flex; - flex-direction: row; - justify-content: center; - align-items: center; - } - - .target { - color: var(--primary-text-color); - } - - .current { - color: var(--secondary-text-color); - } - - .state-label { - font-weight: bold; - text-transform: capitalize; - } - - .unit { - display: inline-block; - direction: ltr; - } - - ${super.styles} - `; - } -} - -customElements.define("ha-entity-humidifier", HaEntityHumidifier); diff --git a/src/panels/lovelace/create-element/create-row-element.ts b/src/panels/lovelace/create-element/create-row-element.ts index 433b50e0a5..178192fa48 100644 --- a/src/panels/lovelace/create-element/create-row-element.ts +++ b/src/panels/lovelace/create-element/create-row-element.ts @@ -24,7 +24,6 @@ const LAZY_LOAD_TYPES = { "climate-entity": () => import("../entity-rows/hui-climate-entity-row"), "cover-entity": () => import("../entity-rows/hui-cover-entity-row"), "group-entity": () => import("../entity-rows/hui-group-entity-row"), - "humidifier-entity": () => import("../entity-rows/hui-humidifier-entity-row"), "input-datetime-entity": () => import("../entity-rows/hui-input-datetime-entity-row"), "input-number-entity": () => @@ -52,7 +51,7 @@ const DOMAIN_TO_ELEMENT_TYPE = { cover: "cover", fan: "toggle", group: "group", - humidifier: "humidifier", + humidifier: "toggle", input_boolean: "toggle", input_number: "input-number", input_select: "input-select", diff --git a/src/panels/lovelace/entity-rows/hui-humidifier-entity-row.ts b/src/panels/lovelace/entity-rows/hui-humidifier-entity-row.ts deleted file mode 100644 index 9e0ee5dd2c..0000000000 --- a/src/panels/lovelace/entity-rows/hui-humidifier-entity-row.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { - css, - CSSResult, - customElement, - html, - LitElement, - property, - PropertyValues, - TemplateResult, -} from "lit-element"; -import "../../../components/entity/ha-entity-humidifier"; -import { HomeAssistant } from "../../../types"; -import { hasConfigOrEntityChanged } from "../common/has-changed"; -import "../components/hui-generic-entity-row"; -import { createEntityNotFoundWarning } from "../components/hui-warning"; -import { EntityConfig, LovelaceRow } from "./types"; - -@customElement("hui-humidifier-entity-row") -class HuiHumidifierEntityRow extends LitElement implements LovelaceRow { - @property() public hass?: HomeAssistant; - - @property() private _config?: EntityConfig; - - public setConfig(config: EntityConfig): void { - if (!config || !config.entity) { - throw new Error("Invalid Configuration: 'entity' required"); - } - - this._config = config; - } - - protected shouldUpdate(changedProps: PropertyValues): boolean { - return hasConfigOrEntityChanged(this, changedProps); - } - - protected render(): TemplateResult { - if (!this.hass || !this._config) { - return html``; - } - - const stateObj = this.hass.states[this._config.entity]; - - if (!stateObj) { - return html` - - ${createEntityNotFoundWarning(this.hass, this._config.entity)} - - `; - } - - return html` - - - - `; - } - - static get styles(): CSSResult { - return css` - ha-humidifier-state { - text-align: right; - } - `; - } -} - -declare global { - interface HTMLElementTagNameMap { - "hui-humidifier-entity-row": HuiHumidifierEntityRow; - } -}