frigate-hass-card
frigate-hass-card copied to clipboard
Add some mechanism to automatically unmute inbound audio when using the microphone
I keep the audio of my cameras muted by default in the card. However, it would be nice to have an option like:
Automatically unmute when microphone connects
So that I don't need to press 2 buttons in order to have a proper conversation.
Maybe a new microphone_connected
card condition?
I have even another use case for such a condition:
- When
microphone_connected
is off, I'd like to set the microphone icon to something else like:
Automatically unmute when microphone connects
I think you mean unmute the inbound audio, not unmute the microphone?
Maybe a new microphone_connected card condition?
Does "connected" here mean the microphone is attached the stream (regardless of whether the microphone is muted/unmuted) or does it mean when the microphone is unmuted? I think the former...
I've been thinking about adding a new automations
section that would run card commands when card conditions are met. If we added a new microphone_connected
condition, and we had this, you could:
- Use
overrides
to change the menu icon. - User
automations
to automatically send an unmute command to the feed.
Something like this:
overrides:
condition:
microphone_connected: true // <----------- Does not exist
menu:
buttons:
microphone:
icon: mdi:phone-in-talk-outline
automations: // <------------ Does not exist
condition:
microphone_connected: true // <----------- Does not exist
actions:
- action: custom:frigate-card-action
frigate_card_action: unmute // <------------ Does not exist
condition:
microphone_connected: false // <----------- Does not exist
actions:
- action: custom:frigate-card-action
frigate_card_action: mute // <------------ Does not exist
Is this the kind of thing you mean? The other approach would be to add a new value for live.auto_unmute
which is microphone
and perhaps something similar for live.auto_mute
to do the opposite.
Is this the kind of thing you mean? The other approach would be to add a new value for live.auto_unmute which is microphone and perhaps something similar for live.auto_mute to do the opposite.
Maybe something like this is more sensible in this case, unmuting your inbound audio stream when you use a microphone seems obvious, and it'd be weird to have to add 11 lines of config (as extensible as it is) just to get that to happen.
Automatically unmute when microphone connects
I think you mean unmute the inbound audio, not unmute the microphone?
Maybe a new microphone_connected card condition?
Does "connected" here mean the microphone is attached the stream (regardless of whether the microphone is muted/unmuted) or does it mean when the microphone is unmuted? I think the former...
Correct for your two assumptions
Use overrides to change the menu icon.
But I thought I could also use overrides to change the unmute too:
overrides:
condition:
microphone_connected: true // <----------- Does not exist
menu:
buttons:
microphone:
icon: mdi:phone-in-talk-outline
live:
auto_unmute: all // <--------------------- Unmutes incoming audio
No?
No?
I'd need to test it, but I think if you did that it would work in all "future" situations as you want -- but for the camera that is already selected it won't do anything (since when the camera was first selected, the auto_unmute was 'never').
I'd need to test it, but I think if you did that it would work in all "future" situations as you want -- but for the camera that is already selected it won't do anything (since when the camera was first selected, the auto_unmute was 'never').
Got it.
Exactly what I need, following.
+1 🙏
Quick update: This feature is 2nd in line, I just have very limited development cycles. I don't think this will be difficult. Whilst I could do it via automations (as suggested in my comment above) I think it's better that the card just support this natively, i.e. this should really just work out of the box.
Current plan:
- Extend the existing
live.auto_unmute
andlive.auto_mute
options for the live player to support a "microphone" option. When the microphone is unmuted, the audio would be unmuted also. The audio would automatically re-mute60s
after the last microphone unmute. - [Optionally] Extend the
live.microphone
section to have aauto_mute_seconds
option that would allow the60s
above to be configurable.
Nit: This does split microphone relevant config options across two config sections, but I think combining with the existing auto_mute
and auto_unmute
options is the least surprising.
I haven't tried implementing any of this, so the plan may change, but that's what I'm thinking for now. If anyone has a reason the above wouldn't suit their usecase, please let me know!
Will be in the next release.