-
Notifications
You must be signed in to change notification settings - Fork 23
Quality of Life Improvements #43
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
base: main
Are you sure you want to change the base?
Conversation
Dyaxler
commented
Oct 13, 2025
- Added a microphone mute switch
- Fixed the media players mute switch
- Fixed an issue where the media player would get stuck in a playing state when there is no media to play. It now properly resets back to Idle so the Assist can use it.
- Added a microphone mute switch - Fixed the media players mute switch - Fixed an issue where the media player would get stuck in a playing state when there is no media to play. It now properly resets back to Idle so the Assist can use it.
|
There we go. I remember reading that you guys prefer "smaller" Pull Requests that center more on specific features being added or contributed. Well, in this case it's one feature and two fixes. I hope that's ok. I had to yank my earlier PR because it had a couple functions that weren't being used by the mute button or pertained to the fixes in general and it was left over "experiments" that didn't need to be in the PR. |
|
We should really break this up into multiple PRs. For example, you just added improved wake & stop logic as well as persistent media volume after restart (which I think warrant their own discussion about how to implement). Example: A reviewer may argue against your approach of ignoring a 2nd wakeword while the 1st is active. They may argue for a queue that will delay acknowledging the 2nd wakeword until the 1st Assist pipeline has responded (else ignore if 1st wakeword's pipeline doesn't respond within a timeout). You wouldn't want that kind of discussion to hold up the release of a bundled simpler change (e.g. the mute switch). |
|
@lowlyocean uhm... yeah. I forgot about that. Doh! The PR is based on my entire fork. I'll move that code into a Branch and rebase the PR. Unless synesthesiam wants it all as-is. |
|
Still buggy, and it lags a lot when playing anything I don't always hear the audio: #33 |
|
I caught that bug. I've fixed it locally just haven't checked it in yet. I was working on a bunch of other things and haven't gotten around to it. Sorry... I'll have a fix shortly. I've stashed my current work and went back and sync'd to apply a single fix for this issue. |
|
FYI, @jianyu-li also submitted a PR to add mute switch functionality: Regardless, I bet they want to breakout code for each feature/function and separate so submit one pull request for each change. It is easier to review smaller pull request and as such they will be revieved faster and thus larger chance of being merged quicker. |
|
As to not complicate things and mine is outdated as this point, I closed my PR |
|
I still experience bugs with the media player and corrupts the satellite playback as well, so what should be done is to run the mpv media player separately from the voice satellite to stop interfering with each others (media player changes to playing when satellite speaks, audio playback corruption when running together) except only if the satellite speaks while the media player is playing to duck its volume. |
|
@omaramin-2000 Does this happen outside my fork in the regular repo? Just trying to isolate where the source of the issue is. If it's a bug introduced in my code, then I can narrow it down more quickly. To be specific, this happens only when you're playing music and trying to use the Assistant? This isn't a use case that I've ever used, I could add it to my list of test cases though. |
It happens after applying your code additions inside my own fork which is based on the regular one. Plus, both satellite and media player likely become silent until I restart the container, this happens after using your latest changes. #33 And I think what causes the media player lag especially when running on Raspberry pi 3 is something due to low-powered hardware. |
|
Hmmm... interesting. Not happening on my assist. I can stream an internet sourced radio station to my assistant and still use it. Although, the way that my box is built, the mics are close to the speakers, so I have to shout really loud in order to trigger the wake word or lower the volume of the music a little. It ducks the music automatically pretty low, almost inaudible. When it's done responding, music returns and plays just fine. The issue you're experiencing must be related to all the changes in your fork. Looks quite extensive. EDIT: I take that back... I did find an unrelated bug. When it's "actively" playing media, the pause button works the first time. Pressing play again will resume the music but it gets stuck in an Idle state. At least that is what the media player is reporting. Anyways, there should be a stop button. I'll have to look into this. I'm busy wrapping up some changes, then I'll need to create a DEV fork and move everything into it so I can keep this PR clean. |
|
FYI... I have moved the last 5 commits into a dev branch so you will no longer see them here. If this current PR is approved and merged, then I'll submit further commits one at a time since they are iterative to keep with the philosophy of "smaller changes". |
|
I realized now that I experience issue when playing something on the media player then pausing, the satellite playback become silent although it operates, this keep happening until I restart the whole container, but if I didn't pause the media player while playing anything it remains working fine... That's what I encounter that since that changes for that PR ( |
|
I'm working on a patch right now and I have that issue fixed. The biggest bugger I'm working on right now is to get a Stop button to appear in HA for the media player. It keeps selecting the wrong set of controls or it's hiding the stop button for some reason. I know my code works to and from HA, but the HA front end is just refusing to display a stop button, and I refuse to implement a custom button. There are a couple other addon authors who somehow set a permanent attribute in HA for their media players There is already code to handle playlists and for playing streaming URL's but there is no stop button to turn them off and flip the media player back to an Idle state without restarting the LVA service or rebooting the streaming device... not ideal. This is why I'm trying to get this to work using "clean" methods vs a band aid or sledgehammer... |
|
HAHAHA... interesting. I own one of those Home Assistant Voice PE devices and the media player entity in that also doesn't have a stop button. When I streamed a radio station to it via Browse Media, all I could do is pause the music. I set that attrib to true and was able to stop it... but then my device stopped working and I had to reboot it. |
* Tracked playback and pause state transitions within the mpv-backed media player so resumed audio no longer reports as idle and manual stops clear state cleanly. * Exposed STOP capability, refreshed supported feature flags, and centralized state determination for the ESPHome media player entity to keep Home Assistant in sync with pause/play/stop commands. * Removed reliance on mpv’s idle-active property and now restore playback purely from tracked pause state, preventing crashes when the backend omits that property while keeping resumed streams marked as playing. All stop button code is correct. HA should render the stop button but it doesn't. Possible bug?
|
Well, I'm totally blocked RE: Stop button. The I'm still wrapping my head around how all the various HA components "talk to each other" but it's my understanding that the front-end HA UI is supposed to properly detect and classify devices feature set and render the correct buttons it supports. Clearly this isn't happening correctly for some reason but I'm still not 100% certain. There was a bug 3 weeks back that has since been fixed and released that keeps coming up in Google searches so that doesn't apply in this case. Could use some help here... Things I have tried: While media is playing, I can manually send a This tells me that LVA is talking to HA through the API --> ESPHome integration correctly. And in the reverse direction, HA is sending device commands through the ESPHome integration back through the API to LVA. I've changed the device class to TV and also tried receiver and have changed the media players default state to ON vs IDLE. In short, code on the LVA side is correct. I'll be pushing this to my repro and include it with this PR since the Stop button code at this point is harmless and there is another fix for some weird Play/Pause issues included in this newest commit. |
* Extended Preferences and ServerState to store the normalized media volume and provide a helper to persist it only when the value changes. * Load the saved volume during startup and apply it immediately to both mpv players so the remembered level is active after every restart. * Initialize the media player entity with the stored volume and write back updates from Home Assistant so future sessions reuse the latest setting.
|
@Dyaxler I tested your latest commits in your fork since last week, but my playback issue didn't fix 100%, after both satellite and media player were going down it works now while the media player is idle but not during pause... if the satellite changed to listening/responding while the media player is paused the audio output isn't heard until I resume the media player on the current content then I hear the playback response at that time and because of that the satellite keeps stucked at responding sometimes. You didn't experience issues like that or get any solutions? |
That is actually a new test case I didn't think of... I'll look into that. Should be an easy fix. The logic would be something along the lines of allowing the Assistant to un-pause the media player if paused, do its work, then return it to its pervious state... which I'm certain it doesn't do at the moment. |
* Cleared the MPV pause flag before starting new playback so announcements can play even when the player was previously paused. * Captured the pre-announcement media state, restored it after playback, and reapplied any paused state so the ESPHome media entity returns to its prior status once the response finishes. Thank you @omaramin-2000 for reporting the bug!