mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 18:27:09 +00:00
Reload conversation entries on update (#123279)
This commit is contained in:
parent
cba6273ac6
commit
933fba84a9
@ -346,9 +346,5 @@ class OllamaConversationEntity(
|
|||||||
self, hass: HomeAssistant, entry: ConfigEntry
|
self, hass: HomeAssistant, entry: ConfigEntry
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Handle options update."""
|
"""Handle options update."""
|
||||||
if entry.options.get(CONF_LLM_HASS_API):
|
# Reload as we update device info + entity name + supported features
|
||||||
self._attr_supported_features = (
|
await hass.config_entries.async_reload(entry.entry_id)
|
||||||
conversation.ConversationEntityFeature.CONTROL
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
self._attr_supported_features = conversation.ConversationEntityFeature(0)
|
|
||||||
|
@ -328,9 +328,5 @@ class OpenAIConversationEntity(
|
|||||||
self, hass: HomeAssistant, entry: ConfigEntry
|
self, hass: HomeAssistant, entry: ConfigEntry
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Handle options update."""
|
"""Handle options update."""
|
||||||
if entry.options.get(CONF_LLM_HASS_API):
|
# Reload as we update device info + entity name + supported features
|
||||||
self._attr_supported_features = (
|
await hass.config_entries.async_reload(entry.entry_id)
|
||||||
conversation.ConversationEntityFeature.CONTROL
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
self._attr_supported_features = conversation.ConversationEntityFeature(0)
|
|
||||||
|
@ -48,6 +48,7 @@ async def mock_init_component(hass: HomeAssistant, mock_config_entry: MockConfig
|
|||||||
):
|
):
|
||||||
assert await async_setup_component(hass, ollama.DOMAIN, {})
|
assert await async_setup_component(hass, ollama.DOMAIN, {})
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
yield
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
|
@ -312,6 +312,7 @@ async def test_unknown_hass_api(
|
|||||||
CONF_LLM_HASS_API: "non-existing",
|
CONF_LLM_HASS_API: "non-existing",
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
result = await conversation.async_converse(
|
result = await conversation.async_converse(
|
||||||
hass, "hello", None, Context(), agent_id=mock_config_entry.entry_id
|
hass, "hello", None, Context(), agent_id=mock_config_entry.entry_id
|
||||||
|
Loading…
x
Reference in New Issue
Block a user