meteocat 3.1.0 → 4.0.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.
Files changed (57) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +45 -45
  2. package/.github/ISSUE_TEMPLATE/config.yml +8 -8
  3. package/.github/ISSUE_TEMPLATE/improvement.md +39 -39
  4. package/.github/ISSUE_TEMPLATE/new_function.md +41 -41
  5. package/.github/labels.yml +63 -63
  6. package/.github/workflows/autocloser.yaml +27 -27
  7. package/.github/workflows/close-on-label.yml +48 -48
  8. package/.github/workflows/force-sync-labels.yml +18 -18
  9. package/.github/workflows/hassfest.yaml +13 -13
  10. package/.github/workflows/publish-zip.yml +67 -67
  11. package/.github/workflows/release.yml +41 -41
  12. package/.github/workflows/stale.yml +63 -63
  13. package/.github/workflows/sync-gitlab.yml +107 -107
  14. package/.github/workflows/sync-labels.yml +21 -21
  15. package/.github/workflows/validate.yaml +16 -16
  16. package/.pre-commit-config.yaml +37 -37
  17. package/.releaserc +37 -37
  18. package/AUTHORS.md +13 -13
  19. package/CHANGELOG.md +954 -898
  20. package/README.md +207 -204
  21. package/conftest.py +11 -11
  22. package/custom_components/meteocat/__init__.py +298 -293
  23. package/custom_components/meteocat/condition.py +63 -59
  24. package/custom_components/meteocat/config_flow.py +613 -435
  25. package/custom_components/meteocat/const.py +132 -120
  26. package/custom_components/meteocat/coordinator.py +1040 -205
  27. package/custom_components/meteocat/helpers.py +58 -63
  28. package/custom_components/meteocat/manifest.json +25 -24
  29. package/custom_components/meteocat/options_flow.py +287 -277
  30. package/custom_components/meteocat/sensor.py +366 -4
  31. package/custom_components/meteocat/strings.json +1058 -867
  32. package/custom_components/meteocat/translations/ca.json +1058 -867
  33. package/custom_components/meteocat/translations/en.json +1058 -867
  34. package/custom_components/meteocat/translations/es.json +1058 -867
  35. package/custom_components/meteocat/version.py +1 -1
  36. package/custom_components/meteocat/weather.py +218 -218
  37. package/filetree.py +48 -48
  38. package/filetree.txt +79 -70
  39. package/hacs.json +8 -8
  40. package/images/daily_forecast_2_alerts.png +0 -0
  41. package/images/daily_forecast_no_alerts.png +0 -0
  42. package/images/diagnostic_sensors.png +0 -0
  43. package/images/dynamic_sensors.png +0 -0
  44. package/images/options.png +0 -0
  45. package/images/regenerate_assets.png +0 -0
  46. package/images/setup_options.png +0 -0
  47. package/images/system_options.png +0 -0
  48. package/info.md +11 -11
  49. package/package.json +22 -22
  50. package/poetry.lock +3222 -3222
  51. package/pyproject.toml +68 -68
  52. package/requirements.test.txt +3 -3
  53. package/setup.cfg +64 -64
  54. package/setup.py +10 -10
  55. package/tests/bandit.yaml +17 -17
  56. package/tests/conftest.py +19 -19
  57. package/tests/test_init.py +9 -9
package/README.md CHANGED
@@ -1,205 +1,208 @@
1
- # Meteocat for Home Assistant
2
- ![Meteocat Banner](images/banner.png)
3
- [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
4
- [![Python version compatibility](https://img.shields.io/pypi/pyversions/meteocat)](https://pypi.org/project/meteocat)
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](https://img.shields.io/github/downloads/figorr/meteocat/latest/total)
10
- ![Latest release](https://img.shields.io/github/v/release/figorr/meteocat?label=latest)
11
- [![Breaking Changes](https://img.shields.io/badge/Breaking%20Changes-critical?logo=data:image/svg+xml;base64,PHN2ZyBpZD0iTGF5ZXJfMSIgZGF0YS1uYW1lPSJMYXllciAxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciI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1LjQ4LDUuNDgsMCwwLDEsNjEsODEuMTFhNS42Niw1LjY2LDAsMCwxLDQuNDIsMS42Niw1LjUzLDUuNTMsMCwwLDEsMS42MiwzLjU0QTUuNiw1LjYsMCwwLDEsNjcsODcuNzJhNiw2LDAsMCwxLS40MiwxLjM0LDUuNTMsNS41MywwLDAsMS0yLjkyLDIuODQsNS43OSw1Ljc5LDAsMCwxLTQuNTctLjEsNS41MSw1LjUxLDAsMCwxLTIuODEtMi45NCw1LjMxLDUuMzEsMCwwLDEtLjM2LTEuMjcsNS45LDUuOSwwLDAsMS0uMDYtMS4zMmgwYTYuNDUsNi40NSwwLDAsMSwuNTctMiw0LjYsNC42LDAsMCwxLDEuMTQtMS41NlptOC4xNS0xMC4yNGMtLjE5LDQuNzktOC4zMSw0LjgtOC40OSwwLS44Mi04LjIxLTIuOTItMjcuNy0yLjg2LTM1LjQyLjA3LTIuMzgsMi0zLjc4LDQuNTYtNC4zMmExMS4xOSwxMS4xOSwwLDAsMSwyLjQ5LS4yNCwxMS43NywxMS43NywwLDAsMSwyLjUuMjVjMi42MS41NSw0LjY1LDIsNC42NSw0LjQ0di4yNEw2NS43Miw3Mi40NVoiLz48L3N2Zz4=&logoColor=white)](#-breaking-changes---upgrade-to-3x)
12
-
13
- This is a project to obtain meteorological data from the Meteocat API inside the Home Assistant environment.
14
-
15
- All the data is property of Meteocat ("Servei Meteorològic de Catalunya"). This project is only a tool to offer an easy and secure access to the meteorological data provided by the "Servei Meteorològic de Catalunya" API, so you can use the data for your personal use.
16
-
17
- Commercial use of this project or the data obtained from the API is not allowed without prior permission from the author, in case of the project, or from the "Servei Meteorològic de Catalunya" in the case of the data provided by the API.
18
-
19
- **NOTE:** Meteocat API requires to use an API_KEY, you should ask to (https://apidocs.meteocat.gencat.cat/documentacio/acces-ciutada-i-administracio/)
20
-
21
- # Credits
22
-
23
- This is a personal project.
24
-
25
- **Authors:**
26
- - [Figorr](https://github.com/figorr)
27
-
28
- **Contributors:**
29
- - [mcasellas](https://github.com/mcasellas) – contributed [c505f27](https://github.com/figorr/meteocat/commit/c505f27) - Improve Catalan translations
30
-
31
- ## ⚠️ Breaking changes - Upgrade to 3.0.0 or later coming from prior versions
32
-
33
- Version **3.0.0 and later** introduces a **breaking change** in how entities are identified.
34
-
35
- ### ⚠️ What this affects
36
- - This affects any update **from a version prior to 3.0.0** to **any version 3.x or later**.
37
- - Entities now use **`town_id`** instead of `region_id` in their `unique_id`.
38
- - This change allows multiple integration entries that share the same `region_id` but different towns.
39
-
40
- ### ✅ Recommended upgrade procedure
41
- To avoid issues with duplicated or unavailable entities:
42
-
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.
45
- 2. **Restart** Home Assistant.
46
- 3. **Install v3.0.0 or later** and configure the integration again.
47
-
48
- ### 🚨 If you update directly
49
- If you update without uninstalling first:
50
-
51
- - Old entities will remain as **Unavailable**.
52
- - New entities will be created (sometimes with a suffix like `2`).
53
- - You may need to manually **remove old entities** and update your automations, dashboards, or scripts to point to the new entities.
54
-
55
- ### 📑 Additional notes
56
-
57
- - This change affects all entity types, including **sensors, diagnostic sensors, and alerts**.
58
- - Always backup your **Home Assistant configuration** before performing major upgrades.
59
-
60
- ## Installation
61
-
62
- #### HACS - Install using the custom repository method.
63
-
64
- 1. First of all you need to add a custom repository like [this](https://hacs.xyz/docs/faq/custom_repositories/).
65
- 1. Then download the integration from HACS.
66
- 1. Restart Home Assistant.
67
- 1. Go to `Settings > Devices & Services`
68
- 1. Click `+ Add Integration`
69
- 1. Search for `Meteocat` and follow the configuration instructions
70
-
71
- #### HACS - Install from the store
72
- 1. Go to `HACS`
73
- 1. Search for `Meteocat` and add it to HACS
74
- 1. Restart Home Assistant
75
- 1. Go to `Settings > Devices & Services`
76
- 1. Click `+ Add Integration`
77
- 1. Search for `Meteocat` and follow the configuration instructions
78
-
79
- #### Manually
80
- Copy the `custom_components/meteocat` folder into the config folder.
81
-
82
- ## Configuration
83
- To add a Meteocat Device, go to `Configuration > Integrations` in the UI. Then click the `+` button and from the list of integrations select Meteocat. You will then be prompted to enter your API Key.
84
-
85
- ![Meteocat custom component login dialog](images/login.png)
86
-
87
- After submitting your API Key you will either be prompted to pick a town from the list as shown below.
88
-
89
- ![Meteocat custom component town picker dialog](images/pick_town.png)
90
-
91
- Once you pick the town you will be prompted to pick a station from the list. These are the nearest stations to the picked town.
92
-
93
- ![Meteocat custom component station picker dialog](images/pick_station.png)
94
-
95
- Then you will be asked to set the API limits from your plan.
96
-
97
- ![Meteocat custom component api limits setting dialog](images/api_limits.png)
98
-
99
- Then you will be asked to pick an area for the device.
100
-
101
- ![Area](images/pick_area.png)
102
-
103
- If the device is added successfully it should appear as shown.
104
-
105
- ![Device](images/devices.png)
106
-
107
- This device will then have the entities shown below. The sensors are translated to your system language (according to tranlation folder: en, es, ca). Or English by default.
108
-
109
- ![Dynamic Sensors](images/dynamic_sensors.png)
110
-
111
- ![Diagnostic Sensors](images/diagnostic_sensors.png)
112
-
113
- ## Changing Units
114
-
115
- To change units select one of the entities and open the more info dialog and click the cog in the top right. This will bring up the settings for the entity. Then select `Unit of Measurement`, and a dropdown will appear where you can select the units you want.
116
-
117
- ![Entity more info settings dialog](images/change_units.png)
118
-
119
- ## Options
120
-
121
- Once the integration is installed, you can reconfigure some parameters without having to remove and reinstall Meteocat.
122
-
123
- Go to:
124
- `Settings > Devices & Services > Meteocat > Configure`
125
-
126
- You will see three available options:
127
-
128
- - **Update API Key and limits**
129
- Allows you to change the API Key and update all API plan limits at the same time.
130
-
131
- - **Update limits only**
132
- Allows you to adjust only the API plan limits, keeping the same API Key.
133
-
134
- - **Regenerate assets**
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.
136
- > ℹ️ If the Meteocat API is not available at that moment, the integration will still start, and you can retry regeneration later.
137
-
138
- ### Accessing the Options Menu
139
-
140
- You can access the Options Menu in two ways, both inside the integration:
141
-
142
- - **Setup Options**
143
-
144
- ![Setup Options menu](images/setup_options.png)
145
-
146
- - **System Options**
147
-
148
- ![System Options menu](images/system_options.png)
149
-
150
- Once you are inside, you will see the following options:
151
-
152
- ![Available Options](images/options.png)
153
-
154
-
155
- ## Uninstallation
156
-
157
- To correctly uninstall the integration:
158
-
159
- - If you are upgrading due to **breaking changes**, remove all configured entries from
160
- **Settings > Devices & Services > Integrations**, restart Home Assistant, and reinstall the new version.
161
- - If you want to **completely remove Meteocat**, after removing the entries and restarting, also uninstall the integration from **HACS > Integrations**.
162
-
163
- 👉 For detailed steps with screenshots, check the [Uninstallation Guide](https://github.com/figorr/meteocat/wiki/Uninstallation).
164
-
165
- ## Custom Meteocat Card available
166
-
167
- Meteocat integration has its own weather card.
168
-
169
- To install the card, please follow the instructions from its own repository, [🎫 Meteocat Card](https://github.com/figorr/meteocat-card).
170
-
171
- ![Meteocat Card](images/daily_forecast_2_alerts.png)
172
-
173
- # Documentation
174
-
175
- For more detailed information about:
176
- - Installation and configuration
177
- - Usage examples
178
- - Extra attributes in sensors
179
- - Known issues and troubleshooting
180
-
181
- please visit the [📖 Meteocat Wiki](https://github.com/figorr/meteocat/wiki).
182
-
183
- # Contributing
184
-
185
- 1. [Check for open features/bugs](https://github.com/figorr/meteocat/issues)
186
- or [initiate a discussion on one](https://github.com/figorr/meteocat/issues/new/choose).
187
- 2. [Fork the repository](https://github.com/figorr/meteocat/fork).
188
- 3. Install the dev environment: `make init`.
189
- 4. Enter the virtual environment: `pipenv shell`
190
- 5. Code your new feature or bug fix.
191
- 6. Write a test that covers your new functionality.
192
- 7. Update `README.md` with any new documentation.
193
- 8. Run tests and ensure 100% code coverage for your contribution: `make coverage`
194
- 9. Ensure you have no linting errors: `make lint`
195
- 10. Ensure you have typed your code correctly: `make typing`
196
- 11. Add yourself to `AUTHORS.md`.
197
- 12. Submit a pull request!
198
-
199
- # License
200
-
201
- [Apache-2.0](LICENSE). By providing a contribution, you agree the contribution is licensed under Apache-2.0.
202
-
203
- # API Reference
204
-
1
+ # Meteocat for Home Assistant
2
+ ![Meteocat Banner](images/banner.png)
3
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
4
+ [![Python version compatibility](https://img.shields.io/pypi/pyversions/meteocat)](https://pypi.org/project/meteocat)
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](https://img.shields.io/github/downloads/figorr/meteocat/latest/total)
10
+ ![Latest release](https://img.shields.io/github/v/release/figorr/meteocat?label=latest)
11
+ [![Breaking Changes](https://img.shields.io/badge/Breaking%20Changes-critical?logo=data:image/svg+xml;base64,PHN2ZyBpZD0iTGF5ZXJfMSIgZGF0YS1uYW1lPSJMYXllciAxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMjIuODggMTExLjU0Ij48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6IzFhMWExYTt9LmNscy0ye2ZpbGw6I2ZmZWYxMTtmaWxsLXJ1bGU6ZXZlbm9kZDt9PC9zdHlsZT48L2RlZnM+PHRpdGxlPmNhdXRpb248L3RpdGxlPjxwYXRoIGNsYXNzPSJjbHMtMSIgZD0iTTIuMzUsODQuNDIsNDUuMjgsMTAuMmwuMTctLjI3aDBBMjMsMjMsMCwwLDEsNTIuNSwyLjY5LDE3LDE3LDAsMCwxLDYxLjU3LDBhMTYuNywxNi43LDAsMCwxLDkuMT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wuNTctMiw0LjYsNC42LDAsMCwxLDEuMTQtMS41NlptOC4xNS0xMC4yNGMtLjE5LDQuNzktOC4zMSw0LjgtOC40OSwwLS44Mi04LjIxLTIuOTItMjcuNy0yLjg2LTM1LjQyLjA3LTIuMzgsMi0zLjc4LDQuNTYtNC4zMmExMS4xOSwxMS4xOSwwLDAsMSwyLjQ5LS4yNCwxMS43NywxMS43NywwLDAsMSwyLjUuMjVjMi42MS41NSw0LjY1LDIsNC42NSw0LjQ0di4yNEw2NS43Miw3Mi40NVoiLz48L3N2Zz4=&logoColor=white)](#-breaking-changes---upgrade-to-3x)
12
+
13
+ This is a project to obtain meteorological data from the Meteocat API inside the Home Assistant environment.
14
+
15
+ All the data is property of Meteocat ("Servei Meteorològic de Catalunya"). This project is only a tool to offer an easy and secure access to the meteorological data provided by the "Servei Meteorològic de Catalunya" API, so you can use the data for your personal use.
16
+
17
+ Commercial use of this project or the data obtained from the API is not allowed without prior permission from the author, in case of the project, or from the "Servei Meteorològic de Catalunya" in the case of the data provided by the API.
18
+
19
+ **NOTE:** Meteocat API requires to use an API_KEY, you should ask to (https://apidocs.meteocat.gencat.cat/documentacio/acces-ciutada-i-administracio/)
20
+
21
+ # Credits
22
+
23
+ This is a personal project.
24
+
25
+ **Authors:**
26
+ - [Figorr](https://github.com/figorr)
27
+
28
+ **Contributors:**
29
+ - [mcasellas](https://github.com/mcasellas) – contributed [c505f27](https://github.com/figorr/meteocat/commit/c505f27) - Improve Catalan translations
30
+
31
+ ## ⚠️ Breaking changes - Upgrade to 3.0.0 or later coming from prior versions
32
+
33
+ Version **3.0.0 and later** introduces a **breaking change** in how entities are identified.
34
+
35
+ ### ⚠️ What this affects
36
+ - This affects any update **from a version prior to 3.0.0** to **any version 3.x or later**.
37
+ - Entities now use **`town_id`** instead of `region_id` in their `unique_id`.
38
+ - This change allows multiple integration entries that share the same `region_id` but different towns.
39
+
40
+ ### ✅ Recommended upgrade procedure
41
+ To avoid issues with duplicated or unavailable entities:
42
+
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.
45
+ 2. **Restart** Home Assistant.
46
+ 3. **Install v3.0.0 or later** and configure the integration again.
47
+
48
+ ### 🚨 If you update directly
49
+ If you update without uninstalling first:
50
+
51
+ - Old entities will remain as **Unavailable**.
52
+ - New entities will be created (sometimes with a suffix like `2`).
53
+ - You may need to manually **remove old entities** and update your automations, dashboards, or scripts to point to the new entities.
54
+
55
+ ### 📑 Additional notes
56
+
57
+ - This change affects all entity types, including **sensors, diagnostic sensors, and alerts**.
58
+ - Always backup your **Home Assistant configuration** before performing major upgrades.
59
+
60
+ ## Installation
61
+
62
+ #### HACS - Install using the custom repository method.
63
+
64
+ 1. First of all you need to add a custom repository like [this](https://hacs.xyz/docs/faq/custom_repositories/).
65
+ 1. Then download the integration from HACS.
66
+ 1. Restart Home Assistant.
67
+ 1. Go to `Settings > Devices & Services`
68
+ 1. Click `+ Add Integration`
69
+ 1. Search for `Meteocat` and follow the configuration instructions
70
+
71
+ #### HACS - Install from the store
72
+ 1. Go to `HACS`
73
+ 1. Search for `Meteocat` and add it to HACS
74
+ 1. Restart Home Assistant
75
+ 1. Go to `Settings > Devices & Services`
76
+ 1. Click `+ Add Integration`
77
+ 1. Search for `Meteocat` and follow the configuration instructions
78
+
79
+ #### Manually
80
+ Copy the `custom_components/meteocat` folder into the config folder.
81
+
82
+ ## Configuration
83
+ To add a Meteocat Device, go to `Configuration > Integrations` in the UI. Then click the `+` button and from the list of integrations select Meteocat. You will then be prompted to enter your API Key.
84
+
85
+ ![Meteocat custom component login dialog](images/login.png)
86
+
87
+ After submitting your API Key you will either be prompted to pick a town from the list as shown below.
88
+
89
+ ![Meteocat custom component town picker dialog](images/pick_town.png)
90
+
91
+ Once you pick the town you will be prompted to pick a station from the list. These are the nearest stations to the picked town.
92
+
93
+ ![Meteocat custom component station picker dialog](images/pick_station.png)
94
+
95
+ Then you will be asked to set the API limits from your plan.
96
+
97
+ ![Meteocat custom component api limits setting dialog](images/api_limits.png)
98
+
99
+ Then you will be asked to pick an area for the device.
100
+
101
+ ![Area](images/pick_area.png)
102
+
103
+ If the device is added successfully it should appear as shown.
104
+
105
+ ![Device](images/devices.png)
106
+
107
+ This device will then have the entities shown below. The sensors are translated to your system language (according to tranlation folder: en, es, ca). Or English by default.
108
+
109
+ ![Dynamic Sensors](images/dynamic_sensors.png)
110
+
111
+ ![Diagnostic Sensors](images/diagnostic_sensors.png)
112
+
113
+ ## Changing Units
114
+
115
+ To change units select one of the entities and open the more info dialog and click the cog in the top right. This will bring up the settings for the entity. Then select `Unit of Measurement`, and a dropdown will appear where you can select the units you want.
116
+
117
+ ![Entity more info settings dialog](images/change_units.png)
118
+
119
+ ## Options
120
+
121
+ Once the integration is installed, you can reconfigure some parameters without having to remove and reinstall Meteocat.
122
+
123
+ Go to:
124
+ `Settings > Devices & Services > Meteocat > Configure`
125
+
126
+ You will see three available options:
127
+
128
+ - **Update API Key and limits**
129
+ Allows you to change the API Key and update all API plan limits at the same time.
130
+
131
+ - **Update limits only**
132
+ Allows you to adjust only the API plan limits, keeping the same API Key.
133
+
134
+ - **Regenerate assets**
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.
136
+ > ℹ️ If the Meteocat API is not available at that moment, the integration will still start, and you can retry regeneration later.
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
+
141
+ ### Accessing the Options Menu
142
+
143
+ You can access the Options Menu in two ways, both inside the integration:
144
+
145
+ - **Setup Options**
146
+
147
+ ![Setup Options menu](images/setup_options.png)
148
+
149
+ - **System Options**
150
+
151
+ ![System Options menu](images/system_options.png)
152
+
153
+ Once you are inside, you will see the following options:
154
+
155
+ ![Available Options](images/options.png)
156
+
157
+
158
+ ## Uninstallation
159
+
160
+ To correctly uninstall the integration:
161
+
162
+ - If you are upgrading due to **breaking changes**, remove all configured entries from
163
+ **Settings > Devices & Services > Integrations**, restart Home Assistant, and reinstall the new version.
164
+ - If you want to **completely remove Meteocat**, after removing the entries and restarting, also uninstall the integration from **HACS > Integrations**.
165
+
166
+ 👉 For detailed steps with screenshots, check the [Uninstallation Guide](https://github.com/figorr/meteocat/wiki/Uninstallation).
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
+ ![Meteocat Card](images/daily_forecast_no_alerts.png)
175
+
176
+ # Documentation
177
+
178
+ For more detailed information about:
179
+ - Installation and configuration
180
+ - Usage examples
181
+ - Extra attributes in sensors
182
+ - Known issues and troubleshooting
183
+
184
+ please visit the [📖 Meteocat Wiki](https://github.com/figorr/meteocat/wiki).
185
+
186
+ # Contributing
187
+
188
+ 1. [Check for open features/bugs](https://github.com/figorr/meteocat/issues)
189
+ or [initiate a discussion on one](https://github.com/figorr/meteocat/issues/new/choose).
190
+ 2. [Fork the repository](https://github.com/figorr/meteocat/fork).
191
+ 3. Install the dev environment: `make init`.
192
+ 4. Enter the virtual environment: `pipenv shell`
193
+ 5. Code your new feature or bug fix.
194
+ 6. Write a test that covers your new functionality.
195
+ 7. Update `README.md` with any new documentation.
196
+ 8. Run tests and ensure 100% code coverage for your contribution: `make coverage`
197
+ 9. Ensure you have no linting errors: `make lint`
198
+ 10. Ensure you have typed your code correctly: `make typing`
199
+ 11. Add yourself to `AUTHORS.md`.
200
+ 12. Submit a pull request!
201
+
202
+ # License
203
+
204
+ [Apache-2.0](LICENSE). By providing a contribution, you agree the contribution is licensed under Apache-2.0.
205
+
206
+ # API Reference
207
+
205
208
  [See the docs 📚](https://apidocs.meteocat.gencat.cat/section/informacio-general/).
package/conftest.py CHANGED
@@ -1,11 +1,11 @@
1
- import pytest
2
- from homeassistant.core import HomeAssistant
3
- from pytest_homeassistant_custom_component.common import mock_component
4
- from homeassistant.setup import async_setup_component
5
-
6
- @pytest.fixture(autouse=True)
7
- async def auto_enable_custom_integrations(hass: HomeAssistant):
8
- """Enable custom integrations."""
9
- mock_component(hass, "meteocat")
10
- await async_setup_component(hass, 'meteocat', {})
11
- yield
1
+ import pytest
2
+ from homeassistant.core import HomeAssistant
3
+ from pytest_homeassistant_custom_component.common import mock_component
4
+ from homeassistant.setup import async_setup_component
5
+
6
+ @pytest.fixture(autouse=True)
7
+ async def auto_enable_custom_integrations(hass: HomeAssistant):
8
+ """Enable custom integrations."""
9
+ mock_component(hass, "meteocat")
10
+ await async_setup_component(hass, 'meteocat', {})
11
+ yield