mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 12:47:08 +00:00
Add CONTROL supported feature to OpenAI conversation entities (#121064)
Add CONTROL supported feature to OpenAI
This commit is contained in:
parent
f284aa41eb
commit
976cb434c9
@ -92,6 +92,10 @@ class OpenAIConversationEntity(
|
||||
model="ChatGPT",
|
||||
entry_type=dr.DeviceEntryType.SERVICE,
|
||||
)
|
||||
if self.entry.options.get(CONF_LLM_HASS_API):
|
||||
self._attr_supported_features = (
|
||||
conversation.ConversationEntityFeature.CONTROL
|
||||
)
|
||||
|
||||
@property
|
||||
def supported_languages(self) -> list[str] | Literal["*"]:
|
||||
|
@ -27,6 +27,33 @@ from homeassistant.util import ulid
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
async def test_entity(
|
||||
hass: HomeAssistant,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
mock_init_component,
|
||||
) -> None:
|
||||
"""Test entity properties."""
|
||||
state = hass.states.get("conversation.openai")
|
||||
assert state
|
||||
assert state.attributes["supported_features"] == 0
|
||||
|
||||
hass.config_entries.async_update_entry(
|
||||
mock_config_entry,
|
||||
options={
|
||||
**mock_config_entry.options,
|
||||
CONF_LLM_HASS_API: "assist",
|
||||
},
|
||||
)
|
||||
await hass.config_entries.async_reload(mock_config_entry.entry_id)
|
||||
|
||||
state = hass.states.get("conversation.openai")
|
||||
assert state
|
||||
assert (
|
||||
state.attributes["supported_features"]
|
||||
== conversation.ConversationEntityFeature.CONTROL
|
||||
)
|
||||
|
||||
|
||||
async def test_error_handling(
|
||||
hass: HomeAssistant, mock_config_entry: MockConfigEntry, mock_init_component
|
||||
) -> None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user