Mycroft skill update

@hobinjk I was playing with the Mycroft skill and it currently runs into an SSL error because gateway.local certs don’t match whatever.mozilla-iot.org.

Is that skill currently working? Can you only have it use gateway.local, and if so, how do you do the ‘connect’ step?

Seems like a great skill to have!

This is the same problem that @benfrancis has been having. However, @IOT_Noob seems to have gotten it to work. Any pointers?

1 Like

Hi @hobinjkI have it working with Mycroft OK…
There was a bit of a “fiddle factor” , but…
I don’t know exactly where you are seeing your problem, but I didn’t try to use any LOCAL certs at all, and I let the Mycroft skill connect “automatically” with it own settings… (to the XXXXX.mozilla-iot.org site)
the other “Gotcha” things I found…

  1. ensure you have the “Assistant” on in the Gateway (under “experiments”) - not sure if this is needed but I set this up a few times and it was always on :slight_smile: - make sure your gateway is not saying “something went wrong” when you try to use the assistant!!! If so you will never get it to work (just Mycroft saying the error “something went wrong” which is actually coming from the gateway!)
  2. When the Mycroft skill tries to authorise via the API it ALWAYS fails the first ( and sometimes the second time) with a web site error ( can’t remember which one now sorry - maybe a 504) - Try again a few times without changing anything… I suspect the the Mycroft.ai page that it needs to access is really slooooow …

Anyway, if none of that helps, then tell me where you are seeing the issue… I “started from scratch” by re flashing the IOT gateway a bout 5 times , so I saw a few weird issues… :slight_smile:
It is stable now though!

I’ll try reflashing and starting from scratch again. I haven’t looked into what the authorize process is doing under the hood, but perhaps I’m doing something different there (or have settings affecting that).

1 Like

Hey James, wanted to check in if you’d had any success or found anything new on this during your tinkering?

I would be interested too…
Mycroft is still “playing well” with my gateway :slight_smile:

Sorry for the delay, haven’t been doing much tinkering. RPi I had for playing with picroft was repurposed, but I am not running it on my desktop.

I did try unchecking Local Access in my mozilla-IOT settings > domain, and that removed the cert error.

However now when I try to use the “automatic gateway configuration” button, I get a generic 500 Internal Server Error after I put in my mozilla-iot domain.

If I try to run the mycroft skill after that, I get a Failed to establish a new connection from the skill when it tries to post to /commands

The specific call that 500’s for me is to

https://api.mycroft.ai/v1/auth/callback?code=...

I still haven’t gotten this working, but in the meantime I’m experimenting with another piece of functionality I think would be very cool.

I’d love to write a mycroft-as-wot-thing skill. That would let you add a Thing on your mozilla IoT hub for Mycroft, and it would have actions like question:query and play which would use the Messagebus to handle the request and could optionally set a property on the thing with the response data.

This would be an interesting avenue for letting you ask things of Mycroft without speaking/being in the same room. You could even use subdomain.mozilla-iot.org to ask Mycroft questions or perform actions while in a totally different location.

One barrier I see even just messing around with that is that pyee versions are incompatible between webthing and mycroft-messagebus-client

ERROR: mycroft-messagebus-client 0.8.1 has requirement pyee==5.0.0, but you'll have pyee 7.0.1 which is incompatible.

Anyone have thoughts on this?

It’s not quite finished, but this gist shows the basics

From there you can use a freetext input to ask questions of Mycroft, and the Response field will update in the front end.

The updated version relies on Events instead, as they get stored in the log instead of being overwritten like a Property.

image

But I’m having trouble getting the WebThingServer inside a thread as a Mycroft skill

WebThingServer uses tornado, which isn’t really friendly towards threads. However, since v0.12.1 of webthing-python, you can swap out tornado with something else, like flask. See here for more information.

That’s very helpful! I’ll give that a shot

So would the idea be that I can replace WebThingServer which still wants to use tornado with a Flask api that implements the Web Thing REST API? Or am I missing something?

The webthing-python readme says “This starts a server and lets you search for it from your gateway through mDNS” – silly question, but what allows it be found via mDNS? I’m having trouble getting started without knowing the requirement to be able to create a service that the gateway can find.

Thanks!

Yes, I think that’s essentially what the other person was doing. You keep the rest of the webthing library, but replace the actual web server piece.

The web thing will advertise a service via DNS-SD (over mDNS), using the _webthing._tcp service type. The Web Thing add-on for the gateway watches for new services on the network of that service type and will allow you to add them to your gateway via the usual means (clicking the + button). This piece is not strictly necessary, just makes things easier so that you don’t have to use the “Add by URL” function and type in an IP address.

Here’s the relevant part of the code: https://github.com/mozilla-iot/webthing-python/blob/master/webthing/server.py#L834-L844