Skip to content

Commit

Permalink
fix(gas boiler): accessor for gas and power consumption UoM (#520)
Browse files Browse the repository at this point in the history
* add test case

* fix uom

* fix more!

* remove empty line
  • Loading branch information
CFenner authored Feb 17, 2025
1 parent 196e109 commit 7c3a03d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 4 additions & 4 deletions PyViCare/PyViCareGazBoiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def getVolumetricFlowReturn(self):
# Gas consumption for Heating data:
@handleNotSupported
def getGasSummaryConsumptionHeatingUnit(self):
return self.service.getProperty("heating.gas.consumption.summary.heating")["properties"]["day"]["unit"]
return self.service.getProperty("heating.gas.consumption.summary.heating")["properties"]["currentDay"]["unit"]

@handleNotSupported
def getGasSummaryConsumptionHeatingCurrentDay(self):
Expand Down Expand Up @@ -180,7 +180,7 @@ def getGasSummaryConsumptionHeatingLastYear(self):
# Gas consumption for Domestic Hot Water data:
@handleNotSupported
def getGasSummaryConsumptionDomesticHotWaterUnit(self):
return self.service.getProperty("heating.gas.consumption.summary.dhw")["properties"]["unit"]["value"]
return self.service.getProperty("heating.gas.consumption.summary.dhw")["properties"]["currentDay"]["unit"]

@handleNotSupported
def getGasSummaryConsumptionDomesticHotWaterCurrentDay(self):
Expand Down Expand Up @@ -209,7 +209,7 @@ def getGasSummaryConsumptionDomesticHotWaterLastYear(self):
# Power consumption for Heating:
@handleNotSupported
def getPowerSummaryConsumptionHeatingUnit(self):
return self.service.getProperty("heating.power.consumption.summary.heating")["properties"]["day"]["unit"]
return self.service.getProperty("heating.power.consumption.summary.heating")["properties"]["currentDay"]["unit"]

@handleNotSupported
def getPowerSummaryConsumptionHeatingCurrentDay(self):
Expand Down Expand Up @@ -238,7 +238,7 @@ def getPowerSummaryConsumptionHeatingLastYear(self):
# Power consumption for Domestic Hot Water:
@handleNotSupported
def getPowerSummaryConsumptionDomesticHotWaterUnit(self):
return self.service.getProperty("heating.power.consumption.summary.dhw")["properties"]["day"]["unit"]
return self.service.getProperty("heating.power.consumption.summary.dhw")["properties"]["currentDay"]["unit"]

@handleNotSupported
def getPowerSummaryConsumptionDomesticHotWaterCurrentDay(self):
Expand Down
4 changes: 4 additions & 0 deletions tests/test_Vitodens100W.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,19 @@ def test_getBurnerModulation(self):

def test_getGasSummaryConsumptionHeatingCurrentDay(self):
self.assertEqual(self.device.getGasSummaryConsumptionHeatingCurrentDay(), 11.2)
self.assertEqual(self.device.getGasSummaryConsumptionHeatingUnit(), "cubicMeter")

def test_getGasSummaryConsumptionDomesticHotWaterCurrentMonth(self):
self.assertEqual(self.device.getGasSummaryConsumptionDomesticHotWaterCurrentMonth(), 13.7)
self.assertEqual(self.device.getGasSummaryConsumptionDomesticHotWaterUnit(), "cubicMeter")

def test_getPowerSummaryConsumptionHeatingCurrentDay(self):
self.assertEqual(self.device.getPowerSummaryConsumptionHeatingCurrentDay(), 0.9)
self.assertEqual(self.device.getPowerSummaryConsumptionHeatingUnit(), "kilowattHour")

def test_getPowerSummaryConsumptionDomesticHotWaterCurrentYear(self):
self.assertEqual(self.device.getPowerSummaryConsumptionDomesticHotWaterCurrentYear(), 18)
self.assertEqual(self.device.getPowerSummaryConsumptionDomesticHotWaterUnit(), "kilowattHour")

def test_getGasSummaryConsumptionDomesticHotWaterUnit(self):
self.assertEqual(self.device.getGasSummaryConsumptionDomesticHotWaterUnit(), "cubicMeter")

0 comments on commit 7c3a03d

Please sign in to comment.