From 7c3a03d85a71ef34f71b356168a2b1319607a661 Mon Sep 17 00:00:00 2001 From: Christopher Fenner <9592452+CFenner@users.noreply.github.com> Date: Mon, 17 Feb 2025 20:27:09 +0100 Subject: [PATCH] fix(gas boiler): accessor for gas and power consumption UoM (#520) * add test case * fix uom * fix more! * remove empty line --- PyViCare/PyViCareGazBoiler.py | 8 ++++---- tests/test_Vitodens100W.py | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/PyViCare/PyViCareGazBoiler.py b/PyViCare/PyViCareGazBoiler.py index c46ccc09..bf6dfd55 100644 --- a/PyViCare/PyViCareGazBoiler.py +++ b/PyViCare/PyViCareGazBoiler.py @@ -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): @@ -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): @@ -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): @@ -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): diff --git a/tests/test_Vitodens100W.py b/tests/test_Vitodens100W.py index e85450f0..1c987bf3 100644 --- a/tests/test_Vitodens100W.py +++ b/tests/test_Vitodens100W.py @@ -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")