Skip to content
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

Fix Tado unique mobile device dispatcher #107631

Merged
12 changes: 3 additions & 9 deletions homeassistant/components/tado/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ def __init__(self, hass, username, password, fallback):
self.tado = None
self.zones = None
self.devices = None
self.mobile_devices = None
self.data = {
"device": {},
"mobile_device": {},
Expand All @@ -182,7 +181,6 @@ def setup(self):
# Load zones and devices
self.zones = self.tado.get_zones()
self.devices = self.tado.get_devices()
self.mobile_devices = self.tado.get_mobile_devices()
tado_home = self.tado.get_me()["homes"][0]
self.home_id = tado_home["id"]
self.home_name = tado_home["name"]
Expand All @@ -208,9 +206,7 @@ def update_mobile_devices(self) -> None:
return

if len(mobile_devices) == 0:
MartinHjelmare marked this conversation as resolved.
Show resolved Hide resolved
_LOGGER.warning(
"No linked mobile devices found for home ID %s", self.home_id
)
_LOGGER.debug("No linked mobile devices found for home ID %s", self.home_id)
return

if "errors" in mobile_devices and len(mobile_devices["errors"]) > 0:
erwindouna marked this conversation as resolved.
Show resolved Hide resolved
erwindouna marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -230,9 +226,7 @@ def update_mobile_devices(self) -> None:
)
dispatcher_send(
MartinHjelmare marked this conversation as resolved.
Show resolved Hide resolved
self.hass,
SIGNAL_TADO_MOBILE_DEVICE_UPDATE_RECEIVED.format(
self.home_id, mobile_device["id"]
),
SIGNAL_TADO_MOBILE_DEVICE_UPDATE_RECEIVED.format(self.home_id),
)

dispatcher_send(self.hass, SIGNAL_TADO_MOBILE_DEVICES_UPDATE)
Expand All @@ -246,7 +240,7 @@ def update_devices(self):
return

if len(devices) == 0:
MartinHjelmare marked this conversation as resolved.
Show resolved Hide resolved
_LOGGER.warning("No linked devices found for home ID %s", self.home_id)
_LOGGER.debug("No linked devices found for home ID %s", self.home_id)
return

if "errors" in devices and len(devices["errors"]) > 0:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/tado/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
DOMAIN = "tado"

SIGNAL_TADO_UPDATE_RECEIVED = "tado_update_received_{}_{}_{}"
SIGNAL_TADO_MOBILE_DEVICE_UPDATE_RECEIVED = "tado_mobile_device_update_received_{}_{}"
SIGNAL_TADO_MOBILE_DEVICE_UPDATE_RECEIVED = "tado_mobile_device_update_received_{}"
SIGNAL_TADO_MOBILE_DEVICES_UPDATE = "tao_mobile_devices_update"
UNIQUE_ID = "unique_id"

Expand Down
4 changes: 1 addition & 3 deletions homeassistant/components/tado/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,7 @@ async def async_added_to_hass(self) -> None:
self.async_on_remove(
async_dispatcher_connect(
self.hass,
SIGNAL_TADO_MOBILE_DEVICE_UPDATE_RECEIVED.format(
self._tado.home_id, self._device_id
),
SIGNAL_TADO_MOBILE_DEVICE_UPDATE_RECEIVED.format(self._tado.home_id),
self.on_demand_update,
)
)
Expand Down
Loading