Skip to content

Commit

Permalink
Add HVAC mode support for AtlanticPassAPCHeatPumpMainComponent (heati… (
Browse files Browse the repository at this point in the history
#122175)

Co-authored-by: Mick Vleeshouwer <mick@imick.nl>
  • Loading branch information
alexfp14 and iMicknl authored Jul 31, 2024
1 parent 220f686 commit 17f34b4
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 3 deletions.
4 changes: 2 additions & 2 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -1051,8 +1051,8 @@ build.json @home-assistant/supervisor
/tests/components/otbr/ @home-assistant/core
/homeassistant/components/ourgroceries/ @OnFreund
/tests/components/ourgroceries/ @OnFreund
/homeassistant/components/overkiz/ @imicknl @vlebourl @tetienne @nyroDev @tronix117
/tests/components/overkiz/ @imicknl @vlebourl @tetienne @nyroDev @tronix117
/homeassistant/components/overkiz/ @imicknl @vlebourl @tetienne @nyroDev @tronix117 @alexfp14
/tests/components/overkiz/ @imicknl @vlebourl @tetienne @nyroDev @tronix117 @alexfp14
/homeassistant/components/ovo_energy/ @timmo001
/tests/components/ovo_energy/ @timmo001
/homeassistant/components/p1_monitor/ @klaasnicolaas
Expand Down
4 changes: 4 additions & 0 deletions homeassistant/components/overkiz/climate_entities/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
)
from .atlantic_electrical_towel_dryer import AtlanticElectricalTowelDryer
from .atlantic_heat_recovery_ventilation import AtlanticHeatRecoveryVentilation
from .atlantic_pass_apc_heat_pump_main_component import (
AtlanticPassAPCHeatPumpMainComponent,
)
from .atlantic_pass_apc_heating_zone import AtlanticPassAPCHeatingZone
from .atlantic_pass_apc_zone_control import AtlanticPassAPCZoneControl
from .atlantic_pass_apc_zone_control_zone import AtlanticPassAPCZoneControlZone
Expand Down Expand Up @@ -43,6 +46,7 @@ class Controllable(StrEnum):
UIWidget.SOMFY_HEATING_TEMPERATURE_INTERFACE: SomfyHeatingTemperatureInterface,
UIWidget.SOMFY_THERMOSTAT: SomfyThermostat,
UIWidget.VALVE_HEATING_TEMPERATURE_INTERFACE: ValveHeatingTemperatureInterface,
UIWidget.ATLANTIC_PASS_APC_HEAT_PUMP: AtlanticPassAPCHeatPumpMainComponent,
}

# For Atlantic APC, some devices are standalone and control themselves, some others needs to be
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
"""Support for Atlantic Pass APC Heat Pump Main Component."""

from __future__ import annotations

from asyncio import sleep
from typing import cast

from pyoverkiz.enums import OverkizCommand, OverkizCommandParam, OverkizState

from homeassistant.components.climate import (
ClimateEntity,
ClimateEntityFeature,
HVACMode,
)
from homeassistant.const import UnitOfTemperature

from ..const import DOMAIN
from ..entity import OverkizEntity

OVERKIZ_TO_HVAC_MODES: dict[str, HVACMode] = {
OverkizCommandParam.STOP: HVACMode.OFF,
OverkizCommandParam.HEATING: HVACMode.HEAT,
OverkizCommandParam.COOLING: HVACMode.COOL,
}

HVAC_MODES_TO_OVERKIZ = {v: k for k, v in OVERKIZ_TO_HVAC_MODES.items()}


class AtlanticPassAPCHeatPumpMainComponent(OverkizEntity, ClimateEntity):
"""Representation of Atlantic Pass APC Heat Pump Main Component.
This component can only turn off the heating pump and select the working mode: heating or cooling.
To set new temperatures, they must be selected individually per Zones (ie: AtlanticPassAPCHeatingAndCoolingZone).
Once the Device is switched on into heating or cooling mode, the Heat Pump will be activated and will use
the default temperature configuration for each available zone.
"""

_attr_hvac_modes = [*HVAC_MODES_TO_OVERKIZ]
_attr_supported_features = (
ClimateEntityFeature.TURN_OFF | ClimateEntityFeature.TURN_ON
)
_attr_temperature_unit = UnitOfTemperature.CELSIUS
_attr_translation_key = DOMAIN
_enable_turn_on_off_backwards_compatibility = False

@property
def hvac_mode(self) -> HVACMode:
"""Return hvac current mode: stop, cooling, heating."""
return OVERKIZ_TO_HVAC_MODES[
cast(
str, self.executor.select_state(OverkizState.IO_PASS_APC_OPERATING_MODE)
)
]

async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None:
"""Set new target hvac mode: stop, cooling, heating."""
# They are mainly managed by the Zone Control device
# However, we can turn off or put the heat pump in cooling/ heating mode.
await self.executor.async_execute_command(
OverkizCommand.SET_PASS_APC_OPERATING_MODE,
HVAC_MODES_TO_OVERKIZ[hvac_mode],
)

# Wait for 2 seconds to ensure the HVAC mode change is properly applied and system stabilizes.
await sleep(2)
1 change: 1 addition & 0 deletions homeassistant/components/overkiz/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
UIWidget.ATLANTIC_ELECTRICAL_TOWEL_DRYER: Platform.CLIMATE, # widgetName, uiClass is HeatingSystem (not supported)
UIWidget.ATLANTIC_HEAT_RECOVERY_VENTILATION: Platform.CLIMATE, # widgetName, uiClass is HeatingSystem (not supported)
UIWidget.ATLANTIC_PASS_APC_DHW: Platform.WATER_HEATER, # widgetName, uiClass is WaterHeatingSystem (not supported)
UIWidget.ATLANTIC_PASS_APC_HEAT_PUMP: Platform.CLIMATE, # widgetName, uiClass is HeatingSystem (not supported)
UIWidget.ATLANTIC_PASS_APC_HEATING_AND_COOLING_ZONE: Platform.CLIMATE, # widgetName, uiClass is HeatingSystem (not supported)
UIWidget.ATLANTIC_PASS_APC_HEATING_ZONE: Platform.CLIMATE, # widgetName, uiClass is HeatingSystem (not supported)
UIWidget.ATLANTIC_PASS_APC_ZONE_CONTROL: Platform.CLIMATE, # widgetName, uiClass is HeatingSystem (not supported)
Expand Down
3 changes: 2 additions & 1 deletion homeassistant/components/overkiz/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"@vlebourl",
"@tetienne",
"@nyroDev",
"@tronix117"
"@tronix117",
"@alexfp14"
],
"config_flow": true,
"dhcp": [
Expand Down

0 comments on commit 17f34b4

Please sign in to comment.