meteocat 2.2.7 → 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.
- package/.github/workflows/publish-zip.yml +19 -9
- package/.github/workflows/release.yml +38 -6
- package/.github/workflows/stale.yml +2 -2
- package/.github/workflows/sync-gitlab.yml +94 -0
- package/.releaserc +1 -8
- package/CHANGELOG.md +17 -0
- package/README.md +29 -4
- package/custom_components/meteocat/__init__.py +154 -110
- package/custom_components/meteocat/config_flow.py +125 -55
- package/custom_components/meteocat/coordinator.py +200 -368
- package/custom_components/meteocat/helpers.py +12 -0
- package/custom_components/meteocat/manifest.json +22 -11
- package/custom_components/meteocat/options_flow.py +46 -2
- package/custom_components/meteocat/strings.json +10 -2
- package/custom_components/meteocat/translations/ca.json +10 -2
- package/custom_components/meteocat/translations/en.json +10 -2
- package/custom_components/meteocat/translations/es.json +10 -2
- package/custom_components/meteocat/version.py +1 -2
- package/filetree.txt +9 -0
- package/hacs.json +2 -2
- package/images/options.png +0 -0
- package/package.json +1 -1
- package/pyproject.toml +1 -1
- package/.releaserc.toml +0 -14
- package/releaserc.json +0 -18
|
@@ -9,46 +9,56 @@ jobs:
|
|
|
9
9
|
runs-on: ubuntu-latest
|
|
10
10
|
permissions:
|
|
11
11
|
contents: write
|
|
12
|
+
|
|
12
13
|
steps:
|
|
14
|
+
# Paso 1: Checkout del repositorio completo
|
|
13
15
|
- name: Checkout repository
|
|
14
16
|
uses: actions/checkout@v4
|
|
15
17
|
with:
|
|
16
18
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
17
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
|
|
18
29
|
|
|
30
|
+
# Paso 3: Actualizar hacs.json con la última versión de Home Assistant
|
|
19
31
|
- name: Get latest Home Assistant version
|
|
20
32
|
id: ha-version
|
|
21
33
|
run: |
|
|
22
34
|
latest=$(curl -s https://api.github.com/repos/home-assistant/core/releases/latest | jq -r .tag_name)
|
|
23
|
-
# quitamos prefijo "v" si existe
|
|
24
35
|
latest_clean=${latest#v}
|
|
25
|
-
echo "
|
|
26
|
-
echo "version=$latest_clean" >> $GITHUB_OUTPUT
|
|
36
|
+
echo "ha_version=$latest_clean" >> $GITHUB_OUTPUT
|
|
27
37
|
|
|
28
38
|
- name: Update hacs.json
|
|
29
39
|
run: |
|
|
30
|
-
ha_version="${{ steps.ha-version.outputs.
|
|
31
|
-
echo "Updating hacs.json with HA version: $ha_version"
|
|
40
|
+
ha_version="${{ steps.ha-version.outputs.ha_version }}"
|
|
32
41
|
jq --arg ver "$ha_version" '.homeassistant = $ver' hacs.json > tmp.json && mv tmp.json hacs.json
|
|
33
|
-
cat hacs.json
|
|
34
42
|
|
|
35
43
|
- name: Commit updated hacs.json
|
|
36
44
|
run: |
|
|
37
45
|
git config user.name "github-actions[bot]"
|
|
38
46
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
39
47
|
git add hacs.json
|
|
40
|
-
if git commit -m "chore: update hacs.json with latest Home Assistant version"; then
|
|
48
|
+
if git commit -m "chore: update hacs.json with latest Home Assistant version [skip ci]"; then
|
|
41
49
|
git push origin master
|
|
42
50
|
else
|
|
43
51
|
echo "No changes to commit"
|
|
44
52
|
fi
|
|
45
53
|
|
|
54
|
+
# Paso 4: Crear zip de la integración con nombre fijo meteocat.zip
|
|
46
55
|
- name: Zip integration
|
|
47
56
|
run: |
|
|
48
57
|
cd custom_components/meteocat
|
|
49
|
-
zip -r meteocat.zip ./
|
|
50
|
-
|
|
58
|
+
zip -r "$GITHUB_WORKSPACE/meteocat.zip" ./
|
|
59
|
+
echo "Zip created at $GITHUB_WORKSPACE/meteocat.zip"
|
|
51
60
|
|
|
61
|
+
# Paso 5: Subir meteocat.zip al release de GitHub
|
|
52
62
|
- name: Upload meteocat.zip to release
|
|
53
63
|
uses: softprops/action-gh-release@v2.2.1
|
|
54
64
|
with:
|
|
@@ -11,27 +11,59 @@ jobs:
|
|
|
11
11
|
runs-on: ubuntu-latest
|
|
12
12
|
|
|
13
13
|
steps:
|
|
14
|
-
# Paso 1:
|
|
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
|
|
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
|
|
24
|
+
node-version: 20.8.1
|
|
23
25
|
|
|
24
|
-
# Paso 3: Instalar dependencias
|
|
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:
|
|
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 }}
|
|
@@ -56,8 +56,8 @@ jobs:
|
|
|
56
56
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
57
57
|
only-labels: "logs required"
|
|
58
58
|
days-before-stale: 7
|
|
59
|
-
days-before-close:
|
|
59
|
+
days-before-close: 1
|
|
60
60
|
stale-issue-message: >-
|
|
61
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.
|
|
62
|
+
Since logs were not provided, this issue will now be closed in 1 day.
|
|
63
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,20 @@
|
|
|
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
|
+
|
|
1
18
|
## [2.2.7](https://github.com/figorr/meteocat/compare/v2.2.6...v2.2.7) (2025-08-29)
|
|
2
19
|
|
|
3
20
|
|
package/README.md
CHANGED
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|

|
|
3
3
|
[](https://opensource.org/licenses/Apache-2.0)
|
|
4
4
|
[](https://pypi.org/project/meteocat)
|
|
5
|
-
[](https://github.com/hacs/integration)
|
|
6
|
+
[](https://github.com/figorr/meteocat/actions/workflows/validate.yaml)
|
|
7
|
+
[](https://github.com/figorr/meteocat/actions/workflows/release.yml)
|
|
8
|
+

|
|
9
|
+

|
|
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
|

|
|
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
|
+

|
|
107
|
+
|
|
83
108
|
# Contributing
|
|
84
109
|
|
|
85
|
-
1. [Check for open features/bugs](https://
|
|
86
|
-
or [initiate a discussion on one](https://
|
|
87
|
-
2. [Fork the repository](https://
|
|
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.
|