From af4154cb6d4074e42de4a0eab06faf6aad8722ac Mon Sep 17 00:00:00 2001 From: Christopher Fenner <9592452+CFenner@users.noreply.github.com> Date: Wed, 20 Nov 2024 07:37:16 +0100 Subject: [PATCH] feat: Expose ventilation levels (#454) * Update PyViCareVentilationDevice.py * Update PyViCareVentilationDevice.py * Update test_Vitopure350.py * Update test_VitoairFs300E.py --- PyViCare/PyViCareVentilationDevice.py | 4 ++++ tests/test_VitoairFs300E.py | 4 ++++ tests/test_Vitopure350.py | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/PyViCare/PyViCareVentilationDevice.py b/PyViCare/PyViCareVentilationDevice.py index 39bd586c..3a8b4141 100644 --- a/PyViCare/PyViCareVentilationDevice.py +++ b/PyViCare/PyViCareVentilationDevice.py @@ -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}) diff --git a/tests/test_VitoairFs300E.py b/tests/test_VitoairFs300E.py index 79362da6..58648a5f 100644 --- a/tests/test_VitoairFs300E.py +++ b/tests/test_VitoairFs300E.py @@ -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) diff --git a/tests/test_Vitopure350.py b/tests/test_Vitopure350.py index 936b9b5d..da8af80c 100644 --- a/tests/test_Vitopure350.py +++ b/tests/test_Vitopure350.py @@ -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()))