Skip to content

Commit 25ba0dd

Browse files
authored
Fix weather suffix handling and wind direction calculation
1 parent 2ada342 commit 25ba0dd

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

fork_u-house_card.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ class ForkUHouseCard extends HTMLElement {
204204
weatherSuffix = 'rainy';
205205
} else if (['snowy', 'snowy-rainy'].includes(s)) {
206206
weatherSuffix = 'snowy';
207+
} else if (s === 'hail') {
208+
weatherSuffix = 'hail';
207209
} else if (s === 'fog') {
208210
weatherSuffix = 'fog';
209211
}
@@ -213,10 +215,11 @@ class ForkUHouseCard extends HTMLElement {
213215
// 5. Sprawdzenie Boolean w Configu
214216
if (weatherSuffix) {
215217
// Klucz np.: img_winter_day_rainy
216-
const configKey = `img_${season}_${timeOfDay}_${weatherSuffix}`;
218+
const configKey = `img_${season}_${timeOfDay}_${weatherSuffix}`;
219+
const configKey_alt = `img_${season}_${weatherSuffix}_${timeOfDay}`;
217220

218221
// Jeśli w YAML jest: img_winter_day_rainy: true
219-
if (this._config[configKey] === true) {
222+
if (this._config[configKey] === true || this._config[configKey_alt] === true) {
220223
return `${path}${season}_${weatherSuffix}_${timeOfDay}.png`;
221224
}
222225
}
@@ -630,7 +633,7 @@ class ForkUHouseCard extends HTMLElement {
630633
const wEnt = this._config.weather_entity;
631634
let wState = this._config.test_weather_state || (wEnt ? this._hass.states[wEnt]?.state : "");
632635
const { speed, bearing } = this._getWindData();
633-
const windDirX = (bearing > 180 || bearing < 0) ? 1 : -1;
636+
const windDirX = (bearing > 180 || bearing < 0) ? -1 : 1;
634637
let moveSpeed = speed / 15; if (moveSpeed < 0.2) moveSpeed = 0.2; if (moveSpeed > 6) moveSpeed = 6;
635638

636639
const sunEnt = this._config.sun_entity || 'sun.sun';

0 commit comments

Comments
 (0)