meteocat 3.0.0 → 3.2.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/ISSUE_TEMPLATE/bug_report.md +8 -2
- package/.github/ISSUE_TEMPLATE/config.yml +7 -0
- package/.github/ISSUE_TEMPLATE/improvement.md +39 -0
- package/.github/ISSUE_TEMPLATE/new_function.md +41 -0
- package/.github/labels.yml +63 -0
- package/.github/workflows/autocloser.yaml +11 -9
- package/.github/workflows/close-on-label.yml +48 -0
- package/.github/workflows/force-sync-labels.yml +18 -0
- package/.github/workflows/sync-gitlab.yml +15 -4
- package/.github/workflows/sync-labels.yml +21 -0
- package/CHANGELOG.md +80 -11
- package/README.md +16 -4
- package/custom_components/meteocat/__init__.py +57 -42
- package/custom_components/meteocat/condition.py +6 -2
- package/custom_components/meteocat/config_flow.py +231 -4
- package/custom_components/meteocat/const.py +17 -2
- package/custom_components/meteocat/coordinator.py +1122 -101
- package/custom_components/meteocat/helpers.py +31 -36
- package/custom_components/meteocat/manifest.json +3 -2
- package/custom_components/meteocat/options_flow.py +71 -3
- package/custom_components/meteocat/sensor.py +660 -247
- package/custom_components/meteocat/strings.json +252 -15
- package/custom_components/meteocat/translations/ca.json +249 -13
- package/custom_components/meteocat/translations/en.json +252 -15
- package/custom_components/meteocat/translations/es.json +252 -15
- package/custom_components/meteocat/version.py +1 -1
- package/filetree.txt +12 -3
- package/hacs.json +1 -1
- package/images/daily_forecast_2_alerts.png +0 -0
- package/images/daily_forecast_no_alerts.png +0 -0
- package/images/diagnostic_sensors.png +0 -0
- package/images/dynamic_sensors.png +0 -0
- package/images/options.png +0 -0
- package/images/regenerate_assets.png +0 -0
- package/images/setup_options.png +0 -0
- package/images/system_options.png +0 -0
- package/package.json +1 -1
- package/pyproject.toml +1 -1
- package/scripts/update_version.sh +6 -0
- package/.github/workflows/close-duplicates.yml +0 -57
|
@@ -6,8 +6,14 @@ labels: bug
|
|
|
6
6
|
assignees: ""
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
**IMPORTANT
|
|
10
|
-
|
|
9
|
+
⚠️ **IMPORTANT:**
|
|
10
|
+
- This template is **only** for reporting bugs, errors, or malfunctions.
|
|
11
|
+
- Do **not** use it for improvements → use the ♻️ Improvement request template.
|
|
12
|
+
- Do **not** use it for new features or new API data → use the 🆕 New function template.
|
|
13
|
+
|
|
14
|
+
❌ The template is mandatory; failure to follow it will result in the issue being **closed without assistance**.
|
|
15
|
+
|
|
16
|
+
Before opening a bug report, please search existing issues (including closed ones) and check the [Wiki - Troubleshooting](https://github.com/figorr/meteocat/wiki/Troubleshooting) page.
|
|
11
17
|
|
|
12
18
|
---
|
|
13
19
|
|
|
@@ -1 +1,8 @@
|
|
|
1
1
|
blank_issues_enabled: false
|
|
2
|
+
contact_links:
|
|
3
|
+
- name: 📖 Wiki - Troubleshooting
|
|
4
|
+
url: https://github.com/figorr/meteocat/wiki/Troubleshooting
|
|
5
|
+
about: Please check the Wiki before opening an issue.
|
|
6
|
+
- name: 💬 Discussions
|
|
7
|
+
url: https://github.com/figorr/meteocat/discussions
|
|
8
|
+
about: Ask questions, share ideas, or get help from the community.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "♻️ Improvement request"
|
|
3
|
+
about: Suggest an improvement or change to the current behavior of the integration
|
|
4
|
+
title: "[Improvement] "
|
|
5
|
+
labels: enhancement
|
|
6
|
+
assignees: ""
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
⚠️ **NOTE:** This template is for improvements or changes to the **current behavior of the integration**.
|
|
10
|
+
|
|
11
|
+
- It is **not** for bugs, errors, or malfunctions → use the 🐞 Bug report template.
|
|
12
|
+
- It is **not** for requesting new features or new API data → use the 🆕 New function template.
|
|
13
|
+
|
|
14
|
+
❌ Any request that does not follow these rules (e.g. bug reports or feature requests submitted here) will be **closed without assistance**.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
### Current behavior
|
|
19
|
+
<!-- Describe the current behavior of the integration. -->
|
|
20
|
+
|
|
21
|
+
### Expected behavior
|
|
22
|
+
<!-- Describe what you would expect instead. -->
|
|
23
|
+
|
|
24
|
+
### Suggested solution
|
|
25
|
+
<!-- If you have an idea of how it could be improved, describe it here. -->
|
|
26
|
+
|
|
27
|
+
### Alternatives considered
|
|
28
|
+
<!-- Mention other approaches you thought about. -->
|
|
29
|
+
|
|
30
|
+
### Additional context
|
|
31
|
+
<!-- Add any other context, screenshots, or examples related to your request. -->
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
### Checklist
|
|
36
|
+
- [ ] I have searched existing issues (including closed ones).
|
|
37
|
+
- [ ] I have checked the [Wiki](https://github.com/figorr/meteocat/wiki).
|
|
38
|
+
- [ ] **I confirm this is not a bug or malfunction, but a request for improvement.**
|
|
39
|
+
- [ ] This request is not a duplicate.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "🆕 New function (API-based)"
|
|
3
|
+
about: Suggest a new function that uses data available from the Meteocat API
|
|
4
|
+
title: "[Function] "
|
|
5
|
+
labels: enhancement
|
|
6
|
+
assignees: ""
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
**IMPORTANT: Please check that the data you are requesting is available in the [Meteocat API Reference](https://apidocs.meteocat.gencat.cat/documentacio/).**
|
|
10
|
+
|
|
11
|
+
⚠️ **NOTE:** This template is for new functions or new API data for the **integration**.
|
|
12
|
+
|
|
13
|
+
- It is **not** for bugs, errors, or malfunctions → use the 🐞 Bug report template.
|
|
14
|
+
- It is **not** for requesting improvements or changes to the current behavior of the integration → use the ♻️ Improvement request template.
|
|
15
|
+
|
|
16
|
+
❌ Any request that does not follow these rules (e.g. bug reports or improvements requests submitted here) will be **closed without assistance**.
|
|
17
|
+
|
|
18
|
+
⚠️ **Note on API limits:** Each additional call to retrieve new or extra resources may cause the monthly API quota to be exhausted earlier than expected.
|
|
19
|
+
Keep in mind that the available limits are relatively low, especially with the basic plan.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
### Describe the function
|
|
24
|
+
<!-- Clear and concise description of the new function you want to add. -->
|
|
25
|
+
|
|
26
|
+
### API endpoint / resource
|
|
27
|
+
<!-- Indicate which API endpoint/resource provides this data. -->
|
|
28
|
+
|
|
29
|
+
### Why is it useful?
|
|
30
|
+
<!-- Explain the value of this function for Home Assistant users. -->
|
|
31
|
+
|
|
32
|
+
### Additional context
|
|
33
|
+
<!-- Add any other context, screenshots, or examples related to your request. -->
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
### Checklist
|
|
38
|
+
- [ ] I have searched existing issues (including closed ones).
|
|
39
|
+
- [ ] I have checked the [Wiki](https://github.com/figorr/meteocat/wiki).
|
|
40
|
+
- [ ] **I have verified that the requested data is available in the [Meteocat API Reference](https://apidocs.meteocat.gencat.cat/documentacio/).**
|
|
41
|
+
- [ ] This request is not a duplicate.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
- name: breaking-change
|
|
2
|
+
color: d73a4a
|
|
3
|
+
description: Indicates a breaking change affecting upgrade or usage.
|
|
4
|
+
|
|
5
|
+
- name: bug
|
|
6
|
+
color: d73a4a
|
|
7
|
+
description: Something isn't working.
|
|
8
|
+
|
|
9
|
+
- name: documentation
|
|
10
|
+
color: 0075ca
|
|
11
|
+
description: Improvements or additions to documentation.
|
|
12
|
+
|
|
13
|
+
- name: duplicate
|
|
14
|
+
color: cfd3d7
|
|
15
|
+
description: This issue or pull request already exists.
|
|
16
|
+
|
|
17
|
+
- name: enhancement
|
|
18
|
+
color: a2eeef
|
|
19
|
+
description: New feature or request.
|
|
20
|
+
|
|
21
|
+
- name: first read
|
|
22
|
+
color: 0052cc
|
|
23
|
+
description: Mandatory reading before opening issues.
|
|
24
|
+
|
|
25
|
+
- name: good first issue
|
|
26
|
+
color: 7057ff
|
|
27
|
+
description: Good for newcomers.
|
|
28
|
+
|
|
29
|
+
- name: help wanted
|
|
30
|
+
color: 008672
|
|
31
|
+
description: Extra attention is needed.
|
|
32
|
+
|
|
33
|
+
- name: invalid
|
|
34
|
+
color: e4e669
|
|
35
|
+
description: This doesn't seem right.
|
|
36
|
+
|
|
37
|
+
- name: logs required
|
|
38
|
+
color: b60205
|
|
39
|
+
description: Logs are required.
|
|
40
|
+
|
|
41
|
+
- name: merged
|
|
42
|
+
color: b337b8
|
|
43
|
+
description: Solution merged.
|
|
44
|
+
|
|
45
|
+
- name: question
|
|
46
|
+
color: d876e3
|
|
47
|
+
description: Further information is requested.
|
|
48
|
+
|
|
49
|
+
- name: solved
|
|
50
|
+
color: 0e8a16
|
|
51
|
+
description: Solved issue.
|
|
52
|
+
|
|
53
|
+
- name: stale
|
|
54
|
+
color: ededed
|
|
55
|
+
description: Marked as stale due to inactivity.
|
|
56
|
+
|
|
57
|
+
- name: wiki
|
|
58
|
+
color: fbca04
|
|
59
|
+
description: Documented at Wiki.
|
|
60
|
+
|
|
61
|
+
- name: wontfix
|
|
62
|
+
color: ffffff
|
|
63
|
+
description: This will not be worked on.
|
|
@@ -3,23 +3,25 @@ name: Autocloser
|
|
|
3
3
|
on:
|
|
4
4
|
issues:
|
|
5
5
|
types: [opened, edited, reopened]
|
|
6
|
-
issue_comment:
|
|
7
|
-
types: [created]
|
|
8
6
|
|
|
9
7
|
jobs:
|
|
10
8
|
autoclose:
|
|
11
9
|
runs-on: ubuntu-latest
|
|
12
10
|
steps:
|
|
13
|
-
- name: Autoclose issues that did not follow
|
|
11
|
+
- name: Autoclose issues that did not follow any template
|
|
14
12
|
uses: roots/issue-closer@v1.1
|
|
15
13
|
with:
|
|
16
14
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
17
15
|
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).
|
|
16
|
+
👋 @${{ github.event.issue.user.login }} this issue was automatically closed because it did not follow any of the required templates.
|
|
20
17
|
|
|
21
|
-
⚠️ Reminder:
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
⚠️ Reminder:
|
|
19
|
+
- Use the [🐞 Bug report template](https://github.com/figorr/meteocat/issues/new?template=bug_report.md) for errors or malfunctions.
|
|
20
|
+
- Use the [♻️ Improvement request template](https://github.com/figorr/meteocat/issues/new?template=improvement.md) for changes to current behavior.
|
|
21
|
+
- Use the [🆕 New function template](https://github.com/figorr/meteocat/issues/new?template=new_function.md) for API-based new features.
|
|
22
|
+
|
|
23
|
+
The template is mandatory; failure to use it will result in issue closure.
|
|
24
24
|
issue-pattern: >
|
|
25
|
-
(Describe the bug
|
|
25
|
+
(### Describe the bug|### To Reproduce|### Expected behavior|### System details|### Debug Logs|
|
|
26
|
+
I confirm this is not a bug or malfunction, but a request for improvement|
|
|
27
|
+
I have verified that the requested data is available)
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
name: Close on labels
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
issues:
|
|
5
|
+
types:
|
|
6
|
+
- labeled
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
close-and-comment:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- name: Filter relevant labels
|
|
13
|
+
if: ${{ contains('wiki,solved,merged,duplicate', github.event.label.name) }}
|
|
14
|
+
id: check
|
|
15
|
+
run: echo "label=${{ github.event.label.name }}" >> $GITHUB_OUTPUT
|
|
16
|
+
|
|
17
|
+
- name: Determine message based on label
|
|
18
|
+
if: ${{ steps.check.outputs.label }}
|
|
19
|
+
id: message
|
|
20
|
+
run: |
|
|
21
|
+
case "${{ github.event.label.name }}" in
|
|
22
|
+
wiki)
|
|
23
|
+
echo "message=👋 This issue is covered in the [Meteocat Wiki](https://github.com/figorr/meteocat/wiki). Please check the documentation there for guidance." >> $GITHUB_OUTPUT
|
|
24
|
+
;;
|
|
25
|
+
solved)
|
|
26
|
+
echo "message=✅ This issue has been solved. Closing now." >> $GITHUB_OUTPUT
|
|
27
|
+
;;
|
|
28
|
+
merged)
|
|
29
|
+
echo "message=🔀 This issue has been merged manually. 'Merged manually in master [commit_hash]'." >> $GITHUB_OUTPUT
|
|
30
|
+
;;
|
|
31
|
+
duplicate)
|
|
32
|
+
echo "message=📄 This issue is marked as a duplicate. 'Closed as duplicate of #<issue_number>'." >> $GITHUB_OUTPUT
|
|
33
|
+
;;
|
|
34
|
+
esac
|
|
35
|
+
|
|
36
|
+
- name: Add comment
|
|
37
|
+
if: ${{ steps.check.outputs.label }}
|
|
38
|
+
uses: peter-evans/create-or-update-comment@v4
|
|
39
|
+
with:
|
|
40
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
41
|
+
issue-number: ${{ github.event.issue.number }}
|
|
42
|
+
body: ${{ steps.message.outputs.message }}
|
|
43
|
+
|
|
44
|
+
- name: Close issue if open
|
|
45
|
+
if: ${{ github.event.issue.state == 'open' && steps.check.outputs.label }}
|
|
46
|
+
uses: peter-evans/close-issue@v2
|
|
47
|
+
with:
|
|
48
|
+
issue-number: ${{ github.event.issue.number }}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
name: Force sync labels
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch: # solo se ejecuta manualmente
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
labels:
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
steps:
|
|
10
|
+
- uses: actions/checkout@v4
|
|
11
|
+
|
|
12
|
+
- name: Force sync GitHub labels
|
|
13
|
+
uses: crazy-max/ghaction-github-labeler@v5
|
|
14
|
+
with:
|
|
15
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
16
|
+
yaml-file: .github/labels.yml
|
|
17
|
+
skip-delete: false # elimina labels que no estén en el YAML
|
|
18
|
+
dry-run: false # aplica cambios realmente
|
|
@@ -33,10 +33,21 @@ jobs:
|
|
|
33
33
|
# Paso 4: Comprobar divergencias en master
|
|
34
34
|
- name: Check for diverging commits
|
|
35
35
|
run: |
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
# Trae todas las ramas del remoto GitLab y crea referencias locales
|
|
37
|
+
git fetch gitlab +refs/heads/*:refs/remotes/gitlab/*
|
|
38
|
+
|
|
39
|
+
# Comprueba que la rama gitlab/master exista
|
|
40
|
+
if git show-ref --verify --quiet refs/remotes/gitlab/master; then
|
|
41
|
+
# Comprueba si GitLab master tiene commits que GitHub no tiene
|
|
42
|
+
if ! git merge-base --is-ancestor gitlab/master master; then
|
|
43
|
+
echo "❌ GitLab master tiene commits que GitHub no tiene. Revisar antes de sincronizar."
|
|
44
|
+
exit 1
|
|
45
|
+
else
|
|
46
|
+
echo "GitLab master está alineado con GitHub master ✅"
|
|
47
|
+
fi
|
|
48
|
+
else
|
|
49
|
+
echo "❌ La rama gitlab/master no se pudo encontrar localmente. Abortando."
|
|
50
|
+
exit 1
|
|
40
51
|
fi
|
|
41
52
|
|
|
42
53
|
# Paso 5: Push de commits y tags a GitLab
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: Sync labels
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
paths:
|
|
6
|
+
- .github/labels.yml
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
labels:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
|
|
15
|
+
- name: Sync GitHub labels (safe)
|
|
16
|
+
uses: crazy-max/ghaction-github-labeler@v5
|
|
17
|
+
with:
|
|
18
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
19
|
+
yaml-file: .github/labels.yml
|
|
20
|
+
skip-delete: true # no elimina labels que no estén en el YAML
|
|
21
|
+
dry-run: false # aplica cambios realmente
|
package/CHANGELOG.md
CHANGED
|
@@ -1,23 +1,92 @@
|
|
|
1
|
-
# [3.
|
|
1
|
+
# [3.2.0](https://github.com/figorr/meteocat/compare/v3.1.0...v3.2.0) (2025-11-07)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add validation date for moon coordinator ([8644f56](https://github.com/figorr/meteocat/commit/8644f56d8f8b6b607ba8809499afbfb81eb70b28))
|
|
7
|
+
* adjust moon update interval ([ea51d90](https://github.com/figorr/meteocat/commit/ea51d905a232ab947607333ea4abaf449cd2e786))
|
|
8
|
+
* fix friendly time translation ([9081a34](https://github.com/figorr/meteocat/commit/9081a343fd1562cb001f8a4b69948be3e26cbe00))
|
|
9
|
+
* fix reset data moon file coordinator ([f3cf22f](https://github.com/figorr/meteocat/commit/f3cf22f1fb1d1a19d6ee9fefd2be304850be1180))
|
|
10
|
+
* more accurate moon calculation ([dcee6e0](https://github.com/figorr/meteocat/commit/dcee6e0040d1cf77860fc7cbd06a5518145d3a72))
|
|
2
11
|
|
|
3
12
|
|
|
4
13
|
### Features
|
|
5
14
|
|
|
6
|
-
*
|
|
15
|
+
* add new moon day data ([77edf68](https://github.com/figorr/meteocat/commit/77edf681af037f00748b2b3cf2d281655d225718))
|
|
16
|
+
* add new moon day data ([d2be96e](https://github.com/figorr/meteocat/commit/d2be96ec7f4f9d48c1f018ba2c642f29558d05fe))
|
|
17
|
+
* add translations for lunation attribute ([10e3409](https://github.com/figorr/meteocat/commit/10e3409f82fa6530f0edf81c5e8406d019aeeaf1))
|
|
18
|
+
* bump solarmoonpy to v1.0.0 ([65c2a04](https://github.com/figorr/meteocat/commit/65c2a0495250bac284c060b575256f95f4fb0be0))
|
|
19
|
+
* bump solarmoonpy to v1.0.1 ([aa86747](https://github.com/figorr/meteocat/commit/aa86747ed41d69a80ac009b75b596746762548fe))
|
|
20
|
+
* bump solarmoonpy to v1.0.3 ([246bd83](https://github.com/figorr/meteocat/commit/246bd835589978940efc11722b79e420f838ecab))
|
|
21
|
+
* include latitude, longitude and altitude as new required variables ([5ef864c](https://github.com/figorr/meteocat/commit/5ef864ca38fa17ed05b36a19a96b8c7182f66be7))
|
|
22
|
+
* new latitude, longitude and altitude update options setup ([1aeb968](https://github.com/figorr/meteocat/commit/1aeb9682c8e65b3cb0b29a7b7467edcc455304c9))
|
|
23
|
+
* new lunation attribute for moon and moon phase name code ([60c7129](https://github.com/figorr/meteocat/commit/60c7129757916908baf26439819458ea3a173ad4))
|
|
24
|
+
* new lunation attribute for moon sensor ([9bb32ff](https://github.com/figorr/meteocat/commit/9bb32ff03bd7eba291a1ee1aa578e2838dcf9bd5))
|
|
25
|
+
* new lunation data and moon phase name rework ([0616401](https://github.com/figorr/meteocat/commit/0616401243334c21736d0877e5e50e435279e002))
|
|
26
|
+
* new moon day attribute ([86ec6e3](https://github.com/figorr/meteocat/commit/86ec6e311fc098174027f17d3502e8be740d7e86))
|
|
27
|
+
* new moon sensors ([7c7c1d3](https://github.com/figorr/meteocat/commit/7c7c1d38393a40fd2e69eeba2c24bb185ae349ef))
|
|
28
|
+
* new solarmoonpy requirement for sun and moon events calculation ([1d25a62](https://github.com/figorr/meteocat/commit/1d25a6252cf568e1242f654c389aeada2b5d73f6))
|
|
29
|
+
* new sun and moon coordinators ([af2290e](https://github.com/figorr/meteocat/commit/af2290e7384a9ad5416afdf4d6767ad69099813c))
|
|
30
|
+
* new sun and moon files ([b489d7a](https://github.com/figorr/meteocat/commit/b489d7a9abc5af747fc50a2e0d7b0d661408b824))
|
|
31
|
+
* new sun and moon sensors ([91265f3](https://github.com/figorr/meteocat/commit/91265f3c6cbd512b3706c29d466f9bb01df6d45e))
|
|
32
|
+
* translation for new moon day attribute ([162859e](https://github.com/figorr/meteocat/commit/162859e2822374b81835cb1af07325dceaf5a55e))
|
|
33
|
+
* translations for the new moon and sun sensors ([91a33b6](https://github.com/figorr/meteocat/commit/91a33b6b52e34ed69eed4eb5fbfaf9dffd20df57))
|
|
34
|
+
|
|
35
|
+
# [3.1.0](https://github.com/figorr/meteocat/compare/v3.0.0...v3.1.0) (2025-09-27)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
### Bug Fixes
|
|
39
|
+
|
|
40
|
+
* fix unknown threshold translation ([6fa7964](https://github.com/figorr/meteocat/commit/6fa79644e3ebbdf9a44826f6071af6009cd2d02d))
|
|
41
|
+
* include Meteocat Card ([513d9ed](https://github.com/figorr/meteocat/commit/513d9ed50fcd9127ac64f0388ed1017db938f378))
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
### Features
|
|
45
|
+
|
|
46
|
+
* ✨ Add native sunrise and sunset sensors to Meteocat integration ([7bb70c6](https://github.com/figorr/meteocat/commit/7bb70c681c90773275e496f938f455c3688fb4c0))
|
|
7
47
|
|
|
48
|
+
## [3.0.0](https://github.com/figorr/meteocat/compare/v2.3.0...v3.0.0) (2025-09-14)
|
|
8
49
|
|
|
9
|
-
### BREAKING CHANGES
|
|
10
50
|
|
|
11
|
-
|
|
12
|
-
|
|
51
|
+
### ⚠️ BREAKING CHANGES
|
|
52
|
+
|
|
53
|
+
* Version **3.0.0 and later** introduces a **breaking change** in how entities are identified.
|
|
54
|
+
|
|
55
|
+
## ⚠️ What this affects
|
|
56
|
+
- This affects any update **from a version prior to 3.0.0** to **any version 3.x or later**.
|
|
57
|
+
- Entities now use **`town_id`** instead of `region_id` in their `unique_id`.
|
|
58
|
+
- This change allows multiple integration entries that share the same `region_id` but different towns.
|
|
59
|
+
|
|
60
|
+
### ✅ Recommended upgrade procedure
|
|
61
|
+
To avoid issues with duplicated or unavailable entities:
|
|
62
|
+
|
|
63
|
+
1. **Uninstall** the existing integration (v2.x).
|
|
64
|
+
2. **Restart** Home Assistant.
|
|
65
|
+
3. **Install v3.0.0 or later** and configure the integration again.
|
|
66
|
+
|
|
67
|
+
### 🚨 If you update directly
|
|
68
|
+
If you update without uninstalling first:
|
|
69
|
+
|
|
70
|
+
- Old entities will remain as **Unavailable**.
|
|
71
|
+
- New entities will be created (sometimes with a suffix like `2`).
|
|
72
|
+
- You may need to manually **remove old entities** and update your automations, dashboards, or scripts to point to the new entities.
|
|
73
|
+
|
|
74
|
+
### 📑 Additional notes
|
|
75
|
+
|
|
76
|
+
- This change affects all entity types, including **sensors, diagnostic sensors, and alerts**.
|
|
77
|
+
- Always backup your **Home Assistant configuration** before performing major upgrades.
|
|
78
|
+
|
|
79
|
+
ℹ️ More details:
|
|
80
|
+
- [README – Breaking changes](https://github.com/figorr/meteocat#-breaking-changes---upgrade-to-3x)
|
|
81
|
+
- [Wiki – Breaking changes](https://github.com/figorr/meteocat/wiki/Breaking-Changes)
|
|
82
|
+
|
|
83
|
+
### Features
|
|
84
|
+
|
|
85
|
+
* change unique_id to use town_id ([3a048ce](https://github.com/figorr/meteocat/commit/3a048ce48a0e1f3ee7642c28bbe7ac6e6e3fc298))
|
|
13
86
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
2. Restart Home Assistant.
|
|
17
|
-
3. Install v3.0.0 and reconfigure the integration.
|
|
87
|
+
### Contributors:
|
|
88
|
+
- [mcasellas](https://github.com/mcasellas) – contributed [c505f27](https://github.com/figorr/meteocat/commit/c505f27) - Improve Catalan translations
|
|
18
89
|
|
|
19
|
-
If you update directly without uninstalling first, old entities will remain as 'unavailable' and new entities will be created (possibly with a suffix like '2').
|
|
20
|
-
In that case, you may need to manually remove the old entities and update your automations or dashboards.
|
|
21
90
|
|
|
22
91
|
## [2.3.0](https://github.com/figorr/meteocat/compare/v2.2.7...v2.3.0) (2025-09-10)
|
|
23
92
|
|
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ This is a personal project.
|
|
|
26
26
|
- [Figorr](https://github.com/figorr)
|
|
27
27
|
|
|
28
28
|
**Contributors:**
|
|
29
|
-
- [mcasellas](https://github.com/mcasellas) – contributed [c505f27](https://github.com/figorr/meteocat/commit/c505f27)
|
|
29
|
+
- [mcasellas](https://github.com/mcasellas) – contributed [c505f27](https://github.com/figorr/meteocat/commit/c505f27) - Improve Catalan translations
|
|
30
30
|
|
|
31
31
|
## ⚠️ Breaking changes - Upgrade to 3.0.0 or later coming from prior versions
|
|
32
32
|
|
|
@@ -40,7 +40,8 @@ Version **3.0.0 and later** introduces a **breaking change** in how entities are
|
|
|
40
40
|
### ✅ Recommended upgrade procedure
|
|
41
41
|
To avoid issues with duplicated or unavailable entities:
|
|
42
42
|
|
|
43
|
-
1. **Uninstall** the existing integration (v2.x)
|
|
43
|
+
1. **Uninstall** the existing integration (v2.x).<br>
|
|
44
|
+
🔗 See [Uninstallation Guide](https://github.com/figorr/meteocat/wiki/Uninstallation) for the proper way of removing prior versions.
|
|
44
45
|
2. **Restart** Home Assistant.
|
|
45
46
|
3. **Install v3.0.0 or later** and configure the integration again.
|
|
46
47
|
|
|
@@ -134,6 +135,9 @@ You will see three available options:
|
|
|
134
135
|
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.
|
|
135
136
|
> ℹ️ If the Meteocat API is not available at that moment, the integration will still start, and you can retry regeneration later.
|
|
136
137
|
|
|
138
|
+
- **Update coordinates and elevation**
|
|
139
|
+
Change the default station coordinates and elevation that were set during the first setup. So you can use your location coordinates and elevation for more accurate sun and moon data.
|
|
140
|
+
|
|
137
141
|
### Accessing the Options Menu
|
|
138
142
|
|
|
139
143
|
You can access the Options Menu in two ways, both inside the integration:
|
|
@@ -146,9 +150,9 @@ You can access the Options Menu in two ways, both inside the integration:
|
|
|
146
150
|
|
|
147
151
|

|
|
148
152
|
|
|
149
|
-
Once inside, you will see the following options:
|
|
153
|
+
Once you are inside, you will see the following options:
|
|
150
154
|
|
|
151
|
-

|
|
155
|
+

|
|
152
156
|
|
|
153
157
|
|
|
154
158
|
## Uninstallation
|
|
@@ -161,6 +165,14 @@ To correctly uninstall the integration:
|
|
|
161
165
|
|
|
162
166
|
👉 For detailed steps with screenshots, check the [Uninstallation Guide](https://github.com/figorr/meteocat/wiki/Uninstallation).
|
|
163
167
|
|
|
168
|
+
## Custom Meteocat Card available
|
|
169
|
+
|
|
170
|
+
Meteocat integration has its own weather card.
|
|
171
|
+
|
|
172
|
+
To install the card, please follow the instructions from its own repository, [🎫 Meteocat Card](https://github.com/figorr/meteocat-card).
|
|
173
|
+
|
|
174
|
+

|
|
175
|
+
|
|
164
176
|
# Documentation
|
|
165
177
|
|
|
166
178
|
For more detailed information about:
|
|
@@ -5,6 +5,7 @@ import voluptuous as vol
|
|
|
5
5
|
from pathlib import Path
|
|
6
6
|
import aiofiles
|
|
7
7
|
import json
|
|
8
|
+
import importlib # Para importaciones lazy
|
|
8
9
|
|
|
9
10
|
from homeassistant import core
|
|
10
11
|
from homeassistant.config_entries import ConfigEntry
|
|
@@ -14,24 +15,6 @@ from homeassistant.helpers.entity_platform import async_get_platforms
|
|
|
14
15
|
from homeassistant.helpers import config_validation as cv
|
|
15
16
|
|
|
16
17
|
from .helpers import get_storage_dir
|
|
17
|
-
from .coordinator import (
|
|
18
|
-
MeteocatSensorCoordinator,
|
|
19
|
-
MeteocatStaticSensorCoordinator,
|
|
20
|
-
MeteocatEntityCoordinator,
|
|
21
|
-
MeteocatUviCoordinator,
|
|
22
|
-
MeteocatUviFileCoordinator,
|
|
23
|
-
HourlyForecastCoordinator,
|
|
24
|
-
DailyForecastCoordinator,
|
|
25
|
-
MeteocatConditionCoordinator,
|
|
26
|
-
MeteocatTempForecastCoordinator,
|
|
27
|
-
MeteocatAlertsCoordinator,
|
|
28
|
-
MeteocatAlertsRegionCoordinator,
|
|
29
|
-
MeteocatQuotesCoordinator,
|
|
30
|
-
MeteocatQuotesFileCoordinator,
|
|
31
|
-
MeteocatLightningCoordinator,
|
|
32
|
-
MeteocatLightningFileCoordinator,
|
|
33
|
-
)
|
|
34
|
-
|
|
35
18
|
from meteocatpy.town import MeteocatTown
|
|
36
19
|
from meteocatpy.symbols import MeteocatSymbols
|
|
37
20
|
from meteocatpy.variables import MeteocatVariables
|
|
@@ -41,7 +24,7 @@ from .const import DOMAIN, PLATFORMS
|
|
|
41
24
|
_LOGGER = logging.getLogger(__name__)
|
|
42
25
|
|
|
43
26
|
# Versión
|
|
44
|
-
__version__ = "3.
|
|
27
|
+
__version__ = "3.2.0"
|
|
45
28
|
|
|
46
29
|
# Definir el esquema de configuración CONFIG_SCHEMA
|
|
47
30
|
CONFIG_SCHEMA = vol.Schema(
|
|
@@ -59,6 +42,9 @@ CONFIG_SCHEMA = vol.Schema(
|
|
|
59
42
|
vol.Optional("province_id"): cv.string,
|
|
60
43
|
vol.Optional("region_name"): cv.string,
|
|
61
44
|
vol.Optional("region_id"): cv.string,
|
|
45
|
+
vol.Required("latitude"): cv.latitude,
|
|
46
|
+
vol.Required("longitude"): cv.longitude,
|
|
47
|
+
vol.Required("altitude"): vol.Coerce(float),
|
|
62
48
|
}
|
|
63
49
|
)
|
|
64
50
|
},
|
|
@@ -119,6 +105,11 @@ async def async_setup(hass: core.HomeAssistant, config: dict) -> bool:
|
|
|
119
105
|
"""Configuración inicial del componente Meteocat."""
|
|
120
106
|
return True
|
|
121
107
|
|
|
108
|
+
def _get_coordinator_module(cls_name: str):
|
|
109
|
+
"""Importa dinámicamente un coordinador para evitar blocking imports."""
|
|
110
|
+
module = importlib.import_module(".coordinator", "custom_components.meteocat")
|
|
111
|
+
return getattr(module, cls_name)
|
|
112
|
+
|
|
122
113
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|
123
114
|
"""Configura una entrada de configuración para Meteocat."""
|
|
124
115
|
_LOGGER.info("Configurando la integración de Meteocat...")
|
|
@@ -129,14 +120,28 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|
|
129
120
|
# Validar campos requeridos
|
|
130
121
|
required_fields = [
|
|
131
122
|
"api_key", "town_name", "town_id", "variable_name",
|
|
132
|
-
"variable_id", "station_name", "station_id", "province_name",
|
|
133
|
-
"province_id", "region_name", "region_id"
|
|
123
|
+
"variable_id", "station_name", "station_id", "province_name",
|
|
124
|
+
"province_id", "region_name", "region_id", "latitude", "longitude", "altitude"
|
|
134
125
|
]
|
|
135
126
|
missing_fields = [field for field in required_fields if field not in entry_data]
|
|
136
127
|
if missing_fields:
|
|
137
128
|
_LOGGER.error(f"Faltan los siguientes campos en la configuración: {missing_fields}")
|
|
138
129
|
return False
|
|
139
|
-
|
|
130
|
+
|
|
131
|
+
# Validar coordenadas válidas para Cataluña
|
|
132
|
+
latitude = entry_data.get("latitude")
|
|
133
|
+
longitude = entry_data.get("longitude")
|
|
134
|
+
if not (40.5 <= latitude <= 42.5 and 0.1 <= longitude <= 3.3): # Rango aproximado para Cataluña
|
|
135
|
+
_LOGGER.warning(
|
|
136
|
+
"Coordenadas inválidas (latitude: %s, longitude: %s). Usando coordenadas de Barcelona por defecto para MeteocatSunCoordinator.",
|
|
137
|
+
latitude, longitude
|
|
138
|
+
)
|
|
139
|
+
entry_data = {
|
|
140
|
+
**entry_data,
|
|
141
|
+
"latitude": 41.38879,
|
|
142
|
+
"longitude": 2.15899
|
|
143
|
+
}
|
|
144
|
+
|
|
140
145
|
# Crear los assets básicos si faltan
|
|
141
146
|
await ensure_assets_exist(
|
|
142
147
|
hass,
|
|
@@ -150,33 +155,41 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|
|
150
155
|
f"Variable '{entry_data['variable_name']}' (ID: {entry_data['variable_id']}), "
|
|
151
156
|
f"Estación '{entry_data['station_name']}' (ID: {entry_data['station_id']}), "
|
|
152
157
|
f"Provincia '{entry_data['province_name']}' (ID: {entry_data['province_id']}), "
|
|
153
|
-
f"Comarca '{entry_data['region_name']}' (ID: {entry_data['region_id']})
|
|
158
|
+
f"Comarca '{entry_data['region_name']}' (ID: {entry_data['region_id']}), "
|
|
159
|
+
f"Coordenadas: ({entry_data['latitude']}, {entry_data['longitude']})."
|
|
160
|
+
f"Altitud: ({entry_data['altitude']})."
|
|
154
161
|
)
|
|
155
162
|
|
|
156
|
-
#
|
|
157
|
-
|
|
158
|
-
("sensor_coordinator", MeteocatSensorCoordinator),
|
|
159
|
-
("static_sensor_coordinator", MeteocatStaticSensorCoordinator),
|
|
160
|
-
("entity_coordinator", MeteocatEntityCoordinator),
|
|
161
|
-
("uvi_coordinator", MeteocatUviCoordinator),
|
|
162
|
-
("uvi_file_coordinator", MeteocatUviFileCoordinator),
|
|
163
|
-
("hourly_forecast_coordinator", HourlyForecastCoordinator),
|
|
164
|
-
("daily_forecast_coordinator", DailyForecastCoordinator),
|
|
165
|
-
("condition_coordinator", MeteocatConditionCoordinator),
|
|
166
|
-
("temp_forecast_coordinator", MeteocatTempForecastCoordinator),
|
|
167
|
-
("alerts_coordinator", MeteocatAlertsCoordinator),
|
|
168
|
-
("alerts_region_coordinator", MeteocatAlertsRegionCoordinator),
|
|
169
|
-
("quotes_coordinator", MeteocatQuotesCoordinator),
|
|
170
|
-
("quotes_file_coordinator", MeteocatQuotesFileCoordinator),
|
|
171
|
-
("lightning_coordinator", MeteocatLightningCoordinator),
|
|
172
|
-
("lightning_file_coordinator", MeteocatLightningFileCoordinator),
|
|
163
|
+
# Lista de coordinadores con sus clases
|
|
164
|
+
coordinator_configs = [
|
|
165
|
+
("sensor_coordinator", "MeteocatSensorCoordinator"),
|
|
166
|
+
("static_sensor_coordinator", "MeteocatStaticSensorCoordinator"),
|
|
167
|
+
("entity_coordinator", "MeteocatEntityCoordinator"),
|
|
168
|
+
("uvi_coordinator", "MeteocatUviCoordinator"),
|
|
169
|
+
("uvi_file_coordinator", "MeteocatUviFileCoordinator"),
|
|
170
|
+
("hourly_forecast_coordinator", "HourlyForecastCoordinator"),
|
|
171
|
+
("daily_forecast_coordinator", "DailyForecastCoordinator"),
|
|
172
|
+
("condition_coordinator", "MeteocatConditionCoordinator"),
|
|
173
|
+
("temp_forecast_coordinator", "MeteocatTempForecastCoordinator"),
|
|
174
|
+
("alerts_coordinator", "MeteocatAlertsCoordinator"),
|
|
175
|
+
("alerts_region_coordinator", "MeteocatAlertsRegionCoordinator"),
|
|
176
|
+
("quotes_coordinator", "MeteocatQuotesCoordinator"),
|
|
177
|
+
("quotes_file_coordinator", "MeteocatQuotesFileCoordinator"),
|
|
178
|
+
("lightning_coordinator", "MeteocatLightningCoordinator"),
|
|
179
|
+
("lightning_file_coordinator", "MeteocatLightningFileCoordinator"),
|
|
180
|
+
("sun_coordinator", "MeteocatSunCoordinator"),
|
|
181
|
+
("sun_file_coordinator", "MeteocatSunFileCoordinator"),
|
|
182
|
+
("moon_coordinator", "MeteocatMoonCoordinator"),
|
|
183
|
+
("moon_file_coordinator", "MeteocatMoonFileCoordinator"),
|
|
173
184
|
]
|
|
174
185
|
|
|
175
186
|
hass.data.setdefault(DOMAIN, {})
|
|
176
187
|
hass.data[DOMAIN][entry.entry_id] = {}
|
|
177
188
|
|
|
178
189
|
try:
|
|
179
|
-
for key,
|
|
190
|
+
for key, cls_name in coordinator_configs:
|
|
191
|
+
# Importación lazy: importa la clase solo cuando sea necesario
|
|
192
|
+
cls = await hass.async_add_executor_job(_get_coordinator_module, cls_name)
|
|
180
193
|
coordinator = cls(hass=hass, entry_data=entry_data)
|
|
181
194
|
await coordinator.async_config_entry_first_refresh()
|
|
182
195
|
hass.data[DOMAIN][entry.entry_id][key] = coordinator
|
|
@@ -251,6 +264,8 @@ async def async_remove_entry(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
|
|
251
264
|
files_folder / f"uvi_{town_id.lower()}_data.json",
|
|
252
265
|
files_folder / f"forecast_{town_id.lower()}_hourly_data.json",
|
|
253
266
|
files_folder / f"forecast_{town_id.lower()}_daily_data.json",
|
|
267
|
+
files_folder / f"sun_{town_id.lower()}_data.json",
|
|
268
|
+
files_folder / f"moon_{town_id.lower()}_data.json",
|
|
254
269
|
])
|
|
255
270
|
|
|
256
271
|
# 3. Archivos de comarca (region_id)
|
|
@@ -280,4 +295,4 @@ async def async_remove_entry(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
|
|
280
295
|
|
|
281
296
|
# Intentar eliminar carpetas vacías
|
|
282
297
|
for folder in [assets_folder, files_folder, base_folder]:
|
|
283
|
-
safe_remove(folder, is_folder=True)
|
|
298
|
+
safe_remove(folder, is_folder=True)
|