Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HVAC action #99

Merged
merged 4 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions custom_components/mypyllant/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
ClimateEntity,
ClimateEntityFeature,
HVACMode,
HVACAction,
)
from homeassistant.components.climate.const import (
FAN_AUTO,
Expand Down Expand Up @@ -47,6 +48,7 @@
ZoneCurrentSpecialFunction,
VentilationOperationMode,
VentilationFanStageType,
CircuitState,
)

from custom_components.mypyllant.utils import shorten_zone_name, EntityList
Expand Down Expand Up @@ -95,6 +97,12 @@
PRESET_SLEEP: ZoneCurrentSpecialFunction.SYSTEM_OFF,
}

ZONE_HVAC_ACTION_MAP = {
CircuitState.STANDBY: HVACAction.IDLE,
CircuitState.HEATING: HVACAction.HEATING,
CircuitState.COOLING: HVACAction.COOLING,
}

VENTILATION_HVAC_MODE_MAP = {
HVACMode.FAN_ONLY: VentilationOperationMode.NORMAL,
HVACMode.AUTO: VentilationOperationMode.TIME_CONTROLLED,
Expand Down Expand Up @@ -497,6 +505,11 @@ async def set_zone_operating_mode(
)
await self.coordinator.async_request_refresh_delayed()

@property
def hvac_action(self) -> HVACAction | None:
circuit_state = self.zone.get_associated_circuit(self.system).circuit_state
return ZONE_HVAC_ACTION_MAP.get(circuit_state)

async def async_set_temperature(self, **kwargs: Any) -> None:
"""
Set new target temperature. Depending on heating mode this sets the manual mode setpoint,
Expand Down
2 changes: 1 addition & 1 deletion custom_components/mypyllant/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/signalkraft/mypyllant-component/issues",
"requirements": [
"myPyllant==0.7.14"
"myPyllant==0.7.15"
],
"version": "v0.7.3"
}
2 changes: 1 addition & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ types-PyYAML~=6.0.12.12
pytest==7.4.3
pytest-cov==4.1.0
pytest-homeassistant-custom-component==0.13.77
myPyllant==0.7.14
myPyllant==0.7.15
dacite~=1.7.0
2 changes: 2 additions & 0 deletions tests/test_climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
VentilationClimate,
ZoneClimate,
async_setup_entry,
ZONE_HVAC_ACTION_MAP,
)
from tests.utils import get_config_entry
from tests.conftest import MockConfigEntry, TEST_OPTIONS
Expand Down Expand Up @@ -96,6 +97,7 @@ async def test_zone_climate(
assert isinstance(climate.preset_modes, list)
assert climate.hvac_mode in climate.hvac_modes
assert climate.preset_mode in climate.preset_modes
assert climate.hvac_action in ZONE_HVAC_ACTION_MAP.values()
await mocked_api.aiohttp_session.close()


Expand Down
Loading