Commit Graph

68 Commits (d4d30f1c46486c5c2a334b39992f3f2efb576581)

Author SHA1 Message Date
Sid 2cc916db6d
Replace pylint broad-except with Ruff BLE001 (#116250) 2024-05-07 14:00:27 +02:00
Paulus Schoutsen f9a7e6bb9f
Add migration logic to assist_pipeline (#115172) 2024-04-08 11:29:55 -04:00
Sid 8e98ba7312
Add first batch of Ruff PYI rules (#115100)
Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
2024-04-07 11:30:50 -10:00
Paulus Schoutsen d2e4f5f36e
Add conversation entity (#114518)
* Default agent as entity

* Migrate constant to point at new value

* Fix tests

* Fix more tests

* Move assist pipeline back to cloud after dependenceis
2024-04-01 21:34:25 -04:00
Joost Lekkerkerker 6bb4e7d62c
Bump ruff to 0.3.4 (#112690)
Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com>
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-03-26 00:02:16 +01:00
Joost Lekkerkerker 690ba103ed
Improve lists in integrations [A] (#113006)
* Use list comprehension [A]

* Use list comprehension [A]

* Update homeassistant/components/aws/notify.py
2024-03-11 16:17:44 +01:00
Marc Mueller ff3a801936
Add empty line after module docstring [a-d] (#112697) 2024-03-08 14:51:32 +01:00
Michael Hansen f6622ea8e0
Add speech-to-text cooldown for local wake word (#108806)
* Deconflict based on wake word

* Undo test

* Make wake up key a string, rename error

* Update snapshot

* Change to "wake word phrase" and normalize

* Move normalization into the wake provider

* Working on describe

* Use satellite info to resolve wake word phrase

* Add test for wake word phrase

* Match phrase with model name in wake word provider

* Check model id

* Use one constant wake word cooldown

* Update homeassistant/components/assist_pipeline/error.py

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>

* Fix wake word tests

---------

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2024-02-26 20:35:19 -05:00
Paulus Schoutsen f1d2868fd0
Add API to fetch Assist devices (#107333)
* Add API to fetch Assist devices

* Revert some changes to fixture, make a single fixture for an Assist device
2024-01-05 23:30:18 -05:00
Martin Hjelmare e1f31194f7
Move cloud stt engine to config entry (#99608)
* Migrate cloud stt to config entry

* Update default engine

* Test config flow

* Migrate pipelines with cloud stt engine to new engine id

* Fix test after rebase

* Update and add comment

* Remove cloud specifics from default stt engine

* Refactor cloud assist pipeline

* Fix cloud stt entity_id

* Try to wait for platforms before creating default pipeline

* Clean up import

* Move function in cloud assist pipeline

* Wait for tts platform loaded in stt migration

* Update deprecation dates

* Clean up not used fixture

* Add test for async_update_pipeline

* Define pipeline update interface better

* Remove leftover

* Fix tests

* Change default engine test

* Add test for missing stt entity during login

* Add and update comments

* Update config entry title
2023-12-21 13:39:02 +01:00
Martin Hjelmare 2e448d2d13
Remove cloud details from assist pipeline (#105687)
* Remove cloud details from assist pipeline

* Update assist pipeline tests

* Update cloud tests
2023-12-14 10:15:59 +01:00
Michael Hansen a73e86a741
Skip TTS events entirely with empty text (#105617) 2023-12-13 00:21:16 -05:00
Michael Hansen 4c4ad9404f
Don't return TTS URL in Assist pipeline (#105164)
* Don't return TTS URL

* Add test for empty queue
2023-12-07 15:28:04 -05:00
Michael Hansen d793203163
Skip TTS when text is empty (#104741)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2023-11-30 01:31:27 +01:00
Aarni Koskela 706add4a57
Switch formatting from black to ruff-format (#102893)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2023-11-27 14:38:59 +01:00
J. Nick Koston cc31d77205
Use ulid_now instead of ulid_at_timestamp if no timestamp is passed (#104226)
* Use ulid_now instead of ulid_at_timestamp if no timestamp is passed

ulid_now is slightly faster than ulid_at_timestamp

* tweak usage
2023-11-19 22:27:24 -05:00
Michael Hansen b3e247d5f0
Add websocket command to capture audio from a device (#103936)
* Add websocket command to capture audio from a device

* Update homeassistant/components/assist_pipeline/pipeline.py

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>

* Add device capture test

* More tests

* Add logbook

* Remove unnecessary check

* Remove seconds and make logbook message past tense

---------

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2023-11-16 10:28:06 -06:00
Michael Hansen ae516ffbb5
Automatically convert TTS audio to MP3 on demand (#102814)
* Add ATTR_PREFERRED_FORMAT to TTS for auto-converting audio

* Move conversion into SpeechManager

* Handle None case for expected_extension

* Only use ATTR_AUDIO_OUTPUT

* Prefer MP3 in pipelines

* Automatically convert to mp3 on demand

* Add preferred audio format

* Break out preferred format

* Add ATTR_BLOCKING to allow async fetching

* Make a copy of supported options

* Fix MaryTTS tests

* Update ESPHome to use "wav" instead of "raw"

* Clean up tests, remove blocking

* Clean up rest of TTS tests

* Fix ESPHome tests

* More test coverage
2023-11-06 15:26:00 -05:00
Michael Hansen a78e3f7b0f
Delay import of webrtc to avoid blocking start up if package is missing (#102594)
* Delay import of webrtc to avoid blocking start up if package is missing

* Update homeassistant/components/assist_pipeline/pipeline.py

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>

* Update homeassistant/components/assist_pipeline/vad.py

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>

---------

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2023-10-23 13:34:32 -05:00
Michael Hansen a52761171f
No cooldown when wake words have the same id (#101846)
* No cooldown when wake words have the same id

* Use wake word entity id in cooldown decision
2023-10-23 13:12:34 -04:00
Michael Hansen 244f6d8002
Add wake word cooldown to avoid duplicate wake-ups (#101417) 2023-10-06 09:18:35 +02:00
Michael Hansen e6504218bc
Pipeline runs are only equal with same id (#101341)
* Pipeline runs are only equal with same id

* Use dict instead of list in PipelineRuns

* Let it blow up

* Test

* Test rest of __eq__
2023-10-03 16:52:31 -05:00
Erik Montnemery a9bcfe5700
Abort wake word detection when assist pipeline is modified (#100918) 2023-09-26 20:24:55 +02:00
Erik Montnemery bd40cbcb21
Tweak pipeline.multiply_volume (#100905) 2023-09-26 09:19:57 -05:00
Erik Montnemery 4df14b2625
Remove duplicated call to `PipelineRun.end` from `PipelineInput.execute` (#100909)
Remove duplicated call to PipelineRun.end from PipelineInput.execute
2023-09-26 12:38:25 +02:00
Erik Montnemery 1e76d37cee
Rename PipelineData.pipeline_runs to pipeline_debug (#100907) 2023-09-26 11:35:51 +02:00
Michael Hansen 785618909a
Use webrtc-noise-gain for audio enhancement in Assist pipelines (#100698)
* Use webrtc-noise-gain instead of webrtcvad package

* Switching to ProcessedAudioChunk

* Refactor VAD and fix tests

* Add vad no chunking test

* Add test that runs audio enhancements
2023-09-25 20:03:50 -04:00
Erik Montnemery d76c5ed351
Use wake word settings in assist pipeline runs (#100864) 2023-09-25 12:58:10 -04:00
Erik Montnemery 803d24ad1a
Rename wake_word.async_default_engine to wake_word.async_default_entity (#100855)
* Rename wake_word.async_default_engine to wake_word.async_default_entity

* tweak

* Some more rename

* Update tests
2023-09-25 17:08:37 +02:00
Erik Montnemery 5a3efb9149
Store wakeword settings in assist pipelines (#100847)
* Store wakeword settings in assist pipelines

* wakeword -> wake_word

* Remove unneeded variable
2023-09-25 16:07:26 +02:00
Erik Montnemery 4f8e28a781
Future proof assist_pipeline.Pipeline (#100277) 2023-09-13 12:41:28 +02:00
Michael Hansen 054a63c3a2
Add option to save Assist pipeline audio (#98928)
* Add pipeline option to save wake/stt audio to media

* Add debug_recording_dir to assist_pipeline YAML config

* Clean up and additional tests

* Remove I/O in event loop

* Organize saved audio by pipeline name and device id

* Record wake/stt debug audio in separate thread

* Fix after rebase

* Use timestamp instead of pipeline id for directory name

* Add WAV write error test

* Join thread in executor
2023-08-29 23:07:27 -04:00
Michael Hansen 8768c39021
Wake word cleanup (#98652)
* Make arguments for async_pipeline_from_audio_stream keyword-only after hass

* Use a bytearray ring buffer

* Move generator outside

* Move stt stream generator outside

* Clean up execute

* Refactor VAD to use bytearray

* More tests

* Refactor chunk_samples to be more correct and robust

* Change AudioBuffer to use append instead of setitem

* Cleanup

---------

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2023-08-25 13:28:48 -04:00
Michael Hansen 49d2c60992
Add pipeline VAD events (#98603)
* Add stt-vad-start and stt-vad-end pipeline events

* Update tests
2023-08-17 19:58:58 -04:00
Michael Hansen 7ea2998b55
Add wake word integration (#96380)
* Add wake component

* Add wake support to Wyoming

* Add helper function to assist_pipeline (not complete)

* Rename wake to wake_word

* Fix platform

* Use send_event and clean up

* Merge wake word into pipeline

* Add wake option to async_pipeline_from_audio_stream

* Add start/end stages to async_pipeline_from_audio_stream

* Add wake timeout

* Remove layer in wake_output

* Use VAD for wake word timeout

* Include audio metadata in wake-start

* Remove unnecessary websocket command

* wake -> wake_word

* Incorporate feedback

* Clean up wake_word tests

* Add wyoming wake word tests

* Add pipeline wake word test

* Add last processed state

* Fix tests

* Add tests for wake word

* More tests for the codebot
2023-08-07 22:22:16 -04:00
Franck Nijhof 30058297cf
Migrate backported StrEnum to built-in StrEnum (#97101) 2023-07-23 23:19:24 +02:00
Michael Hansen b70a67404b
Check end stage as well when preparing pipeline (#95303) 2023-06-26 16:36:02 -05:00
Paulus Schoutsen c42d0feec1
Allow passing in device_id to pipeline run WS API (#95139) 2023-06-23 21:29:56 -05:00
Paulus Schoutsen 65b62d877d
Keep track what devices support Assist features (#93990) 2023-06-03 08:26:28 -05:00
Paulus Schoutsen cd330a2740
Pass device ID to conversation input (#93867) 2023-05-31 16:56:12 -04:00
Paulus Schoutsen 927b59fe5a
Simplify get pipeline method (#93865) 2023-05-31 10:06:03 -05:00
c0ffeeca7 c3a3ddcfa4
Standardize spelling of TTS and STT (#93857)
* Standardize spelling of TTS and STT

* Apply suggestions from code review

* Update homeassistant/components/tts/media_source.py

---------

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2023-05-31 11:00:19 -04:00
Erik Montnemery 887e656570
Small improvement of assist_pipeline test coverage (#92115) 2023-05-04 19:01:41 +02:00
Paulus Schoutsen 7c696754ed
Use pipeline ID in event (#92100)
* Use pipeline ID in event

* Fix tests
2023-04-26 22:40:17 -04:00
Erik Montnemery 2750a5c3e6
Make assist_pipeline an after dependency of cloud (#92057) 2023-04-26 13:45:32 +02:00
Erik Montnemery 57a59d808b
Automaticially create an assist pipeline using cloud stt + tts (#91991)
* Automaticially create an assist pipeline using cloud stt + tts

* Return the id of the cloud enabled pipeline

* Wait for platforms to load

* Fix typing

* Fix startup race

* Update tests

* Create a cloud pipeline only when logging in

* Fix tests

* Tweak _async_resolve_default_pipeline_settings

* Improve assist_pipeline test coverage

* Improve cloud test coverage
2023-04-25 20:40:01 -05:00
Erik Montnemery 8e70446ef8
Tweak a couple of `stt` and `tts` related asserts (#92012)
Tweak a couple of stt and tts related asserts
2023-04-25 11:50:37 -05:00
Erik Montnemery b601fb17d3
Create a default assist pipeline on start (#91947)
* Create a default assist pipeline on start

* Minor adjustments

* Address review comments

* Remove tts.async_get_agent

* Fix bugs, improve test coverage
2023-04-24 14:00:52 -04:00
Erik Montnemery 1c3e1d2e13
Don't resolve default tts engine in assist pipelines (#91943)
* Don't resolve default tts engine in assist pipelines

* Set tts engine when creating default pipeline

* Update tests
2023-04-24 14:40:11 +02:00
Erik Montnemery c5d0c392a9
Don't resolve default stt engine in assist pipelines (#91936)
* Don't resolve default stt engine in assist pipelines

* Apply suggestion from code review

* Add tests

* Tweak

* Add test

* Improve test coverage
2023-04-24 13:37:13 +02:00