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 CarModeSwitches(MycroftSkill): def __init__(self): MycroftSkill.__init__(self) @intent_file_handler('switches.mode.pet.intent') def handle_switches_mode_car(self, message): url = self.settings.get("OSD_API", "http://localhost:5050/send") emit(url, "switchPlugin", {"plugin": "petMode"}) self.speak_dialog('switches.mode.pet') @intent_file_handler('switches.mode.smart_home.intent') def handle_switches_mode_car(self, message): url = self.settings.get("OSD_API", "http://localhost:5050/send") emit(url, "switchPlugin", {"plugin": "smartHome"}) self.speak_dialog('switches.mode.smart_home') @intent_file_handler('switches.mode.maps.intent') def handle_switches_mode_car(self, message): url = self.settings.get("OSD_API", "http://localhost:5050/send") emit(url, "switchPlugin", {"plugin": "maps"}) self.speak_dialog('switches.mode.maps') def create_skill(): return CarModeSwitches()