From 45ce0fed0acc913597f7f3095c11c04fced2b326 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Wed, 7 Aug 2024 12:22:50 +0200 Subject: [PATCH] Reload config entry for anthropic on update (#123280) * Reload config entry for anthropic on update * Fix tests --- homeassistant/components/anthropic/conversation.py | 8 ++------ tests/components/anthropic/conftest.py | 1 + 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/anthropic/conversation.py b/homeassistant/components/anthropic/conversation.py index 3d876bf3325..20e555e9592 100644 --- a/homeassistant/components/anthropic/conversation.py +++ b/homeassistant/components/anthropic/conversation.py @@ -312,9 +312,5 @@ class AnthropicConversationEntity( self, hass: HomeAssistant, entry: ConfigEntry ) -> None: """Handle options update.""" - if entry.options.get(CONF_LLM_HASS_API): - self._attr_supported_features = ( - conversation.ConversationEntityFeature.CONTROL - ) - else: - self._attr_supported_features = conversation.ConversationEntityFeature(0) + # Reload as we update device info + entity name + supported features + await hass.config_entries.async_reload(entry.entry_id) diff --git a/tests/components/anthropic/conftest.py b/tests/components/anthropic/conftest.py index 0a5ad5e5ac6..fe3b20f15b8 100644 --- a/tests/components/anthropic/conftest.py +++ b/tests/components/anthropic/conftest.py @@ -43,6 +43,7 @@ async def mock_init_component(hass, mock_config_entry): ): assert await async_setup_component(hass, "anthropic", {}) await hass.async_block_till_done() + yield @pytest.fixture(autouse=True)