meteocat 2.2.3 → 2.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [2.2.4](https://github.com/figorr/meteocat/compare/v2.2.3...v2.2.4) (2025-02-09)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * 2.2.4 ([59183ea](https://github.com/figorr/meteocat/commit/59183ea082f6d963e46d3f8a51e0867b3f32060d))
7
+ * fix valid lightning data for download from API ([4e4a8ae](https://github.com/figorr/meteocat/commit/4e4a8ae110b72b6e6ff560921f88ea7fb4640a29))
8
+
1
9
  ## [2.2.3](https://github.com/figorr/meteocat/compare/v2.2.2...v2.2.3) (2025-02-08)
2
10
 
3
11
 
@@ -33,7 +33,7 @@ from .const import DOMAIN, PLATFORMS
33
33
  _LOGGER = logging.getLogger(__name__)
34
34
 
35
35
  # Versión
36
- __version__ = "2.2.3"
36
+ __version__ = "2.2.4"
37
37
 
38
38
  # Definir el esquema de configuración CONFIG_SCHEMA
39
39
  CONFIG_SCHEMA = vol.Schema(
@@ -56,6 +56,8 @@ DEFAULT_VALIDITY_MINUTES = 0 # Minutos a partir de los cuales la API tiene la i
56
56
  DEFAULT_ALERT_VALIDITY_TIME = 120 # Minutos a partir de los cuales las alertas están obsoletas y se se debe proceder a una nueva llamada a la API
57
57
  DEFAULT_QUOTES_VALIDITY_TIME = 240 # Minutos a partir de los cuales los datos de cuotas están obsoletos y se se debe proceder a una nueva llamada a la API
58
58
  DEFAULT_LIGHTNING_VALIDITY_TIME = 240 # Minutos a partir de los cuales los datos de rayos están obsoletos y se se debe proceder a una nueva llamada a la API
59
+ DEFAULT_LIGHTNING_VALIDITY_HOURS = 2 # Hora a partir de la cual la API tiene la información actualizada de rayos disponible para descarga
60
+ DEFAULT_LIGHTNING_VALIDITY_MINUTES = 0 # Minutos a partir de los cuales la API tiene la información actualizada de rayos disponible para descarga
59
61
 
60
62
  # Multiplicadores para la duración de validez basada en limit_prediccio
61
63
  ALERT_VALIDITY_MULTIPLIER_100 = 12 # para limit_prediccio <= 100
@@ -43,7 +43,9 @@ from .const import (
43
43
  ALERT_VALIDITY_MULTIPLIER_200,
44
44
  ALERT_VALIDITY_MULTIPLIER_500,
45
45
  ALERT_VALIDITY_MULTIPLIER_DEFAULT,
46
- DEFAULT_LIGHTNING_VALIDITY_TIME
46
+ DEFAULT_LIGHTNING_VALIDITY_TIME,
47
+ DEFAULT_LIGHTNING_VALIDITY_HOURS,
48
+ DEFAULT_LIGHTNING_VALIDITY_MINUTES
47
49
  )
48
50
 
49
51
  _LOGGER = logging.getLogger(__name__)
@@ -1908,6 +1910,8 @@ class MeteocatLightningCoordinator(DataUpdateCoordinator):
1908
1910
  existing_data = await load_json_from_file(self.lightning_file) or {}
1909
1911
 
1910
1912
  # Definir la duración de validez de los datos
1913
+ current_time = datetime.now(timezone.utc).time()
1914
+ validity_start_time = time(DEFAULT_LIGHTNING_VALIDITY_HOURS, DEFAULT_LIGHTNING_VALIDITY_MINUTES)
1911
1915
  validity_duration = timedelta(minutes=DEFAULT_LIGHTNING_VALIDITY_TIME)
1912
1916
 
1913
1917
  if not existing_data:
@@ -1916,7 +1920,7 @@ class MeteocatLightningCoordinator(DataUpdateCoordinator):
1916
1920
  last_update = datetime.fromisoformat(existing_data['actualitzat']['dataUpdate'])
1917
1921
  now = datetime.now(timezone.utc).astimezone(TIMEZONE)
1918
1922
 
1919
- if now - last_update >= validity_duration:
1923
+ if now - last_update >= validity_duration and current_time >= validity_start_time:
1920
1924
  return await self._fetch_and_save_new_data()
1921
1925
  else:
1922
1926
  _LOGGER.debug("Usando datos existentes de rayos: %s", existing_data)
@@ -9,5 +9,5 @@
9
9
  "issue_tracker": "https://github.com/figorr/meteocat/issues",
10
10
  "loggers": ["meteocatpy"],
11
11
  "requirements": ["meteocatpy==1.0.1", "packaging>=20.3", "wrapt>=1.14.0"],
12
- "version": "2.2.3"
12
+ "version": "2.2.4"
13
13
  }
@@ -1,2 +1,2 @@
1
1
  # version.py
2
- __version__ = "2.2.3"
2
+ __version__ = "2.2.4"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meteocat",
3
- "version": "2.2.3",
3
+ "version": "2.2.4",
4
4
  "description": "[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\r [![Python version compatibility](https://img.shields.io/pypi/pyversions/meteocat)](https://pypi.org/project/meteocat)\r [![pipeline status](https://gitlab.com/figorr/meteocat/badges/master/pipeline.svg)](https://gitlab.com/figorr/meteocat/commits/master)",
5
5
  "main": "index.js",
6
6
  "directories": {
package/pyproject.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "meteocat"
3
- version = "2.2.3"
3
+ version = "2.2.4"
4
4
  description = "Script para obtener datos meteorológicos de la API de Meteocat"
5
5
  authors = ["figorr <jdcuartero@yahoo.es>"]
6
6
  license = "Apache-2.0"