meteocat 0.1.36 → 0.1.38
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 +18 -0
- package/custom_components/meteocat/__init__.py +1 -1
- package/custom_components/meteocat/manifest.json +1 -1
- package/custom_components/meteocat/sensor.py +36 -1
- package/custom_components/meteocat/strings.json +9 -2
- package/custom_components/meteocat/translations/ca.json +9 -2
- package/custom_components/meteocat/translations/en.json +9 -2
- package/custom_components/meteocat/translations/es.json +9 -2
- 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,21 @@
|
|
|
1
|
+
## [0.1.38](https://github.com/figorr/meteocat/compare/v0.1.37...v0.1.38) (2024-12-18)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* 0.1.38 ([58014ef](https://github.com/figorr/meteocat/commit/58014ef56ca54f2b458fe6e142fbcf27cd8d211d))
|
|
7
|
+
* add degrees attribute translations ([341cf84](https://github.com/figorr/meteocat/commit/341cf849024f98ff1f31b66ec7ff6a2a39123148))
|
|
8
|
+
* add degrees property to wind direction ([9570a79](https://github.com/figorr/meteocat/commit/9570a7911d112624818da224369bacec1ee74902))
|
|
9
|
+
|
|
10
|
+
## [0.1.37](https://github.com/figorr/meteocat/compare/v0.1.36...v0.1.37) (2024-12-17)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* 0.1.37 ([1e850d8](https://github.com/figorr/meteocat/commit/1e850d8e77d0e572a0bfb8ba01702ab3acf0437f))
|
|
16
|
+
* fix hour attribute translation ([31ccc6f](https://github.com/figorr/meteocat/commit/31ccc6fc9a1a51c441935682cbdc1af07cc6af5f))
|
|
17
|
+
* fix wind directions ([23bbf44](https://github.com/figorr/meteocat/commit/23bbf4465c79107e5326fc107b23cf4a0c71c70c))
|
|
18
|
+
|
|
1
19
|
## [0.1.36](https://github.com/figorr/meteocat/compare/v0.1.35...v0.1.36) (2024-12-17)
|
|
2
20
|
|
|
3
21
|
|
|
@@ -20,7 +20,7 @@ from .const import DOMAIN, PLATFORMS
|
|
|
20
20
|
_LOGGER = logging.getLogger(__name__)
|
|
21
21
|
|
|
22
22
|
# Versión
|
|
23
|
-
__version__ = "0.1.
|
|
23
|
+
__version__ = "0.1.38"
|
|
24
24
|
|
|
25
25
|
def safe_remove(path: Path, is_folder: bool = False):
|
|
26
26
|
"""Elimina de forma segura un archivo o carpeta si existe."""
|
|
@@ -478,10 +478,45 @@ class MeteocatSensor(CoordinatorEntity[MeteocatSensorCoordinator], SensorEntity)
|
|
|
478
478
|
|
|
479
479
|
directions = [
|
|
480
480
|
"N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE",
|
|
481
|
-
"S", "SSW", "SW", "WSW", "
|
|
481
|
+
"S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW", "N",
|
|
482
482
|
]
|
|
483
483
|
index = round(degree / 22.5) % 16
|
|
484
484
|
return directions[index]
|
|
485
|
+
|
|
486
|
+
@property
|
|
487
|
+
def extra_state_attributes(self):
|
|
488
|
+
"""Return additional attributes of the sensor."""
|
|
489
|
+
attributes = super().extra_state_attributes or {}
|
|
490
|
+
|
|
491
|
+
# Agregar grados como atributo solo para WIND_DIRECTION
|
|
492
|
+
if self.entity_description.key == WIND_DIRECTION:
|
|
493
|
+
# Obtener el código del sensor desde CODE_MAPPING
|
|
494
|
+
sensor_code = self.CODE_MAPPING.get(self.entity_description.key)
|
|
495
|
+
|
|
496
|
+
if sensor_code is not None:
|
|
497
|
+
# Acceder a los datos de la estación desde el coordinator
|
|
498
|
+
stations = self.coordinator.data or []
|
|
499
|
+
degrees_value = None
|
|
500
|
+
|
|
501
|
+
for station in stations:
|
|
502
|
+
variables = station.get("variables", [])
|
|
503
|
+
# Buscar la variable correspondiente al código
|
|
504
|
+
variable_data = next(
|
|
505
|
+
(var for var in variables if var.get("codi") == sensor_code),
|
|
506
|
+
None,
|
|
507
|
+
)
|
|
508
|
+
if variable_data:
|
|
509
|
+
# Obtener la última lectura de grados
|
|
510
|
+
lectures = variable_data.get("lectures", [])
|
|
511
|
+
if lectures:
|
|
512
|
+
degrees_value = lectures[-1].get("valor")
|
|
513
|
+
break
|
|
514
|
+
|
|
515
|
+
# Asignar el valor al atributo
|
|
516
|
+
if degrees_value is not None:
|
|
517
|
+
attributes["degrees"] = degrees_value
|
|
518
|
+
|
|
519
|
+
return attributes
|
|
485
520
|
|
|
486
521
|
@property
|
|
487
522
|
def device_info(self) -> DeviceInfo:
|
|
@@ -48,6 +48,11 @@
|
|
|
48
48
|
"NW": "NW",
|
|
49
49
|
"NNW": "NNW",
|
|
50
50
|
"unknown": "Unknown"
|
|
51
|
+
},
|
|
52
|
+
"state_attributes": {
|
|
53
|
+
"degrees": {
|
|
54
|
+
"name": "Degrees"
|
|
55
|
+
}
|
|
51
56
|
}
|
|
52
57
|
},
|
|
53
58
|
"temperature": {
|
|
@@ -70,8 +75,10 @@
|
|
|
70
75
|
},
|
|
71
76
|
"uv_index": {
|
|
72
77
|
"name": "UV Index",
|
|
73
|
-
"
|
|
74
|
-
"hour":
|
|
78
|
+
"state_attributes": {
|
|
79
|
+
"hour": {
|
|
80
|
+
"name": "Hour"
|
|
81
|
+
}
|
|
75
82
|
}
|
|
76
83
|
},
|
|
77
84
|
"max_temperature": {
|
|
@@ -48,6 +48,11 @@
|
|
|
48
48
|
"NW": "NO",
|
|
49
49
|
"NNW": "NNO",
|
|
50
50
|
"unknown": "Desconegut"
|
|
51
|
+
},
|
|
52
|
+
"state_attributes": {
|
|
53
|
+
"degrees": {
|
|
54
|
+
"name": "Graus"
|
|
55
|
+
}
|
|
51
56
|
}
|
|
52
57
|
},
|
|
53
58
|
"temperature": {
|
|
@@ -70,8 +75,10 @@
|
|
|
70
75
|
},
|
|
71
76
|
"uv_index": {
|
|
72
77
|
"name": "UV Índex",
|
|
73
|
-
"
|
|
74
|
-
"hour":
|
|
78
|
+
"state_attributes": {
|
|
79
|
+
"hour": {
|
|
80
|
+
"name": "Hora"
|
|
81
|
+
}
|
|
75
82
|
}
|
|
76
83
|
},
|
|
77
84
|
"max_temperature": {
|
|
@@ -48,6 +48,11 @@
|
|
|
48
48
|
"NW": "NW",
|
|
49
49
|
"NNW": "NNW",
|
|
50
50
|
"unknown": "Unknown"
|
|
51
|
+
},
|
|
52
|
+
"state_attributes": {
|
|
53
|
+
"degrees": {
|
|
54
|
+
"name": "Degrees"
|
|
55
|
+
}
|
|
51
56
|
}
|
|
52
57
|
},
|
|
53
58
|
"temperature": {
|
|
@@ -70,8 +75,10 @@
|
|
|
70
75
|
},
|
|
71
76
|
"uv_index": {
|
|
72
77
|
"name": "UV Index",
|
|
73
|
-
"
|
|
74
|
-
"hour":
|
|
78
|
+
"state_attributes": {
|
|
79
|
+
"hour": {
|
|
80
|
+
"name": "Hour"
|
|
81
|
+
}
|
|
75
82
|
}
|
|
76
83
|
},
|
|
77
84
|
"max_temperature": {
|
|
@@ -48,6 +48,11 @@
|
|
|
48
48
|
"NW": "NO",
|
|
49
49
|
"NNW": "NNO",
|
|
50
50
|
"unknown": "Desconocido"
|
|
51
|
+
},
|
|
52
|
+
"state_attributes": {
|
|
53
|
+
"degrees": {
|
|
54
|
+
"name": "Grados"
|
|
55
|
+
}
|
|
51
56
|
}
|
|
52
57
|
},
|
|
53
58
|
"temperature": {
|
|
@@ -70,8 +75,10 @@
|
|
|
70
75
|
},
|
|
71
76
|
"uv_index": {
|
|
72
77
|
"name": "UV Índice",
|
|
73
|
-
"
|
|
74
|
-
"hour":
|
|
78
|
+
"state_attributes": {
|
|
79
|
+
"hour": {
|
|
80
|
+
"name": "Hora"
|
|
81
|
+
}
|
|
75
82
|
}
|
|
76
83
|
},
|
|
77
84
|
"max_temperature": {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
# version.py
|
|
2
|
-
__version__ = "0.1.
|
|
2
|
+
__version__ = "0.1.38"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "meteocat",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.38",
|
|
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": {
|