Map ViCare cooling operating mode to HVACMode.COOL (#174490)

Co-authored-by: Josef Zweck <josef@zweck.dev>
This commit is contained in:
Christian Lackas
2026-07-09 15:07:11 +02:00
committed by GitHub
co-authored by Josef Zweck
parent 4be0cdc644
commit 498c0861e4
3 changed files with 6621 additions and 1 deletions
@@ -41,6 +41,7 @@ SERVICE_SET_VICARE_MODE = "set_vicare_mode"
SERVICE_SET_VICARE_MODE_ATTR_MODE = "vicare_mode"
VICARE_MODE_DHW = "dhw"
VICARE_MODE_COOLING = "cooling"
VICARE_MODE_HEATING = "heating"
VICARE_MODE_HEATINGCOOLING = "heatingCooling"
VICARE_MODE_DHWANDHEATING = "dhwAndHeating"
@@ -64,6 +65,7 @@ VICARE_TO_HA_HVAC_HEATING: dict[str, HVACMode] = {
VICARE_MODE_DHWANDHEATING: HVACMode.AUTO,
VICARE_MODE_HEATINGCOOLING: HVACMode.AUTO,
VICARE_MODE_HEATING: HVACMode.AUTO,
VICARE_MODE_COOLING: HVACMode.COOL,
VICARE_MODE_FORCEDNORMAL: HVACMode.HEAT,
}
File diff suppressed because it is too large Load Diff
+36 -1
View File
@@ -6,7 +6,12 @@ import pytest
from PyViCare.PyViCareUtils import PyViCareNotSupportedFeatureError
from syrupy.assertion import SnapshotAssertion
from homeassistant.components.climate import ATTR_HVAC_ACTION, HVACAction
from homeassistant.components.climate import (
ATTR_HVAC_ACTION,
ATTR_HVAC_MODES,
HVACAction,
HVACMode,
)
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_component, entity_registry as er
@@ -165,3 +170,33 @@ async def test_hvac_action_multi_compressor_cooling_takes_precedence(
assert climate_states, "no climate entity exposed hvac_action"
for state in climate_states:
assert state.attributes[ATTR_HVAC_ACTION] == HVACAction.COOLING
async def test_hvac_mode_cooling(
hass: HomeAssistant,
mock_config_entry: MockConfigEntry,
) -> None:
"""hvac_mode maps the ViCare cooling operating mode to HVACMode.COOL."""
fixtures: list[Fixture] = [
Fixture(set(), "vicare/Vitocal250A_cooling.json"),
]
with (
patch(
"homeassistant.helpers.config_entry_oauth2_flow.OAuth2Session.async_ensure_token_valid",
),
patch(
f"{MODULE}._setup_vicare_api",
return_value=MockPyViCare(fixtures).as_vicare_data(),
),
patch(f"{MODULE}.PLATFORMS", [Platform.CLIMATE]),
):
await setup_integration(hass, mock_config_entry)
component: entity_component.EntityComponent = hass.data["climate"]
for entity in component.entities:
await entity.async_update_ha_state(force_refresh=True)
state = hass.states.get("climate.model0_heating")
assert state is not None
assert state.state == HVACMode.COOL
assert HVACMode.COOL in state.attributes[ATTR_HVAC_MODES]