Skip to content

Commit

Permalink
add dhw mode functions for e2 devices
Browse files Browse the repository at this point in the history
  • Loading branch information
CFenner committed Oct 7, 2024
1 parent bea1062 commit 4eb9707
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions PyViCare/PyViCareHeatingDevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,20 @@ def getHotWaterStorageTemperatureBottom(self):
def getDomesticHotWaterConfiguredTemperature2(self):
return self.service.getProperty("heating.dhw.temperature.temp2")["properties"]["value"]["value"]


@handleNotSupported
def getDomesticHotWaterModes(self):
if self.isE3Device():
return self.service.getProperty("heating.dhw.operating.modes.active")["commands"]["setMode"][
"params"]["mode"]["constraints"]["enum"]
return []


def getDomesticHotWaterActiveMode(self):
if self.isE3Device():
return self.service.getProperty("heating.dhw.operating.modes.active")["properties"]["value"][
"value"]

schedule = self.getDomesticHotWaterSchedule()
if schedule == "error" or schedule["active"] is not True:
return None
Expand All @@ -103,6 +116,25 @@ def getDomesticHotWaterActiveMode(self):
mode = s["mode"]
return mode


def setDomesticHotWaterMode(self, mode):
""" Set the domestic hot water active mode
Parameters
----------
mode : str
Valid mode can be obtained using getDomesticHotWaterModes()
Returns
-------
result: json
json representation of the answer
"""
if self.isE3Device():
r = self.service.setProperty("heating.dhw.operating.modes.active", "setMode", {'mode': mode})
return r
raise PyViCareNotSupportedFeatureError("setDomesticHotWaterMode")


def getDomesticHotWaterDesiredTemperature(self):
mode = self.getDomesticHotWaterActiveMode()

Expand Down

0 comments on commit 4eb9707

Please sign in to comment.