From 2b37f139d1bcbea4bc69a4ddd8162fbb0043c37e Mon Sep 17 00:00:00 2001 From: Regev Brody Date: Mon, 1 Apr 2024 11:12:50 +0300 Subject: [PATCH] fix: target_temperature unit not working #151 (#152) --- package.json | 2 +- release_notes/v2.7.2.md | 5 +++++ src/main.js | 2 -- src/models/temperature.js | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 release_notes/v2.7.2.md diff --git a/package.json b/package.json index 984012a..d8ec260 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mini-climate-card", - "version": "v2.7.1", + "version": "v2.7.2", "description": "a/c card for Home Assistant Lovelace UI", "keywords": [ "home-assistant", diff --git a/release_notes/v2.7.2.md b/release_notes/v2.7.2.md new file mode 100644 index 0000000..b5b9132 --- /dev/null +++ b/release_notes/v2.7.2.md @@ -0,0 +1,5 @@ +## v2.7.2 +[![Downloads](https://img.shields.io/github/downloads/artem-sedykh/mini-climate-card/v2.7.2/total.svg)](https://github.com/artem-sedykh/mini-climate-card/releases/tag/v2.7.2) + +### Fixed +- fix: target_temperature unit not working #151 by @regevbr diff --git a/src/main.js b/src/main.js index 5b5a7d6..f28be9c 100644 --- a/src/main.js +++ b/src/main.js @@ -400,7 +400,6 @@ class MiniClimate extends ScopedRegistryHost(LitElement) { getTargetTemperatureConfig(config) { const item = { - unit: '°C', source: { entity: undefined, attribute: 'temperature' }, ...config.target_temperature || {}, }; @@ -477,7 +476,6 @@ class MiniClimate extends ScopedRegistryHost(LitElement) { this.config.temperature = { round: 1, - unit: '°C', source: { entity: undefined, attribute: 'current_temperature' }, ...config.temperature || {}, }; diff --git a/src/models/temperature.js b/src/models/temperature.js index a0a45e1..5019c5d 100644 --- a/src/models/temperature.js +++ b/src/models/temperature.js @@ -18,7 +18,7 @@ export default class TemperatureObject { } get unit() { - return this.config.temperature.unit || this.config.target_temperature.unit; + return this.config.temperature.unit || this.config.target_temperature.unit || '°C'; } get step() {