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
8 changed files with 42 additions and 11 deletions
|
@ -173,6 +173,7 @@ class TadoConnector:
|
||||||
self.zones = None
|
self.zones = None
|
||||||
self.devices = None
|
self.devices = None
|
||||||
self.data = {
|
self.data = {
|
||||||
|
"device": {},
|
||||||
"zone": {},
|
"zone": {},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,15 +194,18 @@ class TadoConnector:
|
||||||
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Update the registered zones."""
|
"""Update the registered zones."""
|
||||||
|
for device in self.devices:
|
||||||
|
self.update_sensor("device", device["shortSerialNo"])
|
||||||
for zone in self.zones:
|
for zone in self.zones:
|
||||||
self.update_sensor("zone", zone["id"])
|
self.update_sensor("zone", zone["id"])
|
||||||
self.devices = self.tado.getDevices()
|
|
||||||
|
|
||||||
def update_sensor(self, sensor_type, sensor):
|
def update_sensor(self, sensor_type, sensor):
|
||||||
"""Update the internal data from Tado."""
|
"""Update the internal data from Tado."""
|
||||||
_LOGGER.debug("Updating %s %s", sensor_type, sensor)
|
_LOGGER.debug("Updating %s %s", sensor_type, sensor)
|
||||||
try:
|
try:
|
||||||
if sensor_type == "zone":
|
if sensor_type == "device":
|
||||||
|
data = self.tado.getDeviceInfo(sensor)
|
||||||
|
elif sensor_type == "zone":
|
||||||
data = self.tado.getZoneState(sensor)
|
data = self.tado.getZoneState(sensor)
|
||||||
else:
|
else:
|
||||||
_LOGGER.debug("Unknown sensor: %s", sensor_type)
|
_LOGGER.debug("Unknown sensor: %s", sensor_type)
|
||||||
|
|
|
@ -157,10 +157,10 @@ class TadoDeviceBinarySensor(TadoDeviceEntity, BinarySensorEntity):
|
||||||
@callback
|
@callback
|
||||||
def _async_update_device_data(self):
|
def _async_update_device_data(self):
|
||||||
"""Handle update callbacks."""
|
"""Handle update callbacks."""
|
||||||
for device in self._tado.devices:
|
try:
|
||||||
if device["serialNo"] == self.device_id:
|
self._device_info = self._tado.data["device"][self.device_id]
|
||||||
self._device_info = device
|
except KeyError:
|
||||||
break
|
return
|
||||||
|
|
||||||
if self.device_variable == "battery state":
|
if self.device_variable == "battery state":
|
||||||
self._state = self._device_info["batteryState"] == "LOW"
|
self._state = self._device_info["batteryState"] == "LOW"
|
||||||
|
|
|
@ -11,8 +11,8 @@ class TadoDeviceEntity(Entity):
|
||||||
"""Initialize a Tado device."""
|
"""Initialize a Tado device."""
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self._device_info = device_info
|
self._device_info = device_info
|
||||||
self.device_name = device_info["shortSerialNo"]
|
self.device_name = device_info["serialNo"]
|
||||||
self.device_id = device_info["serialNo"]
|
self.device_id = device_info["shortSerialNo"]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_info(self):
|
def device_info(self):
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"domain": "tado",
|
"domain": "tado",
|
||||||
"name": "Tado",
|
"name": "Tado",
|
||||||
"documentation": "https://www.home-assistant.io/integrations/tado",
|
"documentation": "https://www.home-assistant.io/integrations/tado",
|
||||||
"requirements": ["python-tado==0.8.1"],
|
"requirements": ["python-tado==0.10.0"],
|
||||||
"codeowners": ["@michaelarnauts", "@bdraco"],
|
"codeowners": ["@michaelarnauts", "@bdraco"],
|
||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"homekit": {
|
"homekit": {
|
||||||
|
|
|
@ -1807,7 +1807,7 @@ python-sochain-api==0.0.2
|
||||||
python-songpal==0.12
|
python-songpal==0.12
|
||||||
|
|
||||||
# homeassistant.components.tado
|
# homeassistant.components.tado
|
||||||
python-tado==0.8.1
|
python-tado==0.10.0
|
||||||
|
|
||||||
# homeassistant.components.telegram_bot
|
# homeassistant.components.telegram_bot
|
||||||
python-telegram-bot==13.1
|
python-telegram-bot==13.1
|
||||||
|
|
|
@ -894,7 +894,7 @@ python-openzwave-mqtt[mqtt-client]==1.4.0
|
||||||
python-songpal==0.12
|
python-songpal==0.12
|
||||||
|
|
||||||
# homeassistant.components.tado
|
# homeassistant.components.tado
|
||||||
python-tado==0.8.1
|
python-tado==0.10.0
|
||||||
|
|
||||||
# homeassistant.components.twitch
|
# homeassistant.components.twitch
|
||||||
python-twitch-client==0.6.0
|
python-twitch-client==0.6.0
|
||||||
|
|
|
@ -20,6 +20,9 @@ async def async_init_integration(
|
||||||
me_fixture = "tado/me.json"
|
me_fixture = "tado/me.json"
|
||||||
zones_fixture = "tado/zones.json"
|
zones_fixture = "tado/zones.json"
|
||||||
|
|
||||||
|
# WR1 Device
|
||||||
|
device_wr1_fixture = "tado/device_wr1.json"
|
||||||
|
|
||||||
# Smart AC with Swing
|
# Smart AC with Swing
|
||||||
zone_5_state_fixture = "tado/smartac3.with_swing.json"
|
zone_5_state_fixture = "tado/smartac3.with_swing.json"
|
||||||
zone_5_capabilities_fixture = "tado/zone_with_swing_capabilities.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",
|
"https://my.tado.com/api/v2/homes/1/devices",
|
||||||
text=load_fixture(devices_fixture),
|
text=load_fixture(devices_fixture),
|
||||||
)
|
)
|
||||||
|
m.get(
|
||||||
|
"https://my.tado.com/api/v2/devices/WR1/",
|
||||||
|
text=load_fixture(device_wr1_fixture),
|
||||||
|
)
|
||||||
m.get(
|
m.get(
|
||||||
"https://my.tado.com/api/v2/homes/1/zones",
|
"https://my.tado.com/api/v2/homes/1/zones",
|
||||||
text=load_fixture(zones_fixture),
|
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…
Add table
Add a link
Reference in a new issue