Skip to content

Commit

Permalink
feat: Add methods for heat pump cooling consumption (#371)
Browse files Browse the repository at this point in the history
* add methods for heat pump cooling consumption

* Update test_TestForMissingProperties.py

* add test case

* Update test_Vitocal151A.py

* change naming
  • Loading branch information
CFenner authored Sep 26, 2024
1 parent 9a99a2e commit ed9ccec
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
17 changes: 17 additions & 0 deletions PyViCare/PyViCareHeatPump.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,23 @@ def getPowerSummaryConsumptionHeatingLastSevenDays(self):
def getPowerSummaryConsumptionHeatingLastYear(self):
return self.service.getProperty("heating.power.consumption.summary.heating")["properties"]["lastYear"]["value"]

# Power consumption for Cooling:
@handleNotSupported
def getPowerConsumptionCoolingUnit(self):
return self.service.getProperty("heating.power.consumption.cooling")["properties"]["day"]["unit"]

@handleNotSupported
def getPowerConsumptionCoolingToday(self):
return self.service.getProperty("heating.power.consumption.cooling")["properties"]["day"]["value"][0]

@handleNotSupported
def getPowerConsumptionCoolingThisMonth(self):
return self.service.getProperty("heating.power.consumption.cooling")["properties"]["month"]["value"][0]

@handleNotSupported
def getPowerConsumptionCoolingThisYear(self):
return self.service.getProperty("heating.power.consumption.cooling")["properties"]["year"]["value"][0]

@handleNotSupported
def getPowerConsumptionUnit(self):
return self.service.getProperty("heating.power.consumption.total")["properties"]["day"]["unit"]
Expand Down
2 changes: 0 additions & 2 deletions tests/test_TestForMissingProperties.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ def test_missingProperties(self):

'heating.configuration.dhw.temperature.dhwCylinder.max', # TODO: to analyse, from Vitocal 333G

'heating.power.consumption.cooling', # TODO: to analyse, from Vitocal 151A

'heating.buffer.sensors.temperature.main', # deprecated, removed 2024-09-15 FIXME: remove once data point is removed and test data is updated
'heating.buffer.sensors.temperature.top', # deprecated, removed 2024-09-15 FIXME: remove once data point is removed and test data is updated
'heating.dhw.sensors.temperature.hotWaterStorage', # deprecated, removed 2024-09-15 FIXME: remove once data point is removed and test data is updated
Expand Down
16 changes: 16 additions & 0 deletions tests/test_Vitocal151A.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import unittest

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


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

def test_getPowerConsumptionCooling(self):
self.assertEqual(self.device.getPowerConsumptionCoolingUnit(), "kilowattHour")
self.assertEqual(self.device.getPowerConsumptionCoolingToday(), 0)
self.assertEqual(self.device.getPowerConsumptionCoolingThisMonth(), 0.1)
self.assertEqual(self.device.getPowerConsumptionCoolingThisYear(), 0.1)

0 comments on commit ed9ccec

Please sign in to comment.