Voice-Plugins/car-manual-skill/__init__.py

36 lines
885 B
Python

from mycroft import MycroftSkill, intent_file_handler
import requests
def emit(osd_url, event, data):
json = {
"event": event,
"data": data
}
print(json)
return requests.post(osd_url, json=json)
class CarManual(MycroftSkill):
def __init__(self):
MycroftSkill.__init__(self)
@intent_file_handler('manual.car.childlock.intent')
def handle_manual_car(self, message):
dialog = self.dialog_renderer.render("manual.car.childlock", {})
url = self.settings.get("OSD_API", "http://localhost:5050/send")
emission = {
"plugin": "manual",
"data": {
"title": "Child Lock",
"description": dialog
},
"time": 5000
}
emit(url, "switchPlugin", emission)
self.speak(dialog)
def create_skill():
return CarManual()