mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Move the async_reload on updates in async_setup_entry in Google Generative AI (#147748)
Move the async_reload on updates in async_setup_entry
This commit is contained in:
parent
617ea1925c
commit
25ab47a587
@ -207,6 +207,8 @@ async def async_setup_entry(
|
|||||||
|
|
||||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||||
|
|
||||||
|
entry.async_on_unload(entry.add_update_listener(async_update_options))
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
@ -220,6 +222,13 @@ async def async_unload_entry(
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
async def async_update_options(
|
||||||
|
hass: HomeAssistant, entry: GoogleGenerativeAIConfigEntry
|
||||||
|
) -> None:
|
||||||
|
"""Update options."""
|
||||||
|
await hass.config_entries.async_reload(entry.entry_id)
|
||||||
|
|
||||||
|
|
||||||
async def async_migrate_integration(hass: HomeAssistant) -> None:
|
async def async_migrate_integration(hass: HomeAssistant) -> None:
|
||||||
"""Migrate integration entry structure."""
|
"""Migrate integration entry structure."""
|
||||||
|
|
||||||
|
@ -61,9 +61,6 @@ class GoogleGenerativeAIConversationEntity(
|
|||||||
self.hass, "conversation", self.entry.entry_id, self.entity_id
|
self.hass, "conversation", self.entry.entry_id, self.entity_id
|
||||||
)
|
)
|
||||||
conversation.async_set_agent(self.hass, self.entry, self)
|
conversation.async_set_agent(self.hass, self.entry, self)
|
||||||
self.entry.async_on_unload(
|
|
||||||
self.entry.add_update_listener(self._async_entry_update_listener)
|
|
||||||
)
|
|
||||||
|
|
||||||
async def async_will_remove_from_hass(self) -> None:
|
async def async_will_remove_from_hass(self) -> None:
|
||||||
"""When entity will be removed from Home Assistant."""
|
"""When entity will be removed from Home Assistant."""
|
||||||
@ -103,10 +100,3 @@ class GoogleGenerativeAIConversationEntity(
|
|||||||
conversation_id=chat_log.conversation_id,
|
conversation_id=chat_log.conversation_id,
|
||||||
continue_conversation=chat_log.continue_conversation,
|
continue_conversation=chat_log.continue_conversation,
|
||||||
)
|
)
|
||||||
|
|
||||||
async def _async_entry_update_listener(
|
|
||||||
self, hass: HomeAssistant, entry: ConfigEntry
|
|
||||||
) -> None:
|
|
||||||
"""Handle options update."""
|
|
||||||
# Reload as we update device info + entity name + supported features
|
|
||||||
await hass.config_entries.async_reload(entry.entry_id)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user