meteocat 0.1.44 → 0.1.45
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 +11 -0
- package/custom_components/meteocat/__init__.py +1 -1
- package/custom_components/meteocat/coordinator.py +7 -7
- package/custom_components/meteocat/manifest.json +1 -1
- package/custom_components/meteocat/sensor.py +8 -8
- package/custom_components/meteocat/version.py +1 -1
- package/package.json +1 -1
- package/pyproject.toml +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
## [0.1.45](https://github.com/figorr/meteocat/compare/v0.1.44...v0.1.45) (2024-12-31)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* 0.1.45 ([ab522cf](https://github.com/figorr/meteocat/commit/ab522cf4d94687c64dc84480f8f5507645a79557))
|
|
7
|
+
* change icon for status sensors ([7415646](https://github.com/figorr/meteocat/commit/741564698b09b6e29b774bb388b6c96f718a573a))
|
|
8
|
+
* fix async_add_entities for generic dynamic sensors ([2192214](https://github.com/figorr/meteocat/commit/2192214ebb767e74c187df98e7c811225c21ca33))
|
|
9
|
+
* fix name and comments for Temp Forecast Coordinator ([e65e476](https://github.com/figorr/meteocat/commit/e65e476f03b0de062ab14a9563eaa71b6d80301f))
|
|
10
|
+
* fix name sensor coordinator ([e93d01f](https://github.com/figorr/meteocat/commit/e93d01f359158ee63494e697059550fcea37806f))
|
|
11
|
+
|
|
1
12
|
## [0.1.44](https://github.com/figorr/meteocat/compare/v0.1.43...v0.1.44) (2024-12-30)
|
|
2
13
|
|
|
3
14
|
|
|
@@ -25,7 +25,7 @@ from .const import DOMAIN, PLATFORMS
|
|
|
25
25
|
_LOGGER = logging.getLogger(__name__)
|
|
26
26
|
|
|
27
27
|
# Versión
|
|
28
|
-
__version__ = "0.1.
|
|
28
|
+
__version__ = "0.1.45"
|
|
29
29
|
|
|
30
30
|
def safe_remove(path: Path, is_folder: bool = False):
|
|
31
31
|
"""Elimina de forma segura un archivo o carpeta si existe."""
|
|
@@ -940,14 +940,14 @@ class MeteocatConditionCoordinator(DataUpdateCoordinator):
|
|
|
940
940
|
return {"condition": "unknown", "hour": current_hour, "icon": None, "date": current_date}
|
|
941
941
|
|
|
942
942
|
class MeteocatTempForecastCoordinator(DataUpdateCoordinator):
|
|
943
|
-
"""Coordinator para manejar las predicciones diarias desde archivos locales."""
|
|
943
|
+
"""Coordinator para manejar la temperatura máxima y mínima de las predicciones diarias desde archivos locales."""
|
|
944
944
|
|
|
945
945
|
def __init__(
|
|
946
946
|
self,
|
|
947
947
|
hass: HomeAssistant,
|
|
948
948
|
entry_data: dict,
|
|
949
949
|
):
|
|
950
|
-
"""Inicializa el coordinador para predicciones diarias."""
|
|
950
|
+
"""Inicializa el coordinador para las temperaturas máximas y mínimas de predicciones diarias."""
|
|
951
951
|
self.town_name = entry_data["town_name"]
|
|
952
952
|
self.town_id = entry_data["town_id"]
|
|
953
953
|
self.station_name = entry_data["station_name"]
|
|
@@ -962,7 +962,7 @@ class MeteocatTempForecastCoordinator(DataUpdateCoordinator):
|
|
|
962
962
|
super().__init__(
|
|
963
963
|
hass,
|
|
964
964
|
_LOGGER,
|
|
965
|
-
name=f"{DOMAIN} Daily Forecast Coordinator",
|
|
965
|
+
name=f"{DOMAIN} Daily Temperature Forecast Coordinator",
|
|
966
966
|
update_interval=DEFAULT_TEMP_FORECAST_UPDATE_INTERVAL,
|
|
967
967
|
)
|
|
968
968
|
|
|
@@ -1005,18 +1005,18 @@ class MeteocatTempForecastCoordinator(DataUpdateCoordinator):
|
|
|
1005
1005
|
if datetime.fromisoformat(dia["data"].rstrip("Z")).date() >= today
|
|
1006
1006
|
]
|
|
1007
1007
|
|
|
1008
|
-
# Usar datos del día actual si están disponibles
|
|
1008
|
+
# Usar datos de temperatura del día actual si están disponibles
|
|
1009
1009
|
today_temp_forecast = self.get_temp_forecast_for_today(data)
|
|
1010
1010
|
if today_temp_forecast:
|
|
1011
1011
|
parsed_data = self.parse_temp_forecast(today_temp_forecast)
|
|
1012
1012
|
return parsed_data
|
|
1013
1013
|
except Exception as e:
|
|
1014
|
-
_LOGGER.warning("Error leyendo archivo de predicción diaria: %s", e)
|
|
1014
|
+
_LOGGER.warning("Error leyendo temperaturas del archivo de predicción diaria: %s", e)
|
|
1015
1015
|
|
|
1016
1016
|
return {}
|
|
1017
1017
|
|
|
1018
1018
|
def get_temp_forecast_for_today(self, data: dict) -> dict | None:
|
|
1019
|
-
"""Obtiene los datos diarios para el día actual."""
|
|
1019
|
+
"""Obtiene los datos de temperaturas diarios para el día actual."""
|
|
1020
1020
|
if not data or "dies" not in data or not data["dies"]:
|
|
1021
1021
|
return None
|
|
1022
1022
|
|
|
@@ -1028,7 +1028,7 @@ class MeteocatTempForecastCoordinator(DataUpdateCoordinator):
|
|
|
1028
1028
|
return None
|
|
1029
1029
|
|
|
1030
1030
|
def parse_temp_forecast(self, dia: dict) -> dict:
|
|
1031
|
-
"""Convierte un día de predicción en un diccionario con los datos necesarios."""
|
|
1031
|
+
"""Convierte la temperatura de un día de predicción en un diccionario con los datos necesarios."""
|
|
1032
1032
|
variables = dia.get("variables", {})
|
|
1033
1033
|
|
|
1034
1034
|
temp_forecast_data = {
|
|
@@ -237,19 +237,19 @@ SENSOR_TYPES: tuple[MeteocatSensorEntityDescription, ...] = (
|
|
|
237
237
|
MeteocatSensorEntityDescription(
|
|
238
238
|
key=HOURLY_FORECAST_FILE_STATUS,
|
|
239
239
|
translation_key="hourly_forecast_file_status",
|
|
240
|
-
icon="mdi:
|
|
240
|
+
icon="mdi:update",
|
|
241
241
|
entity_category=EntityCategory.DIAGNOSTIC,
|
|
242
242
|
),
|
|
243
243
|
MeteocatSensorEntityDescription(
|
|
244
244
|
key=DAILY_FORECAST_FILE_STATUS,
|
|
245
245
|
translation_key="daily_forecast_file_status",
|
|
246
|
-
icon="mdi:
|
|
246
|
+
icon="mdi:update",
|
|
247
247
|
entity_category=EntityCategory.DIAGNOSTIC,
|
|
248
248
|
),
|
|
249
249
|
MeteocatSensorEntityDescription(
|
|
250
250
|
key=UVI_FILE_STATUS,
|
|
251
251
|
translation_key="uvi_file_status",
|
|
252
|
-
icon="mdi:
|
|
252
|
+
icon="mdi:update",
|
|
253
253
|
entity_category=EntityCategory.DIAGNOSTIC,
|
|
254
254
|
)
|
|
255
255
|
)
|
|
@@ -260,7 +260,7 @@ async def async_setup_entry(hass, entry, async_add_entities: AddEntitiesCallback
|
|
|
260
260
|
entry_data = hass.data[DOMAIN][entry.entry_id]
|
|
261
261
|
|
|
262
262
|
# Coordinadores para sensores
|
|
263
|
-
|
|
263
|
+
sensor_coordinator = entry_data.get("sensor_coordinator")
|
|
264
264
|
uvi_file_coordinator = entry_data.get("uvi_file_coordinator")
|
|
265
265
|
static_sensor_coordinator = entry_data.get("static_sensor_coordinator")
|
|
266
266
|
condition_coordinator = entry_data.get("condition_coordinator")
|
|
@@ -270,9 +270,9 @@ async def async_setup_entry(hass, entry, async_add_entities: AddEntitiesCallback
|
|
|
270
270
|
|
|
271
271
|
# Sensores generales
|
|
272
272
|
async_add_entities(
|
|
273
|
-
MeteocatSensor(
|
|
273
|
+
MeteocatSensor(sensor_coordinator, description, entry_data)
|
|
274
274
|
for description in SENSOR_TYPES
|
|
275
|
-
if description.key
|
|
275
|
+
if description.key in {WIND_SPEED, WIND_DIRECTION, TEMPERATURE, HUMIDITY, PRESSURE, PRECIPITATION, PRECIPITATION_ACCUMULATED, SOLAR_GLOBAL_IRRADIANCE, MAX_TEMPERATURE, MIN_TEMPERATURE, FEELS_LIKE, WIND_GUST, STATION_TIMESTAMP} # Incluir sensores generales en el coordinador SENSOR COORDINATOR
|
|
276
276
|
)
|
|
277
277
|
|
|
278
278
|
# Sensores estáticos
|
|
@@ -502,9 +502,9 @@ class MeteocatSensor(CoordinatorEntity[MeteocatSensorCoordinator], SensorEntity)
|
|
|
502
502
|
|
|
503
503
|
_attr_has_entity_name = True # Activa el uso de nombres basados en el dispositivo
|
|
504
504
|
|
|
505
|
-
def __init__(self,
|
|
505
|
+
def __init__(self, sensor_coordinator, description, entry_data):
|
|
506
506
|
"""Initialize the sensor."""
|
|
507
|
-
super().__init__(
|
|
507
|
+
super().__init__(sensor_coordinator)
|
|
508
508
|
self.entity_description = description
|
|
509
509
|
self.api_key = entry_data["api_key"]
|
|
510
510
|
self._town_name = entry_data["town_name"]
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
# version.py
|
|
2
|
-
__version__ = "0.1.
|
|
2
|
+
__version__ = "0.1.45"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "meteocat",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.45",
|
|
4
4
|
"description": "[](https://opensource.org/licenses/Apache-2.0)\r [](https://pypi.org/project/meteocat)\r [](https://gitlab.com/figorr/meteocat/commits/master)",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"directories": {
|