Add HVAC mode support for AtlanticPassAPCHeatPumpMainComponent (heati… (#122175)

Co-authored-by: Mick Vleeshouwer <mick@imick.nl>
This commit is contained in:
alexfp14 2024-07-31 20:52:32 +02:00 committed by GitHub
parent 220f686078
commit 17f34b452e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 74 additions and 3 deletions

View File

@ -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

View File

@ -11,6 +11,9 @@ from .atlantic_electrical_heater_with_adjustable_temperature_setpoint import (
)
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
@ -43,6 +46,7 @@ WIDGET_TO_CLIMATE_ENTITY = {
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

View File

@ -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)

View File

@ -95,6 +95,7 @@ OVERKIZ_DEVICE_TO_PLATFORM: dict[UIClass | UIWidget, Platform | None] = {
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)

View File

@ -6,7 +6,8 @@
"@vlebourl",
"@tetienne",
"@nyroDev",
"@tronix117"
"@tronix117",
"@alexfp14"
],
"config_flow": true,
"dhcp": [