Skip to content

Commit

Permalink
feat(heat pump): Expose heating.heatingRod.* data points (#489)
Browse files Browse the repository at this point in the history
* expose heating rod

* update generic tests

* add test case

* fix types
  • Loading branch information
CFenner authored Jan 22, 2025
1 parent ee3bbfa commit 3ccfba4
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 6 deletions.
36 changes: 36 additions & 0 deletions PyViCare/PyViCareHeatPump.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,42 @@ def getSeasonalPerformanceFactorHeating(self) -> float:
def getSeasonalPerformanceFactorTotal(self) -> float:
return float(self.service.getProperty("heating.spf.total")["properties"]["value"]["value"])

@handleNotSupported
def getHeatingRodStarts(self) -> int:
return int(self.service.getProperty("heating.heatingRod.statistics")["properties"]["starts"]["value"])

@handleNotSupported
def getHeatingRodHours(self) -> int:
return int(self.service.getProperty("heating.heatingRod.statistics")["properties"]["hours"]["value"])

@handleNotSupported
def getHeatingRodHeatProductionCurrent(self) -> float:
return float(self.service.getProperty("heating.heatingRod.heat.production.current")["properties"]["value"]["value"])

@handleNotSupported
def getHeatingRodHeatProductionCurrentUnit(self) -> str:
return str(self.service.getProperty("heating.heatingRod.heat.production.current")["properties"]["value"]["unit"])

@handleNotSupported
def getHeatingRodPowerConsumptionCurrent(self) -> float:
return float(self.service.getProperty("heating.heatingRod.power.consumption.current")["properties"]["value"]["value"])

@handleNotSupported
def getHeatingRodPowerConsumptionCurrentUnit(self) -> str:
return str(self.service.getProperty("heating.heatingRod.power.consumption.current")["properties"]["value"]["unit"])

@handleNotSupported
def getHeatingRodPowerConsumptionDHWThisYear(self) -> float:
return float(self.service.getProperty("heating.heatingRod.power.consumption.dhw")["properties"]["year"]["value"][0])

@handleNotSupported
def getHeatingRodPowerConsumptionHeatingThisYear(self) -> float:
return float(self.service.getProperty("heating.heatingRod.power.consumption.heating")["properties"]["year"]["value"][0])

@handleNotSupported
def getHeatingRodPowerConsumptionTotalThisYear(self) -> float:
return float(self.service.getProperty("heating.heatingRod.power.consumption.total")["properties"]["year"]["value"][0])


class Compressor(HeatingDeviceWithComponent):

Expand Down
6 changes: 0 additions & 6 deletions tests/test_TestForMissingProperties.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,8 @@ def test_missingProperties(self):
'heating.compressors.0.power.consumption.dhw',
'heating.compressors.0.power.consumption.heating',
'heating.compressors.0.power.consumption.total',
'heating.heatingRod.heat.production.current',
'heating.heatingRod.power.consumption.current',
'heating.heatingRod.power.consumption.dhw',
'heating.heatingRod.power.consumption.heating',
'heating.heatingRod.power.consumption.summary.dhw',
'heating.heatingRod.power.consumption.summary.heating',
'heating.heatingRod.power.consumption.total',
'heating.heatingRod.statistics',
'heating.heatingRod.status',
'heating.power.consumption.current',
'heating.scop.dhw', # deprecated
Expand Down
9 changes: 9 additions & 0 deletions tests/test_Vitocal250A.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,12 @@ def test_getSeasonalPerformanceFactor(self):
self.assertEqual(self.device.getSeasonalPerformanceFactorDHW(), 4.1)
self.assertEqual(self.device.getSeasonalPerformanceFactorHeating(), 3.2)
self.assertEqual(self.device.getSeasonalPerformanceFactorTotal(), 3.9)

def test_getHeatingRod(self):
self.assertEqual(self.device.getHeatingRodHeatProductionCurrent(), 0)
self.assertEqual(self.device.getHeatingRodPowerConsumptionCurrent(), 0)
self.assertEqual(self.device.getHeatingRodPowerConsumptionDHWThisYear(), 0)
self.assertEqual(self.device.getHeatingRodPowerConsumptionDHWThisYear(), 0)
self.assertEqual(self.device.getHeatingRodPowerConsumptionHeatingThisYear(), 0)
self.assertEqual(self.device.getHeatingRodStarts(), 0)
self.assertEqual(self.device.getHeatingRodHours(), 0)

0 comments on commit 3ccfba4

Please sign in to comment.