Skip to content

Commit

Permalink
Merge branch 'master' into patch-7
Browse files Browse the repository at this point in the history
  • Loading branch information
CFenner authored Oct 7, 2024
2 parents 7f33124 + 7c0cded commit a9f0b96
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/[email protected].0
uses: actions/[email protected].1
- name: 🚀 Sort test response data
run: |
find './tests/response' \
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/[email protected].0
uses: actions/[email protected].1
- name: 🏗 Set up Poetry
run: pipx install poetry
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
Expand All @@ -38,7 +38,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/[email protected].0
uses: actions/[email protected].1
- name: 🏗 Set up Poetry
run: pipx install poetry
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
Expand All @@ -63,7 +63,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/[email protected].0
uses: actions/[email protected].1
- name: 🏗 Set up Poetry
run: pipx install poetry
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
id-token: write
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/[email protected].0
uses: actions/[email protected].1
- name: 🏗 Set up Poetry
run: pipx install poetry
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/[email protected].0
uses: actions/[email protected].1
- name: 🏗 Set up Poetry
run: pipx install poetry
- name: 🏗 Set up Python ${{ matrix.python }}
Expand All @@ -39,7 +39,7 @@ jobs:
- name: 🚀 Run pytest
run: poetry run pytest --cov PyViCare
- name: ⬆️ Upload coverage artifact
uses: actions/[email protected].0
uses: actions/[email protected].1
with:
name: coverage-${{ matrix.python }}
path: .coverage
2 changes: 1 addition & 1 deletion .github/workflows/type.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/[email protected].0
uses: actions/[email protected].1
- name: 🏗 Set up Poetry
run: pipx install poetry
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
Expand Down
6 changes: 6 additions & 0 deletions PyViCare/PyViCareDevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ def __init__(self, service: ViCareService) -> None:
def getSerial(self):
return self.service.getProperty("device.serial")["properties"]["value"]["value"]

def isLegacyDevice(self) -> bool:
return self.service.hasRoles(["type:legacy"])

def isE3Device(self) -> bool:
return self.service.hasRoles(["type:E3"])

def isDomesticHotWaterDevice(self):
return self._isTypeDevice("heating.dhw")

Expand Down
38 changes: 19 additions & 19 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 14 additions & 1 deletion tests/test_PyViCareDeviceConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ def test_autoDetect_RoleVentilation_asVentilation(self):
self.assertEqual("VentilationDevice", type(device_type).__name__)

def test_autoDetect_Vitoair_FS_300E_asVentilation(self):
# self.service.hasRoles = has_roles(["type:ventilation"])
c = PyViCareDeviceConfig(self.service, "0", "E3_ViAir_300F", "Online")
device_type = c.asAutoDetectDevice()
self.assertEqual("VentilationDevice", type(device_type).__name__)
Expand Down Expand Up @@ -121,3 +120,17 @@ def test_autoDetect_RoleGateway_asGateway_TCU300(self):
c = PyViCareDeviceConfig(self.service, "0", "Unknown", "Online")
device_type = c.asAutoDetectDevice()
self.assertEqual("Gateway", type(device_type).__name__)

def test_legacy_device(self):
self.service.hasRoles = has_roles(["type:legacy"])
c = PyViCareDeviceConfig(self.service, "0", "Unknown", "Online")
device = c.asAutoDetectDevice()
self.assertEqual(device.isLegacyDevice(), True)
self.assertEqual(device.isE3Device(), False)

def test_e3_device(self):
self.service.hasRoles = has_roles(["type:E3"])
c = PyViCareDeviceConfig(self.service, "0", "Unknown", "Online")
device = c.asAutoDetectDevice()
self.assertEqual(device.isLegacyDevice(), False)
self.assertEqual(device.isE3Device(), True)

0 comments on commit a9f0b96

Please sign in to comment.