Skip to content

Commit

Permalink
Remove extra attributes.
Browse files Browse the repository at this point in the history
  • Loading branch information
denpamusic committed Jun 17, 2024
1 parent f106506 commit dc78d95
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
13 changes: 1 addition & 12 deletions custom_components/plum_ecomax/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,6 @@
PRESET_ANTIFREEZE: "antifreeze_target_temp",
}

CLIMATE_MODES: Final[list[str]] = [
PRESET_SCHEDULE,
PRESET_ECO,
PRESET_COMFORT,
PRESET_AWAY,
PRESET_AIRING,
PRESET_PARTY,
PRESET_HOLIDAYS,
PRESET_ANTIFREEZE,
]

_LOGGER = logging.getLogger(__name__)


Expand All @@ -94,7 +83,7 @@ class EcomaxClimate(ThermostatEntity, ClimateEntity):
_attr_hvac_mode = HVACMode.HEAT
_attr_hvac_modes = [HVACMode.HEAT]
_attr_precision = PRECISION_TENTHS
_attr_preset_modes = CLIMATE_MODES
_attr_preset_modes = list(HA_TO_EM_MODE)
_attr_supported_features = (
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE
)
Expand Down
4 changes: 1 addition & 3 deletions custom_components/plum_ecomax/water_heater.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ class EcomaxWaterHeater(EcomaxEntity, WaterHeaterEntity):
"""Represents an ecoMAX water heater."""

_attr_extra_state_attributes = {ATTR_TARGET_TEMP_STEP: 1}
_attr_hysteresis: int = 0
_attr_max_temp: float
_attr_min_temp: float
_attr_hysteresis = 0
_attr_operation_list = list(HA_TO_EM_STATE)
_attr_precision = PRECISION_TENTHS
_attr_supported_features = (
Expand Down
16 changes: 14 additions & 2 deletions tests/test_climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,13 @@
from pytest_homeassistant_custom_component.common import MockConfigEntry

from custom_components.plum_ecomax.climate import (
CLIMATE_MODES,
HA_PRESET_TO_EM_TEMP,
HA_TO_EM_MODE,
PRESET_AIRING,
PRESET_ANTIFREEZE,
PRESET_AWAY,
PRESET_HOLIDAYS,
PRESET_PARTY,
PRESET_SCHEDULE,
)
from custom_components.plum_ecomax.connection import EcomaxConnection
Expand Down Expand Up @@ -143,7 +146,16 @@ async def test_thermostat(
assert state.attributes[ATTR_MIN_TEMP] == 10
assert state.attributes[ATTR_MAX_TEMP] == 35
assert state.attributes[ATTR_TARGET_TEMP_STEP] == 0.1
assert state.attributes[ATTR_PRESET_MODES] == CLIMATE_MODES
assert state.attributes[ATTR_PRESET_MODES] == [
PRESET_SCHEDULE,
PRESET_ECO,
PRESET_COMFORT,
PRESET_AWAY,
PRESET_AIRING,
PRESET_PARTY,
PRESET_HOLIDAYS,
PRESET_ANTIFREEZE,
]
assert state.attributes[ATTR_CURRENT_TEMPERATURE] == 0
assert state.attributes[ATTR_HVAC_ACTION] == HVACAction.IDLE
assert state.attributes[ATTR_PRESET_MODE] == PRESET_SCHEDULE
Expand Down

0 comments on commit dc78d95

Please sign in to comment.