Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 1.1.0 #180

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions .devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ludeeus/integration_blueprint",
"image": "mcr.microsoft.com/vscode/devcontainers/python:3.12-bullseye",
"image": "mcr.microsoft.com/devcontainers/python:3.12",
"postCreateCommand": "scripts/setup",
"forwardPorts": [
8123
Expand All @@ -14,25 +14,28 @@
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"charliermarsh.ruff",
"github.vscode-pull-request-github",
"ryanluker.vscode-coverage-gutters",
"ms-python.vscode-pylance"
"ms-python.python",
"ms-python.vscode-pylance",
"ryanluker.vscode-coverage-gutters"
],
"settings": {
"files.eol": "\n",
"editor.tabSize": 4,
"python.pythonPath": "/usr/bin/python3",
"python.analysis.autoSearchPaths": false,
"editor.formatOnPaste": false,
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true
"editor.formatOnType": false,
"files.trimTrailingWhitespace": true,
"python.analysis.typeCheckingMode": "basic",
"python.analysis.autoImportCompletions": true,
"python.defaultInterpreterPath": "/usr/local/bin/python",
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff"
}
}
}
},
"remoteUser": "vscode",
"features": {
"ghcr.io/devcontainers/features/rust:1": {}
}
"features": {}
}
68 changes: 34 additions & 34 deletions .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,47 @@

target-version = "py310"

select = [
"B007", # Loop control variable {name} not used within loop body
"B014", # Exception handler with duplicate exception
"C", # complexity
"D", # docstrings
"E", # pycodestyle
"F", # pyflakes/autoflake
"ICN001", # import concentions; {name} should be imported as {asname}
lint.select = [
"B007", # Loop control variable {name} not used within loop body
"B014", # Exception handler with duplicate exception
"C", # complexity
"D", # docstrings
"E", # pycodestyle
"F", # pyflakes/autoflake
"ICN001", # import concentions; {name} should be imported as {asname}
"PGH004", # Use specific rule codes when using noqa
"PLC0414", # Useless import alias. Import alias does not rename original package.
"SIM105", # Use contextlib.suppress({exception}) instead of try-except-pass
"SIM117", # Merge with-statements that use the same scope
"SIM118", # Use {key} in {dict} instead of {key} in {dict}.keys()
"SIM201", # Use {left} != {right} instead of not {left} == {right}
"SIM212", # Use {a} if {a} else {b} instead of {b} if not {a} else {a}
"SIM300", # Yoda conditions. Use 'age == 42' instead of '42 == age'.
"SIM401", # Use get from dict with default instead of an if block
"T20", # flake8-print
"TRY004", # Prefer TypeError exception for invalid type
"RUF006", # Store a reference to the return value of asyncio.create_task
"UP", # pyupgrade
"W", # pycodestyle
"SIM105", # Use contextlib.suppress({exception}) instead of try-except-pass
"SIM117", # Merge with-statements that use the same scope
"SIM118", # Use {key} in {dict} instead of {key} in {dict}.keys()
"SIM201", # Use {left} != {right} instead of not {left} == {right}
"SIM212", # Use {a} if {a} else {b} instead of {b} if not {a} else {a}
"SIM300", # Yoda conditions. Use 'age == 42' instead of '42 == age'.
"SIM401", # Use get from dict with default instead of an if block
"T20", # flake8-print
"TRY004", # Prefer TypeError exception for invalid type
"RUF006", # Store a reference to the return value of asyncio.create_task
"UP", # pyupgrade
"W", # pycodestyle
]

ignore = [
"D202", # No blank lines allowed after function docstring
"D203", # 1 blank line required before class docstring
"D213", # Multi-line docstring summary should start at the second line
"D404", # First word of the docstring should not be This
"D406", # Section name should end with a newline
"D407", # Section name underlining
"D411", # Missing blank line before section
"E501", # line too long
"E731", # do not assign a lambda expression, use a def
lint.ignore = [
"D202", # No blank lines allowed after function docstring
"D203", # 1 blank line required before class docstring
"D213", # Multi-line docstring summary should start at the second line
"D404", # First word of the docstring should not be This
"D406", # Section name should end with a newline
"D407", # Section name underlining
"D411", # Missing blank line before section
"E501", # line too long
"E731", # do not assign a lambda expression, use a def
]

[flake8-pytest-style]
[lint.flake8-pytest-style]
fixture-parentheses = false

[pyupgrade]
[lint.pyupgrade]
keep-runtime-typing = true

[mccabe]
max-complexity = 25
[lint.mccabe]
max-complexity = 25
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## Release 1.1.0

Date: `NOT REASED YET`

### Changes

* **BREAKING CHANGE** As of 2024.10.x of Home Assistant, the integration is now creating the error `weatherflow_forecast has an invalid unique_id`. With this release, this has been fixed as the Unique ID hasd been changed to live up to new requirements. The integration will continue to run even after installing this update and without doing anything, but the only way you can get rid of the error in the log, is to remove the integration and add it again.


## Release 1.0.11

Date: `2024-10-21`
Expand Down
3 changes: 2 additions & 1 deletion custom_components/weatherflow_forecast/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ async def async_step_user(self, user_input: dict[str, Any] | None = None) -> Flo
errors["base"] = "wrong_token"
return await self._show_setup_form(errors)

await self.async_set_unique_id(user_input[CONF_STATION_ID])
_LOGGER.debug("Unique ID: %s", f"{user_input[CONF_STATION_ID]}-{station_data.device_id}")
await self.async_set_unique_id(f"{user_input[CONF_STATION_ID]}-{station_data.device_id}")
self._abort_if_unique_id_configured

return self.async_create_entry(
Expand Down
2 changes: 1 addition & 1 deletion custom_components/weatherflow_forecast/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
"requirements": [
"pyweatherflow-forecast==1.1.0"
],
"version": "1.0.11"
"version": "1.1.0"
}
3 changes: 2 additions & 1 deletion custom_components/weatherflow_forecast/weather.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ async def async_setup_entry(
name = DEFAULT_NAME
elif TYPE_CHECKING:
assert isinstance(name, str)
_LOGGER.debug("Setting up weather entity for station %s", name)

entities = [WeatherFlowWeather(coordinator, config_entry.data,
False, name, is_metric)]
Expand All @@ -73,7 +74,7 @@ async def async_setup_entry(

def _calculate_unique_id(config: MappingProxyType[str, Any], hourly: bool) -> str:
"""Calculate unique ID."""
name_appendix = ""
name_appendix = "-daily"
if hourly:
name_appendix = "-hourly"

Expand Down
1 change: 1 addition & 0 deletions scripts/setup
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ set -e

cd "$(dirname "$0")/.."

python3 -m pip install --upgrade pip
python3 -m pip install --requirement requirements.txt