diff --git a/PyViCare/PyViCareHeatPump.py b/PyViCare/PyViCareHeatPump.py index 6f0cf3e4..c5776a81 100644 --- a/PyViCare/PyViCareHeatPump.py +++ b/PyViCare/PyViCareHeatPump.py @@ -3,7 +3,7 @@ from PyViCare.PyViCareHeatingDevice import (HeatingDevice, HeatingDeviceWithComponent) -from PyViCare.PyViCareUtils import PyViCareNotSupportedFeatureError, handleNotSupported +from PyViCare.PyViCareUtils import PyViCareNotSupportedFeatureError, handleAPICommandErrors, handleNotSupported class HeatPump(HeatingDevice): @@ -152,6 +152,50 @@ def activateVentilationProgram(self, program): """ return self.service.setProperty(f"ventilation.operating.programs.{program}", "activate", {}) + + @handleNotSupported + def getDomesticHotWaterHysteresis(self): + return self.service.getProperty("heating.dhw.temperature.hysteresis")["properties"]["value"]["value"] + + @handleNotSupported + def getDomesticHotWaterHysteresisMin(self): + return self.service.getProperty("heating.dhw.temperature.hysteresis")["commands"]["setHysteresis"]["params"]["hysteresis"]["constraints"]["min"] + + @handleNotSupported + def getDomesticHotWaterHysteresisMax(self): + return self.service.getProperty("heating.dhw.temperature.hysteresis")["commands"]["setHysteresis"]["params"]["hysteresis"]["constraints"]["max"] + + @handleNotSupported + def getDomesticHotWaterHysteresisStepping(self): + return self.service.getProperty("heating.dhw.temperature.hysteresis")["commands"]["setHysteresis"]["params"]["hysteresis"]["constraints"]["stepping"] + + @handleNotSupported + def getDomesticHotWaterHysteresisUnit(self): + return self.service.getProperty("heating.dhw.temperature.hysteresis")["properties"]["value"]["unit"] + + @handleAPICommandErrors + def setDomesticHotWaterHysteresis(self, temperature): + """ Set the hysteresis temperature for domestic host water + Parameters + ---------- + temperature : float + hysteresis temperature + + Returns + ------- + result: json + json representation of the answer + """ + return self.service.setProperty("heating.dhw.temperature.hysteresis", "setHysteresis", {'hysteresis': int(temperature)}) + + @handleNotSupported + def getDomesticHotWaterHysteresisSwitchOn(self): + return self.service.getProperty("heating.dhw.temperature.hysteresis")["properties"]["switchOnValue"]["value"] + + @handleNotSupported + def getDomesticHotWaterHysteresisSwitchOff(self): + return self.service.getProperty("heating.dhw.temperature.hysteresis")["properties"]["switchOffValue"]["value"] + class Compressor(HeatingDeviceWithComponent): @property diff --git a/tests/test_TestForMissingProperties.py b/tests/test_TestForMissingProperties.py index 00498f08..8e97edc1 100644 --- a/tests/test_TestForMissingProperties.py +++ b/tests/test_TestForMissingProperties.py @@ -32,7 +32,6 @@ def test_missingProperties(self): 'heating.power.consumption', 'heating.circuits.0.temperature.levels', # hint: command - 'heating.dhw.temperature.hysteresis', # hint: command 'heating.dhw.hygiene', 'heating.dhw.temperature', 'heating.burners', diff --git a/tests/test_Vitocal250A.py b/tests/test_Vitocal250A.py index e42e716e..9c46ebb0 100644 --- a/tests/test_Vitocal250A.py +++ b/tests/test_Vitocal250A.py @@ -128,3 +128,15 @@ def test_getOutsideTemperature(self): def test_getFrostProtectionActive(self): self.assertEqual( self.device.circuits[0].getFrostProtectionActive(), False) + + def test_getDomesticHotWaterHysteresis(self): + self.assertEqual( + self.device.getDomesticHotWaterHysteresis(), 5) + self.assertEqual( + self.device.getDomesticHotWaterHysteresisUnit(), 'kelvin') + self.assertEqual( + self.device.getDomesticHotWaterHysteresisMin(), 1) + self.assertEqual( + self.device.getDomesticHotWaterHysteresisMax(), 10) + self.assertEqual( + self.device.getDomesticHotWaterHysteresisStepping(), 0.5)