Skip to content
This repository was archived by the owner on Apr 20, 2025. It is now read-only.

Commit e5468fe

Browse files
tetienneiMicknl
andauthored
Fix temperature for AtlanticElectricalTowelDryer (#704)
* Create linked device property * Fix current temperature retrieval * Use relative import * Remove property decorator Property does not take any arguments... I was tired. * Fix wrong returned type * Remove useless else block Co-authored-by: Mick Vleeshouwer <[email protected]>
1 parent 4853ea0 commit e5468fe

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

custom_components/tahoma/climate_devices/atlantic_electrical_towel_dryer.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
PRESET_NONE,
1414
)
1515
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
16+
from pyoverkiz.enums import OverkizState
1617

18+
from ..coordinator import OverkizDataUpdateCoordinator
1719
from ..entity import OverkizEntity
1820

1921
COMMAND_SET_TARGET_TEMPERATURE = "setTargetTemperature"
@@ -68,6 +70,11 @@ class AtlanticElectricalTowelDryer(OverkizEntity, ClimateEntity):
6870
_attr_supported_features = SUPPORT_PRESET_MODE | SUPPORT_TARGET_TEMPERATURE
6971
_attr_temperature_unit = TEMP_CELSIUS
7072

73+
def __init__(self, device_url: str, coordinator: OverkizDataUpdateCoordinator):
74+
"""Init method."""
75+
super().__init__(device_url, coordinator)
76+
self.temperature_device = self.executor.linked_device(7)
77+
7178
@property
7279
def hvac_mode(self) -> str:
7380
"""Return hvac operation ie. heat, cool mode."""
@@ -103,13 +110,14 @@ def target_temperature(self) -> None:
103110
"""Return the temperature."""
104111
if self.hvac_mode == HVAC_MODE_AUTO:
105112
return self.executor.select_state(IO_EFFECTIVE_TEMPERATURE_SETPOINT_STATE)
106-
else:
107-
return self.executor.select_state(CORE_TARGET_TEMPERATURE_STATE)
113+
return self.executor.select_state(CORE_TARGET_TEMPERATURE_STATE)
108114

109115
@property
110-
def current_temperature(self):
116+
def current_temperature(self) -> float:
111117
"""Return current temperature."""
112-
return self.executor.select_state(CORE_COMFORT_ROOM_TEMPERATURE_STATE)
118+
return float(
119+
self.temperature_device.states.get(OverkizState.CORE_TEMPERATURE).value
120+
)
113121

114122
async def async_set_temperature(self, **kwargs) -> None:
115123
"""Set new temperature."""

custom_components/tahoma/executor.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ def device(self) -> Device:
2626
"""Return Overkiz device linked to this entity."""
2727
return self.coordinator.data[self.device_url]
2828

29+
def linked_device(self, index) -> Device:
30+
"""Return Overkiz device sharing the same base url."""
31+
return self.coordinator.data[f"{self.base_device_url}#{index}"]
32+
2933
def select_command(self, *commands: str) -> str | None:
3034
"""Select first existing command in a list of commands."""
3135
existing_commands = self.device.definition.commands

0 commit comments

Comments
 (0)