-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ElevenLabs text-to-speech integration #115645
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thanks for the contribution! Here are a few comments.
Thanks a lot for the review @autinerd |
Hey @autinerd, sorry it's been a while, I have finally added the async functionality and made the client an attribute of the entity, thus not generating it every single time |
@sorgfresser Can you rebase on |
@synesthesiam thanks for pointing that out! Should be rebased now. |
There are still some failing pytests, but I'm quite sure they aren't related to this PR either. |
except KeyError: | ||
errors[CONF_API_KEY] = "No API-Key provided" | ||
except ApiError: | ||
errors[CONF_API_KEY] = "ElevenLabs API responded with an Error!" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Errors should be keys that refer errors defined in strings.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the error string now.
"""Set up ElevenLabs text-to-speech from a config entry.""" | ||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
validate the API key still works before forwarding entry setup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once validated, set the AsynClient as entry.runtime_data
to be consumed in tts.py
Tests are now passing locally for me 👍 |
I just bumped elevenlabs and renamed the model accordingly. I verified tests run locally as well as that the integration works as expected as a custom component. Still, the |
Glad to hear that @synesthesiam and same here! I am still wondering why 990c6f2 was necessary though |
I am not quite sure what's happening to mypy in the CI |
The mypy error seems unrelated. I'd keep rebasing on dev and seeing if it fixes itself. |
I am not sure, but maybe flushing the action caches (https://github.com/home-assistant/core/actions/caches?query=branch%3Arefs%2Fpull%2F115645%2Fmerge) might solve this? |
I'm thinking that something in the new dependencies is causing this as |
I think we need to add an ignore line to the mypy config like: [mypy-traitlets.*]
ignore_missing_imports = True |
Can you send your discord username? |
Awesome to see this merged! Was it completed in time for the release? |
Yes :) |
I am not 100% sure whether you're asking me, if so, it's Btw thank you very much for the constant effort, I am very glad this is merged! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please address the comment in a new PR. Thanks!
) -> None: | ||
"""Test tts service.""" | ||
tts_entity = hass.data[tts.DOMAIN].get_entity(service_data[ATTR_ENTITY_ID]) | ||
tts_entity._client.generate.reset_mock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to access the entity to access the client since we've patched the client. Use the client patch mock to assert things about the client.
|
||
|
||
@pytest.fixture(name="setup") | ||
async def setup_fixture( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this fixture? We only set up via config entry and nothing else.
Breaking change
Proposed change
Add ElevenLabs as a TTS-integration with support for custom voices and different models.
Type of change
Additional information
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.To help with the load of incoming pull requests: