Fix types in ViCare integration (#101926)
* fix type * fix return type * fix type * fix type * Apply suggestions from code review * Update climate.py * Apply suggestions from code review Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update __init__.py * Update climate.py * Update __init__.py * Apply suggestions from code review Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update binary_sensor.py * Update button.py * Update sensor.py --------- Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
This commit is contained in:
parent
6a6f6fd99d
commit
ae7bb60677
6 changed files with 32 additions and 15 deletions
|
@ -67,7 +67,7 @@ VICARE_HOLD_MODE_OFF = "off"
|
|||
VICARE_TEMP_HEATING_MIN = 3
|
||||
VICARE_TEMP_HEATING_MAX = 37
|
||||
|
||||
VICARE_TO_HA_HVAC_HEATING = {
|
||||
VICARE_TO_HA_HVAC_HEATING: dict[str, HVACMode] = {
|
||||
VICARE_MODE_FORCEDREDUCED: HVACMode.OFF,
|
||||
VICARE_MODE_OFF: HVACMode.OFF,
|
||||
VICARE_MODE_DHW: HVACMode.OFF,
|
||||
|
@ -146,15 +146,15 @@ class ViCareClimate(ViCareEntity, ClimateEntity):
|
|||
_attr_target_temperature_step = PRECISION_WHOLE
|
||||
_attr_preset_modes = list(HA_TO_VICARE_PRESET_HEATING)
|
||||
_current_action: bool | None = None
|
||||
_current_mode: str | None = None
|
||||
|
||||
def __init__(self, name, api, circuit, device_config):
|
||||
def __init__(self, name, api, circuit, device_config) -> None:
|
||||
"""Initialize the climate device."""
|
||||
super().__init__(device_config)
|
||||
self._attr_name = name
|
||||
self._api = api
|
||||
self._circuit = circuit
|
||||
self._attributes: dict[str, Any] = {}
|
||||
self._current_mode = None
|
||||
self._current_program = None
|
||||
self._attr_unique_id = f"{device_config.getConfig().serial}-{circuit.id}"
|
||||
|
||||
|
@ -230,7 +230,9 @@ class ViCareClimate(ViCareEntity, ClimateEntity):
|
|||
@property
|
||||
def hvac_mode(self) -> HVACMode | None:
|
||||
"""Return current hvac mode."""
|
||||
return VICARE_TO_HA_HVAC_HEATING.get(self._current_mode)
|
||||
if self._current_mode is None:
|
||||
return None
|
||||
return VICARE_TO_HA_HVAC_HEATING.get(self._current_mode, None)
|
||||
|
||||
def set_hvac_mode(self, hvac_mode: HVACMode) -> None:
|
||||
"""Set a new hvac mode on the ViCare API."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue