meteocat 0.1.31 → 0.1.33

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,21 @@
1
+ ## [0.1.33](https://github.com/figorr/meteocat/compare/v0.1.32...v0.1.33) (2024-12-14)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * 0.1.33 ([461a423](https://github.com/figorr/meteocat/commit/461a423bd8596234bc182697d9f2725dd5234334))
7
+ * fix feels like options ([8e22c9e](https://github.com/figorr/meteocat/commit/8e22c9efd175d84eede50b4ce5c1f7abac14dc00))
8
+
9
+ ## [0.1.32](https://github.com/figorr/meteocat/compare/v0.1.31...v0.1.32) (2024-12-14)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * 0.1.32 ([7c6186f](https://github.com/figorr/meteocat/commit/7c6186fe81061013f6093355b042750fbc28b921))
15
+ * add LOGGER debug to FEELS LIKE ([a0cd0c4](https://github.com/figorr/meteocat/commit/a0cd0c495b1f01365a74d6262ed595921962b825))
16
+ * add translations names to sensors ([57a5a1c](https://github.com/figorr/meteocat/commit/57a5a1c734db1042b1085c8fb58140c1dc0ad1fb))
17
+ * add wind direction translations ([f4ec133](https://github.com/figorr/meteocat/commit/f4ec1339126d4da008e0cbc2a96fff8be3c6e081))
18
+
1
19
  ## [0.1.31](https://github.com/figorr/meteocat/compare/v0.1.30...v0.1.31) (2024-12-13)
2
20
 
3
21
 
@@ -14,7 +14,7 @@ from .const import DOMAIN, PLATFORMS
14
14
  _LOGGER = logging.getLogger(__name__)
15
15
 
16
16
  # Versión
17
- __version__ = "0.1.31"
17
+ __version__ = "0.1.33"
18
18
 
19
19
  def safe_remove(path: Path, is_folder: bool = False):
20
20
  """Elimina de forma segura un archivo o carpeta si existe."""
@@ -8,5 +8,5 @@
8
8
  "documentation": "https://gitlab.com/figorr/meteocat",
9
9
  "loggers": ["meteocatpy"],
10
10
  "requirements": ["meteocatpy==0.0.15", "packaging>=20.3", "wrapt>=1.14.0"],
11
- "version": "0.1.31"
11
+ "version": "0.1.33"
12
12
  }
@@ -71,7 +71,7 @@ SENSOR_TYPES: tuple[MeteocatSensorEntityDescription, ...] = (
71
71
  # Sensores dinámicos
72
72
  MeteocatSensorEntityDescription(
73
73
  key=WIND_SPEED,
74
- name="Wind Speed",
74
+ translation_key="wind_speed",
75
75
  icon="mdi:weather-windy",
76
76
  device_class=SensorDeviceClass.WIND_SPEED,
77
77
  state_class=SensorStateClass.MEASUREMENT,
@@ -79,13 +79,13 @@ SENSOR_TYPES: tuple[MeteocatSensorEntityDescription, ...] = (
79
79
  ),
80
80
  MeteocatSensorEntityDescription(
81
81
  key=WIND_DIRECTION,
82
- name="Wind Direction",
82
+ translation_key="wind_direction",
83
83
  icon="mdi:compass",
84
84
  device_class=None,
85
85
  ),
86
86
  MeteocatSensorEntityDescription(
87
87
  key=TEMPERATURE,
88
- name="Temperature",
88
+ translation_key="temperature",
89
89
  icon="mdi:thermometer",
90
90
  device_class=SensorDeviceClass.TEMPERATURE,
91
91
  state_class=SensorStateClass.MEASUREMENT,
@@ -93,7 +93,7 @@ SENSOR_TYPES: tuple[MeteocatSensorEntityDescription, ...] = (
93
93
  ),
94
94
  MeteocatSensorEntityDescription(
95
95
  key=HUMIDITY,
96
- name="Humidity",
96
+ translation_key="humidity",
97
97
  icon="mdi:water-percent",
98
98
  device_class=SensorDeviceClass.HUMIDITY,
99
99
  state_class=SensorStateClass.MEASUREMENT,
@@ -101,7 +101,7 @@ SENSOR_TYPES: tuple[MeteocatSensorEntityDescription, ...] = (
101
101
  ),
102
102
  MeteocatSensorEntityDescription(
103
103
  key=PRESSURE,
104
- name="Pressure",
104
+ translation_key="pressure",
105
105
  icon="mdi:gauge",
106
106
  device_class=SensorDeviceClass.ATMOSPHERIC_PRESSURE,
107
107
  state_class=SensorStateClass.MEASUREMENT,
@@ -109,7 +109,7 @@ SENSOR_TYPES: tuple[MeteocatSensorEntityDescription, ...] = (
109
109
  ),
110
110
  MeteocatSensorEntityDescription(
111
111
  key=PRECIPITATION,
112
- name="Precipitation",
112
+ translation_key="precipitation",
113
113
  icon="mdi:weather-rainy",
114
114
  device_class=None,
115
115
  state_class=SensorStateClass.MEASUREMENT,
@@ -117,7 +117,7 @@ SENSOR_TYPES: tuple[MeteocatSensorEntityDescription, ...] = (
117
117
  ),
118
118
  MeteocatSensorEntityDescription(
119
119
  key=PRECIPITATION_ACCUMULATED,
120
- name="Precipitation Accumulated",
120
+ translation_key="precipitation_accumulated",
121
121
  icon="mdi:weather-rainy",
122
122
  device_class=SensorDeviceClass.PRECIPITATION,
123
123
  state_class=SensorStateClass.MEASUREMENT,
@@ -125,7 +125,7 @@ SENSOR_TYPES: tuple[MeteocatSensorEntityDescription, ...] = (
125
125
  ),
126
126
  MeteocatSensorEntityDescription(
127
127
  key=SOLAR_GLOBAL_IRRADIANCE,
128
- name="Solar Global Irradiance",
128
+ translation_key="solar_global_irradiance",
129
129
  icon="mdi:weather-sunny",
130
130
  device_class=SensorDeviceClass.IRRADIANCE,
131
131
  state_class=SensorStateClass.MEASUREMENT,
@@ -133,12 +133,12 @@ SENSOR_TYPES: tuple[MeteocatSensorEntityDescription, ...] = (
133
133
  ),
134
134
  MeteocatSensorEntityDescription(
135
135
  key=UV_INDEX,
136
- name="UV Index",
136
+ translation_key="uv_index",
137
137
  icon="mdi:weather-sunny",
138
138
  ),
139
139
  MeteocatSensorEntityDescription(
140
140
  key=MAX_TEMPERATURE,
141
- name="Max Temperature",
141
+ translation_key="max_temperature",
142
142
  icon="mdi:thermometer-plus",
143
143
  device_class=SensorDeviceClass.TEMPERATURE,
144
144
  state_class=SensorStateClass.MEASUREMENT,
@@ -146,7 +146,7 @@ SENSOR_TYPES: tuple[MeteocatSensorEntityDescription, ...] = (
146
146
  ),
147
147
  MeteocatSensorEntityDescription(
148
148
  key=MIN_TEMPERATURE,
149
- name="Min Temperature",
149
+ translation_key="min_temperature",
150
150
  icon="mdi:thermometer-minus",
151
151
  device_class=SensorDeviceClass.TEMPERATURE,
152
152
  state_class=SensorStateClass.MEASUREMENT,
@@ -154,7 +154,7 @@ SENSOR_TYPES: tuple[MeteocatSensorEntityDescription, ...] = (
154
154
  ),
155
155
  MeteocatSensorEntityDescription(
156
156
  key=FEELS_LIKE,
157
- name="Feels Like",
157
+ translation_key="feels_like",
158
158
  icon="mdi:sun-thermometer",
159
159
  device_class=SensorDeviceClass.TEMPERATURE,
160
160
  state_class=SensorStateClass.MEASUREMENT,
@@ -162,7 +162,7 @@ SENSOR_TYPES: tuple[MeteocatSensorEntityDescription, ...] = (
162
162
  ),
163
163
  MeteocatSensorEntityDescription(
164
164
  key=WIND_GUST,
165
- name="Wind Gust",
165
+ translation_key="wind_gust",
166
166
  icon="mdi:weather-windy",
167
167
  device_class=SensorDeviceClass.WIND_SPEED,
168
168
  state_class=SensorStateClass.MEASUREMENT,
@@ -171,31 +171,31 @@ SENSOR_TYPES: tuple[MeteocatSensorEntityDescription, ...] = (
171
171
  # Sensores estáticos
172
172
  MeteocatSensorEntityDescription(
173
173
  key=TOWN_NAME,
174
- name="Town Name",
174
+ translation_key="town_name",
175
175
  icon="mdi:home-city",
176
176
  entity_category=EntityCategory.DIAGNOSTIC,
177
177
  ),
178
178
  MeteocatSensorEntityDescription(
179
179
  key=TOWN_ID,
180
- name="Town ID",
180
+ translation_key="town_id",
181
181
  icon="mdi:identifier",
182
182
  entity_category=EntityCategory.DIAGNOSTIC,
183
183
  ),
184
184
  MeteocatSensorEntityDescription(
185
185
  key=STATION_NAME,
186
- name="Station Name",
186
+ translation_key="station_name",
187
187
  icon="mdi:broadcast",
188
188
  entity_category=EntityCategory.DIAGNOSTIC,
189
189
  ),
190
190
  MeteocatSensorEntityDescription(
191
191
  key=STATION_ID,
192
- name="Station ID",
192
+ translation_key="station_id",
193
193
  icon="mdi:identifier",
194
194
  entity_category=EntityCategory.DIAGNOSTIC,
195
195
  ),
196
196
  MeteocatSensorEntityDescription(
197
197
  key=STATION_TIMESTAMP,
198
- name="Station Timestamp",
198
+ translation_key="station_timestamp",
199
199
  icon="mdi:calendar-clock",
200
200
  device_class=SensorDeviceClass.TIMESTAMP,
201
201
  )
@@ -321,11 +321,14 @@ class MeteocatSensor(CoordinatorEntity[MeteocatSensorCoordinator], SensorEntity)
321
321
  )
322
322
 
323
323
  # Lógica de selección
324
- if -50 <= temperature <= 10:
324
+ if -50 <= temperature <= 10 and wind_speed > 4.8:
325
+ _LOGGER.debug(f"Sensación térmica por frío, calculada según la fórmula de Wind Chill: {windchill} ºC")
325
326
  return round(windchill, 2)
326
327
  elif temperature > 26 and humidity > 40:
328
+ _LOGGER.debug(f"Sensación térmica por calor, calculada según la fórmula de Heat Index: {heat_index} ºC")
327
329
  return round(heat_index, 2)
328
330
  else:
331
+ _LOGGER.debug(f"Sensación térmica idéntica a la temperatura actual: {temperature} ºC")
329
332
  return round(temperature, 2)
330
333
 
331
334
  sensor_code = self.CODE_MAPPING.get(self.entity_description.key)
@@ -408,7 +411,7 @@ class MeteocatSensor(CoordinatorEntity[MeteocatSensorCoordinator], SensorEntity)
408
411
 
409
412
  directions = [
410
413
  "N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE",
411
- "S", "SSO", "SO", "OSO", "O", "ONO", "NO", "NNO", "N",
414
+ "S", "SSW", "SW", "WSW", "WO", "WNW", "NW", "NNW", "N",
412
415
  ]
413
416
  index = round(degree / 22.5) % 16
414
417
  return directions[index]
@@ -1,26 +1,104 @@
1
1
  {
2
- "config": {
3
- "step": {
4
- "user": {
5
- "description": "Enter your Meteocat API Key to validate it.",
6
- "title": "API Key"
7
- },
8
- "select_municipi": {
9
- "description": "Select a municipality from the list.",
10
- "title": "Municipality Selection"
11
- },
12
- "select_station": {
13
- "description": "Select a station.",
14
- "title": "Station Selection"
2
+ "config": {
3
+ "step": {
4
+ "user": {
5
+ "description": "Enter your Meteocat API Key to validate it.",
6
+ "title": "API Key"
7
+ },
8
+ "select_municipi": {
9
+ "description": "Select a municipality from the list.",
10
+ "title": "Municipality Selection"
11
+ },
12
+ "select_station": {
13
+ "description": "Select a station.",
14
+ "title": "Station Selection"
15
+ }
16
+ },
17
+ "error": {
18
+ "bad_request": "Invalid request. Please check your API Key.",
19
+ "forbidden": "Access denied. Check your API Key permissions.",
20
+ "rate_limit_exceeded": "Rate limit exceeded. Please try again later.",
21
+ "server_error": "Server error. Please try again later.",
22
+ "connection_error": "Connection error. Please check your network.",
23
+ "unknown_error": "An unknown error occurred."
24
+ }
25
+ },
26
+ "entity": {
27
+ "sensor": {
28
+ "wind_speed": {
29
+ "name": "Wind Speed"
30
+ },
31
+ "wind_direction": {
32
+ "name": "Wind Direction",
33
+ "state": {
34
+ "N": "NN",
35
+ "NNE": "NNE",
36
+ "NE": "NE",
37
+ "ENE": "ENE",
38
+ "E": "E",
39
+ "ESE": "ESE",
40
+ "SE": "SE",
41
+ "SSE": "SSE",
42
+ "S": "S",
43
+ "SSW": "SSW",
44
+ "SW": "SW",
45
+ "WSW": "WSW",
46
+ "W": "W",
47
+ "WNW": "WNW",
48
+ "NW": "NW",
49
+ "NNW": "NNW",
50
+ "unknown": "Unknown"
15
51
  }
16
52
  },
17
- "error": {
18
- "bad_request": "Invalid request. Please check your API Key.",
19
- "forbidden": "Access denied. Check your API Key permissions.",
20
- "rate_limit_exceeded": "Rate limit exceeded. Please try again later.",
21
- "server_error": "Server error. Please try again later.",
22
- "connection_error": "Connection error. Please check your network.",
23
- "unknown_error": "An unknown error occurred."
53
+ "temperature": {
54
+ "name": "Temperature"
55
+ },
56
+ "humidity": {
57
+ "name": "Humidity"
58
+ },
59
+ "pressure": {
60
+ "name": "Pressure"
61
+ },
62
+ "precipitation": {
63
+ "name": "Precipitation"
64
+ },
65
+ "precipitation_accumulated": {
66
+ "name": "Precipitation Accumulated"
67
+ },
68
+ "solar_global_irradiance": {
69
+ "name": "Solar Global Irradiance"
70
+ },
71
+ "uv_index": {
72
+ "name": "UV Index"
73
+ },
74
+ "max_temperature": {
75
+ "name": "Max Temperature"
76
+ },
77
+ "min_temperature": {
78
+ "name": "Min Temperature"
79
+ },
80
+ "feels_like": {
81
+ "name": "Feels Like"
82
+ },
83
+ "wind_gust": {
84
+ "name": "Wind Gust"
85
+ },
86
+ "town_name": {
87
+ "name": "Town Name"
88
+ },
89
+ "town_id": {
90
+ "name": "Town ID"
91
+ },
92
+ "station_name": {
93
+ "name": "Station Name"
94
+ },
95
+ "station_id": {
96
+ "name": "Station ID"
97
+ },
98
+ "station_timestamp": {
99
+ "name": "Station Timestamp"
24
100
  }
25
101
  }
26
- }
102
+ }
103
+ }
104
+
@@ -22,5 +22,82 @@
22
22
  "connection_error": "Error de connexió. Reviseu la vostra connexió de xarxa.",
23
23
  "unknown_error": "Error desconegut."
24
24
  }
25
+ },
26
+ "entity": {
27
+ "sensor": {
28
+ "wind_speed": {
29
+ "name": "Vent Velocitat"
30
+ },
31
+ "wind_direction": {
32
+ "name": "Vent Direcció",
33
+ "state": {
34
+ "N": "NN",
35
+ "NNE": "NNE",
36
+ "NE": "NE",
37
+ "ENE": "ENE",
38
+ "E": "E",
39
+ "ESE": "ESE",
40
+ "SE": "SE",
41
+ "SSE": "SSE",
42
+ "S": "S",
43
+ "SSW": "SSO",
44
+ "SW": "SO",
45
+ "WSW": "OSO",
46
+ "W": "O",
47
+ "WNW": "ONO",
48
+ "NW": "NO",
49
+ "NNW": "NNO",
50
+ "unknown": "Desconegut"
51
+ }
52
+ },
53
+ "temperature": {
54
+ "name": "Temperatura"
55
+ },
56
+ "humidity": {
57
+ "name": "Humitat"
58
+ },
59
+ "pressure": {
60
+ "name": "Pressió"
61
+ },
62
+ "precipitation": {
63
+ "name": "Precipitació"
64
+ },
65
+ "precipitation_accumulated": {
66
+ "name": "Precipitació Acumulada"
67
+ },
68
+ "solar_global_irradiance": {
69
+ "name": "Irradiació Solar Global"
70
+ },
71
+ "uv_index": {
72
+ "name": "UV Índex"
73
+ },
74
+ "max_temperature": {
75
+ "name": "Temperatura Max"
76
+ },
77
+ "min_temperature": {
78
+ "name": "Temperatura Min"
79
+ },
80
+ "feels_like": {
81
+ "name": "Sensació Tèrmica"
82
+ },
83
+ "wind_gust": {
84
+ "name": "Vent Ratxa"
85
+ },
86
+ "town_name": {
87
+ "name": "Municipi Nom"
88
+ },
89
+ "town_id": {
90
+ "name": "Municipi ID"
91
+ },
92
+ "station_name": {
93
+ "name": "Estació Nom"
94
+ },
95
+ "station_id": {
96
+ "name": "Estació ID"
97
+ },
98
+ "station_timestamp": {
99
+ "name": "Estació Timestamp"
100
+ }
101
+ }
25
102
  }
26
- }
103
+ }
@@ -22,5 +22,83 @@
22
22
  "connection_error": "Connection error. Please check your network.",
23
23
  "unknown_error": "An unknown error occurred."
24
24
  }
25
+ },
26
+ "entity": {
27
+ "sensor": {
28
+ "wind_speed": {
29
+ "name": "Wind Speed"
30
+ },
31
+ "wind_direction": {
32
+ "name": "Wind Direction",
33
+ "state": {
34
+ "N": "NN",
35
+ "NNE": "NNE",
36
+ "NE": "NE",
37
+ "ENE": "ENE",
38
+ "E": "E",
39
+ "ESE": "ESE",
40
+ "SE": "SE",
41
+ "SSE": "SSE",
42
+ "S": "S",
43
+ "SSW": "SSW",
44
+ "SW": "SW",
45
+ "WSW": "WSW",
46
+ "W": "W",
47
+ "WNW": "WNW",
48
+ "NW": "NW",
49
+ "NNW": "NNW",
50
+ "unknown": "Unknown"
51
+ }
52
+ },
53
+ "temperature": {
54
+ "name": "Temperature"
55
+ },
56
+ "humidity": {
57
+ "name": "Humidity"
58
+ },
59
+ "pressure": {
60
+ "name": "Pressure"
61
+ },
62
+ "precipitation": {
63
+ "name": "Precipitation"
64
+ },
65
+ "precipitation_accumulated": {
66
+ "name": "Precipitation Accumulated"
67
+ },
68
+ "solar_global_irradiance": {
69
+ "name": "Solar Global Irradiance"
70
+ },
71
+ "uv_index": {
72
+ "name": "UV Index"
73
+ },
74
+ "max_temperature": {
75
+ "name": "Max Temperature"
76
+ },
77
+ "min_temperature": {
78
+ "name": "Min Temperature"
79
+ },
80
+ "feels_like": {
81
+ "name": "Feels Like"
82
+ },
83
+ "wind_gust": {
84
+ "name": "Wind Gust"
85
+ },
86
+ "town_name": {
87
+ "name": "Town Name"
88
+ },
89
+ "town_id": {
90
+ "name": "Town ID"
91
+ },
92
+ "station_name": {
93
+ "name": "Station Name"
94
+ },
95
+ "station_id": {
96
+ "name": "Station ID"
97
+ },
98
+ "station_timestamp": {
99
+ "name": "Station Timestamp"
100
+ }
101
+ }
25
102
  }
26
- }
103
+ }
104
+
@@ -22,5 +22,83 @@
22
22
  "connection_error": "Error de conexión. Revise su conexión de red.",
23
23
  "unknown_error": "Error desconocido."
24
24
  }
25
+ },
26
+ "entity": {
27
+ "sensor": {
28
+ "wind_speed": {
29
+ "name": "Viento Velocidad"
30
+ },
31
+ "wind_direction": {
32
+ "name": "Viento Dirección",
33
+ "state": {
34
+ "N": "NN",
35
+ "NNE": "NNE",
36
+ "NE": "NE",
37
+ "ENE": "ENE",
38
+ "E": "E",
39
+ "ESE": "ESE",
40
+ "SE": "SE",
41
+ "SSE": "SSE",
42
+ "S": "S",
43
+ "SSW": "SSO",
44
+ "SW": "SO",
45
+ "WSW": "OSO",
46
+ "W": "O",
47
+ "WNW": "ONO",
48
+ "NW": "NO",
49
+ "NNW": "NNO",
50
+ "unknown": "Desconocido"
51
+ }
52
+ },
53
+ "temperature": {
54
+ "name": "Temperatura"
55
+ },
56
+ "humidity": {
57
+ "name": "Humedad"
58
+ },
59
+ "pressure": {
60
+ "name": "Presión"
61
+ },
62
+ "precipitation": {
63
+ "name": "Precipitación"
64
+ },
65
+ "precipitation_accumulated": {
66
+ "name": "Precipitación Acumulada"
67
+ },
68
+ "solar_global_irradiance": {
69
+ "name": "Irradiación Solar Global"
70
+ },
71
+ "uv_index": {
72
+ "name": "UV Índice"
73
+ },
74
+ "max_temperature": {
75
+ "name": "Temperatura Max"
76
+ },
77
+ "min_temperature": {
78
+ "name": "Temperatura Min"
79
+ },
80
+ "feels_like": {
81
+ "name": "Sensación Térmica"
82
+ },
83
+ "wind_gust": {
84
+ "name": "Viento Racha"
85
+ },
86
+ "town_name": {
87
+ "name": "Municipio Nombre"
88
+ },
89
+ "town_id": {
90
+ "name": "Municipio ID"
91
+ },
92
+ "station_name": {
93
+ "name": "Estación Nombre"
94
+ },
95
+ "station_id": {
96
+ "name": "Estación ID"
97
+ },
98
+ "station_timestamp": {
99
+ "name": "Estación Timestamp"
100
+ }
101
+ }
25
102
  }
26
- }
103
+ }
104
+
@@ -1,2 +1,2 @@
1
1
  # version.py
2
- __version__ = "0.1.31"
2
+ __version__ = "0.1.33"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meteocat",
3
- "version": "0.1.31",
3
+ "version": "0.1.33",
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 = "0.1.31"
3
+ version = "0.1.33"
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"