Integration tado bump (#97791)

* Bumping to PyTado 0.16 and adding test coverage

* Removing comment

* Upgrading the deprecated functions

* Updating tests to support paramterization

* Delete test_config_flow.py

Reverting the tests, which will be placed in a different PR.

* Revert "Delete test_config_flow.py"

This reverts commit 1719ebc990.

* Reverting back changes
This commit is contained in:
Erwin Douna 2023-08-07 15:59:46 +02:00 committed by GitHub
parent 3a0822e03b
commit 65365d1db5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 23 deletions

View file

@ -163,12 +163,11 @@ class TadoConnector:
def setup(self):
"""Connect to Tado and fetch the zones."""
self.tado = Tado(self._username, self._password)
self.tado.setDebugging(True)
self.tado = Tado(self._username, self._password, None, True)
# Load zones and devices
self.zones = self.tado.getZones()
self.devices = self.tado.getDevices()
tado_home = self.tado.getMe()["homes"][0]
self.zones = self.tado.get_zones()
self.devices = self.tado.get_devices()
tado_home = self.tado.get_me()["homes"][0]
self.home_id = tado_home["id"]
self.home_name = tado_home["name"]
@ -181,7 +180,7 @@ class TadoConnector:
def update_devices(self):
"""Update the device data from Tado."""
devices = self.tado.getDevices()
devices = self.tado.get_devices()
for device in devices:
device_short_serial_no = device["shortSerialNo"]
_LOGGER.debug("Updating device %s", device_short_serial_no)
@ -190,7 +189,7 @@ class TadoConnector:
INSIDE_TEMPERATURE_MEASUREMENT
in device["characteristics"]["capabilities"]
):
device[TEMP_OFFSET] = self.tado.getDeviceInfo(
device[TEMP_OFFSET] = self.tado.get_device_info(
device_short_serial_no, TEMP_OFFSET
)
except RuntimeError:
@ -218,7 +217,7 @@ class TadoConnector:
def update_zones(self):
"""Update the zone data from Tado."""
try:
zone_states = self.tado.getZoneStates()["zoneStates"]
zone_states = self.tado.get_zone_states()["zoneStates"]
except RuntimeError:
_LOGGER.error("Unable to connect to Tado while updating zones")
return
@ -230,7 +229,7 @@ class TadoConnector:
"""Update the internal data from Tado."""
_LOGGER.debug("Updating zone %s", zone_id)
try:
data = self.tado.getZoneState(zone_id)
data = self.tado.get_zone_state(zone_id)
except RuntimeError:
_LOGGER.error("Unable to connect to Tado while updating zone %s", zone_id)
return
@ -251,8 +250,8 @@ class TadoConnector:
def update_home(self):
"""Update the home data from Tado."""
try:
self.data["weather"] = self.tado.getWeather()
self.data["geofence"] = self.tado.getHomeState()
self.data["weather"] = self.tado.get_weather()
self.data["geofence"] = self.tado.get_home_state()
dispatcher_send(
self.hass,
SIGNAL_TADO_UPDATE_RECEIVED.format(self.home_id, "home", "data"),
@ -265,15 +264,15 @@ class TadoConnector:
def get_capabilities(self, zone_id):
"""Return the capabilities of the devices."""
return self.tado.getCapabilities(zone_id)
return self.tado.get_capabilities(zone_id)
def get_auto_geofencing_supported(self):
"""Return whether the Tado Home supports auto geofencing."""
return self.tado.getAutoGeofencingSupported()
return self.tado.get_auto_geofencing_supported()
def reset_zone_overlay(self, zone_id):
"""Reset the zone back to the default operation."""
self.tado.resetZoneOverlay(zone_id)
self.tado.reset_zone_overlay(zone_id)
self.update_zone(zone_id)
def set_presence(
@ -282,11 +281,11 @@ class TadoConnector:
):
"""Set the presence to home, away or auto."""
if presence == PRESET_AWAY:
self.tado.setAway()
self.tado.set_away()
elif presence == PRESET_HOME:
self.tado.setHome()
self.tado.set_home()
elif presence == PRESET_AUTO:
self.tado.setAuto()
self.tado.set_auto()
# Update everything when changing modes
self.update_zones()
@ -320,7 +319,7 @@ class TadoConnector:
)
try:
self.tado.setZoneOverlay(
self.tado.set_zone_overlay(
zone_id,
overlay_mode,
temperature,
@ -340,7 +339,7 @@ class TadoConnector:
def set_zone_off(self, zone_id, overlay_mode, device_type="HEATING"):
"""Set a zone to off."""
try:
self.tado.setZoneOverlay(
self.tado.set_zone_overlay(
zone_id, overlay_mode, None, None, device_type, "OFF"
)
except RequestException as exc:
@ -351,6 +350,6 @@ class TadoConnector:
def set_temperature_offset(self, device_id, offset):
"""Set temperature offset of device."""
try:
self.tado.setTempOffset(device_id, offset)
self.tado.set_temp_offset(device_id, offset)
except RequestException as exc:
_LOGGER.error("Could not set temperature offset: %s", exc)

View file

@ -14,5 +14,5 @@
},
"iot_class": "cloud_polling",
"loggers": ["PyTado"],
"requirements": ["python-tado==0.15.0"]
"requirements": ["python-tado==0.16.0"]
}

View file

@ -2162,7 +2162,7 @@ python-smarttub==0.0.33
python-songpal==0.15.2
# homeassistant.components.tado
python-tado==0.15.0
python-tado==0.16.0
# homeassistant.components.telegram_bot
python-telegram-bot==13.1

View file

@ -1591,7 +1591,7 @@ python-smarttub==0.0.33
python-songpal==0.15.2
# homeassistant.components.tado
python-tado==0.15.0
python-tado==0.16.0
# homeassistant.components.telegram_bot
python-telegram-bot==13.1