Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add methods for heat pump cooling consumption #371

Merged
merged 7 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Loading