mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 03:06:41 +00:00
Fix current_humidity no shown on climate state card if also current_temperature is set (#14993)
* Also show current_humidity on climate * Use one line * Update src/components/ha-climate-state.ts Co-authored-by: Paul Bottein <paul.bottein@gmail.com> * Another blank and add import Co-authored-by: Paul Bottein <paul.bottein@gmail.com>
This commit is contained in:
parent
711286f7c0
commit
363ad369fc
@ -3,6 +3,7 @@ import { customElement, property } from "lit/decorators";
|
|||||||
import { computeAttributeValueDisplay } from "../common/entity/compute_attribute_display";
|
import { computeAttributeValueDisplay } from "../common/entity/compute_attribute_display";
|
||||||
import { computeStateDisplay } from "../common/entity/compute_state_display";
|
import { computeStateDisplay } from "../common/entity/compute_state_display";
|
||||||
import { formatNumber } from "../common/number/format_number";
|
import { formatNumber } from "../common/number/format_number";
|
||||||
|
import { blankBeforePercent } from "../common/translations/blank_before_percent";
|
||||||
import { ClimateEntity, CLIMATE_PRESET_NONE } from "../data/climate";
|
import { ClimateEntity, CLIMATE_PRESET_NONE } from "../data/climate";
|
||||||
import { isUnavailableState } from "../data/entity";
|
import { isUnavailableState } from "../data/entity";
|
||||||
import type { HomeAssistant } from "../types";
|
import type { HomeAssistant } from "../types";
|
||||||
@ -47,6 +48,19 @@ class HaClimateState extends LitElement {
|
|||||||
if (!this.hass || !this.stateObj) {
|
if (!this.hass || !this.stateObj) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
if (
|
||||||
|
this.stateObj.attributes.current_temperature != null &&
|
||||||
|
this.stateObj.attributes.current_humidity != null
|
||||||
|
) {
|
||||||
|
return `${formatNumber(
|
||||||
|
this.stateObj.attributes.current_temperature,
|
||||||
|
this.hass.locale
|
||||||
|
)} ${this.hass.config.unit_system.temperature}/
|
||||||
|
${formatNumber(
|
||||||
|
this.stateObj.attributes.current_humidity,
|
||||||
|
this.hass.locale
|
||||||
|
)}${blankBeforePercent(this.hass.locale)}%`;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.stateObj.attributes.current_temperature != null) {
|
if (this.stateObj.attributes.current_temperature != null) {
|
||||||
return `${formatNumber(
|
return `${formatNumber(
|
||||||
@ -59,7 +73,7 @@ class HaClimateState extends LitElement {
|
|||||||
return `${formatNumber(
|
return `${formatNumber(
|
||||||
this.stateObj.attributes.current_humidity,
|
this.stateObj.attributes.current_humidity,
|
||||||
this.hass.locale
|
this.hass.locale
|
||||||
)} %`;
|
)}${blankBeforePercent(this.hass.locale)}%`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return undefined;
|
return undefined;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user