meteocat 2.2.6 → 2.3.0

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,67 @@
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
+
13
+ steps:
14
+ # Paso 1: Checkout del repositorio completo
15
+ - name: Checkout repository
16
+ uses: actions/checkout@v4
17
+ with:
18
+ token: ${{ secrets.GITHUB_TOKEN }}
19
+ ref: master
20
+ fetch-depth: 0
21
+
22
+ # Paso 2: Obtener la versión del release recién publicado
23
+ - name: Get release version
24
+ id: release-version
25
+ run: |
26
+ version="${GITHUB_REF#refs/tags/v}"
27
+ echo "Release version: $version"
28
+ echo "version=$version" >> $GITHUB_OUTPUT
29
+
30
+ # Paso 3: Actualizar hacs.json con la última versión de Home Assistant
31
+ - name: Get latest Home Assistant version
32
+ id: ha-version
33
+ run: |
34
+ latest=$(curl -s https://api.github.com/repos/home-assistant/core/releases/latest | jq -r .tag_name)
35
+ latest_clean=${latest#v}
36
+ echo "ha_version=$latest_clean" >> $GITHUB_OUTPUT
37
+
38
+ - name: Update hacs.json
39
+ run: |
40
+ ha_version="${{ steps.ha-version.outputs.ha_version }}"
41
+ jq --arg ver "$ha_version" '.homeassistant = $ver' hacs.json > tmp.json && mv tmp.json hacs.json
42
+
43
+ - name: Commit updated hacs.json
44
+ run: |
45
+ git config user.name "github-actions[bot]"
46
+ git config user.email "github-actions[bot]@users.noreply.github.com"
47
+ git add hacs.json
48
+ if git commit -m "chore: update hacs.json with latest Home Assistant version [skip ci]"; then
49
+ git push origin master
50
+ else
51
+ echo "No changes to commit"
52
+ fi
53
+
54
+ # Paso 4: Crear zip de la integración con nombre fijo meteocat.zip
55
+ - name: Zip integration
56
+ run: |
57
+ cd custom_components/meteocat
58
+ zip -r "$GITHUB_WORKSPACE/meteocat.zip" ./
59
+ echo "Zip created at $GITHUB_WORKSPACE/meteocat.zip"
60
+
61
+ # Paso 5: Subir meteocat.zip al release de GitHub
62
+ - name: Upload meteocat.zip to release
63
+ uses: softprops/action-gh-release@v2.2.1
64
+ with:
65
+ files: meteocat.zip
66
+ env:
67
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -11,27 +11,59 @@ jobs:
11
11
  runs-on: ubuntu-latest
12
12
 
13
13
  steps:
14
- # Paso 1: Configurar el repositorio
14
+ # Paso 1: Checkout completo (necesario para semantic-release y tags)
15
15
  - name: Checkout repository
16
16
  uses: actions/checkout@v3
17
+ with:
18
+ fetch-depth: 0
17
19
 
18
- # Paso 2: Configurar Node.js (requerido para semantic-release)
20
+ # Paso 2: Configurar Node.js
19
21
  - name: Set up Node.js
20
22
  uses: actions/setup-node@v3
21
23
  with:
22
- node-version: 20.8.1 # Versión compatible con semantic-release
24
+ node-version: 20.8.1
23
25
 
24
- # Paso 3: Instalar dependencias necesarias
26
+ # Paso 3: Instalar dependencias
25
27
  - name: Install dependencies
26
28
  run: npm ci
27
-
29
+
28
30
  # Paso 4: Configurar el autor de Git
29
31
  - name: Configure Git author
30
32
  run: |
31
33
  git config user.name "semantic-release-bot"
32
34
  git config user.email "jdcuartero@yahoo.es"
33
35
 
34
- # Paso 5: Ejecutar semantic-release
36
+ # Paso 5: Obtener próxima versión (dry-run)
37
+ - name: Get next version
38
+ id: nextver
39
+ run: |
40
+ version=$(npx semantic-release --dry-run | grep "The next release version is" | awk '{print $NF}')
41
+ echo "next_version=$version" >> $GITHUB_OUTPUT
42
+ echo "Next version: $version"
43
+
44
+ # Paso 6: Actualizar archivos de versión antes del release
45
+ - name: Update version in files
46
+ run: |
47
+ version=${{ steps.nextver.outputs.next_version }}
48
+
49
+ # pyproject.toml
50
+ sed -i "s/^version = \".*\"/version = \"$version\"/" pyproject.toml
51
+
52
+ # manifest.json
53
+ jq --arg ver "$version" '.version = $ver' custom_components/meteocat/manifest.json > tmp.json && mv tmp.json custom_components/meteocat/manifest.json
54
+
55
+ # version.py
56
+ echo "__version__ = \"$version\"" > custom_components/meteocat/version.py
57
+
58
+ # __init__.py
59
+ sed -i "s/^__version__ = \".*\"/__version__ = \"$version\"/" custom_components/meteocat/__init__.py
60
+
61
+ # Commit con [skip ci] para no reiniciar workflow
62
+ git add pyproject.toml custom_components/meteocat/manifest.json custom_components/meteocat/version.py custom_components/meteocat/__init__.py
63
+ git commit -m "chore: bump version to $version [skip ci]" || echo "No changes to commit"
64
+ git push origin master
65
+
66
+ # Paso 7: Ejecutar semantic-release (generación de release, changelog, assets)
35
67
  - name: Run semantic-release
36
68
  env:
37
69
  GITHUB_TOKEN: ${{ secrets.WORKFLOW_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: 1
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 in 1 day.
63
+ stale-issue-label: "stale"
@@ -0,0 +1,94 @@
1
+ name: Sync to GitLab
2
+
3
+ on:
4
+ release:
5
+ types: [published] # Se dispara al publicarse un release en GitHub
6
+
7
+ jobs:
8
+ sync:
9
+ runs-on: ubuntu-latest
10
+
11
+ steps:
12
+ # Paso 1: Checkout completo
13
+ - name: Checkout repository
14
+ uses: actions/checkout@v3
15
+ with:
16
+ fetch-depth: 0
17
+
18
+ # Paso 2: Configurar Git
19
+ - name: Configure Git
20
+ run: |
21
+ git config user.name "github-bot"
22
+ git config user.email "bot@github.com"
23
+
24
+ # Paso 3: Añadir remoto de GitLab
25
+ - name: Add GitLab remote
26
+ env:
27
+ GL_REMOTE_URL: ${{ secrets.GL_REMOTE_URL }}
28
+ GL_TOKEN: ${{ secrets.GL_TOKEN }}
29
+ run: |
30
+ git remote add gitlab "https://oauth2:${GL_TOKEN}@${GL_REMOTE_URL#https://}"
31
+
32
+ # Paso 4: Comprobar divergencias en master
33
+ - name: Check for diverging commits
34
+ run: |
35
+ git fetch gitlab master
36
+ if ! git merge-base --is-ancestor gitlab/master master; then
37
+ echo "❌ GitLab master tiene commits que GitHub no tiene. Revisar antes de sincronizar."
38
+ exit 1
39
+
40
+ # Paso 5: Push de commits y tags a GitLab
41
+ - name: Push commits and tags to GitLab
42
+ run: |
43
+ git push gitlab master
44
+ git push gitlab --tags
45
+
46
+ # Paso 6: Crear release en GitLab si no existe
47
+ - name: Create GitLab release
48
+ env:
49
+ GL_REMOTE_URL: ${{ secrets.GL_REMOTE_URL }}
50
+ GL_TOKEN: ${{ secrets.GL_TOKEN }}
51
+ RELEASE_TAG: ${{ github.ref_name }}
52
+ run: |
53
+ PROJECT_PATH=$(echo $GL_REMOTE_URL | sed -E 's#https://[^/]+/(.*)\.git#\1#')
54
+ PROJECT_PATH_ENCODED=$(python3 -c "import urllib.parse; print(urllib.parse.quote('''$PROJECT_PATH''', safe=''))")
55
+
56
+ EXISTING=$(curl -s --header "PRIVATE-TOKEN: $GL_TOKEN" "https://gitlab.com/api/v4/projects/$PROJECT_PATH_ENCODED/releases/$RELEASE_TAG")
57
+
58
+ if echo "$EXISTING" | grep -q 'tag_name'; then
59
+ echo "Release ya existe en GitLab: $RELEASE_TAG"
60
+ else
61
+ echo "Creando release en GitLab: $RELEASE_TAG"
62
+ curl -s --request POST "https://gitlab.com/api/v4/projects/$PROJECT_PATH_ENCODED/releases" \
63
+ --header "PRIVATE-TOKEN: $GL_TOKEN" \
64
+ --header "Content-Type: application/json" \
65
+ --data "{
66
+ \"name\": \"Release $RELEASE_TAG\",
67
+ \"tag_name\": \"$RELEASE_TAG\",
68
+ \"description\": \"Release sincronizado desde GitHub\"
69
+ }"
70
+ fi
71
+
72
+ # Paso 7: Subir meteocat.zip como asset al release de GitLab
73
+ - name: Upload meteocat.zip to GitLab release
74
+ env:
75
+ GL_REMOTE_URL: ${{ secrets.GL_REMOTE_URL }}
76
+ GL_TOKEN: ${{ secrets.GL_TOKEN }}
77
+ RELEASE_TAG: ${{ github.ref_name }}
78
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79
+ run: |
80
+ PROJECT_PATH=$(echo $GL_REMOTE_URL | sed -E 's#https://[^/]+/(.*)\.git#\1#')
81
+ PROJECT_PATH_ENCODED=$(python3 -c "import urllib.parse; print(urllib.parse.quote('''$PROJECT_PATH''', safe=''))")
82
+
83
+ ASSET_NAME="meteocat.zip"
84
+ ZIP_URL="https://github.com/${GITHUB_REPOSITORY}/releases/download/$RELEASE_TAG/meteocat.zip"
85
+
86
+ echo "Subiendo $ASSET_NAME al release de GitLab desde $ZIP_URL"
87
+ curl --request POST "https://gitlab.com/api/v4/projects/$PROJECT_PATH_ENCODED/releases/$RELEASE_TAG/assets/links" \
88
+ --header "PRIVATE-TOKEN: $GL_TOKEN" \
89
+ --header "Content-Type: application/json" \
90
+ --data "{
91
+ \"name\": \"$ASSET_NAME\",
92
+ \"url\": \"$ZIP_URL\"
93
+ }"
94
+
package/.releaserc CHANGED
@@ -10,14 +10,7 @@
10
10
  }
11
11
  ],
12
12
  "@semantic-release/npm",
13
- "@semantic-release/github",
14
- [
15
- "@semantic-release/git",
16
- {
17
- "assets": ["CHANGELOG.md", "package.json", "pyproject.toml"],
18
- "message": "v${nextRelease.version}\n\n${nextRelease.notes}"
19
- }
20
- ]
13
+ "@semantic-release/github"
21
14
  ],
22
15
  "repositoryUrl": "https://github.com/figorr/meteocat"
23
16
  }
package/CHANGELOG.md CHANGED
@@ -1,3 +1,32 @@
1
+ # [2.3.0](https://github.com/figorr/meteocat/compare/v2.2.7...v2.3.0) (2025-09-10)
2
+
3
+
4
+ ### Features
5
+
6
+ * download and save town and station json files during setup ([7b98c22](https://github.com/figorr/meteocat/commit/7b98c22d5ca43d4cbf80895e11c02594208f7470))
7
+ * include options documentation ([a85ef74](https://github.com/figorr/meteocat/commit/a85ef7492eb8ed4af99b8d0f50b8e77ff7f7976a))
8
+ * include options image ([dbb047a](https://github.com/figorr/meteocat/commit/dbb047a6bdf32af03fec8351c9a608593b369e3b))
9
+ * include regenerate assets files option ([f2ce357](https://github.com/figorr/meteocat/commit/f2ce357c8ce6371d97523870f4bf6a9cba6a151c))
10
+ * recover assets files ([f493b33](https://github.com/figorr/meteocat/commit/f493b33e54e10994b6b08232f37dd5bb35f4a9b7))
11
+ * regenerate assets option translation ([317ce9f](https://github.com/figorr/meteocat/commit/317ce9fecc03f88b8b8072b41b357846fb075dcc))
12
+ * safe remove keeping common entry files ([6cefe04](https://github.com/figorr/meteocat/commit/6cefe04289b1b74fe30d615e7056bd643d845b89))
13
+ * **storage:** moving the API downloaded files to the new folder meteocat_files ([06c68e3](https://github.com/figorr/meteocat/commit/06c68e36b5669efc8fe3174a71e41624e9728b07))
14
+ * update .gitignore ([fac7772](https://github.com/figorr/meteocat/commit/fac7772a1093f2165e1b33098631096138617a6d))
15
+ * update README ([9855939](https://github.com/figorr/meteocat/commit/98559398e6bae30e8e9c9ff2b2fe27409a3930bd))
16
+ * update repo files structure ([0778679](https://github.com/figorr/meteocat/commit/0778679d218a89e89bb18791f1245c5c9f7b188f))
17
+
18
+ ## [2.2.7](https://github.com/figorr/meteocat/compare/v2.2.6...v2.2.7) (2025-08-29)
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * 2.2.7 ([ece96b9](https://github.com/figorr/meteocat/commit/ece96b983e6ba5df8a2811fdb86452857cadbb18))
24
+ * fix HACS info ([ae829fa](https://github.com/figorr/meteocat/commit/ae829fa09047bd57d8f5aa8eae746bf31f3a30db))
25
+ * Fix meteor case sensitive for alerts sensors ([d247476](https://github.com/figorr/meteocat/commit/d24747660175d2c305fcffbbae6472ccd490cfb1))
26
+ * Fix umbral case insensitive ([73d6b58](https://github.com/figorr/meteocat/commit/73d6b5808acf8c896a7d822cab7640607f430b37))
27
+ * Fix warning log when an umbral is not in UMBRAL_MAPPING ([adf3511](https://github.com/figorr/meteocat/commit/adf351111e8cb14cba3fd2f2868496701b445b97))
28
+ * Include warning when umbral is not at UMBRAL_MAPPING ([c1b1f75](https://github.com/figorr/meteocat/commit/c1b1f75d7b6a219fbce4580a29e85e168127998e))
29
+
1
30
  ## [2.2.6](https://github.com/figorr/meteocat/compare/v2.2.5...v2.2.6) (2025-08-27)
2
31
 
3
32
 
package/README.md CHANGED
@@ -2,7 +2,11 @@
2
2
  ![Meteocat Banner](images/banner.png)
3
3
  [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
4
4
  [![Python version compatibility](https://img.shields.io/pypi/pyversions/meteocat)](https://pypi.org/project/meteocat)
5
- [![pipeline status](https://gitlab.com/figorr/meteocat/badges/master/pipeline.svg)](https://gitlab.com/figorr/meteocat/commits/master)
5
+ [![hacs_badge](https://img.shields.io/badge/HACS-Default-orange.svg)](https://github.com/hacs/integration)
6
+ [![Validate](https://github.com/figorr/meteocat/actions/workflows/validate.yaml/badge.svg)](https://github.com/figorr/meteocat/actions/workflows/validate.yaml)
7
+ [![Release](https://github.com/figorr/meteocat/actions/workflows/release.yml/badge.svg)](https://github.com/figorr/meteocat/actions/workflows/release.yml)
8
+ ![GitHub all releases](https://img.shields.io/github/downloads/figorr/meteocat/total)
9
+ ![GitHub release (latest by SemVer)](https://img.shields.io/github/downloads/figorr/meteocat/latest/total)
6
10
 
7
11
 
8
12
  This is a project to obtain meteorological data from the Meteocat API inside the Home Assistant environment.
@@ -80,11 +84,32 @@ To change units select one of the entities and open the more info dialog and cli
80
84
 
81
85
  ![Entity more info settings dialog](images/change_units.png)
82
86
 
87
+ ## Options
88
+
89
+ Once the integration is installed, you can reconfigure some parameters without having to remove and reinstall Meteocat.
90
+
91
+ Go to:
92
+ `Settings > Devices & Services > Meteocat > Configure`
93
+
94
+ You will see three available options:
95
+
96
+ - **Update API Key and limits**
97
+ Allows you to change the API Key and update all API plan limits at the same time.
98
+
99
+ - **Update limits only**
100
+ Allows you to adjust only the API plan limits, keeping the same API Key.
101
+
102
+ - **Regenerate assets**
103
+ If for any reason some files in the `assets` folder (`towns.json`, `stations.json`, `variables.json`, `symbols.json`, or `stations_<town_id>.json`) are missing or outdated, you can regenerate them directly from the options menu.
104
+ > ℹ️ If the Meteocat API is not available at that moment, the integration will still start, and you can retry regeneration later.
105
+
106
+ ![Options](images/options.png)
107
+
83
108
  # Contributing
84
109
 
85
- 1. [Check for open features/bugs](https://gitlab.com/figorr/meteocat/issues)
86
- or [initiate a discussion on one](https://gitlab.com/figorr/meteocat/issues/new).
87
- 2. [Fork the repository](https://gitlab.com/figorr/meteocat/forks/new).
110
+ 1. [Check for open features/bugs](https://github.com/figorr/meteocat/issues)
111
+ or [initiate a discussion on one](https://github.com/figorr/meteocat/issues/new/choose).
112
+ 2. [Fork the repository](https://github.com/figorr/meteocat/fork).
88
113
  3. Install the dev environment: `make init`.
89
114
  4. Enter the virtual environment: `pipenv shell`
90
115
  5. Code your new feature or bug fix.