@KathyReid @forslund @eric-mycroft Here’s another update on the magic-mirror-voice-control-skill. Well… actually I didn’t make any changes to the skill, but I did add a Mycroft Icon on the MagicMirror and text of what Mycroft hears and text of what Mycroft responds. At this point, it’s a complete hack, not a skill. I’m attaching a short video to give you an idea of what the interaction between the user and Mycroft look like on the MagicMirror.
On the MagicMirror, I am using the MMM-kalliope module to receive the text from Mycroft through a requests.post to the MagicMirror’s ip address at the default port/kalliope.
Now here’s the hack, and I would of course prefer another way, but I’m kind of stuck on how to do this in a skill. I added a couple of lines of code to the /home/pi/mycroft-core/mycroft/client/speech/main.py:
def handle_wakeword(event):
LOG.info("Wakeword Detected: " + event['utterance'])
ws.emit(Message('recognizer_loop:wakeword', event))
voiceurl = 'http://192.168.3.126:8080/kalliope' #<----- Add these lines, using your mirror's ip
voice_payload = {"notification":"KALLIOPE", "payload": "Listening"} #<-------
r = requests.post(url=voiceurl, data=voice_payload) #<-------
def handle_utterance(event):
LOG.info("Utterance: " + str(event['utterances']))
context = {'client_name': 'mycroft_listener'}
if 'ident' in event:
ident = event.pop('ident')
context['ident'] = ident
ws.emit(Message('recognizer_loop:utterance', event, context))
utterance = str(event['utterances']) #<--------- I added these 6 lines of code
utterance = utterance.replace("['", "") #<--------- to send what Mycroft hears
utterance = utterance.replace("']", "") #<--------- formatted without ['example']
voiceurl = 'http://192.168.3.126:8080/kalliope' #<----- to a hard coded url
voice_payload = {"notification":"KALLIOPE", "payload": utterance} #<-------
r = requests.post(url=voiceurl, data=voice_payload) #<----- again, I know this is not ideal
It does work as you can see from the video, but the timing is slow. It is convenient from the perspective that if Mycroft doesn’t hear you quite right, you realize what it heard.
The other hack was to the /home/pi/mycroft-core/mycroft/client/text/main.py:
def handle_speak(event):
global chat
utterance = event.data.get('utterance')
utterance = TTS.remove_ssml(utterance)
voiceurl = 'http://192.168.3.126:8080/kalliope' #<- I only needed to add three lines
voice_payload = {"notification":"KALLIOPE", "payload": utterance} #<--- here
r = requests.post(url=voiceurl, data=voice_payload) #<---- and here
if bSimple:
print(">> " + utterance)
else:
chat.append(">> " + utterance)
draw_screen()
Again a hard coded url, at this point it is just a hack.
Is this even possible using a skill???
if so, how would the skill get triggered??
I’m looking for a little advice.
Cheers!
Dave