Skip to content

Commit 63088eb

Browse files
committed
gui: add title in div container in order to show a popup (useful when the card is rendered with no icons/texts) fix #50
code: add a bottom limit to HI calcs so it won't fall when there's no "heat" in the room, fix #48 languages: add polish from PR by @mailwash, fix slovak from PR by @misa1515, fix czech
1 parent ace518d commit 63088eb

8 files changed

+57
-7
lines changed

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ Thanks to the people listed below and many more, this card is available in the f
8585
* Greek - ![gr_lang_status][trans_gr_lang] - Originally translated by [@tzam](https://github.com/tzamer)
8686
* Hungarian - ![hu_lang_status][trans_hu_lang] - Originally translated by [@n0is3r](https://github.com/n0is3r)
8787
* Italian - ![it_lang_status][trans_it_lang] - Originally translated by [@argaar](https://github.com/argaar)
88+
* Polish - ![pl_lang_status][trans_pl_lang] - Originally translated by [@mailwash](https://github.com/mailwash)
8889
* Portuguese - ![pt_lang_status][trans_pt_lang] - Originally translated by [@FragMenthor](https://github.com/FragMenthor)
8990
* Russian - ![ru_lang_status][trans_ru_lang] - Originally translated by [@kai-zer-ru](https://github.com/kai-zer-ru)
9091
* Slovak - ![sk_lang_status][trans_sk_lang] - Originally translated by [@misa1515](https://github.com/misa1515)
@@ -130,6 +131,8 @@ If you can help translating some text, head to invitation link on [Locize](https
130131

131132
[trans_nl_lang]:https://img.shields.io/badge/dynamic/json.svg?style=plastic&color=2096F3&label=locize&query=%24.versions%5B'latest'%5D.languages%5B'nl'%5D.translatedPercentage&url=https://api.locize.app/badgedata/535e704d-ed8a-4d1d-88b6-f29e6a61507a&suffix=%+translated&link=https://www.locize.com&prefix=nl:+
132133

134+
[trans_pl_lang]:https://img.shields.io/badge/dynamic/json.svg?style=plastic&color=2096F3&label=locize&query=%24.versions%5B'latest'%5D.languages%5B'pl'%5D.translatedPercentage&url=https://api.locize.app/badgedata/535e704d-ed8a-4d1d-88b6-f29e6a61507a&suffix=%+translated&link=https://www.locize.com&prefix=pl:+
135+
133136
[trans_pt_lang]:https://img.shields.io/badge/dynamic/json.svg?style=plastic&color=2096F3&label=locize&query=%24.versions%5B'latest'%5D.languages%5B'pt'%5D.translatedPercentage&url=https://api.locize.app/badgedata/535e704d-ed8a-4d1d-88b6-f29e6a61507a&suffix=%+translated&link=https://www.locize.com&prefix=pt:+
134137

135138
[trans_pt-BR_lang]:https://img.shields.io/badge/dynamic/json.svg?style=plastic&color=2096F3&label=locize&query=%24.versions%5B'latest'%5D.languages%5B'pt-BR'%5D.translatedPercentage&url=https://api.locize.app/badgedata/535e704d-ed8a-4d1d-88b6-f29e6a61507a&suffix=%+translated&link=https://www.locize.com&prefix=pt-BR:+

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "comfortable-environment-card",
3-
"version": "1.7.1",
3+
"version": "1.7.9",
44
"description": "Lovelace comfortable-environment-card",
55
"keywords": [
66
"home-assistant",

src/comfortable-environment-card.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ class ComfortableEnvironmentCard extends LitElement {
104104
protected calcHIEffects(hiValue: number): number {
105105
let hieffects = NaN
106106
switch(true) {
107-
case hiValue<80:
107+
case hiValue<80.0:
108108
hieffects = 0
109109
break;
110-
case hiValue>=80 && hiValue<=90.0:
110+
case hiValue>=80.0 && hiValue<=90.0:
111111
hieffects = 1
112112
break;
113113
case hiValue>90.0 && hiValue<=105.0:
@@ -179,7 +179,7 @@ class ComfortableEnvironmentCard extends LitElement {
179179
const tempFarenheitValue = tempSensorUnitInF ? tempSensorStatus : this.toFahrenheit(tempSensorStatus)
180180

181181
let HI = this.calcHI(tempFarenheitValue, humSensorStatus)
182-
const HIeffects = this.calcHIEffects(HI)
182+
const HIeffects = tempCelsiusValue<=20?NaN:this.calcHIEffects(HI)
183183

184184
// Convert HI back to original unit_of_measurement from sensor
185185
HI = tempSensorUnitInF ? HI : this.toCelsius(HI)
@@ -260,7 +260,7 @@ class ComfortableEnvironmentCard extends LitElement {
260260
`:``}
261261
</div>
262262
`:``}
263-
<div class="color-range-container${indexInfo=='NONE'?' collapsed':''}">
263+
<div class="color-range-container${indexInfo=='NONE'?' collapsed':''}" title="${!Number.isNaN(HIeffects)?localize('states.hi.'+[HIeffects]):'---'}">
264264
<div class="color-range-gradient" style="background: linear-gradient(90deg, rgb(254, 240, 217) 0%, rgb(253, 204, 138) 28%, rgb(252, 141, 89) 42%, rgb(227, 74, 51) 66%, rgb(179, 0, 0) 100%);" >
265265
<div class="value-box" style="margin-left: max(0%,calc(${this.calcRange(0,100,tempSensorUnitInF?76:23,tempSensorUnitInF?132:57,HI)}% - 46px))">${HI.toFixed(display_precision)}</div>
266266
</div>
@@ -294,7 +294,7 @@ class ComfortableEnvironmentCard extends LitElement {
294294
`:``}
295295
</div>
296296
`:``}
297-
<div class="color-range-container${indexInfo=='NONE'?' collapsed':''}">
297+
<div class="color-range-container${indexInfo=='NONE'?' collapsed':''}" title="${!Number.isNaN(DIeffects)?localize('states.di.'+[DIeffects]):'---'}">
298298
<div class="color-range-gradient" style="background: linear-gradient(90deg,rgb(5, 112, 176) 0%,rgb(116, 169, 207)12%,rgb(189, 201, 225) 32%,rgb(241, 238, 246) 44%,rgb(254, 240, 217) 56%,rgb(253, 204, 138) 68%,rgb(252, 141, 89) 80%,rgb(227, 74, 51) 88%,rgb(179, 0, 0) 100%);" >
299299
<div class="value-box" style="margin-left: max(0%,calc(${this.calcRange(0,100,8,34,DI)}% - 46px))">${DI.toFixed(display_precision)}</div>
300300
</div>

src/const.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const CARD_VERSION = '1.7.1'
1+
export const CARD_VERSION = '1.7.9'

src/localize/languages/cs/languages.json

+3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@
99
"version": "Verze"
1010
},
1111
"configurator": {
12+
"display_precision": "Zobrazit N čísel po des. čárce",
1213
"hum_sensor": "Senzor vlhkosti",
14+
"index_showinfo": "Zobrazit info o indexu",
1315
"room_name": "Název oblasti",
1416
"show_index": "Vyberte, které indexy chcete zobrazit",
17+
"show_realvalues": "Zobrazit reálné hodnoty v pravém horním rohu",
1518
"temp_sensor": "Senzor teploty"
1619
},
1720
"states": {
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"common": {
3+
"description": "Karta wyświetlająca informacje na temat indeksu cieplnego i indeksu dyskomfortu cieplnego bazując na temperaturze i wilgotności w pokoju!",
4+
"di": "Indeks dyskomfortu cieplnego",
5+
"hi": "Indeks cieplny",
6+
"humidity": "Wilgotność",
7+
"invalid_configuration": "konfiguracja karty Comfortable Environment jest nieprawidłowa lub nie ustnieje, sprawdź ustawienia!",
8+
"temperature": "Temperatura",
9+
"version": "Wersja"
10+
},
11+
"configurator": {
12+
"display_precision": "Wyświetl N liczb po przecinku",
13+
"hum_sensor": "Czujnik wilgotności",
14+
"index_showinfo": "Wyświetl szczegóły",
15+
"room_name": "Nazwa pokoju",
16+
"show_index": "Wybierz który indeks chcesz pokazać",
17+
"show_realvalues": "Wyświetl dokładne wartości w prawym górnym rogu",
18+
"temp_sensor": "Czujnik temperatury"
19+
},
20+
"states": {
21+
"di": [
22+
"Ekstremalnie nieprzyjemnie",
23+
"Umiartowanie nieprzyjemnie",
24+
"Stosunkowo komfortowo",
25+
"Komfortowo",
26+
"Poniżej 50% populacji czuje się niekomfortowo",
27+
"Powyżej 50% populacji czyje się niekomfortowo",
28+
"Większość populacji czuje się niekomfortowo",
29+
"Każdy odczuwa silny stres",
30+
"Stan zagrożenia medycznego"
31+
],
32+
"hi": [
33+
"Dobrze",
34+
"Zachowaj ostrożnośc",
35+
"Zachowaj szczególną ostrożność",
36+
"Niebezpieczeństwo",
37+
"Olbrzymie niebezpieczeństwo"
38+
]
39+
}
40+
}

src/localize/languages/sk/languages.json

+2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
"configurator": {
1212
"display_precision": "Zobraziť N čísiel za desatinnou čiarkou",
1313
"hum_sensor": "Snímač vlhkosti",
14+
"index_showinfo": "Zobraziť index info",
1415
"room_name": "Názov miestnosti",
1516
"show_index": "Vyberte, ktorý index chcete zobraziť",
17+
"show_realvalues": "Zobrazte skutočné hodnoty v pravom hornom rohu",
1618
"temp_sensor": "Snímač teploty"
1719
},
1820
"states": {

src/localize/localize.ts

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import * as gr from "./languages/gr/languages.json";
77
import * as hu from "./languages/hu/languages.json";
88
import * as it from "./languages/it/languages.json";
99
import * as nl from "./languages/nl/languages.json";
10+
import * as pl from "./languages/pl/languages.json";
1011
import * as pt from "./languages/pt/languages.json";
1112
import * as pt_BR from "./languages/pt-BR/languages.json";
1213
import * as ru from "./languages/ru/languages.json";
@@ -24,6 +25,7 @@ const languages: any = {
2425
hu: hu,
2526
it: it,
2627
nl: nl,
28+
pl: pl,
2729
pt: pt,
2830
pt_BR: pt_BR,
2931
ru: ru,

0 commit comments

Comments
 (0)