diff --git a/PyViCare/PyViCareHeatPump.py b/PyViCare/PyViCareHeatPump.py index 17b16bb6..800b4758 100644 --- a/PyViCare/PyViCareHeatPump.py +++ b/PyViCare/PyViCareHeatPump.py @@ -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"] diff --git a/tests/test_TestForMissingProperties.py b/tests/test_TestForMissingProperties.py index 648a2d11..8f85dd8f 100644 --- a/tests/test_TestForMissingProperties.py +++ b/tests/test_TestForMissingProperties.py @@ -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 diff --git a/tests/test_Vitocal151A.py b/tests/test_Vitocal151A.py new file mode 100644 index 00000000..512b139c --- /dev/null +++ b/tests/test_Vitocal151A.py @@ -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)