From 37ad90fc527ec8d0c1a6587cf90ed1da295428e9 Mon Sep 17 00:00:00 2001 From: undel-gh Date: Tue, 12 May 2026 15:51:10 +0300 Subject: [PATCH 01/18] Update sun-position-card-editor.js Added ru --- src/sun-position-card-editor.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/sun-position-card-editor.js b/src/sun-position-card-editor.js index c0ab3ba..556ca9c 100644 --- a/src/sun-position-card-editor.js +++ b/src/sun-position-card-editor.js @@ -6,6 +6,7 @@ import ita from './lang-ita.js'; import nl from './lang-nl.js'; import pl from './lang-pl.js'; import cs from './lang-cs.js'; +import cs from './lang-ru.js'; const fireEvent = (node, type, detail, options) => { options = options || {}; @@ -23,7 +24,7 @@ const fireEvent = (node, type, detail, options) => { class SunPositionCardEditor extends HTMLElement { constructor() { super(); - this.langs = { de, en, fr, it: ita, nl, pl, cs }; + this.langs = { de, en, fr, it: ita, nl, pl, cs, ru }; this._initialized = false; } @@ -352,6 +353,7 @@ class SunPositionCardEditor extends HTMLElement { { value: "nl", label: "Nederlands" }, { value: "pl", label: "Polski" }, { value: "cs", label: "Čeština" } + { value: "ru", label: "Русский" } ], mode: "dropdown" } }; } From 5465d034e877f90e1baa8f3f7302a4e93d17506f Mon Sep 17 00:00:00 2001 From: undel-gh Date: Tue, 12 May 2026 15:53:39 +0300 Subject: [PATCH 02/18] Update sun-position-card.js Added ru --- src/sun-position-card.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sun-position-card.js b/src/sun-position-card.js index c258afe..6d2428c 100644 --- a/src/sun-position-card.js +++ b/src/sun-position-card.js @@ -6,6 +6,7 @@ import ita from './lang-ita.js'; import nl from './lang-nl.js'; import pl from './lang-pl.js'; import cs from './lang-cs.js'; +import ru from './lang-ru.js'; console.log( "%c☀️ Sun-Position-Card v_2.2 ready", From 3a0ed397f1257dc2f455fd288fd20e9b43539da7 Mon Sep 17 00:00:00 2001 From: undel-gh Date: Tue, 12 May 2026 16:20:08 +0300 Subject: [PATCH 03/18] Update lang-ru.js From 92c583c723b9e90f0fa55f6d8d9fef6286245e42 Mon Sep 17 00:00:00 2001 From: undel-gh Date: Tue, 12 May 2026 18:45:41 +0300 Subject: [PATCH 04/18] Create lang-se.js Added svenska --- src/lang-se.js | 105 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 src/lang-se.js diff --git a/src/lang-se.js b/src/lang-se.js new file mode 100644 index 0000000..dd01619 --- /dev/null +++ b/src/lang-se.js @@ -0,0 +1,105 @@ +export default { + card: { + name: "Solpositionskort", + description: "Solens och månens position med anpassade bilder." + }, + error: { + no_sun_entity: "Vänligen ange en sol-entitet.", + entity_not_found: "Entitet hittades inte: " + }, + sun_state: { + below_horizon: "Under horisonten", + dawn: "Gryning", + dusk: "Skymning", + morning: "Förmiddag", + noon: "Middag", + afternoon: "Eftermiddag", + evening: "Kväll" + }, + moon_phase: { + new_moon: 'Nymåne', + waxing_crescent: 'Tilltagande måne', + first_quarter: 'Första kvarteret', + waxing_gibbous: 'Tilltagande gibbös', + full_moon: 'Fullmåne', + waning_gibbous: 'Avtagande gibbös', + last_quarter: 'Sista kvarteret', + waning_crescent: 'Avtagande måne' + }, + weather_state: { + 'clear-night': 'Klar natt', + 'cloudy': 'Molnigt', + 'fog': 'Dimma', + 'hail': 'Hagel', + 'lightning': 'Åska', + 'lightning-rainy': 'Åska och regn', + 'partlycloudy': 'Delvis molnigt', + 'pouring': 'Skyfall', + 'rainy': 'Regnigt', + 'snowy': 'Snöigt', + 'snowy-rainy': 'Snö och regn', + 'sunny': 'Soligt', + 'windy': 'Blåsigt', + 'windy-variant': 'Blåsigt', + 'exceptional': 'Extremt' + }, + time_entry: { + current: "Nuvarande", + azimuth: "Azimut", + elevation: "Elevation", + daylight_duration: "Dagens längd", + day_comparison: "Jämförelse av dagslängd", + next_rising: "Soluppgång", + next_setting: "Solnedgång", + next_dawn: "Gryning", + next_dusk: "Skymning", + next_noon: "Middag", + next_midnight: "Midnatt", + moon_phase: "Månfas", + weather: "Väder" + }, + editor: { + entity: "Sol-entitet", + moon_entity: "Mån-entitet (valfri)", + weather_entity: "Väder-entitet (valfri)", + temp_entity: "Temperatur-entitet (valfri, ersätter väder)", + main_options: "Visningsalternativ", + view_mode: "Visningsläge", + view_mode_classic: "Klassisk (6 bilder)", + view_mode_calculated: "Beräknad (endast elevation)", + view_mode_arc: "Båge (180° rörelse)", + show_image: "Visa solposition (bild)", + show_weather_badge: "Visa väderindikator", + animate_images: "Animera bilder (förutom morgon/skymningsbild)", + sun_size: "Sol/Måne-storlek (endast båge)", + state_position: "Statusposition", + state_pos_above: "Ovanför bild", + state_pos_in_list: "I lista", + state_pos_hide: "Dölj", + moon_phase_position: "Månfasposition", + hide_moon_phase_on_day: "Dölj månfas under dagen", + show_night_arc: "Visa månbåge (180°)", + show_moon_icon_in_text: "Visa månikon i text", + show_dividers: "Visa avdelare", + show_degrees: "Visa grader (azimut/elevation)", + show_degrees_in_list: "Visa grader i lista", + time_position: "Tidsposition", + time_pos_below: "Under bild", + time_pos_above: "Ovanför bild", + time_pos_right: "Till höger om bild", + time_list_format: "Justering av tidslista", + time_format_centered: "Centrerad", + time_format_block: "Block", + times_to_show: "Välj tider", + use_12h_format: "Använd 12-timmarsformat (AM/PM)", + language: "Språk", + language_auto: "Automatiskt (Home Assistant)", + solar_entity: "Solenergi-entitet (valfri, t.ex. vädersensor)", + show_solar_badge: "Visa solenergi-indikator", + advanced_options: "Tröskelvärden (avancerat)", + morning_azimuth: "Morgon-azimut", + noon_azimuth: "Middag-azimut", + afternoon_azimuth: "Eftermiddags-azimut", + dusk_elevation: "Skymnings-elevation" + } +}; From c67e7436dbb3bc65c4779c20cbc85fb37783988d Mon Sep 17 00:00:00 2001 From: undel-gh Date: Tue, 12 May 2026 18:47:51 +0300 Subject: [PATCH 05/18] Create lang-br.js Added brazilian portugese --- src/lang-br.js | 105 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 src/lang-br.js diff --git a/src/lang-br.js b/src/lang-br.js new file mode 100644 index 0000000..3338067 --- /dev/null +++ b/src/lang-br.js @@ -0,0 +1,105 @@ +export default { + card: { + name: "Cartão de Posição Solar", + description: "Posição do Sol e da Lua com imagens personalizadas." + }, + error: { + no_sun_entity: "Por favor, defina uma entidade solar.", + entity_not_found: "Entidade não encontrada: " + }, + sun_state: { + below_horizon: "Abaixo do Horizonte", + dawn: "Amanhecer", + dusk: "Entardecer", + morning: "Manhã", + noon: "Meio-dia", + afternoon: "Tarde", + evening: "Noite" + }, + moon_phase: { + new_moon: 'Lua Nova', + waxing_crescent: 'Lua Crescente', + first_quarter: 'Quarto Crescente', + waxing_gibbous: 'Gibosa Crescente', + full_moon: 'Lua Cheia', + waning_gibbous: 'Gibosa Minguante', + last_quarter: 'Quarto Minguante', + waning_crescent: 'Lua Minguante' + }, + weather_state: { + 'clear-night': 'Noite Limpa', + 'cloudy': 'Nublado', + 'fog': 'Névoa', + 'hail': 'Granizo', + 'lightning': 'Raios', + 'lightning-rainy': 'Chuva com Raios', + 'partlycloudy': 'Parcialmente Nublado', + 'pouring': 'Chuva Forte', + 'rainy': 'Chuvoso', + 'snowy': 'Nevando', + 'snowy-rainy': 'Chuva e Neve', + 'sunny': 'Ensolarado', + 'windy': 'Ventania', + 'windy-variant': 'Vento Variável', + 'exceptional': 'Excepcional' + }, + time_entry: { + current: "Atual", + azimuth: "Azimute", + elevation: "Elevação", + daylight_duration: "Duração da Luz do Dia", + day_comparison: "Comparação de Luz Solar", + next_rising: "Nascer do Sol", + next_setting: "Pôr do Sol", + next_dawn: "Alvorecer", + next_dusk: "Crepúsculo", + next_noon: "Meio-dia solar", + next_midnight: "Meia-noite", + moon_phase: "Fase da Lua", + weather: "Clima" + }, + editor: { + entity: "Entidade Solar", + moon_entity: "Entidade Lunar (Opcional)", + weather_entity: "Entidade de Clima (Opcional)", + temp_entity: "Entidade de Temperatura (Opcional, substitui clima)", + main_options: "Opções de Exibição", + view_mode: "Modo de Visualização", + view_mode_classic: "Clássico (6 Imagens)", + view_mode_calculated: "Calculado (Apenas elevação)", + view_mode_arc: "Arco (Movimento 180°)", + show_image: "Mostrar Posição do Sol (Imagem)", + show_weather_badge: "Mostrar Badge de Clima", + animate_images: "Animar Imagens (exceto imagem de manhã/crepúsculo)", + sun_size: "Tamanho do Sol/Lua (Apenas Arco)", + state_position: "Posição do Estado", + state_pos_above: "Acima da Imagem", + state_pos_in_list: "Na Lista", + state_pos_hide: "Ocultar", + moon_phase_position: "Posição da Fase da Lua", + hide_moon_phase_on_day: "Ocultar Fase da Lua durante o dia", + show_night_arc: "Mostrar Arco da Lua (180°)", + show_moon_icon_in_text: "Mostrar Ícone da Lua no texto", + show_dividers: "Mostrar Divisores", + show_degrees: "Mostrar Graus (Azimute/Elevação)", + show_degrees_in_list: "Mostrar Graus na Lista", + time_position: "Posição do Horário", + time_pos_below: "Abaixo da Imagem", + time_pos_above: "Acima da Imagem", + time_pos_right: "À Direita da Imagem", + time_list_format: "Alinhamento da Lista de Horários", + time_format_centered: "Centralizado", + time_format_block: "Bloco", + times_to_show: "Selecionar Horários", + use_12h_format: "Usar formato 12 horas (AM/PM)", + language: "Idioma", + language_auto: "Automático (Home Assistant)", + solar_entity: "Entidade de Energia Solar (Opcional, ex: sensor de clima)", + show_solar_badge: "Mostrar Badge de Energia Solar", + advanced_options: "Limites (Avançado)", + morning_azimuth: "Azimute da Manhã", + noon_azimuth: "Azimute do Meio-dia", + afternoon_azimuth: "Azimute da Tarde", + dusk_elevation: "Elevação do Entardecer" + } +}; From c7f6f0cca07d02e94bdeb41fbfcb63f20681613c Mon Sep 17 00:00:00 2001 From: undel-gh Date: Tue, 12 May 2026 18:50:32 +0300 Subject: [PATCH 06/18] Update sun-position-card.js Added br and se --- src/sun-position-card.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/sun-position-card.js b/src/sun-position-card.js index 6d2428c..8d44f99 100644 --- a/src/sun-position-card.js +++ b/src/sun-position-card.js @@ -7,6 +7,8 @@ import nl from './lang-nl.js'; import pl from './lang-pl.js'; import cs from './lang-cs.js'; import ru from './lang-ru.js'; +import br from './lang-br.js'; +import se from './lang-se.js'; console.log( "%c☀️ Sun-Position-Card v_2.2 ready", @@ -26,7 +28,7 @@ class SunPositionCard extends HTMLElement { super(); this._created = false; this._lastImage = null; - this.langs = { de, en, fr, it: ita, nl, pl, cs }; + this.langs = { de, en, fr, it: ita, nl, pl, cs, br, se }; } _localize(key, lang = this.config?.language || this._hass?.locale?.language || 'en') { From 1d57b5e046d1342b6d16a6058d3ed0d9742bec5d Mon Sep 17 00:00:00 2001 From: undel-gh Date: Tue, 12 May 2026 18:55:11 +0300 Subject: [PATCH 07/18] Update sun-position-card-editor.js added br and se --- src/sun-position-card-editor.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/sun-position-card-editor.js b/src/sun-position-card-editor.js index 556ca9c..004f978 100644 --- a/src/sun-position-card-editor.js +++ b/src/sun-position-card-editor.js @@ -7,6 +7,8 @@ import nl from './lang-nl.js'; import pl from './lang-pl.js'; import cs from './lang-cs.js'; import cs from './lang-ru.js'; +import br from './lang-br.js'; +import se from './lang-se.js'; const fireEvent = (node, type, detail, options) => { options = options || {}; @@ -24,7 +26,7 @@ const fireEvent = (node, type, detail, options) => { class SunPositionCardEditor extends HTMLElement { constructor() { super(); - this.langs = { de, en, fr, it: ita, nl, pl, cs, ru }; + this.langs = { de, en, fr, it: ita, nl, pl, cs, ru, br, se }; this._initialized = false; } @@ -352,8 +354,10 @@ class SunPositionCardEditor extends HTMLElement { { value: "it", label: "Italiano" }, { value: "nl", label: "Nederlands" }, { value: "pl", label: "Polski" }, - { value: "cs", label: "Čeština" } - { value: "ru", label: "Русский" } + { value: "cs", label: "Čeština" }, + { value: "ru", label: "Русский" }, + { value: "se", label: "Svenska" }, + { value: "br", label: "português do Brasil" } ], mode: "dropdown" } }; } From 3229a698048885879a5a8a488beda71d122dbd61 Mon Sep 17 00:00:00 2001 From: undel-gh Date: Tue, 12 May 2026 18:57:50 +0300 Subject: [PATCH 08/18] Create lang-es.js spanish --- src/lang-es.js | 105 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 src/lang-es.js diff --git a/src/lang-es.js b/src/lang-es.js new file mode 100644 index 0000000..70d0d0f --- /dev/null +++ b/src/lang-es.js @@ -0,0 +1,105 @@ +export default { + card: { + name: "Sun Position Card", + description: "Posición del Sol y la Luna con imágenes personalizadas.", + }, + error: { + no_sun_entity: "Por favor, define una entidad de sol.", + entity_not_found: "Entidad no encontrada: ", + }, + sun_state: { + below_horizon: "Bajo el horizonte", + dawn: "Alba", + dusk: "Crepúsculo", + morning: "Mañana", + noon: "Mediodía", + afternoon: "Tarde", + evening: "Anochecer", + }, + moon_phase: { + new_moon: "Luna nueva", + waxing_crescent: "Luna creciente", + first_quarter: "Cuarto creciente", + waxing_gibbous: "Gibosa creciente", + full_moon: "Luna llena", + waning_gibbous: "Gibosa menguante", + last_quarter: "Cuarto menguante", + waning_crescent: "Luna menguante", + }, + weather_state: { + "clear-night": "Despejado (noche)", + cloudy: "Nublado", + fog: "Niebla", + hail: "Granizo", + lightning: "Relámpagos", + "lightning-rainy": "Tormenta eléctrica", + partlycloudy: "Parcialmente nublado", + pouring: "Lluvia intensa", + rainy: "Lluvia", + snowy: "Nieve", + snowy-rainy: "Nieve y lluvia", + sunny: "Soleado", + windy: "Ventoso", + "windy-variant": "Ventoso", + exceptional: "Excepcional", + }, + time_entry: { + current: "Actual", + azimuth: "Azimut", + elevation: "Elevación", + daylight_duration: "Duración de luz diurna", + day_comparison: "Comparativa del día", + next_rising: "Amanecer", + next_setting: "Atardecer", + next_dawn: "Alba", + next_dusk: "Crepúsculo", + next_noon: "Mediodía", + next_midnight: "Medianoche", + moon_phase: "Fase lunar", + weather: "Tiempo", + }, + editor: { + entity: "Entidad de Sol", + moon_entity: "Entidad de Luna (Opcional)", + weather_entity: "Entidad de Tiempo (Opcional)", + temp_entity: "Entidad de Temperatura (Opcional, anula el tiempo)", + main_options: "Opciones de visualización", + view_mode: "Modo de vista", + view_mode_classic: "Clásico (6 Imágenes)", + view_mode_calculated: "Calculado (Solo elevación)", + view_mode_arc: "Arco (Movimiento 180°)", + show_image: "Mostrar posición del sol (Imagen)", + show_weather_badge: "Mostrar insignia del tiempo", + animate_images: "Animar imágenes (excepto mañana/crepúsculo)", + sun_size: "Tamaño Sol/Luna (Solo en Arco)", + state_position: "Posición del estado", + state_pos_above: "Sobre la imagen", + state_pos_in_list: "En la lista", + state_pos_hide: "Ocultar", + moon_phase_position: "Posición de la fase lunar", + hide_moon_phase_on_day: "Ocultar fase lunar durante el día", + show_night_arc: "Mostrar arco lunar (180°)", + show_moon_icon_in_text: "Mostrar icono de la luna en el texto", + show_dividers: "Mostrar divisores", + show_degrees: "Mostrar grados (Azimut/Elevación)", + show_degrees_in_list: "Mostrar grados en la lista", + time_position: "Posición de la hora", + time_pos_below: "Bajo la imagen", + time_pos_above: "Sobre la imagen", + time_pos_right: "A la derecha de la imagen", + time_list_format: "Alineación de la lista de horas", + time_format_centered: "Centrado", + time_format_block: "Bloque", + times_to_show: "Seleccionar horas", + use_12h_format: "Usar formato 12h (AM/PM)", + language: "Idioma", + language_auto: "Automático (Home Assistant)", + solar_entity: "Entidad de energía solar (Opcional)", + show_solar_badge: "Mostrar insignia de energía solar", + advanced_options: "Umbrales (Avanzado)", + morning_azimuth: "Azimut de la mañana", + noon_azimuth: "Azimut del mediodía", + afternoon_azimuth: "Azimut de la tarde", + dusk_elevation: "Elevación del crepúsculo", + }, +}; From f58cf0cadae8b4b83e82468222a5435145235679 Mon Sep 17 00:00:00 2001 From: undel-gh Date: Tue, 12 May 2026 19:00:00 +0300 Subject: [PATCH 09/18] Update sun-position-card-editor.js --- src/sun-position-card-editor.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sun-position-card-editor.js b/src/sun-position-card-editor.js index 004f978..8e94f9c 100644 --- a/src/sun-position-card-editor.js +++ b/src/sun-position-card-editor.js @@ -9,6 +9,7 @@ import cs from './lang-cs.js'; import cs from './lang-ru.js'; import br from './lang-br.js'; import se from './lang-se.js'; +import es from './lang-es.js'; const fireEvent = (node, type, detail, options) => { options = options || {}; @@ -26,7 +27,7 @@ const fireEvent = (node, type, detail, options) => { class SunPositionCardEditor extends HTMLElement { constructor() { super(); - this.langs = { de, en, fr, it: ita, nl, pl, cs, ru, br, se }; + this.langs = { de, en, fr, it: ita, nl, pl, cs, ru, br, se, es }; this._initialized = false; } @@ -357,7 +358,8 @@ class SunPositionCardEditor extends HTMLElement { { value: "cs", label: "Čeština" }, { value: "ru", label: "Русский" }, { value: "se", label: "Svenska" }, - { value: "br", label: "português do Brasil" } + { value: "es", label: "Svenska" }, + { value: "br", label: "Español" } ], mode: "dropdown" } }; } From c82ced938182c1e3fbe6833d909e53cbe5dcf227 Mon Sep 17 00:00:00 2001 From: undel-gh Date: Tue, 12 May 2026 19:01:31 +0300 Subject: [PATCH 10/18] Update sun-position-card-editor.js typos --- src/sun-position-card-editor.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sun-position-card-editor.js b/src/sun-position-card-editor.js index 8e94f9c..89bfc46 100644 --- a/src/sun-position-card-editor.js +++ b/src/sun-position-card-editor.js @@ -358,8 +358,8 @@ class SunPositionCardEditor extends HTMLElement { { value: "cs", label: "Čeština" }, { value: "ru", label: "Русский" }, { value: "se", label: "Svenska" }, - { value: "es", label: "Svenska" }, - { value: "br", label: "Español" } + { value: "es", label: "Español" }, + { value: "br", label: "Português do Brasil" } ], mode: "dropdown" } }; } From 71051fa443dca42c08d7089aa5978d7358a6f968 Mon Sep 17 00:00:00 2001 From: undel-gh Date: Tue, 12 May 2026 19:02:30 +0300 Subject: [PATCH 11/18] Update sun-position-card.js added es --- src/sun-position-card.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sun-position-card.js b/src/sun-position-card.js index 8d44f99..7d6a6ea 100644 --- a/src/sun-position-card.js +++ b/src/sun-position-card.js @@ -9,6 +9,7 @@ import cs from './lang-cs.js'; import ru from './lang-ru.js'; import br from './lang-br.js'; import se from './lang-se.js'; +import es from './lang-es.js'; console.log( "%c☀️ Sun-Position-Card v_2.2 ready", From fe6cde8369e80890731db2beab24f484c4802dc7 Mon Sep 17 00:00:00 2001 From: undel-gh Date: Tue, 12 May 2026 19:03:19 +0300 Subject: [PATCH 12/18] Update sun-position-card.js added es --- src/sun-position-card.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sun-position-card.js b/src/sun-position-card.js index 7d6a6ea..e4f5b70 100644 --- a/src/sun-position-card.js +++ b/src/sun-position-card.js @@ -29,7 +29,7 @@ class SunPositionCard extends HTMLElement { super(); this._created = false; this._lastImage = null; - this.langs = { de, en, fr, it: ita, nl, pl, cs, br, se }; + this.langs = { de, en, fr, it: ita, nl, pl, cs, br, se, es }; } _localize(key, lang = this.config?.language || this._hass?.locale?.language || 'en') { From 6618ac346cf200a5b0c9a6bb775fcbc86f0bd2be Mon Sep 17 00:00:00 2001 From: undel-gh Date: Wed, 13 May 2026 11:31:57 +0300 Subject: [PATCH 13/18] Update sun-position-card.js Farenheit / celsius fix --- src/sun-position-card.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/sun-position-card.js b/src/sun-position-card.js index e4f5b70..93a5938 100644 --- a/src/sun-position-card.js +++ b/src/sun-position-card.js @@ -444,10 +444,18 @@ class SunPositionCard extends HTMLElement { if (weatherStateObj) { const cond = this._localize(`weather_state.${weatherStateObj.state}`); let temp = weatherStateObj.attributes.temperature; - let unit = hass.config.unit_system.temperature || '°C'; + // Берем unit из weather entity если есть + let unit = + weatherStateObj.attributes.temperature_unit || + weatherStateObj.attributes.unit_of_measurement || + hass.config.unit_system.temperature || + '°C'; + + // temp_entity имеет приоритет if (tempStateObj && !isNaN(tempStateObj.state)) { temp = tempStateObj.state; + if (tempStateObj.attributes.unit_of_measurement) { unit = tempStateObj.attributes.unit_of_measurement; } From 4be56114f5d4b050d811cb16fb638cf49aad0739 Mon Sep 17 00:00:00 2001 From: undel-gh Date: Wed, 13 May 2026 11:46:44 +0300 Subject: [PATCH 14/18] Update sun-position-card.js timezone fix --- src/sun-position-card.js | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/src/sun-position-card.js b/src/sun-position-card.js index 93a5938..786b849 100644 --- a/src/sun-position-card.js +++ b/src/sun-position-card.js @@ -350,28 +350,22 @@ class SunPositionCard extends HTMLElement { const formatTime = (isoString) => { if (!isoString) return ''; + const date = new Date(isoString); - const currentLang = (config.language || hass.locale?.language || 'en').split('-')[0]; + const locale = hass.locale?.language || 'en-US'; + const currentLang = (config.language || locale).split('-')[0]; const isEnglish = currentLang === 'en'; - - const serverTimeZone = hass.config?.time_zone; - - if (isEnglish && use12hFormat) { - return date.toLocaleTimeString('en-US', { - hour: 'numeric', - minute: '2-digit', - hour12: true, - ...(serverTimeZone && { timeZone: serverTimeZone }) - }); - } else { - return date.toLocaleTimeString(hass.locale?.language || 'en-US', { - hour: '2-digit', - minute: '2-digit', - hour12: false, - ...(serverTimeZone && { timeZone: serverTimeZone }) - }); - } + const timeZone = + hass.config?.time_zone || + Intl.DateTimeFormat().resolvedOptions().timeZone; + + return date.toLocaleTimeString(locale, { + hour: use12hFormat ? 'numeric' : '2-digit', + minute: '2-digit', + hour12: use12hFormat, + timeZone + }); }; const calculateDaylight = (sunrise, sunset) => { From e3847f32b8609ec72280e4a1f230c8f739cf065b Mon Sep 17 00:00:00 2001 From: undel-gh Date: Wed, 13 May 2026 11:50:35 +0300 Subject: [PATCH 15/18] Update sun-position-card.js math fixes --- src/sun-position-card.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sun-position-card.js b/src/sun-position-card.js index 786b849..fd4326c 100644 --- a/src/sun-position-card.js +++ b/src/sun-position-card.js @@ -447,7 +447,7 @@ class SunPositionCard extends HTMLElement { '°C'; // temp_entity имеет приоритет - if (tempStateObj && !isNaN(tempStateObj.state)) { + if (tempStateObj && !isNaN(parseFloat(tempStateObj.state))) { temp = tempStateObj.state; if (tempStateObj.attributes.unit_of_measurement) { @@ -455,7 +455,7 @@ class SunPositionCard extends HTMLElement { } } - weatherTemp = `${temp}${unit}`; + weatherTemp = `${parseFloat(temp).toFixed(1)}${unit}`; weatherText = `${cond}, ${weatherTemp}`; weatherIcon = this._getWeatherIcon(weatherStateObj.state); } From 8b759a9504b3978d0689274c7412f43d327407ce Mon Sep 17 00:00:00 2001 From: undel-gh Date: Wed, 13 May 2026 12:13:56 +0300 Subject: [PATCH 16/18] Update sun-position-card.js minor improvements --- src/sun-position-card.js | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/src/sun-position-card.js b/src/sun-position-card.js index fd4326c..023b036 100644 --- a/src/sun-position-card.js +++ b/src/sun-position-card.js @@ -29,7 +29,7 @@ class SunPositionCard extends HTMLElement { super(); this._created = false; this._lastImage = null; - this.langs = { de, en, fr, it: ita, nl, pl, cs, br, se, es }; + this.langs = { de, en, fr, it: ita, nl, pl, cs, ru, br, se, es }; } _localize(key, lang = this.config?.language || this._hass?.locale?.language || 'en') { @@ -351,11 +351,14 @@ class SunPositionCard extends HTMLElement { const formatTime = (isoString) => { if (!isoString) return ''; - const date = new Date(isoString); + const date = new Date(Date.parse(isoString)); - const locale = hass.locale?.language || 'en-US'; - const currentLang = (config.language || locale).split('-')[0]; - const isEnglish = currentLang === 'en'; + const locale = + config.language || + hass.locale?.language || + navigator.language || + 'en-US'; + const timeZone = hass.config?.time_zone || Intl.DateTimeFormat().resolvedOptions().timeZone; @@ -455,7 +458,12 @@ class SunPositionCard extends HTMLElement { } } - weatherTemp = `${parseFloat(temp).toFixed(1)}${unit}`; + const parsedTemp = parseFloat(temp); + + weatherTemp = !isNaN(parsedTemp) + ? `${parsedTemp.toFixed(1)}${unit}` + : `--${unit}`; + weatherText = `${cond}, ${weatherTemp}`; weatherIcon = this._getWeatherIcon(weatherStateObj.state); } @@ -584,7 +592,13 @@ class SunPositionCard extends HTMLElement { solarBadgeEl.style.display = 'flex'; const badgeBg = isDay ? 'rgba(21, 67, 108, 0.8)' : 'rgba(0, 0, 0, 0.8)'; solarBadgeEl.style.background = badgeBg; - const solarValue = solarStateObj.state; + const solarValue = parseFloat(solarStateObj.state); + + solarBadgeEl.innerHTML = + !isNaN(solarValue) + ? `${solarValue} ${solarUnit}` + : `--`; + const solarUnit = solarStateObj.attributes.unit_of_measurement || 'W'; solarBadgeEl.innerHTML = `${solarValue} ${solarUnit}`; } else { From e2c457a56beadb7c4fd7f4cf7dd92c6b9d2f3608 Mon Sep 17 00:00:00 2001 From: undel-gh Date: Wed, 13 May 2026 12:26:13 +0300 Subject: [PATCH 17/18] Update sun-position-card-editor.js typo --- src/sun-position-card-editor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sun-position-card-editor.js b/src/sun-position-card-editor.js index 89bfc46..41c7f82 100644 --- a/src/sun-position-card-editor.js +++ b/src/sun-position-card-editor.js @@ -6,7 +6,7 @@ import ita from './lang-ita.js'; import nl from './lang-nl.js'; import pl from './lang-pl.js'; import cs from './lang-cs.js'; -import cs from './lang-ru.js'; +import ru from './lang-ru.js'; import br from './lang-br.js'; import se from './lang-se.js'; import es from './lang-es.js'; From 9c4c489e6763fe15c1e59742233fdc203514640c Mon Sep 17 00:00:00 2001 From: undel-gh Date: Wed, 13 May 2026 13:07:46 +0300 Subject: [PATCH 18/18] Update lang-es.js ident --- src/lang-es.js | 208 ++++++++++++++++++++++++------------------------- 1 file changed, 104 insertions(+), 104 deletions(-) diff --git a/src/lang-es.js b/src/lang-es.js index 70d0d0f..8247961 100644 --- a/src/lang-es.js +++ b/src/lang-es.js @@ -1,105 +1,105 @@ export default { - card: { - name: "Sun Position Card", - description: "Posición del Sol y la Luna con imágenes personalizadas.", - }, - error: { - no_sun_entity: "Por favor, define una entidad de sol.", - entity_not_found: "Entidad no encontrada: ", - }, - sun_state: { - below_horizon: "Bajo el horizonte", - dawn: "Alba", - dusk: "Crepúsculo", - morning: "Mañana", - noon: "Mediodía", - afternoon: "Tarde", - evening: "Anochecer", - }, - moon_phase: { - new_moon: "Luna nueva", - waxing_crescent: "Luna creciente", - first_quarter: "Cuarto creciente", - waxing_gibbous: "Gibosa creciente", - full_moon: "Luna llena", - waning_gibbous: "Gibosa menguante", - last_quarter: "Cuarto menguante", - waning_crescent: "Luna menguante", - }, - weather_state: { - "clear-night": "Despejado (noche)", - cloudy: "Nublado", - fog: "Niebla", - hail: "Granizo", - lightning: "Relámpagos", - "lightning-rainy": "Tormenta eléctrica", - partlycloudy: "Parcialmente nublado", - pouring: "Lluvia intensa", - rainy: "Lluvia", - snowy: "Nieve", - snowy-rainy: "Nieve y lluvia", - sunny: "Soleado", - windy: "Ventoso", - "windy-variant": "Ventoso", - exceptional: "Excepcional", - }, - time_entry: { - current: "Actual", - azimuth: "Azimut", - elevation: "Elevación", - daylight_duration: "Duración de luz diurna", - day_comparison: "Comparativa del día", - next_rising: "Amanecer", - next_setting: "Atardecer", - next_dawn: "Alba", - next_dusk: "Crepúsculo", - next_noon: "Mediodía", - next_midnight: "Medianoche", - moon_phase: "Fase lunar", - weather: "Tiempo", - }, - editor: { - entity: "Entidad de Sol", - moon_entity: "Entidad de Luna (Opcional)", - weather_entity: "Entidad de Tiempo (Opcional)", - temp_entity: "Entidad de Temperatura (Opcional, anula el tiempo)", - main_options: "Opciones de visualización", - view_mode: "Modo de vista", - view_mode_classic: "Clásico (6 Imágenes)", - view_mode_calculated: "Calculado (Solo elevación)", - view_mode_arc: "Arco (Movimiento 180°)", - show_image: "Mostrar posición del sol (Imagen)", - show_weather_badge: "Mostrar insignia del tiempo", - animate_images: "Animar imágenes (excepto mañana/crepúsculo)", - sun_size: "Tamaño Sol/Luna (Solo en Arco)", - state_position: "Posición del estado", - state_pos_above: "Sobre la imagen", - state_pos_in_list: "En la lista", - state_pos_hide: "Ocultar", - moon_phase_position: "Posición de la fase lunar", - hide_moon_phase_on_day: "Ocultar fase lunar durante el día", - show_night_arc: "Mostrar arco lunar (180°)", - show_moon_icon_in_text: "Mostrar icono de la luna en el texto", - show_dividers: "Mostrar divisores", - show_degrees: "Mostrar grados (Azimut/Elevación)", - show_degrees_in_list: "Mostrar grados en la lista", - time_position: "Posición de la hora", - time_pos_below: "Bajo la imagen", - time_pos_above: "Sobre la imagen", - time_pos_right: "A la derecha de la imagen", - time_list_format: "Alineación de la lista de horas", - time_format_centered: "Centrado", - time_format_block: "Bloque", - times_to_show: "Seleccionar horas", - use_12h_format: "Usar formato 12h (AM/PM)", - language: "Idioma", - language_auto: "Automático (Home Assistant)", - solar_entity: "Entidad de energía solar (Opcional)", - show_solar_badge: "Mostrar insignia de energía solar", - advanced_options: "Umbrales (Avanzado)", - morning_azimuth: "Azimut de la mañana", - noon_azimuth: "Azimut del mediodía", - afternoon_azimuth: "Azimut de la tarde", - dusk_elevation: "Elevación del crepúsculo", - }, -}; + card: { + name: "Sun Position Card", + description: "Posición del Sol y la Luna con imágenes personalizadas.", + }, + error: { + no_sun_entity: "Por favor, define una entidad de sol.", + entity_not_found: "Entidad no encontrada: ", + }, + sun_state: { + below_horizon: "Bajo el horizonte", + dawn: "Alba", + dusk: "Crepúsculo", + morning: "Mañana", + noon: "Mediodía", + afternoon: "Tarde", + evening: "Anochecer", + }, + moon_phase: { + new_moon: "Luna nueva", + waxing_crescent: "Luna creciente", + first_quarter: "Cuarto creciente", + waxing_gibbous: "Gibosa creciente", + full_moon: "Luna llena", + waning_gibbous: "Gibosa menguante", + last_quarter: "Cuarto menguante", + waning_crescent: "Luna menguante", + }, + weather_state: { + "clear-night": "Despejado (noche)", + cloudy: "Nublado", + fog: "Niebla", + hail: "Granizo", + lightning: "Relámpagos", + "lightning-rainy": "Tormenta eléctrica", + partlycloudy: "Parcialmente nublado", + pouring: "Lluvia intensa", + rainy: "Lluvia", + snowy: "Nieve", + snowy-rainy: "Nieve y lluvia", + sunny: "Soleado", + windy: "Ventoso", + "windy-variant": "Ventoso", + exceptional: "Excepcional", + }, + time_entry: { + current: "Actual", + azimuth: "Azimut", + elevation: "Elevación", + daylight_duration: "Duración de luz diurna", + day_comparison: "Comparativa del día", + next_rising: "Amanecer", + next_setting: "Atardecer", + next_dawn: "Alba", + next_dusk: "Crepúsculo", + next_noon: "Mediodía", + next_midnight: "Medianoche", + moon_phase: "Fase lunar", + weather: "Tiempo", + }, + editor: { + entity: "Entidad de Sol", + moon_entity: "Entidad de Luna (Opcional)", + weather_entity: "Entidad de Tiempo (Opcional)", + temp_entity: "Entidad de Temperatura (Opcional, anula el tiempo)", + main_options: "Opciones de visualización", + view_mode: "Modo de vista", + view_mode_classic: "Clásico (6 Imágenes)", + view_mode_calculated: "Calculado (Solo elevación)", + view_mode_arc: "Arco (Movimiento 180°)", + show_image: "Mostrar posición del sol (Imagen)", + show_weather_badge: "Mostrar insignia del tiempo", + animate_images: "Animar imágenes (excepto mañana/crepúsculo)", + sun_size: "Tamaño Sol/Luna (Solo en Arco)", + state_position: "Posición del estado", + state_pos_above: "Sobre la imagen", + state_pos_in_list: "En la lista", + state_pos_hide: "Ocultar", + moon_phase_position: "Posición de la fase lunar", + hide_moon_phase_on_day: "Ocultar fase lunar durante el día", + show_night_arc: "Mostrar arco lunar (180°)", + show_moon_icon_in_text: "Mostrar icono de la luna en el texto", + show_dividers: "Mostrar divisores", + show_degrees: "Mostrar grados (Azimut/Elevación)", + show_degrees_in_list: "Mostrar grados en la lista", + time_position: "Posición de la hora", + time_pos_below: "Bajo la imagen", + time_pos_above: "Sobre la imagen", + time_pos_right: "A la derecha de la imagen", + time_list_format: "Alineación de la lista de horas", + time_format_centered: "Centrado", + time_format_block: "Bloque", + times_to_show: "Seleccionar horas", + use_12h_format: "Usar formato 12h (AM/PM)", + language: "Idioma", + language_auto: "Automático (Home Assistant)", + solar_entity: "Entidad de energía solar (Opcional)", + show_solar_badge: "Mostrar insignia de energía solar", + advanced_options: "Umbrales (Avanzado)", + morning_azimuth: "Azimut de la mañana", + noon_azimuth: "Azimut del mediodía", + afternoon_azimuth: "Azimut de la tarde", + dusk_elevation: "Elevación del crepúsculo", + }, + };