Skip to content

Commit

Permalink
feat: Expose ventilation levels (#454)
Browse files Browse the repository at this point in the history
* Update PyViCareVentilationDevice.py

* Update PyViCareVentilationDevice.py

* Update test_Vitopure350.py

* Update test_VitoairFs300E.py
  • Loading branch information
CFenner authored Nov 20, 2024
1 parent 68bb80b commit af4154c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions PyViCare/PyViCareVentilationDevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ def deactivateProgram(self, program):
"""
return self.service.setProperty(f"ventilation.operating.programs.{program}", "deactivate", {})

@handleNotSupported
def getPermanentLevels(self) -> list[str]:
return list[str](self.service.getProperty("ventilation.operating.modes.permanent")["commands"]["setLevel"]["params"]["level"]["constraints"]["enum"])

@handleAPICommandErrors
def setPermanentLevel(self, level: str):
return self.service.setProperty("ventilation.operating.modes.permanent", "setLevel", {'level': level})
Expand Down
4 changes: 4 additions & 0 deletions tests/test_VitoairFs300E.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ def test_getAvailablePrograms(self):
expected_programs = ['standby']
self.assertListEqual(self.device.getAvailablePrograms(), expected_programs)

def test_getPermanentLevels(self):
expected_levels = ['levelOne', 'levelTwo', 'levelThree', 'levelFour']
self.assertListEqual(expected_levels, self.device.getPermanentLevels())

def test_getSchedule(self):
keys = ['active', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun']
self.assertListEqual(list(self.device.getSchedule().keys()), keys)
Expand Down
4 changes: 4 additions & 0 deletions tests/test_Vitopure350.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ def test_getAvailablePrograms(self):
expected_programs = ['standby']
self.assertListEqual(expected_programs, self.device.getAvailablePrograms())

def test_getPermanentLevels(self):
expected_levels = ['levelOne', 'levelTwo', 'levelThree', 'levelFour']
self.assertListEqual(expected_levels, self.device.getPermanentLevels())

def test_getSchedule(self):
keys = ['active', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun']
self.assertListEqual(keys, list(self.device.getSchedule().keys()))
Expand Down

0 comments on commit af4154c

Please sign in to comment.