mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 00:37:53 +00:00
Bump PyTado to 0.10.0 (#44770)
* Bump PyTado to v0.10.0 Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> * Tado: switch to getDeviceInfo This function has been introduced in version 0.10.0 of PyTado. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> * Tado: update tests Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
This commit is contained in:
parent
2bd8ee34f4
commit
ec926105a0
@ -173,6 +173,7 @@ class TadoConnector:
|
||||
self.zones = None
|
||||
self.devices = None
|
||||
self.data = {
|
||||
"device": {},
|
||||
"zone": {},
|
||||
}
|
||||
|
||||
@ -193,15 +194,18 @@ class TadoConnector:
|
||||
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
||||
def update(self):
|
||||
"""Update the registered zones."""
|
||||
for device in self.devices:
|
||||
self.update_sensor("device", device["shortSerialNo"])
|
||||
for zone in self.zones:
|
||||
self.update_sensor("zone", zone["id"])
|
||||
self.devices = self.tado.getDevices()
|
||||
|
||||
def update_sensor(self, sensor_type, sensor):
|
||||
"""Update the internal data from Tado."""
|
||||
_LOGGER.debug("Updating %s %s", sensor_type, sensor)
|
||||
try:
|
||||
if sensor_type == "zone":
|
||||
if sensor_type == "device":
|
||||
data = self.tado.getDeviceInfo(sensor)
|
||||
elif sensor_type == "zone":
|
||||
data = self.tado.getZoneState(sensor)
|
||||
else:
|
||||
_LOGGER.debug("Unknown sensor: %s", sensor_type)
|
||||
|
@ -157,10 +157,10 @@ class TadoDeviceBinarySensor(TadoDeviceEntity, BinarySensorEntity):
|
||||
@callback
|
||||
def _async_update_device_data(self):
|
||||
"""Handle update callbacks."""
|
||||
for device in self._tado.devices:
|
||||
if device["serialNo"] == self.device_id:
|
||||
self._device_info = device
|
||||
break
|
||||
try:
|
||||
self._device_info = self._tado.data["device"][self.device_id]
|
||||
except KeyError:
|
||||
return
|
||||
|
||||
if self.device_variable == "battery state":
|
||||
self._state = self._device_info["batteryState"] == "LOW"
|
||||
|
@ -11,8 +11,8 @@ class TadoDeviceEntity(Entity):
|
||||
"""Initialize a Tado device."""
|
||||
super().__init__()
|
||||
self._device_info = device_info
|
||||
self.device_name = device_info["shortSerialNo"]
|
||||
self.device_id = device_info["serialNo"]
|
||||
self.device_name = device_info["serialNo"]
|
||||
self.device_id = device_info["shortSerialNo"]
|
||||
|
||||
@property
|
||||
def device_info(self):
|
||||
|
@ -2,7 +2,7 @@
|
||||
"domain": "tado",
|
||||
"name": "Tado",
|
||||
"documentation": "https://www.home-assistant.io/integrations/tado",
|
||||
"requirements": ["python-tado==0.8.1"],
|
||||
"requirements": ["python-tado==0.10.0"],
|
||||
"codeowners": ["@michaelarnauts", "@bdraco"],
|
||||
"config_flow": true,
|
||||
"homekit": {
|
||||
|
@ -1807,7 +1807,7 @@ python-sochain-api==0.0.2
|
||||
python-songpal==0.12
|
||||
|
||||
# homeassistant.components.tado
|
||||
python-tado==0.8.1
|
||||
python-tado==0.10.0
|
||||
|
||||
# homeassistant.components.telegram_bot
|
||||
python-telegram-bot==13.1
|
||||
|
@ -894,7 +894,7 @@ python-openzwave-mqtt[mqtt-client]==1.4.0
|
||||
python-songpal==0.12
|
||||
|
||||
# homeassistant.components.tado
|
||||
python-tado==0.8.1
|
||||
python-tado==0.10.0
|
||||
|
||||
# homeassistant.components.twitch
|
||||
python-twitch-client==0.6.0
|
||||
|
@ -20,6 +20,9 @@ async def async_init_integration(
|
||||
me_fixture = "tado/me.json"
|
||||
zones_fixture = "tado/zones.json"
|
||||
|
||||
# WR1 Device
|
||||
device_wr1_fixture = "tado/device_wr1.json"
|
||||
|
||||
# Smart AC with Swing
|
||||
zone_5_state_fixture = "tado/smartac3.with_swing.json"
|
||||
zone_5_capabilities_fixture = "tado/zone_with_swing_capabilities.json"
|
||||
@ -50,6 +53,10 @@ async def async_init_integration(
|
||||
"https://my.tado.com/api/v2/homes/1/devices",
|
||||
text=load_fixture(devices_fixture),
|
||||
)
|
||||
m.get(
|
||||
"https://my.tado.com/api/v2/devices/WR1/",
|
||||
text=load_fixture(device_wr1_fixture),
|
||||
)
|
||||
m.get(
|
||||
"https://my.tado.com/api/v2/homes/1/zones",
|
||||
text=load_fixture(zones_fixture),
|
||||
|
20
tests/fixtures/tado/device_wr1.json
vendored
Normal file
20
tests/fixtures/tado/device_wr1.json
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"deviceType" : "WR02",
|
||||
"currentFwVersion" : "59.4",
|
||||
"accessPointWiFi" : {
|
||||
"ssid" : "tado8480"
|
||||
},
|
||||
"characteristics" : {
|
||||
"capabilities" : [
|
||||
"INSIDE_TEMPERATURE_MEASUREMENT",
|
||||
"IDENTIFY"
|
||||
]
|
||||
},
|
||||
"serialNo" : "WR1",
|
||||
"commandTableUploadState" : "FINISHED",
|
||||
"connectionState" : {
|
||||
"timestamp" : "2020-03-23T18:30:07.377Z",
|
||||
"value" : true
|
||||
},
|
||||
"shortSerialNo" : "WR1"
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user