Skip to content

Commit

Permalink
Fix failed recovery in roku (#94572)
Browse files Browse the repository at this point in the history
  • Loading branch information
ctalkington authored and balloob committed Jun 15, 2023
1 parent d28d909 commit 8f437c5
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions homeassistant/components/roku/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,18 @@

async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up Roku from a config entry."""
hass.data.setdefault(DOMAIN, {})
if not (coordinator := hass.data[DOMAIN].get(entry.entry_id)):
coordinator = RokuDataUpdateCoordinator(hass, host=entry.data[CONF_HOST])
hass.data[DOMAIN][entry.entry_id] = coordinator

coordinator = RokuDataUpdateCoordinator(hass, host=entry.data[CONF_HOST])
await coordinator.async_config_entry_first_refresh()

hass.data.setdefault(DOMAIN, {})[entry.entry_id] = coordinator

await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)

return True


async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload a config entry."""
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
if unload_ok:
if unload_ok := await hass.config_entries.async_unload_platforms(entry, PLATFORMS):
hass.data[DOMAIN].pop(entry.entry_id)
return unload_ok

0 comments on commit 8f437c5

Please sign in to comment.