mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Tile card current temperature for climate entity (#18143)
This commit is contained in:
parent
8c3a7de6d9
commit
095d171a61
@ -41,6 +41,7 @@ import {
|
|||||||
import { isUnavailableState } from "../../../data/entity";
|
import { isUnavailableState } from "../../../data/entity";
|
||||||
import { FanEntity, computeFanSpeedStateDisplay } from "../../../data/fan";
|
import { FanEntity, computeFanSpeedStateDisplay } from "../../../data/fan";
|
||||||
import type { HumidifierEntity } from "../../../data/humidifier";
|
import type { HumidifierEntity } from "../../../data/humidifier";
|
||||||
|
import type { ClimateEntity } from "../../../data/climate";
|
||||||
import type { LightEntity } from "../../../data/light";
|
import type { LightEntity } from "../../../data/light";
|
||||||
import type { ActionHandlerEvent } from "../../../data/lovelace";
|
import type { ActionHandlerEvent } from "../../../data/lovelace";
|
||||||
import { SENSOR_DEVICE_CLASS_TIMESTAMP } from "../../../data/sensor";
|
import { SENSOR_DEVICE_CLASS_TIMESTAMP } from "../../../data/sensor";
|
||||||
@ -239,6 +240,20 @@ export class HuiTileCard extends LitElement implements LovelaceCard {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (domain === "climate") {
|
||||||
|
const current_temperature = (stateObj as ClimateEntity).attributes
|
||||||
|
.current_temperature;
|
||||||
|
if (current_temperature) {
|
||||||
|
const formattedCurrentTemperature =
|
||||||
|
this.hass!.formatEntityAttributeValue(
|
||||||
|
stateObj,
|
||||||
|
"current_temperature",
|
||||||
|
current_temperature
|
||||||
|
);
|
||||||
|
return `${stateDisplay} ⸱ ${formattedCurrentTemperature}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return stateDisplay;
|
return stateDisplay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user