From 68bb80b859bc38b45a13a835dce20064f82b8788 Mon Sep 17 00:00:00 2001 From: Christopher Fenner <9592452+CFenner@users.noreply.github.com> Date: Wed, 20 Nov 2024 07:34:55 +0100 Subject: [PATCH] feat: Expose ventilation state (#456) * Update PyViCareVentilationDevice.py * Update test_VitoairFs300E.py * Update test_Vitopure350.py * Update test_VitoairFs300E.py * Update test_Vitopure350.py * Update test_Vitopure350.py * Update test_VitoairFs300E.py * Update test_VitoairFs300E.py --- PyViCare/PyViCareVentilationDevice.py | 12 ++++++++++++ tests/test_VitoairFs300E.py | 5 +++++ tests/test_Vitopure350.py | 5 +++++ 3 files changed, 22 insertions(+) diff --git a/PyViCare/PyViCareVentilationDevice.py b/PyViCare/PyViCareVentilationDevice.py index a232ce88..39bd586c 100644 --- a/PyViCare/PyViCareVentilationDevice.py +++ b/PyViCare/PyViCareVentilationDevice.py @@ -91,3 +91,15 @@ def getSchedule(self): "sat": properties["entries"]["value"]["sat"], "sun": properties["entries"]["value"]["sun"] } + + @handleNotSupported + def getVentilationDemand(self) -> str: + return str(self.service.getProperty("ventilation.operating.state")["properties"]["demand"]["value"]) + + @handleNotSupported + def getVentilationLevel(self) -> str: + return str(self.service.getProperty("ventilation.operating.state")["properties"]["level"]["value"]) + + @handleNotSupported + def getVentilationReason(self) -> str: + return str(self.service.getProperty("ventilation.operating.state")["properties"]["reason"]["value"]) diff --git a/tests/test_VitoairFs300E.py b/tests/test_VitoairFs300E.py index 7fb7991b..79362da6 100644 --- a/tests/test_VitoairFs300E.py +++ b/tests/test_VitoairFs300E.py @@ -38,3 +38,8 @@ def test_getSchedule(self): def test_getSerial(self): self.assertEqual(self.device.getSerial(), "################") + + def test_ventilationState(self): + self.assertEqual(self.device.getVentilationDemand(), "unknown") + self.assertEqual(self.device.getVentilationLevel(), "levelFour") + self.assertEqual(self.device.getVentilationReason(), "sensorOverride") diff --git a/tests/test_Vitopure350.py b/tests/test_Vitopure350.py index 9b32282b..936b9b5d 100644 --- a/tests/test_Vitopure350.py +++ b/tests/test_Vitopure350.py @@ -31,3 +31,8 @@ def test_getSchedule(self): def test_getSerial(self): with self.assertRaises(PyViCareNotSupportedFeatureError): self.device.getSerial() + + def test_ventilationState(self): + self.assertEqual(self.device.getVentilationDemand(), "unknown") + self.assertEqual(self.device.getVentilationLevel(), "unknown") + self.assertEqual(self.device.getVentilationReason(), "sensorDriven")