Compare commits
4 Commits
ff73d81d2d
...
master
Author | SHA1 | Date | |
---|---|---|---|
48824323aa | |||
f1b2e7a3e4 | |||
7ef7a3aebe | |||
8d26cd4d5d |
@@ -13,10 +13,12 @@ def main():
|
|||||||
"Main function"
|
"Main function"
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
mycroft = MessageBusClient()
|
mycroft = MessageBusClient()
|
||||||
mycroft.run_in_thread()
|
|
||||||
daemon = Daemon(config.OSD_URL, config.CAR_API_URL, mycroft)
|
daemon = Daemon(config.OSD_URL, config.CAR_API_URL, mycroft)
|
||||||
for plugin in plugins:
|
for plugin in plugins:
|
||||||
daemon.register_plugin(plugin)
|
daemon.register_plugin(plugin)
|
||||||
|
# Start mycroft after registering plugins so that an .on events by plugins
|
||||||
|
# get registered
|
||||||
|
mycroft.run_in_thread()
|
||||||
while True:
|
while True:
|
||||||
daemon.check_all()
|
daemon.check_all()
|
||||||
time.sleep(config.DELAY)
|
time.sleep(config.DELAY)
|
||||||
|
@@ -1,2 +1,4 @@
|
|||||||
from .fuel_check import FuelCheck
|
from .fuel_check import FuelCheck
|
||||||
plugins = [FuelCheck]
|
from .air_bags import AirBags
|
||||||
|
from .voice_icon import VoiceIcon
|
||||||
|
plugins = [FuelCheck, AirBags, VoiceIcon]
|
||||||
|
@@ -21,7 +21,7 @@ class FuelCheck(DaemonPlugin):
|
|||||||
if ratio <= self.threshold:
|
if ratio <= self.threshold:
|
||||||
if self.last_message is None:
|
if self.last_message is None:
|
||||||
desc = f"Only {int(ratio)}% fuel left. Please refill the tank."
|
desc = f"Only {int(ratio)}% fuel left. Please refill the tank."
|
||||||
self.speak(desc)
|
self.speak(desc.replace("%", " percent"))
|
||||||
self.emit("switchPlugin", {
|
self.emit("switchPlugin", {
|
||||||
"plugin": "warning",
|
"plugin": "warning",
|
||||||
"data": {
|
"data": {
|
||||||
|
27
plugins/voice_icon.py
Normal file
27
plugins/voice_icon.py
Normal 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]})
|
Reference in New Issue
Block a user