Skip to content

Commit

Permalink
Further PR corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
tggm committed Dec 7, 2022
1 parent 4b302d7 commit cf88d69
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
8 changes: 3 additions & 5 deletions homeassistant/components/rointe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,10 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)

if unload_ok:
coordinator: RointeDataUpdateCoordinator = hass.data[DOMAIN][entry.entry_id][
ROINTE_COORDINATOR
]
rointe_data = hass.data[DOMAIN].pop(entry.entry_id)

while coordinator.cleanup_callbacks:
coordinator.cleanup_callbacks.pop()()
while rointe_data[ROINTE_COORDINATOR].cleanup_callbacks:
rointe_data[ROINTE_COORDINATOR].cleanup_callbacks.pop()()

return unload_ok

Expand Down
15 changes: 10 additions & 5 deletions homeassistant/components/rointe/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,16 @@ async def _async_update_data(self) -> dict[str, RointeDevice]:

devices = await self.device_manager.update()

for device_id, device in devices.items():
for platform in PLATFORMS:
if device_id not in self.unregistered_keys[platform]:
self.unregistered_keys[platform][device_id] = device

for platform in PLATFORMS:
self.unregistered_keys[platform].update(
{
device_id: device
for device_id, device in devices.items()
if device_id not in self.unregistered_keys[platform]
}
)

for device in devices.values():
device_update_info(self.hass, device)

return devices
Expand Down

0 comments on commit cf88d69

Please sign in to comment.