Tado: use proper variable name to avoid confusion (#44571)
Current device_id variable refers to the Home ID obtained from the Tado API. Let's use home_id in order to avoid confusion with Tado devices. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
This commit is contained in:
parent
ed576edde7
commit
50e11773ee
6 changed files with 17 additions and 17 deletions
|
@ -168,7 +168,7 @@ class TadoConnector:
|
||||||
self._password = password
|
self._password = password
|
||||||
self._fallback = fallback
|
self._fallback = fallback
|
||||||
|
|
||||||
self.device_id = None
|
self.home_id = None
|
||||||
self.tado = None
|
self.tado = None
|
||||||
self.zones = None
|
self.zones = None
|
||||||
self.devices = None
|
self.devices = None
|
||||||
|
@ -188,7 +188,7 @@ class TadoConnector:
|
||||||
# Load zones and devices
|
# Load zones and devices
|
||||||
self.zones = self.tado.getZones()
|
self.zones = self.tado.getZones()
|
||||||
self.devices = self.tado.getDevices()
|
self.devices = self.tado.getDevices()
|
||||||
self.device_id = self.tado.getMe()["homes"][0]["id"]
|
self.home_id = self.tado.getMe()["homes"][0]["id"]
|
||||||
|
|
||||||
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
||||||
def update(self):
|
def update(self):
|
||||||
|
@ -218,14 +218,14 @@ class TadoConnector:
|
||||||
|
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"Dispatching update to %s %s %s: %s",
|
"Dispatching update to %s %s %s: %s",
|
||||||
self.device_id,
|
self.home_id,
|
||||||
sensor_type,
|
sensor_type,
|
||||||
sensor,
|
sensor,
|
||||||
data,
|
data,
|
||||||
)
|
)
|
||||||
dispatcher_send(
|
dispatcher_send(
|
||||||
self.hass,
|
self.hass,
|
||||||
SIGNAL_TADO_UPDATE_RECEIVED.format(self.device_id, sensor_type, sensor),
|
SIGNAL_TADO_UPDATE_RECEIVED.format(self.home_id, sensor_type, sensor),
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_capabilities(self, zone_id):
|
def get_capabilities(self, zone_id):
|
||||||
|
|
|
@ -63,7 +63,7 @@ class TadoDeviceSensor(TadoDeviceEntity, BinarySensorEntity):
|
||||||
|
|
||||||
self.device_variable = device_variable
|
self.device_variable = device_variable
|
||||||
|
|
||||||
self._unique_id = f"{device_variable} {self.device_id} {tado.device_id}"
|
self._unique_id = f"{device_variable} {self.device_id} {tado.home_id}"
|
||||||
|
|
||||||
self._state = None
|
self._state = None
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ class TadoDeviceSensor(TadoDeviceEntity, BinarySensorEntity):
|
||||||
async_dispatcher_connect(
|
async_dispatcher_connect(
|
||||||
self.hass,
|
self.hass,
|
||||||
SIGNAL_TADO_UPDATE_RECEIVED.format(
|
SIGNAL_TADO_UPDATE_RECEIVED.format(
|
||||||
self._tado.device_id, "device", self.device_id
|
self._tado.home_id, "device", self.device_id
|
||||||
),
|
),
|
||||||
self._async_update_callback,
|
self._async_update_callback,
|
||||||
)
|
)
|
||||||
|
|
|
@ -203,11 +203,11 @@ class TadoClimate(TadoZoneEntity, ClimateEntity):
|
||||||
):
|
):
|
||||||
"""Initialize of Tado climate entity."""
|
"""Initialize of Tado climate entity."""
|
||||||
self._tado = tado
|
self._tado = tado
|
||||||
super().__init__(zone_name, tado.device_id, zone_id)
|
super().__init__(zone_name, tado.home_id, zone_id)
|
||||||
|
|
||||||
self.zone_id = zone_id
|
self.zone_id = zone_id
|
||||||
self.zone_type = zone_type
|
self.zone_type = zone_type
|
||||||
self._unique_id = f"{zone_type} {zone_id} {tado.device_id}"
|
self._unique_id = f"{zone_type} {zone_id} {tado.home_id}"
|
||||||
|
|
||||||
self._ac_device = zone_type == TYPE_AIR_CONDITIONING
|
self._ac_device = zone_type == TYPE_AIR_CONDITIONING
|
||||||
self._supported_hvac_modes = supported_hvac_modes
|
self._supported_hvac_modes = supported_hvac_modes
|
||||||
|
@ -245,7 +245,7 @@ class TadoClimate(TadoZoneEntity, ClimateEntity):
|
||||||
async_dispatcher_connect(
|
async_dispatcher_connect(
|
||||||
self.hass,
|
self.hass,
|
||||||
SIGNAL_TADO_UPDATE_RECEIVED.format(
|
SIGNAL_TADO_UPDATE_RECEIVED.format(
|
||||||
self._tado.device_id, "zone", self.zone_id
|
self._tado.home_id, "zone", self.zone_id
|
||||||
),
|
),
|
||||||
self._async_update_callback,
|
self._async_update_callback,
|
||||||
)
|
)
|
||||||
|
|
|
@ -35,10 +35,10 @@ class TadoDeviceEntity(Entity):
|
||||||
class TadoZoneEntity(Entity):
|
class TadoZoneEntity(Entity):
|
||||||
"""Base implementation for Tado zone."""
|
"""Base implementation for Tado zone."""
|
||||||
|
|
||||||
def __init__(self, zone_name, device_id, zone_id):
|
def __init__(self, zone_name, home_id, zone_id):
|
||||||
"""Initialize a Tado zone."""
|
"""Initialize a Tado zone."""
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self._device_zone_id = f"{device_id}_{zone_id}"
|
self._device_zone_id = f"{home_id}_{zone_id}"
|
||||||
self.zone_name = zone_name
|
self.zone_name = zone_name
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -78,12 +78,12 @@ class TadoZoneSensor(TadoZoneEntity, Entity):
|
||||||
def __init__(self, tado, zone_name, zone_id, zone_variable):
|
def __init__(self, tado, zone_name, zone_id, zone_variable):
|
||||||
"""Initialize of the Tado Sensor."""
|
"""Initialize of the Tado Sensor."""
|
||||||
self._tado = tado
|
self._tado = tado
|
||||||
super().__init__(zone_name, tado.device_id, zone_id)
|
super().__init__(zone_name, tado.home_id, zone_id)
|
||||||
|
|
||||||
self.zone_id = zone_id
|
self.zone_id = zone_id
|
||||||
self.zone_variable = zone_variable
|
self.zone_variable = zone_variable
|
||||||
|
|
||||||
self._unique_id = f"{zone_variable} {zone_id} {tado.device_id}"
|
self._unique_id = f"{zone_variable} {zone_id} {tado.home_id}"
|
||||||
|
|
||||||
self._state = None
|
self._state = None
|
||||||
self._state_attributes = None
|
self._state_attributes = None
|
||||||
|
@ -96,7 +96,7 @@ class TadoZoneSensor(TadoZoneEntity, Entity):
|
||||||
async_dispatcher_connect(
|
async_dispatcher_connect(
|
||||||
self.hass,
|
self.hass,
|
||||||
SIGNAL_TADO_UPDATE_RECEIVED.format(
|
SIGNAL_TADO_UPDATE_RECEIVED.format(
|
||||||
self._tado.device_id, "zone", self.zone_id
|
self._tado.home_id, "zone", self.zone_id
|
||||||
),
|
),
|
||||||
self._async_update_callback,
|
self._async_update_callback,
|
||||||
)
|
)
|
||||||
|
|
|
@ -133,10 +133,10 @@ class TadoWaterHeater(TadoZoneEntity, WaterHeaterEntity):
|
||||||
"""Initialize of Tado water heater entity."""
|
"""Initialize of Tado water heater entity."""
|
||||||
|
|
||||||
self._tado = tado
|
self._tado = tado
|
||||||
super().__init__(zone_name, tado.device_id, zone_id)
|
super().__init__(zone_name, tado.home_id, zone_id)
|
||||||
|
|
||||||
self.zone_id = zone_id
|
self.zone_id = zone_id
|
||||||
self._unique_id = f"{zone_id} {tado.device_id}"
|
self._unique_id = f"{zone_id} {tado.home_id}"
|
||||||
|
|
||||||
self._device_is_active = False
|
self._device_is_active = False
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ class TadoWaterHeater(TadoZoneEntity, WaterHeaterEntity):
|
||||||
async_dispatcher_connect(
|
async_dispatcher_connect(
|
||||||
self.hass,
|
self.hass,
|
||||||
SIGNAL_TADO_UPDATE_RECEIVED.format(
|
SIGNAL_TADO_UPDATE_RECEIVED.format(
|
||||||
self._tado.device_id, "zone", self.zone_id
|
self._tado.home_id, "zone", self.zone_id
|
||||||
),
|
),
|
||||||
self._async_update_callback,
|
self._async_update_callback,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue