From becf3980ff92f1b88b156cce847d5637fc625000 Mon Sep 17 00:00:00 2001 From: Erwin Douna Date: Mon, 22 Sep 2025 19:21:57 +0000 Subject: [PATCH 1/4] Add fanSpeeds --- .github/workflows/tests.yaml | 4 +++- .pre-commit-config.yaml | 2 +- src/tadoasync/models.py | 3 +++ tests/__snapshots__/test_tado.ambr | 7 +++++++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index a278bd5..6bb3864 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -35,7 +35,7 @@ jobs: - name: ๐Ÿ— Install dependencies run: poetry install --no-interaction - name: ๐Ÿš€ Run pytest - run: poetry run pytest --cov tado tests + run: poetry run pytest --cov tado tests --cov-fail-under=95 - name: โฌ†๏ธ Upload coverage artifact uses: actions/upload-artifact@v4.3.1 with: @@ -71,6 +71,8 @@ jobs: run: | poetry run coverage combine coverage*/.coverage* poetry run coverage xml -i + - name: โœ… Enforce minimum coverage (95%) + run: poetry run coverage report -m --fail-under=95 - name: ๐Ÿš€ Upload coverage report uses: codecov/codecov-action@v4.1.0 with: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 27adace..51d1bdf 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -112,7 +112,7 @@ repos: name: ๐Ÿงช Running tests and test coverage with pytest language: system types: [python] - entry: poetry run pytest + entry: poetry run pytest --cov=. --cov-report=term-missing --cov-report=xml --cov-fail-under=95 pass_filenames: false - id: trailing-whitespace name: โœ„ Trim Trailing Whitespace diff --git a/src/tadoasync/models.py b/src/tadoasync/models.py index 81cd51e..dfb25c6 100644 --- a/src/tadoasync/models.py +++ b/src/tadoasync/models.py @@ -308,6 +308,9 @@ class AutoAC(DataClassORJSONMixin): fan_level: list[str] | None = field( default=None, metadata=field_options(alias="fanLevel") ) + fan_speeds: list[str] | None = field( + default=None, metadata=field_options(alias="fanSpeeds") + ) vertical_swing: list[str] | None = field( default=None, metadata=field_options(alias="verticalSwing") ) diff --git a/tests/__snapshots__/test_tado.ambr b/tests/__snapshots__/test_tado.ambr index 73bb60e..b9f37c2 100644 --- a/tests/__snapshots__/test_tado.ambr +++ b/tests/__snapshots__/test_tado.ambr @@ -34,6 +34,12 @@ dict({ 'auto': dict({ 'fan_level': None, + 'fan_speeds': list([ + 'AUTO', + 'HIGH', + 'MIDDLE', + 'LOW', + ]), 'horizontal_swing': None, 'light': None, 'temperatures': None, @@ -106,6 +112,7 @@ 'LEVEL5', 'SILENT', ]), + 'fan_speeds': None, 'horizontal_swing': list([ 'OFF', 'ON', From 212aa5f93a4e3e3ab034d913e52f2d8e00fb36b4 Mon Sep 17 00:00:00 2001 From: Erwin Douna Date: Mon, 22 Sep 2025 19:29:10 +0000 Subject: [PATCH 2/4] Update project --- pyproject.toml | 71 ++++++++++++++------------------------------------ 1 file changed, 20 insertions(+), 51 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index bb46b30..69bb184 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "tadoasync" -version = "0.1.21" +version = "0.2.1" authors = ["Erwin Douna "] classifiers = [ "Development Status :: 5 - Production/Stable", @@ -50,12 +50,22 @@ yamllint = "1.33.0" syrupy = "4.6.1" deptry = "^0.19.1" +[tool.coverage.run] +source = ["tado"] +omit = [ + "tests/*", + "*/.venv/*", + "*/venv/*", + "*/site-packages/*", +] + [tool.coverage.report] show_missing = true - -[tool.coverage.run] -plugins = ["covdefaults"] -source = ["tadoasync"] +fail_under = 95 +exclude_lines = [ + "pragma: no cover", + "if __name__ == \"__main__\":", +] [tool.mypy] # Specify the target platform details in config, so your developers are @@ -106,50 +116,9 @@ ignore-imports = true max-line-length = 88 [tool.pytest.ini_options] -addopts = "--cov" -asyncio_mode = "auto" - -[tool.ruff] -ignore = [ - "ANN101", # Self... explanatory - "ANN102", # cls... just as useless - "ANN401", # Opinioated warning on disallowing dynamically typed expressions - "D203", # Conflicts with other rules - "ARG002", # Conflicts with other rules - "D213", # Conflicts with other rules - "D417", # False positives in some occasions - "PLR2004", # Just annoying, not really useful - "SLOT000", # Has a bug with enums: https://github.com/astral-sh/ruff/issues/5748 - "TRY003", # Avoid specifying long messages outside the exception class - "EM101", # Exception must not use a string literal, assign to variable first - "EM102", # Exception must not use an f-string literal, assign to variable first - "PLR0913", # Too many arguments in function definition - "N815", # Scope should not be mixedCase - "PLR0912", # Too many branches - "PLR0915", # Too many statements - "C901", # Too complex - - # Conflicts with the Ruff formatter - "COM812", - "ISC001", +addopts = [ + "--cov=tado", + "--cov-report=term-missing", + "--cov-report=xml", + "--cov-fail-under=95", ] -select = ["ALL"] - -[tool.ruff.flake8-pytest-style] -fixture-parentheses = false -mark-parentheses = false - -[tool.ruff.isort] -known-first-party = ["tado"] - -[tool.ruff.lint.flake8-type-checking] -runtime-evaluated-base-classes = [ - "mashumaro.mixins.orjson.DataClassORJSONMixin", -] - -[tool.ruff.mccabe] -max-complexity = 25 - -[build-system] -build-backend = "poetry.core.masonry.api" -requires = ["poetry-core>=1.0.0"] From bb847ea6780addcba9747b153a39db28c2cada17 Mon Sep 17 00:00:00 2001 From: Erwin Douna Date: Mon, 22 Sep 2025 19:32:09 +0000 Subject: [PATCH 3/4] Revert --- pyproject.toml | 69 ++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 50 insertions(+), 19 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 69bb184..9039bc4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,22 +50,12 @@ yamllint = "1.33.0" syrupy = "4.6.1" deptry = "^0.19.1" -[tool.coverage.run] -source = ["tado"] -omit = [ - "tests/*", - "*/.venv/*", - "*/venv/*", - "*/site-packages/*", -] - [tool.coverage.report] show_missing = true -fail_under = 95 -exclude_lines = [ - "pragma: no cover", - "if __name__ == \"__main__\":", -] + +[tool.coverage.run] +plugins = ["covdefaults"] +source = ["tadoasync"] [tool.mypy] # Specify the target platform details in config, so your developers are @@ -116,9 +106,50 @@ ignore-imports = true max-line-length = 88 [tool.pytest.ini_options] -addopts = [ - "--cov=tado", - "--cov-report=term-missing", - "--cov-report=xml", - "--cov-fail-under=95", +addopts = "--cov" +asyncio_mode = "auto" + +[tool.ruff] +ignore = [ + "ANN101", # Self... explanatory + "ANN102", # cls... just as useless + "ANN401", # Opinioated warning on disallowing dynamically typed expressions + "D203", # Conflicts with other rules + "ARG002", # Conflicts with other rules + "D213", # Conflicts with other rules + "D417", # False positives in some occasions + "PLR2004", # Just annoying, not really useful + "SLOT000", # Has a bug with enums: https://github.com/astral-sh/ruff/issues/5748 + "TRY003", # Avoid specifying long messages outside the exception class + "EM101", # Exception must not use a string literal, assign to variable first + "EM102", # Exception must not use an f-string literal, assign to variable first + "PLR0913", # Too many arguments in function definition + "N815", # Scope should not be mixedCase + "PLR0912", # Too many branches + "PLR0915", # Too many statements + "C901", # Too complex + + # Conflicts with the Ruff formatter + "COM812", + "ISC001", ] +select = ["ALL"] + +[tool.ruff.flake8-pytest-style] +fixture-parentheses = false +mark-parentheses = false + +[tool.ruff.isort] +known-first-party = ["tado"] + +[tool.ruff.lint.flake8-type-checking] +runtime-evaluated-base-classes = [ + "mashumaro.mixins.orjson.DataClassORJSONMixin", +] + +[tool.ruff.mccabe] +max-complexity = 25 + +[build-system] +build-backend = "poetry.core.masonry.api" +requires = ["poetry-core>=1.0.0"] From 6eb4cfc06e5368a2dc132553c38bb66013c8971a Mon Sep 17 00:00:00 2001 From: Erwin Douna Date: Mon, 22 Sep 2025 19:36:31 +0000 Subject: [PATCH 4/4] Adjustments --- .github/workflows/tests.yaml | 2 +- .pre-commit-config.yaml | 2 +- pyproject.toml | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 6bb3864..0539722 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -35,7 +35,7 @@ jobs: - name: ๐Ÿ— Install dependencies run: poetry install --no-interaction - name: ๐Ÿš€ Run pytest - run: poetry run pytest --cov tado tests --cov-fail-under=95 + run: poetry run pytest --cov=tadoasync tests --cov-fail-under=95 - name: โฌ†๏ธ Upload coverage artifact uses: actions/upload-artifact@v4.3.1 with: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 51d1bdf..6e8bb92 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -112,7 +112,7 @@ repos: name: ๐Ÿงช Running tests and test coverage with pytest language: system types: [python] - entry: poetry run pytest --cov=. --cov-report=term-missing --cov-report=xml --cov-fail-under=95 + entry: poetry run pytest --cov=tadoasync --cov-report=term-missing --cov-report=xml --cov-fail-under=95 pass_filenames: false - id: trailing-whitespace name: โœ„ Trim Trailing Whitespace diff --git a/pyproject.toml b/pyproject.toml index 9039bc4..c3055a2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,6 +52,7 @@ deptry = "^0.19.1" [tool.coverage.report] show_missing = true +fail_under = 95 [tool.coverage.run] plugins = ["covdefaults"]