esphome / home-assistant-voice-pe

Home Assistant Voice PE
Other
72 stars 10 forks source link

Media Player Cleanup #53

Closed kahrendt closed 2 months ago

kahrendt commented 2 months ago

This PR is mainly for cleaning up and better organizing the nabu media player code. Most of the changes make error handling better in the media playback process and better logging of the pipeline details. Besides under-the-hood improvements, there are two notable changes:

New Feature: set_ducking yaml action. The ducking level is now set by specifying the number of decibels to reduce the media stream by. This is a more natural measurement for the sound reduction versus the raw ratio. Additionally, you can optionally set the duration, so it will gradually increase or decrease the media volume until it reaches the desired level. If not specified, it changes to the specified level immediately.

Bugfix: The media player would go into an invalid state if you stopped the media (say, via Music Assistant). This case is properly handled, and, in general, makes it more stable after encountering an error.

Due to changes to how the ducking level is set, the config has breaking changes. I will follow up with another PR to point the external component reference back to dev.