Skip to content

Commit

Permalink
Merge branch 'BenPru:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
svasek authored Sep 23, 2024
2 parents 097d765 + e801237 commit 4be96d3
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 33 deletions.
59 changes: 29 additions & 30 deletions custom_components/luxtronik/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@
hvac_mode_mapping=HVAC_MODE_MAPPING_HEAT,
hvac_action_mapping=HVAC_ACTION_MAPPING_HEAT,
preset_modes=[PRESET_NONE, PRESET_AWAY, PRESET_BOOST],
supported_features=ClimateEntityFeature.AUX_HEAT
| ClimateEntityFeature.PRESET_MODE # noqa: W503
supported_features=ClimateEntityFeature.PRESET_MODE
| ClimateEntityFeature.TARGET_TEMPERATURE, # noqa: W503
luxtronik_key=LuxParameter.P0003_MODE_HEATING,
# luxtronik_key_current_temperature=LuxCalculation.C0227_ROOM_THERMOSTAT_TEMPERATURE,
Expand Down Expand Up @@ -172,7 +171,7 @@ class LuxtronikClimateExtraStoredData(ExtraStoredData):
_attr_target_temperature: float | None = None
_attr_hvac_mode: HVACMode | str | None = None
_attr_preset_mode: str | None = None
_attr_is_aux_heat: bool | None = None
# _attr_is_aux_heat: bool | None = None
last_hvac_mode_before_preset: str | None = None

def as_dict(self) -> dict[str, Any]:
Expand All @@ -194,7 +193,7 @@ class LuxtronikThermostat(LuxtronikEntity, ClimateEntity, RestoreEntity):
_attr_target_temperature_low = 18.0
_attr_target_temperature_step = 0.5

_attr_is_aux_heat: bool | None = None
# _attr_is_aux_heat: bool | None = None
_attr_hvac_mode: HVACMode | str | None = None
_attr_preset_mode: str | None = None

Expand Down Expand Up @@ -254,10 +253,10 @@ def _handle_coordinator_update(
if lux_action is None
else self.entity_description.hvac_action_mapping[lux_action]
)
self._attr_is_aux_heat = (
None if mode is None else mode == LuxMode.second_heatsource.value
)
if self._attr_preset_mode == PRESET_NONE or self._attr_is_aux_heat:
# self._attr_is_aux_heat = (
# None if mode is None else mode == LuxMode.second_heatsource.value
# )
if self._attr_preset_mode == PRESET_NONE: # or self._attr_is_aux_heat:
self._last_hvac_mode_before_preset = None
key = self.entity_description.luxtronik_key_current_temperature
if isinstance(key, str):
Expand Down Expand Up @@ -339,27 +338,27 @@ async def async_set_preset_mode(self, preset_mode: str) -> None:
lux_mode = LuxMode.off.value
await self._async_set_lux_mode(lux_mode)

async def async_turn_aux_heat_on(self) -> None:
"""Turn auxiliary heater on."""
self._attr_is_aux_heat = True
if self._last_hvac_mode_before_preset is None:
self._last_hvac_mode_before_preset = self._attr_hvac_mode
await self._async_set_lux_mode(LuxMode.second_heatsource.value)

async def async_turn_aux_heat_off(self) -> None:
"""Turn auxiliary heater off."""
self._attr_is_aux_heat = False
if (self._last_hvac_mode_before_preset is None) or (
not self._last_hvac_mode_before_preset in HVAC_PRESET_MAPPING
):
await self._async_set_lux_mode(LuxMode.automatic.value)
else:
lux_mode = [
k
for k, v in HVAC_PRESET_MAPPING.items()
if v == self._last_hvac_mode_before_preset
][0]
await self._async_set_lux_mode(lux_mode)
# async def async_turn_aux_heat_on(self) -> None:
# """Turn auxiliary heater on."""
# self._attr_is_aux_heat = True
# if self._last_hvac_mode_before_preset is None:
# self._last_hvac_mode_before_preset = self._attr_hvac_mode
# await self._async_set_lux_mode(LuxMode.second_heatsource.value)

# async def async_turn_aux_heat_off(self) -> None:
# """Turn auxiliary heater off."""
# self._attr_is_aux_heat = False
# if (self._last_hvac_mode_before_preset is None) or (
# not self._last_hvac_mode_before_preset in HVAC_PRESET_MAPPING
# ):
# await self._async_set_lux_mode(LuxMode.automatic.value)
# else:
# lux_mode = [
# k
# for k, v in HVAC_PRESET_MAPPING.items()
# if v == self._last_hvac_mode_before_preset
# ][0]
# await self._async_set_lux_mode(lux_mode)

@property
def extra_restore_state_data(self) -> LuxtronikClimateExtraStoredData:
Expand All @@ -368,6 +367,6 @@ def extra_restore_state_data(self) -> LuxtronikClimateExtraStoredData:
self._attr_target_temperature,
self._attr_hvac_mode,
self._attr_preset_mode,
self._attr_is_aux_heat,
# self._attr_is_aux_heat,
self._last_hvac_mode_before_preset,
)
2 changes: 1 addition & 1 deletion custom_components/luxtronik/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class LuxStatus3Option(StrEnum):
thermal_desinfection: Final = ("thermal desinfection",)
cooling: Final = ("cooling",)
swimming_pool_solar: Final = ("swimming pool/solar",)
heating_external_energy_source: Final = ("heating external engery source",)
heating_external_energy_source: Final = ("heating external energy source",)
domestic_water_external_energy_source: Final = (
"domestic water external energy source",
)
Expand Down
1 change: 0 additions & 1 deletion custom_components/luxtronik/lux_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import struct
import threading
import time
import asyncio

from async_timeout import timeout

Expand Down
2 changes: 1 addition & 1 deletion custom_components/luxtronik/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"after_dependencies": [],
"codeowners": ["@BenPru"],
"iot_class": "local_polling",
"version": "2023.11.30",
"version": "2024.9.23",
"homeassistant": "2023.1.0",
"dhcp": [
{ "macaddress": "000E8C*" },
Expand Down

0 comments on commit 4be96d3

Please sign in to comment.