Skip to content

Commit

Permalink
feat: Expose ventilation state (#456)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
CFenner authored Nov 20, 2024
1 parent c122f3f commit 68bb80b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
12 changes: 12 additions & 0 deletions PyViCare/PyViCareVentilationDevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
5 changes: 5 additions & 0 deletions tests/test_VitoairFs300E.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
5 changes: 5 additions & 0 deletions tests/test_Vitopure350.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

0 comments on commit 68bb80b

Please sign in to comment.