mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Add quality scale to ElevenLabs (#133276)
This commit is contained in:
parent
482ad6fbee
commit
e6e9788ecd
@ -10,7 +10,7 @@ from elevenlabs.core import ApiError
|
|||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CONF_API_KEY, Platform
|
from homeassistant.const import CONF_API_KEY, Platform
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import ConfigEntryError
|
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryError
|
||||||
from homeassistant.helpers.httpx_client import get_async_client
|
from homeassistant.helpers.httpx_client import get_async_client
|
||||||
|
|
||||||
from .const import CONF_MODEL
|
from .const import CONF_MODEL
|
||||||
@ -49,7 +49,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: EleventLabsConfigEntry)
|
|||||||
try:
|
try:
|
||||||
model = await get_model_by_id(client, model_id)
|
model = await get_model_by_id(client, model_id)
|
||||||
except ApiError as err:
|
except ApiError as err:
|
||||||
raise ConfigEntryError("Auth failed") from err
|
raise ConfigEntryAuthFailed("Auth failed") from err
|
||||||
|
|
||||||
if model is None or (not model.languages):
|
if model is None or (not model.languages):
|
||||||
raise ConfigEntryError("Model could not be resolved")
|
raise ConfigEntryError("Model could not be resolved")
|
||||||
|
@ -9,12 +9,7 @@ from elevenlabs import AsyncElevenLabs
|
|||||||
from elevenlabs.core import ApiError
|
from elevenlabs.core import ApiError
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.config_entries import (
|
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult, OptionsFlow
|
||||||
ConfigEntry,
|
|
||||||
ConfigFlow,
|
|
||||||
ConfigFlowResult,
|
|
||||||
OptionsFlow,
|
|
||||||
)
|
|
||||||
from homeassistant.const import CONF_API_KEY
|
from homeassistant.const import CONF_API_KEY
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.httpx_client import get_async_client
|
from homeassistant.helpers.httpx_client import get_async_client
|
||||||
@ -24,6 +19,7 @@ from homeassistant.helpers.selector import (
|
|||||||
SelectSelectorConfig,
|
SelectSelectorConfig,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from . import EleventLabsConfigEntry
|
||||||
from .const import (
|
from .const import (
|
||||||
CONF_CONFIGURE_VOICE,
|
CONF_CONFIGURE_VOICE,
|
||||||
CONF_MODEL,
|
CONF_MODEL,
|
||||||
@ -96,7 +92,7 @@ class ElevenLabsConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def async_get_options_flow(
|
def async_get_options_flow(
|
||||||
config_entry: ConfigEntry,
|
config_entry: EleventLabsConfigEntry,
|
||||||
) -> OptionsFlow:
|
) -> OptionsFlow:
|
||||||
"""Create the options flow."""
|
"""Create the options flow."""
|
||||||
return ElevenLabsOptionsFlow(config_entry)
|
return ElevenLabsOptionsFlow(config_entry)
|
||||||
@ -105,7 +101,7 @@ class ElevenLabsConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||||||
class ElevenLabsOptionsFlow(OptionsFlow):
|
class ElevenLabsOptionsFlow(OptionsFlow):
|
||||||
"""ElevenLabs options flow."""
|
"""ElevenLabs options flow."""
|
||||||
|
|
||||||
def __init__(self, config_entry: ConfigEntry) -> None:
|
def __init__(self, config_entry: EleventLabsConfigEntry) -> None:
|
||||||
"""Initialize options flow."""
|
"""Initialize options flow."""
|
||||||
self.api_key: str = config_entry.data[CONF_API_KEY]
|
self.api_key: str = config_entry.data[CONF_API_KEY]
|
||||||
# id -> name
|
# id -> name
|
||||||
|
92
homeassistant/components/elevenlabs/quality_scale.yaml
Normal file
92
homeassistant/components/elevenlabs/quality_scale.yaml
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
rules:
|
||||||
|
# Bronze
|
||||||
|
action-setup:
|
||||||
|
status: done
|
||||||
|
comment: >
|
||||||
|
Only entity services
|
||||||
|
appropriate-polling: done
|
||||||
|
brands: done
|
||||||
|
common-modules: done
|
||||||
|
config-flow-test-coverage:
|
||||||
|
status: todo
|
||||||
|
comment: >
|
||||||
|
We should have every test end in either ABORT or CREATE_ENTRY.
|
||||||
|
test_invalid_api_key should assert the kind of error that is raised.
|
||||||
|
config-flow: done
|
||||||
|
dependency-transparency: done
|
||||||
|
docs-actions: done
|
||||||
|
docs-high-level-description: done
|
||||||
|
docs-installation-instructions: done
|
||||||
|
docs-removal-instructions: todo
|
||||||
|
entity-event-setup:
|
||||||
|
status: exempt
|
||||||
|
comment: >
|
||||||
|
Entities of this integration does not explicitly subscribe to events.
|
||||||
|
entity-unique-id: done
|
||||||
|
has-entity-name: todo
|
||||||
|
runtime-data: done
|
||||||
|
test-before-configure: done
|
||||||
|
test-before-setup: done
|
||||||
|
unique-config-entry: todo
|
||||||
|
# Silver
|
||||||
|
config-entry-unloading: done
|
||||||
|
log-when-unavailable: todo
|
||||||
|
entity-unavailable:
|
||||||
|
status: exempt
|
||||||
|
comment: >
|
||||||
|
There is no state in the TTS platform and we can't check poll if the TTS service is available.
|
||||||
|
action-exceptions: done
|
||||||
|
reauthentication-flow: todo
|
||||||
|
parallel-updates: done
|
||||||
|
test-coverage: todo
|
||||||
|
integration-owner: done
|
||||||
|
docs-installation-parameters: todo
|
||||||
|
docs-configuration-parameters: todo
|
||||||
|
|
||||||
|
# Gold
|
||||||
|
entity-translations: todo
|
||||||
|
entity-device-class:
|
||||||
|
status: exempt
|
||||||
|
comment: There is no device class for Text To Speech entities.
|
||||||
|
devices: done
|
||||||
|
entity-category: done
|
||||||
|
entity-disabled-by-default: todo
|
||||||
|
discovery:
|
||||||
|
status: exempt
|
||||||
|
comment: >
|
||||||
|
This is not possible because there is no physical device.
|
||||||
|
stale-devices:
|
||||||
|
status: exempt
|
||||||
|
comment: >
|
||||||
|
This is not possible because there is no physical device.
|
||||||
|
diagnostics: todo
|
||||||
|
exception-translations: todo
|
||||||
|
icon-translations: todo
|
||||||
|
reconfiguration-flow:
|
||||||
|
status: todo
|
||||||
|
comment: >
|
||||||
|
I imagine this could be useful if the default voice is deleted from voice lab.
|
||||||
|
dynamic-devices:
|
||||||
|
status: exempt
|
||||||
|
comment: |
|
||||||
|
This is not possible because there is no physical device.
|
||||||
|
discovery-update-info:
|
||||||
|
status: exempt
|
||||||
|
comment: >
|
||||||
|
This is not needed because there are no physical devices.
|
||||||
|
repair-issues: todo
|
||||||
|
docs-use-cases: done
|
||||||
|
docs-supported-devices:
|
||||||
|
status: exempt
|
||||||
|
comment: >
|
||||||
|
This integration does not support any devices.
|
||||||
|
docs-supported-functions: todo
|
||||||
|
docs-data-update: todo
|
||||||
|
docs-known-limitations: todo
|
||||||
|
docs-troubleshooting: todo
|
||||||
|
docs-examples: todo
|
||||||
|
|
||||||
|
# Platinum
|
||||||
|
async-dependency: done
|
||||||
|
inject-websession: done
|
||||||
|
strict-typing: done
|
@ -16,6 +16,7 @@ from homeassistant.components.tts import (
|
|||||||
TtsAudioType,
|
TtsAudioType,
|
||||||
Voice,
|
Voice,
|
||||||
)
|
)
|
||||||
|
from homeassistant.const import EntityCategory
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import HomeAssistantError
|
from homeassistant.exceptions import HomeAssistantError
|
||||||
from homeassistant.helpers.device_registry import DeviceEntryType, DeviceInfo
|
from homeassistant.helpers.device_registry import DeviceEntryType, DeviceInfo
|
||||||
@ -38,6 +39,7 @@ from .const import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
PARALLEL_UPDATES = 0
|
||||||
|
|
||||||
|
|
||||||
def to_voice_settings(options: MappingProxyType[str, Any]) -> VoiceSettings:
|
def to_voice_settings(options: MappingProxyType[str, Any]) -> VoiceSettings:
|
||||||
@ -84,6 +86,7 @@ class ElevenLabsTTSEntity(TextToSpeechEntity):
|
|||||||
"""The ElevenLabs API entity."""
|
"""The ElevenLabs API entity."""
|
||||||
|
|
||||||
_attr_supported_options = [ATTR_VOICE]
|
_attr_supported_options = [ATTR_VOICE]
|
||||||
|
_attr_entity_category = EntityCategory.CONFIG
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
|
@ -338,7 +338,6 @@ INTEGRATIONS_WITHOUT_QUALITY_SCALE_FILE = [
|
|||||||
"eight_sleep",
|
"eight_sleep",
|
||||||
"electrasmart",
|
"electrasmart",
|
||||||
"electric_kiwi",
|
"electric_kiwi",
|
||||||
"elevenlabs",
|
|
||||||
"eliqonline",
|
"eliqonline",
|
||||||
"elkm1",
|
"elkm1",
|
||||||
"elmax",
|
"elmax",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user