Skip to content

Commit 67a1fd4

Browse files
authored
feat: Expose if a device supports dhw, solar thermal or ventilation capabilities (#360)
* Update PyViCareDevice.py * Update PyViCareDevice.py * Update test_Solar.py * Update test_VitoairFs300E.py * Create test_Vitovent.py * Create Vitovent.json * Update test_Vitocal222S.py * Update test_Vitodens200W.py * Update PyViCareDevice.py * Update test_Vitocal222S.py * Update test_Solar.py * update tests * handle exceptions * ignore pylint issue for now * ignore new properties * test gateway.devices * test 'heating.solar' * check isEnabled and active property * add further test cases * remove isHeatingDevice * reorder * change asserts * Update and rename Vitovent.json to Vitocal-200S-with-Vitovent-300W.json * Update and rename test_Vitovent.py to test_vitocal-with-vitovent.py * sort * Update test_TestForMissingProperties.py
1 parent 7cf8605 commit 67a1fd4

14 files changed

+3698
-2
lines changed

PyViCare/PyViCareDevice.py

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from PyViCare.PyViCareService import ViCareService
2-
from PyViCare.PyViCareUtils import handleNotSupported
2+
from PyViCare.PyViCareUtils import PyViCareNotSupportedFeatureError, handleNotSupported
33

44

55
class Device:
@@ -21,3 +21,18 @@ def isLegacyDevice(self) -> bool:
2121

2222
def isE3Device(self) -> bool:
2323
return self.service.hasRoles(["type:E3"])
24+
25+
def isDomesticHotWaterDevice(self):
26+
return self._isTypeDevice("heating.dhw")
27+
28+
def isSolarThermalDevice(self):
29+
return self._isTypeDevice("heating.solar")
30+
31+
def isVentilationDevice(self):
32+
return self._isTypeDevice("ventilation")
33+
34+
def _isTypeDevice(self, deviceType: str):
35+
try:
36+
return self.service.getProperty(deviceType)["isEnabled"] and self.service.getProperty(deviceType)["properties"]["active"]["value"]
37+
except PyViCareNotSupportedFeatureError:
38+
return False

0 commit comments

Comments
 (0)