Skip to content

Commit

Permalink
Tile card current temperature for climate entity (#18143)
Browse files Browse the repository at this point in the history
  • Loading branch information
fustom authored Oct 11, 2023
1 parent 8c3a7de commit 095d171
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/panels/lovelace/cards/hui-tile-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 095d171

Please sign in to comment.