mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
Ensure claude supported feature reflect latest config entry options (#123050)
This commit is contained in:
parent
db238a75e3
commit
b6c9fe86e1
@ -21,6 +21,7 @@ from voluptuous_openapi import convert
|
|||||||
|
|
||||||
from homeassistant.components import conversation
|
from homeassistant.components import conversation
|
||||||
from homeassistant.components.conversation import trace
|
from homeassistant.components.conversation import trace
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CONF_LLM_HASS_API, MATCH_ALL
|
from homeassistant.const import CONF_LLM_HASS_API, MATCH_ALL
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import HomeAssistantError, TemplateError
|
from homeassistant.exceptions import HomeAssistantError, TemplateError
|
||||||
@ -117,6 +118,13 @@ class AnthropicConversationEntity(
|
|||||||
"""Return a list of supported languages."""
|
"""Return a list of supported languages."""
|
||||||
return MATCH_ALL
|
return MATCH_ALL
|
||||||
|
|
||||||
|
async def async_added_to_hass(self) -> None:
|
||||||
|
"""When entity is added to Home Assistant."""
|
||||||
|
await super().async_added_to_hass()
|
||||||
|
self.entry.async_on_unload(
|
||||||
|
self.entry.add_update_listener(self._async_entry_update_listener)
|
||||||
|
)
|
||||||
|
|
||||||
async def async_process(
|
async def async_process(
|
||||||
self, user_input: conversation.ConversationInput
|
self, user_input: conversation.ConversationInput
|
||||||
) -> conversation.ConversationResult:
|
) -> conversation.ConversationResult:
|
||||||
@ -299,3 +307,14 @@ class AnthropicConversationEntity(
|
|||||||
return conversation.ConversationResult(
|
return conversation.ConversationResult(
|
||||||
response=intent_response, conversation_id=conversation_id
|
response=intent_response, conversation_id=conversation_id
|
||||||
)
|
)
|
||||||
|
|
||||||
|
async def _async_entry_update_listener(
|
||||||
|
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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user