Skip to content

Commit e6e9788

Browse files
authored
Add quality scale to ElevenLabs (#133276)
1 parent 482ad6f commit e6e9788

File tree

5 files changed

+101
-11
lines changed

5 files changed

+101
-11
lines changed

homeassistant/components/elevenlabs/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from homeassistant.config_entries import ConfigEntry
1111
from homeassistant.const import CONF_API_KEY, Platform
1212
from homeassistant.core import HomeAssistant
13-
from homeassistant.exceptions import ConfigEntryError
13+
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryError
1414
from homeassistant.helpers.httpx_client import get_async_client
1515

1616
from .const import CONF_MODEL
@@ -49,7 +49,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: EleventLabsConfigEntry)
4949
try:
5050
model = await get_model_by_id(client, model_id)
5151
except ApiError as err:
52-
raise ConfigEntryError("Auth failed") from err
52+
raise ConfigEntryAuthFailed("Auth failed") from err
5353

5454
if model is None or (not model.languages):
5555
raise ConfigEntryError("Model could not be resolved")

homeassistant/components/elevenlabs/config_flow.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,7 @@
99
from elevenlabs.core import ApiError
1010
import voluptuous as vol
1111

12-
from homeassistant.config_entries import (
13-
ConfigEntry,
14-
ConfigFlow,
15-
ConfigFlowResult,
16-
OptionsFlow,
17-
)
12+
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult, OptionsFlow
1813
from homeassistant.const import CONF_API_KEY
1914
from homeassistant.core import HomeAssistant
2015
from homeassistant.helpers.httpx_client import get_async_client
@@ -24,6 +19,7 @@
2419
SelectSelectorConfig,
2520
)
2621

22+
from . import EleventLabsConfigEntry
2723
from .const import (
2824
CONF_CONFIGURE_VOICE,
2925
CONF_MODEL,
@@ -96,7 +92,7 @@ async def async_step_user(
9692

9793
@staticmethod
9894
def async_get_options_flow(
99-
config_entry: ConfigEntry,
95+
config_entry: EleventLabsConfigEntry,
10096
) -> OptionsFlow:
10197
"""Create the options flow."""
10298
return ElevenLabsOptionsFlow(config_entry)
@@ -105,7 +101,7 @@ def async_get_options_flow(
105101
class ElevenLabsOptionsFlow(OptionsFlow):
106102
"""ElevenLabs options flow."""
107103

108-
def __init__(self, config_entry: ConfigEntry) -> None:
104+
def __init__(self, config_entry: EleventLabsConfigEntry) -> None:
109105
"""Initialize options flow."""
110106
self.api_key: str = config_entry.data[CONF_API_KEY]
111107
# id -> name
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
rules:
2+
# Bronze
3+
action-setup:
4+
status: done
5+
comment: >
6+
Only entity services
7+
appropriate-polling: done
8+
brands: done
9+
common-modules: done
10+
config-flow-test-coverage:
11+
status: todo
12+
comment: >
13+
We should have every test end in either ABORT or CREATE_ENTRY.
14+
test_invalid_api_key should assert the kind of error that is raised.
15+
config-flow: done
16+
dependency-transparency: done
17+
docs-actions: done
18+
docs-high-level-description: done
19+
docs-installation-instructions: done
20+
docs-removal-instructions: todo
21+
entity-event-setup:
22+
status: exempt
23+
comment: >
24+
Entities of this integration does not explicitly subscribe to events.
25+
entity-unique-id: done
26+
has-entity-name: todo
27+
runtime-data: done
28+
test-before-configure: done
29+
test-before-setup: done
30+
unique-config-entry: todo
31+
# Silver
32+
config-entry-unloading: done
33+
log-when-unavailable: todo
34+
entity-unavailable:
35+
status: exempt
36+
comment: >
37+
There is no state in the TTS platform and we can't check poll if the TTS service is available.
38+
action-exceptions: done
39+
reauthentication-flow: todo
40+
parallel-updates: done
41+
test-coverage: todo
42+
integration-owner: done
43+
docs-installation-parameters: todo
44+
docs-configuration-parameters: todo
45+
46+
# Gold
47+
entity-translations: todo
48+
entity-device-class:
49+
status: exempt
50+
comment: There is no device class for Text To Speech entities.
51+
devices: done
52+
entity-category: done
53+
entity-disabled-by-default: todo
54+
discovery:
55+
status: exempt
56+
comment: >
57+
This is not possible because there is no physical device.
58+
stale-devices:
59+
status: exempt
60+
comment: >
61+
This is not possible because there is no physical device.
62+
diagnostics: todo
63+
exception-translations: todo
64+
icon-translations: todo
65+
reconfiguration-flow:
66+
status: todo
67+
comment: >
68+
I imagine this could be useful if the default voice is deleted from voice lab.
69+
dynamic-devices:
70+
status: exempt
71+
comment: |
72+
This is not possible because there is no physical device.
73+
discovery-update-info:
74+
status: exempt
75+
comment: >
76+
This is not needed because there are no physical devices.
77+
repair-issues: todo
78+
docs-use-cases: done
79+
docs-supported-devices:
80+
status: exempt
81+
comment: >
82+
This integration does not support any devices.
83+
docs-supported-functions: todo
84+
docs-data-update: todo
85+
docs-known-limitations: todo
86+
docs-troubleshooting: todo
87+
docs-examples: todo
88+
89+
# Platinum
90+
async-dependency: done
91+
inject-websession: done
92+
strict-typing: done

homeassistant/components/elevenlabs/tts.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
TtsAudioType,
1717
Voice,
1818
)
19+
from homeassistant.const import EntityCategory
1920
from homeassistant.core import HomeAssistant
2021
from homeassistant.exceptions import HomeAssistantError
2122
from homeassistant.helpers.device_registry import DeviceEntryType, DeviceInfo
@@ -38,6 +39,7 @@
3839
)
3940

4041
_LOGGER = logging.getLogger(__name__)
42+
PARALLEL_UPDATES = 0
4143

4244

4345
def to_voice_settings(options: MappingProxyType[str, Any]) -> VoiceSettings:
@@ -84,6 +86,7 @@ class ElevenLabsTTSEntity(TextToSpeechEntity):
8486
"""The ElevenLabs API entity."""
8587

8688
_attr_supported_options = [ATTR_VOICE]
89+
_attr_entity_category = EntityCategory.CONFIG
8790

8891
def __init__(
8992
self,

script/hassfest/quality_scale.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,6 @@ class Rule:
338338
"eight_sleep",
339339
"electrasmart",
340340
"electric_kiwi",
341-
"elevenlabs",
342341
"eliqonline",
343342
"elkm1",
344343
"elmax",

0 commit comments

Comments
 (0)