Commit Graph

94 Commits (d4d30f1c46486c5c2a334b39992f3f2efb576581)

Author SHA1 Message Date
Sid 2cc916db6d
Replace pylint broad-except with Ruff BLE001 (#116250) 2024-05-07 14:00:27 +02:00
Sid 895f73d8e4
Enable Ruff A001 (#115654) 2024-04-21 23:25: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 aa16a9d707
Add empty line after module docstring (3) (#112750) 2024-03-08 20:38:34 +01:00
Marc Mueller 2c06d4fcb9
Add empty line after module docstring (2) [components] (#112736) 2024-03-08 19:15:59 +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
Marc Mueller c82933175d
Use builtin TimeoutError [a-d] (#109678) 2024-02-05 11:31:33 +01: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 f605df5bf2
Adjust logbook message for assist pipeline recording (#104105)
* Adjust logbook message

* Fix test
2023-11-16 23:39:08 -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
Marc Mueller a70ec64408
Update mypy to 1.7.0 (#103800) 2023-11-11 23:31:04 +01: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
Michael Hansen cc7e35e299
Increase pipeline timeout to 5 minutes (#101327) 2023-10-03 19:41:00 +02:00
Michael Hansen f39b2716b0
Remove fma instructions from webrtc-noise-gain (#101060) 2023-09-28 19:07:00 +02:00
Michael Hansen 5fe61ca5e7
Use webrtc-noise-gain without AVX2 (#101028) 2023-09-27 19:55:26 -05:00
Michael Hansen 8a9b2f4515
Bump to webrtc-noise-gain 1.2.1 for 32-bit builds (#100942)
* Bump to 1.2.0 for 32-bit builds

* Bugfix with 1.2.1
2023-09-26 17:14:48 -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 e69c88a0d2
Use aliases when listing pipeline languages (#99672) 2023-09-08 08:22:08 -04:00
Erik Montnemery 9e178ae2ce
Fix assist_pipeline schema (#99318) 2023-08-30 11:33:41 +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
J. Nick Koston 262483f3f6
Replace async_timeout with asyncio.timeout A-B (#98415) 2023-08-15 10:29:28 +02: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
Franck Nijhof 86708b5590
Update ruff to v0.0.280 (#97102) 2023-07-23 22:00:26 +02:00