[assistant.picovoice] Leverage upstream `_on_mute_changed`.

The plugin should leverage `AssistantPlugin._on_mute_changed` to handle
the boilerplate state managent on mute/unmute actions instead of
re-implementing the same logic.
This commit is contained in:
Fabio Manganiello 2024-04-13 21:00:30 +02:00
parent 8082123c58
commit c86e3be0d1
Signed by: blacklight
GPG Key ID: D90FBA7F76362774
1 changed files with 1 additions and 3 deletions

View File

@ -2,7 +2,6 @@ import os
from typing import Optional, Sequence from typing import Optional, Sequence
from platypush.context import get_plugin from platypush.context import get_plugin
from platypush.message.event.assistant import MicMutedEvent, MicUnmutedEvent
from platypush.plugins import RunnablePlugin, action from platypush.plugins import RunnablePlugin, action
from platypush.plugins.assistant import AssistantPlugin from platypush.plugins.assistant import AssistantPlugin
from platypush.plugins.tts.picovoice import TtsPicovoicePlugin from platypush.plugins.tts.picovoice import TtsPicovoicePlugin
@ -239,11 +238,10 @@ class AssistantPicovoicePlugin(AssistantPlugin, RunnablePlugin):
:param muted: Set to True or False. :param muted: Set to True or False.
""" """
self._is_muted = muted
if self._assistant: if self._assistant:
self._assistant.set_mic_mute(muted) self._assistant.set_mic_mute(muted)
self._send_event(MicMutedEvent if muted else MicUnmutedEvent) super()._on_mute_changed(muted)
@action @action
def toggle_mute(self, *_, **__): def toggle_mute(self, *_, **__):