From 38a4d934a0c2b306c71d7c2f294cf45fb5098b79 Mon Sep 17 00:00:00 2001 From: BenPru Date: Thu, 26 Oct 2023 00:06:06 +0200 Subject: [PATCH] * Small improvements --- custom_components/luxtronik/climate.py | 9 +++++++-- custom_components/luxtronik/const.py | 3 +++ custom_components/luxtronik/manifest.json | 2 +- custom_components/luxtronik/update.py | 18 +++++++++++++++--- 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/custom_components/luxtronik/climate.py b/custom_components/luxtronik/climate.py index 2dc8c52..0246545 100644 --- a/custom_components/luxtronik/climate.py +++ b/custom_components/luxtronik/climate.py @@ -244,7 +244,9 @@ def _handle_coordinator_update( data, self.entity_description.luxtronik_key_current_action.value ) self._attr_hvac_action = ( - None if lux_action is None else self.entity_description.hvac_action_mapping[lux_action] + None + 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 @@ -271,10 +273,13 @@ def _handle_coordinator_update( if ( self._attr_target_temperature is not None and self._attr_current_temperature is not None # noqa: W503 + and self._attr_current_temperature > 0.0 and correction_factor is not None # noqa: W503 ): delta_temp = self._attr_target_temperature - self._attr_current_temperature - correction = round(delta_temp * (correction_factor/100.0), 1) # correction_factor is in %, so need to divide by 100 + correction = round( + delta_temp * (correction_factor / 100.0), 1 + ) # correction_factor is in %, so need to divide by 100 key_correction_target = ( self.entity_description.luxtronik_key_correction_target.value ) diff --git a/custom_components/luxtronik/const.py b/custom_components/luxtronik/const.py index 9388860..dfd9ef7 100644 --- a/custom_components/luxtronik/const.py +++ b/custom_components/luxtronik/const.py @@ -326,6 +326,9 @@ class LuxParameter(StrEnum): P1059_ADDITIONAL_HEAT_GENERATOR_AMOUNT_COUNTER: Final = ( "parameters.ID_Waermemenge_ZWE" ) + P1119_LAST_DEFROST_TIMESTAMP: Final = ( + "parameters.Unknown_Parameter_1119" # 1685073431 -> 26.5.23 05:57 + ) P1136_HEAT_ENERGY_INPUT: Final = "parameters.Unknown_Parameter_1136" P1137_DHW_ENERGY_INPUT: Final = "parameters.Unknown_Parameter_1137" # ? P1138_SWIMMING_POOL_ENERGY_INPUT: Final = "parameters.Unknown_Parameter_1138" --> diff --git a/custom_components/luxtronik/manifest.json b/custom_components/luxtronik/manifest.json index ab19865..c17481c 100755 --- a/custom_components/luxtronik/manifest.json +++ b/custom_components/luxtronik/manifest.json @@ -9,7 +9,7 @@ "after_dependencies": [], "codeowners": ["@BenPru"], "iot_class": "local_polling", - "version": "2023.10.22", + "version": "2023.10.26", "homeassistant": "2023.1.0", "dhcp": [ { "macaddress": "000E8C*" }, diff --git a/custom_components/luxtronik/update.py b/custom_components/luxtronik/update.py index 38464b8..49b4793 100644 --- a/custom_components/luxtronik/update.py +++ b/custom_components/luxtronik/update.py @@ -1,4 +1,5 @@ """Luxtronik Update platform.""" +# region Imports from __future__ import annotations from datetime import datetime, timedelta @@ -35,6 +36,8 @@ from .lux_helper import get_firmware_download_id, get_manufacturer_firmware_url_by_model from .model import LuxtronikUpdateEntityDescription +# endregion Imports + MIN_TIME_BETWEEN_UPDATES: Final = timedelta(hours=1) @@ -69,7 +72,10 @@ class LuxtronikUpdateEntity(LuxtronikEntity, UpdateEntity): entity_description: LuxtronikUpdateEntityDescription _attr_title = "Luxtronik Firmware Version" - _attr_supported_features: UpdateEntityFeature = UpdateEntityFeature.INSTALL | UpdateEntityFeature.RELEASE_NOTES + # INSTALL --> is needed to get a notification!!! + _attr_supported_features: UpdateEntityFeature = ( + UpdateEntityFeature.INSTALL | UpdateEntityFeature.RELEASE_NOTES + ) __firmware_version_available = None __firmware_version_available_last_request = None @@ -107,7 +113,13 @@ def release_notes(self) -> str | None: release_url = get_manufacturer_firmware_url_by_model(self.coordinator.model) download_id = get_firmware_download_id(self.installed_version) download_url = f"{DOWNLOAD_PORTAL_URL}{download_id}" - return f'Firmware Download PortalDirect Download

alpha innotec doesn\'t provide a changelog.
Please contact support for more information.' + if self.state: + upgrade_text = f"For your {self.coordinator.manufacturer} {self.coordinator.model} (Download ID {download_id}) is Firmware Version {self.__firmware_version_available} available.

" + return ( + f'{upgrade_text}Firmware Download Portal ' + + f'Direct Download

' + + "alpha innotec doesn't provide a changelog.
Please contact support for more information." + ) @Throttle(MIN_TIME_BETWEEN_UPDATES) def update(self) -> None: @@ -134,7 +146,7 @@ def do_request_available_firmware_version(self, download_id: int): datetime.utcnow().timestamp() ) # Filename e.g.: wp2reg-V2.88.1-9086 - # Extract 'V2.88.1' from 'wp2reg-V2.88.1-9086'. + # Extract 'V2.88.1-9086' from 'wp2reg-V2.88.1-9086'. self.__firmware_version_available = filename.split("-", 1)[1] except Exception: # pylint: disable=broad-except LOGGER.warning(