Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions homeassistant/components/fritzbox/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ def cleanup_removed_devices(self, avaiable_ains: list[str]) -> None:
def _update_fritz_devices(self) -> FritzboxCoordinatorData:
"""Update all fritzbox device data."""
try:
self.fritz.update_devices()
self.fritz.update_devices(ignore_removed=False)
if self.has_templates:
self.fritz.update_templates()
self.fritz.update_templates(ignore_removed=False)
except RequestConnectionError as ex:
raise UpdateFailed from ex
except HTTPError:
Expand All @@ -93,9 +93,9 @@ def _update_fritz_devices(self) -> FritzboxCoordinatorData:
self.fritz.login()
except LoginError as ex:
raise ConfigEntryAuthFailed from ex
self.fritz.update_devices()
self.fritz.update_devices(ignore_removed=False)
if self.has_templates:
self.fritz.update_templates()
self.fritz.update_templates(ignore_removed=False)

devices = self.fritz.get_devices()
device_data = {}
Expand Down Expand Up @@ -124,14 +124,18 @@ def _update_fritz_devices(self) -> FritzboxCoordinatorData:
self.new_devices = device_data.keys() - self.data.devices.keys()
self.new_templates = template_data.keys() - self.data.templates.keys()

if (
self.data.devices.keys() - device_data.keys()
or self.data.templates.keys() - template_data.keys()
):
self.cleanup_removed_devices(list(device_data) + list(template_data))

return FritzboxCoordinatorData(devices=device_data, templates=template_data)

async def _async_update_data(self) -> FritzboxCoordinatorData:
"""Fetch all device data."""
return await self.hass.async_add_executor_job(self._update_fritz_devices)
new_data = await self.hass.async_add_executor_job(self._update_fritz_devices)

if (
self.data.devices.keys() - new_data.devices.keys()
or self.data.templates.keys() - new_data.templates.keys()
):
self.cleanup_removed_devices(
list(new_data.devices) + list(new_data.templates)
)

return new_data
2 changes: 1 addition & 1 deletion homeassistant/components/fritzbox/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"iot_class": "local_polling",
"loggers": ["pyfritzhome"],
"quality_scale": "gold",
"requirements": ["pyfritzhome==0.6.10"],
"requirements": ["pyfritzhome==0.6.11"],
"ssdp": [
{
"st": "urn:schemas-upnp-org:device:fritzbox:1"
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1833,7 +1833,7 @@ pyforked-daapd==0.1.14
pyfreedompro==1.1.0

# homeassistant.components.fritzbox
pyfritzhome==0.6.10
pyfritzhome==0.6.11

# homeassistant.components.ifttt
pyfttt==0.3
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1429,7 +1429,7 @@ pyforked-daapd==0.1.14
pyfreedompro==1.1.0

# homeassistant.components.fritzbox
pyfritzhome==0.6.10
pyfritzhome==0.6.11

# homeassistant.components.ifttt
pyfttt==0.3
Expand Down