meteocat 2.2.6 → 2.2.7

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.
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: "🐞 Bug report"
3
+ about: Report a problem with the integration
4
+ title: "[Bug] "
5
+ labels: bug
6
+ assignees: ""
7
+ ---
8
+
9
+ **IMPORTANT: Please search the issues, including closed issues before opening a new issue.
10
+ The template is mandatory; failure to use it will result in issue closure.**
11
+
12
+ ---
13
+
14
+ ### Describe the bug
15
+ <!-- A clear and concise description of what the bug is. -->
16
+
17
+ ### To Reproduce
18
+ <!-- Steps to reproduce the behavior. -->
19
+ 1. Go to '...'
20
+ 2. Click on '....'
21
+ 3. Scroll down to '....'
22
+ 4. See error
23
+
24
+ ### Expected behavior
25
+ <!-- A clear and concise description of what you expected to happen. -->
26
+
27
+ ### Screenshots
28
+ <!-- If applicable, add screenshots to help explain your problem. -->
29
+
30
+ ### System details
31
+ - Home Assistant version:
32
+ - meteocat version (from `const.py` or HA startup log):
33
+ - meteocatpy version (from `pip show meteocatpy` in the HA container or HA startup log):
34
+
35
+ ### Debug Logs (meteocat & meteocatpy)
36
+ <!-- Please provide [logs] - Enable debug logging for the component. -->
37
+
38
+ ### Additional context
39
+ <!-- Add any other context about the problem here. -->
@@ -0,0 +1 @@
1
+ blank_issues_enabled: false
@@ -0,0 +1,25 @@
1
+ name: Autocloser
2
+
3
+ on:
4
+ issues:
5
+ types: [opened, edited, reopened]
6
+ issue_comment:
7
+ types: [created]
8
+
9
+ jobs:
10
+ autoclose:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - name: Autoclose issues that did not follow issue template
14
+ uses: roots/issue-closer@v1.1
15
+ with:
16
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
17
+ issue-close-message: >
18
+ 👋 @${{ github.event.issue.user.login }} this issue was automatically closed because it did not follow the
19
+ [issue template](https://github.com/figorr/meteocat/issues/new/choose).
20
+
21
+ ⚠️ Reminder:
22
+ **IMPORTANT: Please search the issues, including closed issues before opening a new issue.
23
+ The template is mandatory; failure to use it will result in issue closure.**
24
+ issue-pattern: >
25
+ (Describe the bug|To Reproduce|Expected behavior|System details|Debug Logs)
@@ -0,0 +1,57 @@
1
+ name: Close duplicate issues
2
+
3
+ on:
4
+ issues:
5
+ types:
6
+ - labeled
7
+
8
+ jobs:
9
+ close-duplicate:
10
+ runs-on: ubuntu-latest
11
+ if: github.event.label.name == 'duplicate'
12
+ steps:
13
+ - name: Extract linked issue number
14
+ id: extract
15
+ run: |
16
+ body="${{ github.event.issue.body }}"
17
+ # Convertimos a minúsculas para que el match sea insensible a mayúsculas
18
+ lower=$(echo "$body" | tr '[:upper:]' '[:lower:]')
19
+
20
+ # Buscamos "closed as duplicate of #123" o "duplicate of #123"
21
+ if [[ "$lower" =~ closed[[:space:]]+as[[:space:]]+duplicate[[:space:]]+of[[:space:]]+#([0-9]+) ]]; then
22
+ echo "number=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT
23
+ elif [[ "$lower" =~ duplicate[[:space:]]+of[[:space:]]+#([0-9]+) ]]; then
24
+ echo "number=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT
25
+ fi
26
+
27
+ - name: Close issue
28
+ if: steps.extract.outputs.number != ''
29
+ uses: peter-evans/close-issue@v2
30
+ with:
31
+ issue-number: ${{ github.event.issue.number }}
32
+ comment: |
33
+ Closed as duplicate of #${{ steps.extract.outputs.number }}.
34
+ Please follow the discussion there.
35
+
36
+ - name: Update title
37
+ if: steps.extract.outputs.number != ''
38
+ uses: actions-ecosystem/action-edit-issue@v1
39
+ with:
40
+ github_token: ${{ secrets.GITHUB_TOKEN }}
41
+ issue_number: ${{ github.event.issue.number }}
42
+ title: "[Duplicate] ${{ github.event.issue.title }}"
43
+
44
+ - name: Remove duplicate label
45
+ if: steps.extract.outputs.number != ''
46
+ uses: actions-ecosystem/action-remove-labels@v1
47
+ with:
48
+ github_token: ${{ secrets.GITHUB_TOKEN }}
49
+ issue_number: ${{ github.event.issue.number }}
50
+ labels: duplicate
51
+
52
+ - name: Lock conversation
53
+ if: steps.extract.outputs.number != ''
54
+ uses: dessant/lock-threads@v4
55
+ with:
56
+ github-token: ${{ secrets.GITHUB_TOKEN }}
57
+ issue-lock-reason: "resolved"
@@ -0,0 +1,57 @@
1
+ name: Publish zip
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ publish-zip:
9
+ runs-on: ubuntu-latest
10
+ permissions:
11
+ contents: write
12
+ steps:
13
+ - name: Checkout repository
14
+ uses: actions/checkout@v4
15
+ with:
16
+ token: ${{ secrets.GITHUB_TOKEN }}
17
+ ref: master
18
+
19
+ - name: Get latest Home Assistant version
20
+ id: ha-version
21
+ run: |
22
+ latest=$(curl -s https://api.github.com/repos/home-assistant/core/releases/latest | jq -r .tag_name)
23
+ # quitamos prefijo "v" si existe
24
+ latest_clean=${latest#v}
25
+ echo "Latest HA version: $latest_clean"
26
+ echo "version=$latest_clean" >> $GITHUB_OUTPUT
27
+
28
+ - name: Update hacs.json
29
+ run: |
30
+ ha_version="${{ steps.ha-version.outputs.version }}"
31
+ echo "Updating hacs.json with HA version: $ha_version"
32
+ jq --arg ver "$ha_version" '.homeassistant = $ver' hacs.json > tmp.json && mv tmp.json hacs.json
33
+ cat hacs.json
34
+
35
+ - name: Commit updated hacs.json
36
+ run: |
37
+ git config user.name "github-actions[bot]"
38
+ git config user.email "github-actions[bot]@users.noreply.github.com"
39
+ git add hacs.json
40
+ if git commit -m "chore: update hacs.json with latest Home Assistant version"; then
41
+ git push origin master
42
+ else
43
+ echo "No changes to commit"
44
+ fi
45
+
46
+ - name: Zip integration
47
+ run: |
48
+ cd custom_components/meteocat
49
+ zip -r meteocat.zip ./
50
+ mv meteocat.zip $GITHUB_WORKSPACE/
51
+
52
+ - name: Upload meteocat.zip to release
53
+ uses: softprops/action-gh-release@v2.2.1
54
+ with:
55
+ files: meteocat.zip
56
+ env:
57
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -49,3 +49,15 @@ jobs:
49
49
  This bug report has had no activity for 3 weeks.
50
50
  It has been marked as *help wanted* and will remain open.
51
51
  stale-issue-label: "help wanted"
52
+
53
+ # 4. Issues con "logs required" sin actividad (cerrar en 14 días)
54
+ - uses: actions/stale@v8
55
+ with:
56
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
57
+ only-labels: "logs required"
58
+ days-before-stale: 7
59
+ days-before-close: 7
60
+ stale-issue-message: >-
61
+ This issue has been marked as *requiring logs*, but no activity has been detected for 7 days.
62
+ Since logs were not provided, this issue will now be closed.
63
+ stale-issue-label: "stale"
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## [2.2.7](https://github.com/figorr/meteocat/compare/v2.2.6...v2.2.7) (2025-08-29)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * 2.2.7 ([ece96b9](https://github.com/figorr/meteocat/commit/ece96b983e6ba5df8a2811fdb86452857cadbb18))
7
+ * fix HACS info ([ae829fa](https://github.com/figorr/meteocat/commit/ae829fa09047bd57d8f5aa8eae746bf31f3a30db))
8
+ * Fix meteor case sensitive for alerts sensors ([d247476](https://github.com/figorr/meteocat/commit/d24747660175d2c305fcffbbae6472ccd490cfb1))
9
+ * Fix umbral case insensitive ([73d6b58](https://github.com/figorr/meteocat/commit/73d6b5808acf8c896a7d822cab7640607f430b37))
10
+ * Fix warning log when an umbral is not in UMBRAL_MAPPING ([adf3511](https://github.com/figorr/meteocat/commit/adf351111e8cb14cba3fd2f2868496701b445b97))
11
+ * Include warning when umbral is not at UMBRAL_MAPPING ([c1b1f75](https://github.com/figorr/meteocat/commit/c1b1f75d7b6a219fbce4580a29e85e168127998e))
12
+
1
13
  ## [2.2.6](https://github.com/figorr/meteocat/compare/v2.2.5...v2.2.6) (2025-08-27)
2
14
 
3
15
 
@@ -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.6"
36
+ __version__ = "2.2.7"
37
37
 
38
38
  # Definir el esquema de configuración CONFIG_SCHEMA
39
39
  CONFIG_SCHEMA = vol.Schema(
@@ -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.6"
12
+ "version": "2.2.7"
13
13
  }
@@ -1357,6 +1357,13 @@ class MeteocatAlertRegionSensor(CoordinatorEntity[MeteocatAlertsRegionCoordinato
1357
1357
  # Assign entity_category if defined in the description
1358
1358
  self._attr_entity_category = getattr(description, "entity_category", None)
1359
1359
 
1360
+ def _map_meteor_case_insensitive(self, meteor: str) -> str:
1361
+ """Busca el meteor en el mapping sin importar mayúsculas/minúsculas."""
1362
+ for key, value in self.METEOR_MAPPING.items():
1363
+ if key.lower() == meteor.lower():
1364
+ return value
1365
+ return "unknown"
1366
+
1360
1367
  @property
1361
1368
  def native_value(self):
1362
1369
  """Devuelve el número de alertas activas."""
@@ -1368,10 +1375,13 @@ class MeteocatAlertRegionSensor(CoordinatorEntity[MeteocatAlertsRegionCoordinato
1368
1375
  meteor_details = self.coordinator.data.get("detalles", {}).get("meteor", {})
1369
1376
 
1370
1377
  # Convertimos las claves al formato deseado usando el mapping
1371
- attributes = {
1372
- f"alert_{i+1}": self.METEOR_MAPPING.get(meteor, "unknown")
1373
- for i, meteor in enumerate(meteor_details.keys())
1374
- }
1378
+ attributes = {}
1379
+ for i, meteor in enumerate(meteor_details.keys()):
1380
+ mapped_name = self._map_meteor_case_insensitive(meteor)
1381
+ if not mapped_name:
1382
+ _LOGGER.warning("Meteor desconocido sin mapeo: '%s'. Añadirlo a 'METEOR_MAPPING' del coordinador 'MeteocatAlertRegionSensor' si es necesario.", meteor)
1383
+ mapped_name = "unknown"
1384
+ attributes[f"alert_{i+1}"] = mapped_name
1375
1385
 
1376
1386
  _LOGGER.info("Atributos traducidos del sensor: %s", attributes)
1377
1387
  return attributes
@@ -1461,6 +1471,23 @@ class MeteocatAlertMeteorSensor(CoordinatorEntity[MeteocatAlertsRegionCoordinato
1461
1471
  self._attr_unique_id,
1462
1472
  )
1463
1473
 
1474
+ def _get_meteor_data_case_insensitive(self, meteor_type: str) -> dict:
1475
+ """Busca en los datos de meteor de forma case-insensitive."""
1476
+ meteor_data_dict = self.coordinator.data.get("detalles", {}).get("meteor", {})
1477
+ for key, value in meteor_data_dict.items():
1478
+ if key.lower() == meteor_type.lower():
1479
+ return value
1480
+ return {}
1481
+
1482
+ def _get_umbral_case_insensitive(self, umbral: str) -> str:
1483
+ """Convierte un umbral a su clave interna usando case-insensitive."""
1484
+ if umbral is None:
1485
+ return "unknown"
1486
+ for key, value in self.UMBRAL_MAPPING.items():
1487
+ if key.lower() == umbral.lower():
1488
+ return value
1489
+ return "unknown"
1490
+
1464
1491
  @property
1465
1492
  def native_value(self):
1466
1493
  """Devuelve el estado de la alerta específica."""
@@ -1468,7 +1495,7 @@ class MeteocatAlertMeteorSensor(CoordinatorEntity[MeteocatAlertsRegionCoordinato
1468
1495
  if not meteor_type:
1469
1496
  return "Desconocido"
1470
1497
 
1471
- meteor_data = self.coordinator.data.get("detalles", {}).get("meteor", {}).get(meteor_type, {})
1498
+ meteor_data = self._get_meteor_data_case_insensitive(meteor_type)
1472
1499
 
1473
1500
  # Convertir estado para translation_key
1474
1501
  estado_original = meteor_data.get("estado", "Tancat")
@@ -1479,15 +1506,27 @@ class MeteocatAlertMeteorSensor(CoordinatorEntity[MeteocatAlertsRegionCoordinato
1479
1506
  """Devuelve los atributos específicos de la alerta."""
1480
1507
  meteor_type = self.METEOR_MAPPING.get(self.entity_description.key)
1481
1508
  if not meteor_type:
1482
- return {}
1509
+ _LOGGER.warning(
1510
+ "Tipo de meteor desconocido para sensor %s: '%s'. Añadirlo a 'METEOR_MAPPING' del coordinador 'MeteocatAlertMeteorSensor' si es necesario.",
1511
+ self.entity_description.key,
1512
+ self.coordinator.data.get("detalles", {}).get("meteor", {}).keys(),
1513
+ )
1514
+ return "unknown"
1483
1515
 
1484
- meteor_data = self.coordinator.data.get("detalles", {}).get("meteor", {}).get(meteor_type, {})
1516
+ meteor_data = self._get_meteor_data_case_insensitive(meteor_type)
1485
1517
  if not meteor_data:
1486
1518
  return {}
1487
1519
 
1488
1520
  # Convertir umbral para translation_key
1489
1521
  umbral_original = meteor_data.get("umbral")
1490
- umbral_convertido = self.UMBRAL_MAPPING.get(umbral_original, "unknown")
1522
+ umbral_convertido = self._get_umbral_case_insensitive(umbral_original)
1523
+
1524
+ if umbral_convertido == "unknown" and umbral_original is not None:
1525
+ _LOGGER.warning(
1526
+ "Umbral desconocido para sensor %s: '%s'. Añadirlo a 'UMBRAL_MAPPING' del coordinador 'MeteocatAlertMeteorSensor' si es necesario.",
1527
+ self.entity_description.key,
1528
+ umbral_original
1529
+ )
1491
1530
 
1492
1531
  return {
1493
1532
  "inicio": meteor_data.get("inicio"),
@@ -1,2 +1,2 @@
1
1
  # version.py
2
- __version__ = "2.2.6"
2
+ __version__ = "2.2.7"
package/hacs.json CHANGED
@@ -1,5 +1,8 @@
1
1
  {
2
2
  "name": "Meteocat",
3
- "render_readme": true
4
- }
5
-
3
+ "homeassistant": "2025.3.0",
4
+ "hide_default_branch": true,
5
+ "render_readme": true,
6
+ "zip_release": true,
7
+ "filename": "meteocat.zip"
8
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meteocat",
3
- "version": "2.2.6",
3
+ "version": "2.2.7",
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.6"
3
+ version = "2.2.7"
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"