Tile card current temperature for climate entity (#18143)

This commit is contained in:
fustom 2023-10-11 09:01:34 +02:00 committed by GitHub
parent 8c3a7de6d9
commit 095d171a61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,6 +41,7 @@ import {
import { isUnavailableState } from "../../../data/entity";
import { FanEntity, computeFanSpeedStateDisplay } from "../../../data/fan";
import type { HumidifierEntity } from "../../../data/humidifier";
import type { ClimateEntity } from "../../../data/climate";
import type { LightEntity } from "../../../data/light";
import type { ActionHandlerEvent } from "../../../data/lovelace";
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;
}