Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #117 from adorobis/master
Browse files Browse the repository at this point in the history
Add set_heating_curve service
  • Loading branch information
oischinger authored Jan 4, 2023
2 parents 2eb801c + 5ded20e commit fef79bf
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
21 changes: 21 additions & 0 deletions custom_components/vicare/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
SERVICE_SET_VICARE_MODE = "set_vicare_mode"
SERVICE_SET_VICARE_MODE_ATTR_MODE = "vicare_mode"

SERVICE_SET_HEATING_CURVE = "set_heating_curve"
SERVICE_SET_HEATING_CURVE_ATTR_SLOPE = "slope"
SERVICE_SET_HEATING_CURVE_ATTR_SHIFT = "shift"

VICARE_MODE_DHW = "dhw"
VICARE_MODE_HEATING = "heating"
VICARE_MODE_DHWANDHEATING = "dhwAndHeating"
Expand Down Expand Up @@ -138,6 +142,15 @@ async def async_setup_entry(
"set_vicare_mode",
)

platform.async_register_entity_service(
SERVICE_SET_HEATING_CURVE,
{
vol.Required(SERVICE_SET_HEATING_CURVE_ATTR_SHIFT): int,
vol.Required(SERVICE_SET_HEATING_CURVE_ATTR_SLOPE): float,
},
"set_heating_curve",
)

async_add_entities(entities)


Expand Down Expand Up @@ -374,3 +387,11 @@ def set_vicare_mode(self, vicare_mode):
raise ValueError(f"Cannot set invalid vicare mode: {vicare_mode}.")

self._circuit.setMode(vicare_mode)

def set_heating_curve(self, shift, slope):
"""Service function to set vicare modes directly."""
if not 0.2 <= round(float(slope),1) <= 3.5:
raise ValueError(f"Cannot set invalid heating curve slope: {slope}.")
if not -13 <= int(shift) <= 40:
raise ValueError(f"Cannot set invalid heating curve shift: {shift}.")
self._circuit.setHeatingCurve(int(shift), round(float(slope),1))
25 changes: 25 additions & 0 deletions custom_components/vicare/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,28 @@ set_vicare_mode:
- "forcedReduced"
- "heating"
- "standby"

set_heating_curve:
name: Set Vicare Heating Curve
description: Set Vicare Heating Curve.
target:
entity:
integration: vicare
domain: climate
fields:
shift:
name: Vicare Heating Curve Shift
description: Vicare Heating Curve Shift
required: true
selector:
number:
min: -13
max: 40
slope:
name: Vicare Heating Curve Slope
description: Vicare Heating Curve Slope
required: true
selector:
number:
min: 0.2
max: 3.5

0 comments on commit fef79bf

Please sign in to comment.