From 095d171a61a1fc6da160033b1753960dcfe4b914 Mon Sep 17 00:00:00 2001 From: fustom Date: Wed, 11 Oct 2023 09:01:34 +0200 Subject: [PATCH] Tile card current temperature for climate entity (#18143) --- src/panels/lovelace/cards/hui-tile-card.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/panels/lovelace/cards/hui-tile-card.ts b/src/panels/lovelace/cards/hui-tile-card.ts index ae8374e991..5857f6cb8a 100644 --- a/src/panels/lovelace/cards/hui-tile-card.ts +++ b/src/panels/lovelace/cards/hui-tile-card.ts @@ -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; }