Skip to content

Commit

Permalink
feat: add new sensors for DomesticHotWaterStorage (#404)
Browse files Browse the repository at this point in the history
* add new sensors for DomesticHotWaterStorage

* remove ignore properties

* add test cases

* Update test_Vitocal250A.py

* update test case
  • Loading branch information
CFenner authored Oct 29, 2024
1 parent bf7a655 commit 4cec5d1
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 12 deletions.
25 changes: 17 additions & 8 deletions PyViCare/PyViCareHeatingDevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,30 @@ def getOutsideTemperature(self):
def getDomesticHotWaterConfiguredTemperature(self):
return self.service.getProperty("heating.dhw.temperature.main")["properties"]["value"]["value"]

@handleNotSupported
def getDomesticHotWaterStorageTemperature(self):
return self.service.getProperty("heating.dhw.sensors.temperature.dhwCylinder")["properties"]["value"][
"value"]

@handleNotSupported
def getHotWaterStorageTemperatureTop(self):
return self.service.getProperty("heating.dhw.sensors.temperature.dhwCylinder.top")["properties"]["value"][
"value"]

@handleNotSupported
def getDomesticHotWaterStorageTemperatureMiddle(self):
return self.service.getProperty("heating.dhw.sensors.temperature.dhwCylinder.middle")["properties"]["value"][
"value"]

@handleNotSupported
def getDomesticHotWaterStorageTemperatureMidBottom(self):
return self.service.getProperty("heating.dhw.sensors.temperature.dhwCylinder.midBottom")["properties"]["value"][
"value"]

@handleNotSupported
def getHotWaterStorageTemperatureBottom(self):
return \
self.service.getProperty("heating.dhw.sensors.temperature.dhwCylinder.bottom")["properties"]["value"][
"value"]
return self.service.getProperty("heating.dhw.sensors.temperature.dhwCylinder.bottom")["properties"]["value"][
"value"]

@handleNotSupported
def getDomesticHotWaterConfiguredTemperature2(self):
Expand Down Expand Up @@ -113,11 +127,6 @@ def getDomesticHotWaterDesiredTemperature(self):

return None

@handleNotSupported
def getDomesticHotWaterStorageTemperature(self):
return self.service.getProperty("heating.dhw.sensors.temperature.dhwCylinder")["properties"]["value"][
"value"]

@handleNotSupported
def getDomesticHotWaterOutletTemperature(self):
return self.service.getProperty("heating.dhw.sensors.temperature.outlet")["properties"]["value"]["value"]
Expand Down
5 changes: 1 addition & 4 deletions tests/test_TestForMissingProperties.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,7 @@ def test_unverifiedProperties(self):
# properties which are not in any test response data

ignore = [
'heating.dhw.sensors.temperature.dhwCylinder.top', # FIXME: remove once test data is updated
'heating.dhw.sensors.temperature.dhwCylinder.bottom', # FIXME: remove once test data is updated
'heating.bufferCylinder.sensors.temperature.main', # FIXME: remove once test data is updated
'heating.bufferCylinder.sensors.temperature.top', # FIXME: remove once test data is updated
'heating.dhw.sensors.temperature.dhwCylinder.midBottom', # FIXME: remove once test data is updated
]

all_features = self.read_all_features()
Expand Down
4 changes: 4 additions & 0 deletions tests/test_Vitocal250A.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,7 @@ def test_setDomesticHotWaterHysteresisSwitchOff(self):
self.service.setPropertyData[0]['action'], 'setHysteresisSwitchOffValue')
self.assertEqual(self.service.setPropertyData[0]['data'], {
'hysteresis': 5})

def test_getDomesticHotWaterStorageTemperature(self):
self.assertEqual(
self.device.getDomesticHotWaterStorageTemperature(), 58.8)
18 changes: 18 additions & 0 deletions tests/test_Vitocal333G.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import unittest

from PyViCare.PyViCareHeatPump import HeatPump
from tests.ViCareServiceMock import ViCareServiceMock


class Vitocal300G(unittest.TestCase):
def setUp(self):
self.service = ViCareServiceMock('response/Vitocal333G.json')
self.device = HeatPump(self.service)

def test_getDomesticHotWaterStorageTemperature(self):
self.assertEqual(
self.device.getDomesticHotWaterStorageTemperature(), 47.5)

def test_getHotWaterStorageTemperatureTop(self):
self.assertEqual(
self.device.getHotWaterStorageTemperatureTop(), 47.5)

0 comments on commit 4cec5d1

Please sign in to comment.