mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 04:37:06 +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",
|
model="ChatGPT",
|
||||||
entry_type=dr.DeviceEntryType.SERVICE,
|
entry_type=dr.DeviceEntryType.SERVICE,
|
||||||
)
|
)
|
||||||
|
if self.entry.options.get(CONF_LLM_HASS_API):
|
||||||
|
self._attr_supported_features = (
|
||||||
|
conversation.ConversationEntityFeature.CONTROL
|
||||||
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supported_languages(self) -> list[str] | Literal["*"]:
|
def supported_languages(self) -> list[str] | Literal["*"]:
|
||||||
|
@ -27,6 +27,33 @@ from homeassistant.util import ulid
|
|||||||
from tests.common import MockConfigEntry
|
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(
|
async def test_error_handling(
|
||||||
hass: HomeAssistant, mock_config_entry: MockConfigEntry, mock_init_component
|
hass: HomeAssistant, mock_config_entry: MockConfigEntry, mock_init_component
|
||||||
) -> None:
|
) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user