-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for TadoX thermostatic radiator valves #129600
Closed
Closed
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
08734c5
Support for TadoX thermostatic radiator valves
Moritz-Schmidt b5544e4
Merge branch 'home-assistant:dev' into dev
Moritz-Schmidt c9b2c4c
Merge branch 'dev' into dev
karlbeecken 767af19
set correct python-tado version
karlbeecken bbb0105
fix tests
karlbeecken 116811d
Merge branch 'dev' into dev
karlbeecken 42856eb
code quality improvements
Moritz-Schmidt 0993116
Merge branch 'dev' into dev
karlbeecken af49c37
Merge branch 'dev' into dev
karlbeecken d2c5942
more code quality improvements
Moritz-Schmidt 3197897
Merge branch 'dev' into dev
karlbeecken a37b07d
Merge branch 'dev' into dev
karlbeecken c2ef176
Merge branch 'dev' into dev
karlbeecken 4e2259c
Merge branch 'dev' into dev
karlbeecken d8ccef9
Merge branch 'dev' into dev
karlbeecken 760a8c8
Merge branch 'dev' into dev
Moritz-Schmidt 9649be5
Update homeassistant/components/tado/tado_connector.py
karlbeecken 5785f33
fixing logic of review changes
Moritz-Schmidt ba33fca
code quality improvements
Moritz-Schmidt 12d9950
Merge branch 'dev' into dev
karlbeecken c919469
fix typing
Moritz-Schmidt dac759a
Merge branch 'dev' into dev
karlbeecken a461545
Merge branch 'dev' into dev
edenhaus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -23,7 +23,12 @@ | |||||||||||||||||||
HVACAction, | ||||||||||||||||||||
HVACMode, | ||||||||||||||||||||
) | ||||||||||||||||||||
from homeassistant.const import ATTR_TEMPERATURE, PRECISION_TENTHS, UnitOfTemperature | ||||||||||||||||||||
from homeassistant.const import ( | ||||||||||||||||||||
ATTR_TEMPERATURE, | ||||||||||||||||||||
PRECISION_HALVES, | ||||||||||||||||||||
PRECISION_TENTHS, | ||||||||||||||||||||
UnitOfTemperature, | ||||||||||||||||||||
) | ||||||||||||||||||||
from homeassistant.core import HomeAssistant, callback | ||||||||||||||||||||
from homeassistant.helpers import config_validation as cv, entity_platform | ||||||||||||||||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect | ||||||||||||||||||||
|
@@ -69,6 +74,8 @@ | |||||||||||||||||||
TADO_TO_HA_OFFSET_MAP, | ||||||||||||||||||||
TADO_TO_HA_SWING_MODE_MAP, | ||||||||||||||||||||
TADO_VERTICAL_SWING_SETTING, | ||||||||||||||||||||
TADO_X_DEFAULT_MAX_TEMP, | ||||||||||||||||||||
TADO_X_DEFAULT_MIN_TEMP, | ||||||||||||||||||||
TEMP_OFFSET, | ||||||||||||||||||||
TYPE_AIR_CONDITIONING, | ||||||||||||||||||||
TYPE_HEATING, | ||||||||||||||||||||
|
@@ -222,16 +229,21 @@ def create_climate_entity( | |||||||||||||||||||
if heat_temperatures is None and "temperatures" in capabilities: | ||||||||||||||||||||
heat_temperatures = capabilities["temperatures"] | ||||||||||||||||||||
|
||||||||||||||||||||
if cool_temperatures is None and heat_temperatures is None: | ||||||||||||||||||||
if cool_temperatures is None and heat_temperatures is None and not tado.is_x: | ||||||||||||||||||||
_LOGGER.debug("Not adding zone %s since it has no temperatures", name) | ||||||||||||||||||||
return None | ||||||||||||||||||||
|
||||||||||||||||||||
heat_min_temp = None | ||||||||||||||||||||
heat_max_temp = None | ||||||||||||||||||||
heat_step = None | ||||||||||||||||||||
cool_min_temp = None | ||||||||||||||||||||
cool_max_temp = None | ||||||||||||||||||||
cool_step = None | ||||||||||||||||||||
heat_min_temp: float | None = None | ||||||||||||||||||||
heat_max_temp: float | None = None | ||||||||||||||||||||
heat_step: float | None = None | ||||||||||||||||||||
cool_min_temp: float | None = None | ||||||||||||||||||||
cool_max_temp: float | None = None | ||||||||||||||||||||
cool_step: float | None = None | ||||||||||||||||||||
|
||||||||||||||||||||
if tado.is_x: | ||||||||||||||||||||
heat_min_temp = TADO_X_DEFAULT_MIN_TEMP | ||||||||||||||||||||
heat_max_temp = TADO_X_DEFAULT_MAX_TEMP | ||||||||||||||||||||
heat_step = PRECISION_HALVES | ||||||||||||||||||||
|
||||||||||||||||||||
if heat_temperatures is not None: | ||||||||||||||||||||
heat_min_temp = float(heat_temperatures["celsius"]["min"]) | ||||||||||||||||||||
|
@@ -299,7 +311,11 @@ def __init__( | |||||||||||||||||||
self._attr_unique_id = f"{zone_type} {zone_id} {tado.home_id}" | ||||||||||||||||||||
|
||||||||||||||||||||
self._device_info = device_info | ||||||||||||||||||||
self._device_id = self._device_info["shortSerialNo"] | ||||||||||||||||||||
self._device_id = ( | ||||||||||||||||||||
self._device_info["serialNumber"] | ||||||||||||||||||||
if self._tado.is_x | ||||||||||||||||||||
else self._device_info["shortSerialNo"] | ||||||||||||||||||||
) | ||||||||||||||||||||
|
||||||||||||||||||||
self._ac_device = zone_type == TYPE_AIR_CONDITIONING | ||||||||||||||||||||
self._attr_hvac_modes = supported_hvac_modes | ||||||||||||||||||||
|
@@ -419,6 +435,10 @@ def preset_mode(self) -> str: | |||||||||||||||||||
): | ||||||||||||||||||||
if not self._tado_geofence_data["presenceLocked"]: | ||||||||||||||||||||
return PRESET_AUTO | ||||||||||||||||||||
if self._tado.is_x and self._tado_geofence_data["presence"] == "HOME": | ||||||||||||||||||||
return PRESET_HOME | ||||||||||||||||||||
if self._tado.is_x and self._tado_geofence_data["presence"] == "AWAY": | ||||||||||||||||||||
return PRESET_AWAY | ||||||||||||||||||||
Comment on lines
+438
to
+441
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||
if self._tado_zone_data.is_away: | ||||||||||||||||||||
return PRESET_AWAY | ||||||||||||||||||||
return PRESET_HOME | ||||||||||||||||||||
|
@@ -603,16 +623,21 @@ def _async_update_zone_data(self) -> None: | |||||||||||||||||||
"""Load tado data into zone.""" | ||||||||||||||||||||
self._tado_zone_data = self._tado.data["zone"][self.zone_id] | ||||||||||||||||||||
|
||||||||||||||||||||
# Assign offset values to mapped attributes | ||||||||||||||||||||
for offset_key, attr in TADO_TO_HA_OFFSET_MAP.items(): | ||||||||||||||||||||
if ( | ||||||||||||||||||||
self._device_id in self._tado.data["device"] | ||||||||||||||||||||
and offset_key | ||||||||||||||||||||
in self._tado.data["device"][self._device_id][TEMP_OFFSET] | ||||||||||||||||||||
): | ||||||||||||||||||||
self._tado_zone_temp_offset[attr] = self._tado.data["device"][ | ||||||||||||||||||||
self._device_id | ||||||||||||||||||||
][TEMP_OFFSET][offset_key] | ||||||||||||||||||||
if self._tado.is_x: | ||||||||||||||||||||
self._tado_zone_temp_offset["offsent_celsius"] = self._tado.data["device"][ | ||||||||||||||||||||
self._device_id | ||||||||||||||||||||
][TEMP_OFFSET] | ||||||||||||||||||||
else: | ||||||||||||||||||||
# Assign offset values to mapped attributes | ||||||||||||||||||||
for offset_key, attr in TADO_TO_HA_OFFSET_MAP.items(): | ||||||||||||||||||||
if ( | ||||||||||||||||||||
self._device_id in self._tado.data["device"] | ||||||||||||||||||||
and offset_key | ||||||||||||||||||||
in self._tado.data["device"][self._device_id][TEMP_OFFSET] | ||||||||||||||||||||
): | ||||||||||||||||||||
self._tado_zone_temp_offset[attr] = self._tado.data["device"][ | ||||||||||||||||||||
self._device_id | ||||||||||||||||||||
][TEMP_OFFSET][offset_key] | ||||||||||||||||||||
|
||||||||||||||||||||
self._current_tado_hvac_mode = self._tado_zone_data.current_hvac_mode | ||||||||||||||||||||
self._current_tado_hvac_action = self._tado_zone_data.current_hvac_action | ||||||||||||||||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,17 +17,33 @@ def __init__(self, device_info: dict[str, str]) -> None: | |
"""Initialize a Tado device.""" | ||
super().__init__() | ||
self._device_info = device_info | ||
self.device_name = device_info["serialNo"] | ||
self.device_id = device_info["shortSerialNo"] | ||
self._attr_device_info = DeviceInfo( | ||
configuration_url=f"https://app.tado.com/en/main/settings/rooms-and-devices/device/{self.device_name}", | ||
identifiers={(DOMAIN, self.device_id)}, | ||
name=self.device_name, | ||
manufacturer=DEFAULT_NAME, | ||
sw_version=device_info["currentFwVersion"], | ||
model=device_info["deviceType"], | ||
via_device=(DOMAIN, device_info["serialNo"]), | ||
) | ||
if device_info["is_x"]: | ||
self.device_name = device_info["serialNumber"] | ||
self.device_id = device_info["serialNumber"] | ||
self._attr_device_info = DeviceInfo( | ||
configuration_url=f"https://app.tado.com/en/main/settings/home/rooms-and-devices/device/{self.device_name}", | ||
identifiers={(DOMAIN, self.device_id)}, | ||
name=self.device_name, | ||
manufacturer=DEFAULT_NAME, | ||
sw_version=device_info["firmwareVersion"], | ||
model=device_info["type"], | ||
via_device=(DOMAIN, device_info["serialNumber"]), | ||
) | ||
else: | ||
self.device_name = device_info["serialNo"] | ||
self.device_id = device_info["shortSerialNo"] | ||
self._attr_device_info = DeviceInfo( | ||
configuration_url=f"https://app.tado.com/en/main/settings/rooms-and-devices/device/{self.device_name}", | ||
identifiers={(DOMAIN, self.device_id)}, | ||
name=self.device_name, | ||
manufacturer=DEFAULT_NAME, | ||
sw_version=device_info["currentFwVersion"], | ||
model=device_info["deviceType"], | ||
via_device=( | ||
DOMAIN, | ||
device_info["serialNo"], | ||
), | ||
Comment on lines
+40
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To deduplicate code please create local variables for these attributes and have a single DeviceInfo |
||
) | ||
|
||
|
||
class TadoHomeEntity(Entity): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of having a lot of these if statements, can we have separate classes for it?