Add voice_icon plugin

This commit is contained in:
Ceda EI 2021-01-04 00:57:07 +05:30
parent f1b2e7a3e4
commit 48824323aa
2 changed files with 29 additions and 1 deletions

View File

@ -1,3 +1,4 @@
from .fuel_check import FuelCheck
from .air_bags import AirBags
plugins = [FuelCheck, AirBags]
from .voice_icon import VoiceIcon
plugins = [FuelCheck, AirBags, VoiceIcon]

27
plugins/voice_icon.py Normal file
View File

@ -0,0 +1,27 @@
"Voice Icon"
import time
from daemon import DaemonPlugin
class VoiceIcon(DaemonPlugin):
"Forwards Messages from message bus to OSD Frontend"
def initialize(self):
"Initialize plugin"
self.messagebus_client.on("recognizer_loop:wakeword", self.on_wakeword)
self.messagebus_client.on("recognizer_loop:record_end",
self.on_record_end)
self.messagebus_client.on("recognizer_loop:utterance",
self.on_utterance)
def check(self, data):
pass
def on_wakeword(self, message):
self.emit("voice:wakeword", {})
def on_record_end(self, message):
self.emit("voice:record_end", {})
def on_utterance(self, message):
self.emit("voice:utterance", {"text": message.data["utterances"][0]})