Skip to content

Commit

Permalink
Small PR fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Tronix117 committed Feb 26, 2024
1 parent 0e508dc commit a315e05
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
3 changes: 2 additions & 1 deletion homeassistant/components/overkiz/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ async def async_setup_entry(
if device.widget in WIDGET_TO_CLIMATE_ENTITY
)

# Mainly Atlantic APC
# Match devices based on the widget and controllableName
# This is for example used for Atlantic APC, where devices with different functionality share the same uiClass and widget.
async_add_entities(
WIDGET_AND_CONTROLLABLE_TO_CLIMATE_ENTITY[device.widget][
cast(Controllable, device.controllable_name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
class AtlanticPassAPCZoneControl(OverkizEntity, ClimateEntity):
"""Representation of Atlantic Pass APC Zone Control."""

_attr_hvac_modes = [*HVAC_MODE_TO_OVERKIZ]
_attr_temperature_unit = UnitOfTemperature.CELSIUS
_attr_supported_features = (
ClimateEntityFeature.TURN_OFF | ClimateEntityFeature.TURN_ON
Expand All @@ -39,6 +38,8 @@ def __init__(
"""Init method."""
super().__init__(device_url, coordinator)

self._attr_hvac_modes = [*HVAC_MODE_TO_OVERKIZ]

# Cooling is supported by a separate command
if self.is_auto_hvac_mode_available:
self._attr_hvac_modes.append(HVACMode.AUTO)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

PRESET_MODES_TO_OVERKIZ = {v: k for k, v in OVERKIZ_MODE_TO_PRESET_MODES.items()}

TEMPERATURE_ZONECONTROL_DEVICE_INDEX = 1


# Those device depends on a main probe that choose the operating mode (heating, cooling, ...)
class AtlanticPassAPCZoneControlZone(AtlanticPassAPCHeatingZone):
Expand All @@ -45,7 +47,9 @@ def __init__(
# Those APC Heating and Cooling probes depends on the zone control device (main probe).
# Only the base device (#1) can be used to get/set some states.
# Like to retrieve and set the current operating mode (heating, cooling, drying, off).
self.zone_control_device = self.executor.linked_device(1)
self.zone_control_device = self.executor.linked_device(
TEMPERATURE_ZONECONTROL_DEVICE_INDEX
)

@property
def is_using_derogated_temperature_fallback(self) -> bool:
Expand All @@ -59,13 +63,13 @@ def is_using_derogated_temperature_fallback(self) -> bool:
def zone_control_hvac_mode(self) -> HVACMode:
"""Return hvac operation ie. heat, cool, dry, off mode."""

state = self.zone_control_device.states[OverkizState.IO_PASS_APC_OPERATING_MODE]

return (
OVERKIZ_TO_HVAC_MODE[state.value_as_str]
if state is not None and state.value_as_str is not None
else HVACMode.OFF
)
if (
state := self.zone_control_device.states[
OverkizState.IO_PASS_APC_OPERATING_MODE
]
) is not None and (value := state.value_as_str) is not None:
return OVERKIZ_TO_HVAC_MODE[value]
return HVACMode.OFF

@property
def hvac_mode(self) -> HVACMode:
Expand Down Expand Up @@ -190,7 +194,6 @@ def target_temperature(self) -> float:
),
)

# Not sure this temperature is relevant.
return cast(
float, self.executor.select_state(OverkizState.CORE_TARGET_TEMPERATURE)
)
Expand Down

0 comments on commit a315e05

Please sign in to comment.