Skip to content
Merged
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
58 changes: 0 additions & 58 deletions .github/workflows/build.yml

This file was deleted.

85 changes: 85 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
name: Linting

# yamllint disable-line rule:truthy
on:
push:
branches:
- main
pull_request:
workflow_dispatch:

env:
DEFAULT_PYTHON: "3.11"

jobs:
codespell:
name: codespell
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@v4.1.7
- name: 🏗 Set up Poetry
run: pipx install poetry
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@v5.1.1
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache: "poetry"
- name: 🏗 Install workflow dependencies
run: |
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
- name: 🏗 Install Python dependencies
run: poetry install --no-interaction
- name: 🚀 Check code for common misspellings
run: poetry run codespell **/*.py

ruff:
name: Ruff
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@v4.1.7
- name: 🏗 Set up Poetry
run: pipx install poetry
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@v5.1.1
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache: "poetry"
- name: 🏗 Install workflow dependencies
run: |
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
- name: 🏗 Install Python dependencies
run: poetry install --no-interaction
- name: 🚀 Run ruff linter
run: poetry run ruff check --output-format=github .
# - name: 🚀 Run ruff formatter
# run: poetry run ruff format --check .

pylint:
name: pylint
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@v4.1.7
- name: 🏗 Set up Poetry
run: pipx install poetry
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@v5.1.1
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache: "poetry"
- name: 🏗 Install workflow dependencies
run: |
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
- name: 🏗 Install Python dependencies
run: poetry install --no-interaction
- name: 🚀 Run pylint
run: poetry run pylint **/*.py
44 changes: 44 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Testing

# yamllint disable-line rule:truthy
on:
push:
branches:
- main
pull_request:
workflow_dispatch:

env:
DEFAULT_PYTHON: "3.11"

jobs:
pytest:
name: Python ${{ matrix.python }}
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.11", "3.12"]
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/checkout@v4.1.7
- name: 🏗 Set up Poetry
run: pipx install poetry
- name: 🏗 Set up Python ${{ matrix.python }}
id: python
uses: actions/setup-python@v5.1.1
with:
python-version: ${{ matrix.python }}
cache: "poetry"
- name: 🏗 Install workflow dependencies
run: |
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
- name: 🏗 Install dependencies
run: poetry install --no-interaction
- name: 🚀 Run pytest
run: poetry run pytest --cov src tests
- name: ⬆️ Upload coverage artifact
uses: actions/upload-artifact@v4.3.6
with:
name: coverage-${{ matrix.python }}
path: .coverage
2 changes: 1 addition & 1 deletion PyViCare/Feature.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Feature flag to raise an exception in case of a non existing device feature.
# The flag should be fully removed in a later release.
# It allows dependend libraries to gracefully migrate to the new behaviour
# It allows dependent libraries to gracefully migrate to the new behaviour
raise_exception_on_not_supported_device_feature = True

# Feature flag to raise exception if rate limit of the API is hit
Expand Down
46 changes: 23 additions & 23 deletions PyViCare/PyViCareHeatPump.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,18 @@ def getAvailableVentilationModes(self):
def getActiveVentilationMode(self):
return self.service.getProperty("ventilation.operating.modes.active")["properties"]["value"]["value"]

""" Set the active mode
Parameters
----------
mode : str
Valid mode can be obtained using getModes()

Returns
-------
result: json
json representation of the answer
"""
def setActiveVentilationMode(self, mode):
""" Set the active mode
Parameters
----------
mode : str
Valid mode can be obtained using getModes()

Returns
-------
result: json
json representation of the answer
"""
return self.service.setProperty("ventilation.operating.modes.active", "setMode", {'mode': mode})

@handleNotSupported
Expand All @@ -137,19 +137,19 @@ def getAvailableVentilationPrograms(self):
def getActiveVentilationProgram(self):
return self.service.getProperty("ventilation.operating.programs.active")["properties"]["value"]["value"]

""" Activate a ventilation program
NOTE
DEVICE_COMMUNICATION_ERROR can just mean that the program is already on
Parameters
----------
program : str

Returns
-------
result: json
json representation of the answer
"""
def activateVentilationProgram(self, program):
""" Activate a ventilation program
NOTE
DEVICE_COMMUNICATION_ERROR can just mean that the program is already on
Parameters
----------
program : str

Returns
-------
result: json
json representation of the answer
"""
return self.service.setProperty(f"ventilation.operating.programs.{program}", "activate", {})

class Compressor(HeatingDeviceWithComponent):
Expand Down
Loading