You should be able to move those things into your skill by listening for the wake words, STT result and the speak messages on the bus.
This is done using self.add_event(MESSAGE_TYPE, self.handler_method)
where MESSAGE_TYPE is a string and self.handler_method is a method you create for handling the message.
The message types for the above cases (if I’ve understood them correctly) is:
Wakeword detected: “recognizer_loop:record_begin”
STT result: “recognizer_loop:utterance”
Mycroft speaks: “speak”
It would look something like this in your skill:
[...]
def initialize(self):
self.add_event('recognizer_loop:record_begin', self.handle_listen)
self.add_event('recognizer_loop:utterance', self.handle_utterance)
self.add_event('speak', self.handle_speak)
def handle_listen(self, message):
voiceurl = 'http://192.168.3.126:8080/kalliope' #<----- Here you can use self.settings['ip']
voice_payload = {"notification":"KALLIOPE", "payload": "Listening"}
r = requests.post(url=voiceurl, data=voice_payload)
def handle_utterance(self, message):
utterance = str(event['utterances'])
utterance = utterance.replace("['", "")
utterance = utterance.replace("']", "")
voiceurl = 'http://192.168.3.126:8080/kalliope' #<----- again with self.settings
voice_payload = {"notification":"KALLIOPE", "payload": utterance}
r = requests.post(url=voiceurl, data=voice_payload)
def handle_speak(self, message):
voiceurl = 'http://192.168.3.126:8080/kalliope'
voice_payload = {"notification":"KALLIOPE", "payload": utterance}
r = requests.post(url=voiceurl, data=voice_payload)
The speed will still be about the same as previously though…