Skip to content

Commit

Permalink
feat: Expose if a device supports dhw, solar thermal or ventilation c…
Browse files Browse the repository at this point in the history
…apabilities (#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
  • Loading branch information
CFenner authored Nov 11, 2024
1 parent 7cf8605 commit 67a1fd4
Show file tree
Hide file tree
Showing 14 changed files with 3,698 additions and 2 deletions.
17 changes: 16 additions & 1 deletion PyViCare/PyViCareDevice.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from PyViCare.PyViCareService import ViCareService
from PyViCare.PyViCareUtils import handleNotSupported
from PyViCare.PyViCareUtils import PyViCareNotSupportedFeatureError, handleNotSupported


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

def isE3Device(self) -> bool:
return self.service.hasRoles(["type:E3"])

def isDomesticHotWaterDevice(self):
return self._isTypeDevice("heating.dhw")

def isSolarThermalDevice(self):
return self._isTypeDevice("heating.solar")

def isVentilationDevice(self):
return self._isTypeDevice("ventilation")

def _isTypeDevice(self, deviceType: str):
try:
return self.service.getProperty(deviceType)["isEnabled"] and self.service.getProperty(deviceType)["properties"]["active"]["value"]
except PyViCareNotSupportedFeatureError:
return False
Loading

0 comments on commit 67a1fd4

Please sign in to comment.