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

Commit

Permalink
Use temp min/max/step from API
Browse files Browse the repository at this point in the history
Get rid of hardcoded values and use the data provided by the API
  • Loading branch information
oischinger committed Aug 12, 2023
1 parent a051d9a commit e787698
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 26 deletions.
18 changes: 5 additions & 13 deletions custom_components/vicare/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@
HVACMode,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
ATTR_TEMPERATURE,
PRECISION_TENTHS,
PRECISION_WHOLE,
UnitOfTemperature,
)
from homeassistant.const import ATTR_TEMPERATURE, PRECISION_TENTHS, UnitOfTemperature
from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_platform
import homeassistant.helpers.config_validation as cv
Expand Down Expand Up @@ -75,9 +70,6 @@
VICARE_HOLD_MODE_HOME = "home"
VICARE_HOLD_MODE_OFF = "off"

VICARE_TEMP_HEATING_MIN = 3
VICARE_TEMP_HEATING_MAX = 37

VICARE_HEATING_CURVE_SLOPE_MIN = 0.3
VICARE_HEATING_CURVE_SLOPE_MAX = 3.5

Expand Down Expand Up @@ -344,17 +336,17 @@ def hvac_action(self) -> HVACAction:
@property
def min_temp(self):
"""Return the minimum temperature."""
return VICARE_TEMP_HEATING_MIN
return self._circuit.getActiveProgramMinTemperature()

@property
def max_temp(self):
"""Return the maximum temperature."""
return VICARE_TEMP_HEATING_MAX
return self._circuit.getActiveProgramMaxTemperature()

@property
def target_temperature_step(self) -> float:
"""Set target temperature step to wholes."""
return PRECISION_WHOLE
"""Get current stepping."""
return self._circuit.getActiveProgramStepping

def set_temperature(self, **kwargs: Any) -> None:
"""Set new target temperatures."""
Expand Down
18 changes: 5 additions & 13 deletions custom_components/vicare/water_heater.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@
WaterHeaterEntityFeature,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
ATTR_TEMPERATURE,
PRECISION_TENTHS,
PRECISION_WHOLE,
UnitOfTemperature,
)
from homeassistant.const import ATTR_TEMPERATURE, PRECISION_TENTHS, UnitOfTemperature
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.entity_platform import AddEntitiesCallback
Expand All @@ -38,9 +33,6 @@
VICARE_MODE_FORCEDNORMAL = "forcedNormal"
VICARE_MODE_OFF = "standby"

VICARE_TEMP_WATER_MIN = 10
VICARE_TEMP_WATER_MAX = 60

OPERATION_MODE_ON = "on"
OPERATION_MODE_OFF = "off"

Expand Down Expand Up @@ -176,17 +168,17 @@ def set_temperature(self, **kwargs: Any) -> None:
@property
def min_temp(self):
"""Return the minimum temperature."""
return VICARE_TEMP_WATER_MIN
return self._circuit.getActiveProgramMinTemperature()

@property
def max_temp(self):
"""Return the maximum temperature."""
return VICARE_TEMP_WATER_MAX
return self._circuit.getActiveProgramMaxTemperature()

@property
def target_temperature_step(self) -> float:
"""Set target temperature step to wholes."""
return PRECISION_WHOLE
"""Get current stepping."""
return self._circuit.getActiveProgramStepping

@property
def current_operation(self):
Expand Down

0 comments on commit e787698

Please sign in to comment.