Voice Assistant error ( bug?) "Training Error"

I am seeing an error in the logs when I try to use the voice assistant in the GW.

2019-12-11 21:01:31.082 INFO : Training error: Error: connect ECONNREFUSED 127.0.0.1:5555
2019-12-11 21:01:31.086 INFO : Error training: Failed to train intent parser.
2019-12-11 21:02:00.741 INFO : Training error: Error: connect ECONNREFUSED 127.0.0.1:5555

the error seen in the UI is “Sorry, Something went wrong”

I have looked at the issues in Github and couldn’t find anything, so I thought I would raise it here:
This is the situation:
a) Gateway is built from the (excellent) instructions on Github Wiki, on a ( wait for it) - Pi3 A+. so i know I may run int memory issues, but I am monitoring it
b) I have only local sensor “things” on the Pi
c) There is a “virtual Thing” as an on/of switch called “light”

I tell the virtual Assistant to “turn on light” from a phone and the error occurs - same result from a PC…

Now here is the Interesting part … I get the SAME error and SAME result when I use the authorised “Mycroft” system … So Mycroft says “sorry, something went wrong” - which is a non-standard error - If I unauthorise Mycroft , it says “An error occurred in the Mozilla IOT gateway”

Is this a bug?
I have tried all sorts of stuff…
After rebooting the Pi. - with NO external 0Auth for Mycroft.

  1. tried the Gateway voice Assistant - same error
  2. added the Mycroft API ( I have found that I always need to try TWICE when I do this, first time gives a websocket error, second time works … But that is a different issue :slight_smile:
  3. try it from mycroft - same error
  4. try it again from the gateway assistant - same error

It seems that the port 5555 is not open?

Larger chunk of log, covering the above is below.

Thanks!
2019-12-11 21:00:37.873 INFO : Finished updating add-ons
2019-12-11 21:01:14.694 INFO : getValue for property uptime for: System returning 544
2019-12-11 21:01:14.704 INFO : getValue for property cpuTemperature for: CPU returning 46.16
2019-12-11 21:01:14.754 INFO : getValue for property memAvailable for: RAM returning 178.63671875
2019-12-11 21:01:31.082 INFO : Training error: Error: connect ECONNREFUSED 127.0.0.1:5555
2019-12-11 21:01:31.086 INFO : Error training: Failed to train intent parser.
2019-12-11 21:02:00.741 INFO : Training error: Error: connect ECONNREFUSED 127.0.0.1:5555
2019-12-11 21:02:00.744 INFO : Error training: Failed to train intent parser.
2019-12-11 21:02:25.916 ERROR : WebSocket sendMessage failed: Error: WebSocket is not open: readyState 2 (CLOSING)
2019-12-11 21:02:25.924 ERROR : WebSocket sendMessage failed: Error: WebSocket is not open: readyState 2 (CLOSING)
2019-12-11 21:02:25.973 ERROR : WebSocket sendMessage failed: Error: WebSocket is not open: readyState 2 (CLOSING)
2019-12-11 21:04:34.675 INFO : Tunnel domain found. Tunnel name is: (XXXXXXXXXX) and tunnel domain is: mozilla-iot.org
2019-12-11 21:04:34.678 INFO : Tunnel name is set to: https://(XXXXXXXXXX).mozilla-iot.org
2019-12-11 21:04:34.679 INFO : Local mDNS Service Domain Name is: raspberrypi
2019-12-11 21:04:35.675 INFO : Tunnel domain found. Tunnel name is: (XXXXXXXXXXX) and tunnel domain is: mozilla-iot.org
2019-12-11 21:04:35.678 INFO : Tunnel name is set to: https://(XXXXXXXXXX).mozilla-iot.org
2019-12-11 21:04:35.680 INFO : Local mDNS Service Domain Name is: raspberrypi
2019-12-11 21:05:19.038 INFO : Training error: Error: connect ECONNREFUSED 127.0.0.1:5555
2019-12-11 21:05:19.041 INFO : Error training: Failed to train intent parser.

@benfrancis do you know if port 5555 should be open & what should open it? Maybe some service isn’t running?

Port 5555 is used by the intent parser’s TCP server, but only via localhost (127.0.0.1).

Client: https://github.com/mozilla-iot/gateway/blob/master/src/models/intentparser.js#L57
Server: https://github.com/mozilla-iot/intent-parser/blob/master/intent-parser-server.py

As I understand it both the built-in smart assistant experiment and the Mycroft skill use that code path by calling the Commands API https://github.com/mozilla-iot/gateway/blob/master/src/controllers/commands_controller.js

So yes, if the gateway process isn’t able to connect to the intent parser process then that would prevent the Mycroft skill from working.

However, on the official Raspberry Pi build the built-in smart assistant is working for me so I would be surprised if this is the issue that other people are having with Mycroft.

I will (hopefully) get a chance to do burn the official build onto a card and put it on a PI in the next few days & try again…
and yes it is trying to open port 5555 on the local host and it is failing.

I would be interested to know what is not running on the one I built from instructions that should be listening on 5555 - I don’t want to dedicate a whole PI to just the gateway…

I’d guess you need to git clone the intent-parser repo and follow the instructions in that repo to install Adapt and run the intent parser server https://github.com/mozilla-iot/intent-parser

Thanks @benfrancis .
So the intent parser must be in the official build but not part of the gateway…
I cloned the parser and pip installed it etc. but now I see
" from socketserver import BaseRequestHandler, ThreadingTCPServer
ImportError: No module named socketserver "

LOL!!! So this is another “rabbit hole”! I can see an endless string of, “that needs to be running” then “that needs to be running” :slight_smile:

Looks like a full time job!

@benfrancis
I can confirm with you now that the Mycroft - Mozilla-IOT-gateway link works without issue! :slight_smile:
I can turn on & off a virtual switch …
AND I can turn on or off a “Homekit” power plug (Once only but that is another issue - see my other thread…)
This is using the official build…
So there is no bug in there that I have seen yet!
I am not going to report this on the Mycroft chat until I see if there is something simple wrong with the Homekit adapter not updating with @mrstegeman
:slight_smile: