Skip to content

Commit

Permalink
* Small improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
BenPru committed Oct 25, 2023
1 parent 274167e commit 38a4d93
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
9 changes: 7 additions & 2 deletions custom_components/luxtronik/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
)
Expand Down
3 changes: 3 additions & 0 deletions custom_components/luxtronik/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -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" -->
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.10.22",
"version": "2023.10.26",
"homeassistant": "2023.1.0",
"dhcp": [
{ "macaddress": "000E8C*" },
Expand Down
18 changes: 15 additions & 3 deletions custom_components/luxtronik/update.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Luxtronik Update platform."""
# region Imports
from __future__ import annotations

from datetime import datetime, timedelta
Expand Down Expand Up @@ -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)


Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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'<a href="{release_url}" target="_blank" rel="noreferrer noopener">Firmware Download Portal</a>&emsp;<a href="{download_url}" target="_blank" rel="noreferrer noopener">Direct Download</a><br><br>alpha innotec doesn\'t provide a changelog.<br>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.<br><br>"
return (
f'{upgrade_text}<a href="{release_url}" target="_blank" rel="noreferrer noopener">Firmware Download Portal</a>&emsp;'
+ f'<a href="{download_url}" target="_blank" rel="noreferrer noopener">Direct Download</a><br><br>'
+ "alpha innotec doesn't provide a changelog.<br>Please contact support for more information."
)

@Throttle(MIN_TIME_BETWEEN_UPDATES)
def update(self) -> None:
Expand All @@ -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(
Expand Down

0 comments on commit 38a4d93

Please sign in to comment.