Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mycroft Skill #1624

Closed
benfrancis opened this issue Feb 5, 2019 · 32 comments
Closed

Mycroft Skill #1624

benfrancis opened this issue Feb 5, 2019 · 32 comments

Comments

@benfrancis
Copy link
Member

As a user I want to control my smart home using the Mycroft voice assistant.

@benfrancis benfrancis added the epic label Feb 5, 2019
@benfrancis benfrancis added this to the 0.8 milestone Feb 5, 2019
@flatsiedatsie
Copy link
Contributor

Would this be about installing MyCroft on the Pi? If so, there is already a local voice control option?
https://github.com/andrenatal/voice-addon

As far as I can tell this add-on is built by someone at Mozilla. Perhaps its wise to just focus on making that work well for version 1.0?

@mrstegeman
Copy link
Contributor

No, the objective of this is to have a skill that the full Mycroft stack can use, such as the Mark 1 or the Picroft port.

@jaller94
Copy link

In my mind, this issue is best addressed by creating a new repository for a Mycroft Skill which is generic and can handle any Web Thing. The gateway can then expose connected things (as in the name "gateway").
A local authorization in the gateway should allow Mycroft to connect to the things.

@hobinjk
Copy link
Contributor

hobinjk commented Feb 26, 2019

Sorry for not responding to this earlier. I typed up a reply but it's lost somewhere in my forest of tabs.

A skill for generic webthing control would be very compelling and interesting but would also require reimplementing the discovery and WoT API parts of the gateway in python. At least for now the goal for this skill is just to demonstrate that the gateway can be easily controlled by a third party service.

@mrstegeman mrstegeman added this to In progress in WebThings Gateway Mar 26, 2019
@mrstegeman mrstegeman modified the milestones: 0.8, 0.9 Jul 2, 2019
@mrstegeman mrstegeman modified the milestones: 0.9, 0.10 Jul 16, 2019
@benfrancis benfrancis removed this from the 0.10 milestone Sep 11, 2019
@mrstegeman
Copy link
Contributor

@hobinjk @benfrancis @kgiori Do we have any status on this? It's been a while.

@hobinjk
Copy link
Contributor

hobinjk commented Oct 12, 2019

90% sure the only remaining item for the first review is for me to update the Mycroft skill's recommended commands list then we only need two more reviews

@hobinjk
Copy link
Contributor

hobinjk commented Oct 12, 2019

MycroftAI/mycroft-skills#1086 is where the work for this is taking place

@mrstegeman
Copy link
Contributor

Thanks for the update!

@mrstegeman
Copy link
Contributor

Actually, it looks like that PR was just merged. Does that mean we officially have a Mycroft skill now??

@benfrancis
Copy link
Member Author

@hobinjk I set up Picroft but I can't see our skill at https://market.mycroft.ai/skills

Are you aware of any further steps that need taking?

@hobinjk
Copy link
Contributor

hobinjk commented Oct 17, 2019

I think it'll take a bit to show up in the web interface because there are other less recent skill changes that haven't show up yet.

@benfrancis
Copy link
Member Author

Good news: The skill is now live and I successfully managed to authenticate it with my gateway using the configuration UI

Bad news: Currently all voice commands I try cause the spoken response "An error occurred when processing request in Mozilla IoT gateway"

@benfrancis
Copy link
Member Author

@hobinjk Do you have any tips on debugging this?

@hobinjk
Copy link
Contributor

hobinjk commented Oct 22, 2019

I think a more verbose error should show up in mycroft-cli-client

@benfrancis
Copy link
Member Author

Here is the string of exceptions I see in mycroft-cli-client:

2019-10-30 19:07:26.527 | ERROR    |  1587 | mycroft.skills.mycroft_skill.mycroft_skill:on_error:785 | An error occurred while processing a request in Mozilla Iot Gateway
Traceback (most recent call last):
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connection.py", line 159, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/util/connection.py", line 57, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "/usr/lib/python3.7/socket.py", line 748, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 343, in _make_request
    self._validate_conn(conn)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 839, in _validate_conn
    conn.connect()
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connection.py", line 301, in connect
    conn = self._new_conn()
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connection.py", line 168, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x8a1e71d0>: Failed to establish a new connection: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 638, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/util/retry.py", line 399, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='gateway.local', port=443): Max retries exceeded with url: /commands (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x8a1e71d0>: Failed to establish a new connection: [Errno -2] Name or service not known'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/mycroft-core/mycroft/skills/mycroft_skill/event_container.py", line 66, in wrapper
    handler(message)
  File "/opt/mycroft/skills/mozilla-webthings-gateway-skill.mozilla-iot/__init__.py", line 70, in handle_command_intent
    headers=self.get_headers())
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/api.py", line 116, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/sessions.py", line 524, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/sessions.py", line 637, in send
    r = adapter.send(request, **kwargs)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='gateway.local', port=443): Max retries exceeded with url: /commands (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x8a1e71d0>: Failed to establish a new connection: [Errno -2] Name or service not known'))
2019-10-30 19:07:26.555 | INFO     |  1587 | mycroft.skills.settings:save_settings:109 | Skill settings successfully saved to /opt/mycroft/skills/mozilla-webthings-gateway-skill.mozilla-iot/settings.json
2019-10-30 19:07:34.069 | INFO     |  1587 | ConfigurationSkill | Remote configuration updated
2019-10-30 19:10:22.184 | INFO     |  1587 | QuestionsAnswersSkill | Searching for exit
2019-10-30 19:10:22.243 | INFO     |  1587 | mycroft.skills.settings:save_settings:109 | Skill settings successfully saved to /opt/mycroft/skills/mycroft-fallback-duck-duck-go.mycroftai/settings.json
Removing event fallback-query.mycroftai:QuestionQueryTimeout
2019-10-30 19:10:22.246 | INFO     |  1587 | mycroft.skills.settings:save_settings:109 | Skill settings successfully saved to /opt/mycroft/skills/fallback-wolfram-alpha.mycroftai/settings.json
Removing event fallback-query.mycroftai:QuestionQueryTimeout
2019-10-30 19:10:22.255 | INFO     |  1587 | mycroft.skills.settings:save_settings:109 | Skill settings successfully saved to /opt/mycroft/skills/fallback-query.mycroftai/settings.json
2019-10-30 19:10:22.261 | INFO     |  1587 | mycroft.skills.settings:save_settings:109 | Skill settings successfully saved to /opt/mycroft/skills/fallback-query.mycroftai/settings.json
Removing event fallback-query.mycroftai:QuestionQueryTimeout
Removing event fallback-query.mycroftai:QuestionQueryTimeout
Removing event fallback-query.mycroftai:QuestionQueryTimeout
2019-10-30 19:10:23.420 | INFO     |  1587 | QuestionsAnswersSkill | Timeout occured check responses
2019-10-30 19:11:44.186 | ERROR    |  1587 | mycroft.skills.mycroft_skill.mycroft_skill:on_error:785 | An error occurred while processing a request in Mozilla Iot Gateway
Traceback (most recent call last):
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connection.py", line 159, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/util/connection.py", line 57, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "/usr/lib/python3.7/socket.py", line 748, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 343, in _make_request
    self._validate_conn(conn)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 839, in _validate_conn
    conn.connect()
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connection.py", line 301, in connect
    conn = self._new_conn()
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connection.py", line 168, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x8a1f5cf0>: Failed to establish a new connection: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 638, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/util/retry.py", line 399, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='gateway.local', port=443): Max retries exceeded with url: /commands (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x8a1f5cf0>: Failed to establish a new connection: [Errno -2] Name or service not known'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/mycroft-core/mycroft/skills/mycroft_skill/event_container.py", line 66, in wrapper
    handler(message)
  File "/opt/mycroft/skills/mozilla-webthings-gateway-skill.mozilla-iot/__init__.py", line 70, in handle_command_intent
    headers=self.get_headers())
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/api.py", line 116, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/sessions.py", line 524, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/sessions.py", line 637, in send
    r = adapter.send(request, **kwargs)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='gateway.local', port=443): Max retries exceeded with url: /commands (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x8a1f5cf0>: Failed to establish a new connection: [Errno -2] Name or service not known'))
2019-10-30 19:15:59.886 | ERROR    |  1587 | mycroft.skills.settings:_get_remote_settings:379 | Failed to download remote settings from server.
Traceback (most recent call last):
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/contrib/pyopenssl.py", line 456, in wrap_socket
    cnx.do_handshake()
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1915, in do_handshake
    self._raise_ssl_error(self._ssl, result)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1622, in _raise_ssl_error
    raise WantReadError()
OpenSSL.SSL.WantReadError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 343, in _make_request
    self._validate_conn(conn)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 839, in _validate_conn
    conn.connect()
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connection.py", line 344, in connect
    ssl_context=context)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/util/ssl_.py", line 345, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/contrib/pyopenssl.py", line 459, in wrap_socket
    raise timeout('select timed out')
socket.timeout: select timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 638, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/util/retry.py", line 368, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/packages/six.py", line 686, in reraise
    raise value
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 346, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=conn.timeout)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 306, in _raise_timeout
    raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)
urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='api.mycroft.ai', port=443): Read timed out. (read timeout=3.05)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/mycroft-core/mycroft/skills/settings.py", line 377, in _get_remote_settings
    remote_settings = self.api.get_skill_settings()
  File "/home/pi/mycroft-core/mycroft/api/__init__.py", line 370, in get_skill_settings
    "path": "/" + UUID + "/skill/settings",
  File "/home/pi/mycroft-core/mycroft/api/__init__.py", line 69, in request
    return self.send(params)
  File "/home/pi/mycroft-core/mycroft/api/__init__.py", line 141, in send
    data=data, json=json_body, timeout=(3.05, 15)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/sessions.py", line 524, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/sessions.py", line 637, in send
    r = adapter.send(request, **kwargs)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/adapters.py", line 529, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='api.mycroft.ai', port=443): Read timed out. (read timeout=3.05)

@benfrancis
Copy link
Member Author

It seems to be trying to access gateway.local but my gateway's hostname is set to webthings.local. If I change it to gateway.local I get a different error message:

2019-10-30 19:07:26.527 | ERROR    |  1587 | mycroft.skills.mycroft_skill.mycroft_skill:on_error:785 | An error occurred while processing a request in Mozilla Iot Gateway
Traceback (most recent call last):
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connection.py", line 159, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/util/connection.py", line 57, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "/usr/lib/python3.7/socket.py", line 748, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 343, in _make_request
    self._validate_conn(conn)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 839, in _validate_conn
    conn.connect()
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connection.py", line 301, in connect
    conn = self._new_conn()
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connection.py", line 168, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x8a1e71d0>: Failed to establish a new connection: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 638, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/util/retry.py", line 399, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='gateway.local', port=443): Max retries exceeded with url: /commands (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x8a1e71d0>: Failed to establish a new connection: [Errno -2] Name or service not known'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/mycroft-core/mycroft/skills/mycroft_skill/event_container.py", line 66, in wrapper
    handler(message)
  File "/opt/mycroft/skills/mozilla-webthings-gateway-skill.mozilla-iot/__init__.py", line 70, in handle_command_intent
    headers=self.get_headers())
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/api.py", line 116, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/sessions.py", line 524, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/sessions.py", line 637, in send
    r = adapter.send(request, **kwargs)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='gateway.local', port=443): Max retries exceeded with url: /commands (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x8a1e71d0>: Failed to establish a new connection: [Errno -2] Name or service not known'))
2019-10-30 19:07:26.555 | INFO     |  1587 | mycroft.skills.settings:save_settings:109 | Skill settings successfully saved to /opt/mycroft/skills/mozilla-webthings-gateway-skill.mozilla-iot/settings.json
2019-10-30 19:07:34.069 | INFO     |  1587 | ConfigurationSkill | Remote configuration updated
2019-10-30 19:10:22.184 | INFO     |  1587 | QuestionsAnswersSkill | Searching for exit
2019-10-30 19:10:22.243 | INFO     |  1587 | mycroft.skills.settings:save_settings:109 | Skill settings successfully saved to /opt/mycroft/skills/mycroft-fallback-duck-duck-go.mycroftai/settings.json
Removing event fallback-query.mycroftai:QuestionQueryTimeout
2019-10-30 19:10:22.246 | INFO     |  1587 | mycroft.skills.settings:save_settings:109 | Skill settings successfully saved to /opt/mycroft/skills/fallback-wolfram-alpha.mycroftai/settings.json
Removing event fallback-query.mycroftai:QuestionQueryTimeout
2019-10-30 19:10:22.255 | INFO     |  1587 | mycroft.skills.settings:save_settings:109 | Skill settings successfully saved to /opt/mycroft/skills/fallback-query.mycroftai/settings.json
2019-10-30 19:10:22.261 | INFO     |  1587 | mycroft.skills.settings:save_settings:109 | Skill settings successfully saved to /opt/mycroft/skills/fallback-query.mycroftai/settings.json
Removing event fallback-query.mycroftai:QuestionQueryTimeout
Removing event fallback-query.mycroftai:QuestionQueryTimeout
Removing event fallback-query.mycroftai:QuestionQueryTimeout
2019-10-30 19:10:23.420 | INFO     |  1587 | QuestionsAnswersSkill | Timeout occured check responses
2019-10-30 19:11:44.186 | ERROR    |  1587 | mycroft.skills.mycroft_skill.mycroft_skill:on_error:785 | An error occurred while processing a request in Mozilla Iot Gateway
Traceback (most recent call last):
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connection.py", line 159, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/util/connection.py", line 57, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "/usr/lib/python3.7/socket.py", line 748, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 343, in _make_request
    self._validate_conn(conn)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 839, in _validate_conn
    conn.connect()
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connection.py", line 301, in connect
    conn = self._new_conn()
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connection.py", line 168, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x8a1f5cf0>: Failed to establish a new connection: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 638, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/util/retry.py", line 399, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='gateway.local', port=443): Max retries exceeded with url: /commands (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x8a1f5cf0>: Failed to establish a new connection: [Errno -2] Name or service not known'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/mycroft-core/mycroft/skills/mycroft_skill/event_container.py", line 66, in wrapper
    handler(message)
  File "/opt/mycroft/skills/mozilla-webthings-gateway-skill.mozilla-iot/__init__.py", line 70, in handle_command_intent
    headers=self.get_headers())
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/api.py", line 116, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/sessions.py", line 524, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/sessions.py", line 637, in send
    r = adapter.send(request, **kwargs)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='gateway.local', port=443): Max retries exceeded with url: /commands (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x8a1f5cf0>: Failed to establish a new connection: [Errno -2] Name or service not known'))
2019-10-30 19:15:59.886 | ERROR    |  1587 | mycroft.skills.settings:_get_remote_settings:379 | Failed to download remote settings from server.
Traceback (most recent call last):
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/contrib/pyopenssl.py", line 456, in wrap_socket
    cnx.do_handshake()
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1915, in do_handshake
    self._raise_ssl_error(self._ssl, result)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1622, in _raise_ssl_error
    raise WantReadError()
OpenSSL.SSL.WantReadError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 343, in _make_request
    self._validate_conn(conn)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 839, in _validate_conn
    conn.connect()
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connection.py", line 344, in connect
    ssl_context=context)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/util/ssl_.py", line 345, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/contrib/pyopenssl.py", line 459, in wrap_socket
    raise timeout('select timed out')
socket.timeout: select timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 638, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/util/retry.py", line 368, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/packages/six.py", line 686, in reraise
    raise value
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 346, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=conn.timeout)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 306, in _raise_timeout
    raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)
urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='api.mycroft.ai', port=443): Read timed out. (read timeout=3.05)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/mycroft-core/mycroft/skills/settings.py", line 377, in _get_remote_settings
    remote_settings = self.api.get_skill_settings()
  File "/home/pi/mycroft-core/mycroft/api/__init__.py", line 370, in get_skill_settings
    "path": "/" + UUID + "/skill/settings",
  File "/home/pi/mycroft-core/mycroft/api/__init__.py", line 69, in request
    return self.send(params)
  File "/home/pi/mycroft-core/mycroft/api/__init__.py", line 141, in send
    data=data, json=json_body, timeout=(3.05, 15)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/sessions.py", line 524, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/sessions.py", line 637, in send
    r = adapter.send(request, **kwargs)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/adapters.py", line 529, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='api.mycroft.ai', port=443): Read timed out. (read timeout=3.05)
2019-10-30 19:19:36.939 | WARNING  |  1587 | ConfigurationSkill | Failed to update settings, will retry later
2019-10-30 19:21:04.870 | ERROR    |  1587 | mycroft.skills.settings:_get_remote_settings:379 | Failed to download remote settings from server.
Traceback (most recent call last):
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connection.py", line 159, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/util/connection.py", line 80, in create_connection
    raise err
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/util/connection.py", line 70, in create_connection
    sock.connect(sa)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 343, in _make_request
    self._validate_conn(conn)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 839, in _validate_conn
    conn.connect()
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connection.py", line 301, in connect
    conn = self._new_conn()
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connection.py", line 164, in _new_conn
    (self.host, self.timeout))
urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.VerifiedHTTPSConnection object at 0xb4cf3d50>, 'Connection to api.mycroft.ai timed out. (connect timeout=3.05)')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 638, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/util/retry.py", line 399, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.mycroft.ai', port=443): Max retries exceeded with url: /v1/device/6fdf9e51-97e7-486f-bd1d-c5dd48228ee7/skill/settings (Caused by ConnectTimeoutError(<urllib3.connection.VerifiedHTTPSConnection object at 0xb4cf3d50>, 'Connection to api.mycroft.ai timed out. (connect timeout=3.05)'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/mycroft-core/mycroft/skills/settings.py", line 377, in _get_remote_settings
    remote_settings = self.api.get_skill_settings()
  File "/home/pi/mycroft-core/mycroft/api/__init__.py", line 370, in get_skill_settings
    "path": "/" + UUID + "/skill/settings",
  File "/home/pi/mycroft-core/mycroft/api/__init__.py", line 69, in request
    return self.send(params)
  File "/home/pi/mycroft-core/mycroft/api/__init__.py", line 141, in send
    data=data, json=json_body, timeout=(3.05, 15)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/sessions.py", line 524, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/sessions.py", line 637, in send
    r = adapter.send(request, **kwargs)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/adapters.py", line 504, in send
    raise ConnectTimeout(e, request=request)
requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='api.mycroft.ai', port=443): Max retries exceeded with url: /v1/device/6fdf9e51-97e7-486f-bd1d-c5dd48228ee7/skill/settings (Caused by ConnectTimeoutError(<urllib3.connection.VerifiedHTTPSConnection object at 0xb4cf3d50>, 'Connection to api.mycroft.ai timed out. (connect timeout=3.05)'))
2019-10-30 19:25:51.601 | ERROR    |  1587 | urllib3.connection | Certificate did not match expected hostname: gateway.local. Certificate: {'subject': ((('commonName', 'tola.mozilla-iot.org'),),), 'subjectAltName': [('DNS', 'tola.mozilla-iot.org')]}
2019-10-30 19:25:51.605 | ERROR    |  1587 | mycroft.skills.mycroft_skill.mycroft_skill:on_error:785 | An error occurred while processing a request in Mozilla Iot Gateway
Traceback (most recent call last):
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 343, in _make_request
    self._validate_conn(conn)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 839, in _validate_conn
    conn.connect()
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connection.py", line 364, in connect
    _match_hostname(cert, self.assert_hostname or server_hostname)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connection.py", line 374, in _match_hostname
    match_hostname(cert, asserted_hostname)
  File "/usr/lib/python3.7/ssl.py", line 327, in match_hostname
    % (hostname, dnsnames[0]))
ssl.SSLCertVerificationError: ("hostname 'gateway.local' doesn't match 'tola.mozilla-iot.org'",)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/connectionpool.py", line 638, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/urllib3/util/retry.py", line 399, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='gateway.local', port=443): Max retries exceeded with url: /commands (Caused by SSLError(SSLCertVerificationError("hostname 'gateway.local' doesn't match 'tola.mozilla-iot.org'")))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/mycroft-core/mycroft/skills/mycroft_skill/event_container.py", line 66, in wrapper
    handler(message)
  File "/opt/mycroft/skills/mozilla-webthings-gateway-skill.mozilla-iot/__init__.py", line 70, in handle_command_intent
    headers=self.get_headers())
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/api.py", line 116, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/sessions.py", line 524, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/sessions.py", line 637, in send
    r = adapter.send(request, **kwargs)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/requests/adapters.py", line 514, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='gateway.local', port=443): Max retries exceeded with url: /commands (Caused by SSLError(SSLCertVerificationError("hostname 'gateway.local' doesn't match 'tola.mozilla-iot.org'")))

@mrstegeman
Copy link
Contributor

I assume you'll need to use your full domain (tola.mozilla-iot.org), since certificate validation will fail with the .local domain.

@benfrancis
Copy link
Member Author

My domain was configured via the OAuth ("Automatic") mechanism in the Mycroft web interface:
mycroft_settings

It appears that this setting has not taken effect and the skill is defaulting to gateway.local and then getting a certificate error because the certificate is for my full domain.

Repeating the OAuth process doesn't seem to fix it, despite the web interface saying it has succeeded.

@benfrancis
Copy link
Member Author

@hobinjk: Do you have any idea what might be going on here by any chance?

@hobinjk
Copy link
Contributor

hobinjk commented Nov 4, 2019

To me the most likely thing would be that you're using an out-of-date version of the skill that was manually cloned from an earlier point since there used to be a bug where it always went to gateway.local. You can also add prints to your local copy of the skill to see what's going on:
https://github.com/mozilla-iot/mozilla-webthings-gateway-skill/blob/master/__init__.py#L60

@benfrancis
Copy link
Member Author

Thanks for that tip @hobinjk !

I've verified that it is the latest version and after adding print statements everywhere (!) I've discovered the problem is with getting the host from the oauth token. It's throwing a ValueError exception at https://github.com/mozilla-iot/mozilla-webthings-gateway-skill/blob/c0182320badd3c84f01f370ed7e18988316816d0/__init__.py#L46

Do you have any idea what might be causing that?

I was also wondering where those hard coded integers come from which are passed to DeviceApi().get_oauth_token() and how we know if they need updating?

@hobinjk
Copy link
Contributor

hobinjk commented Nov 11, 2019

The hardcoded integers are references to a database of skills on Mycroft's end so Åke would know if they need changing.

It's possible that the request in get_oauth_token is returning something unparsable due to something messing with the connection to the mycroft API but that feels less likely

@ChanceNCounter
Copy link

Hi! Rando half-competent Mycroft contributor here, just skimming the file. Have you confirmed that payload_medium_rare (L43) is valid JSON, and contains the right key? I realize I'm being Yogi Berra, but I don't have any of the gear to dive all the way in myself.

WebThings Gateway automation moved this from In progress to Done Jan 30, 2020
@flatsiedatsie
Copy link
Contributor

Interesting. From what I understand, any future voice control will have to work like Voco in that it handles all logic in the add-on itself, and will just call the API?

So if there is a desire for voice control via MyCroft, someone will have to create a Mycroft add-on that handles everything internally?

@mrstegeman
Copy link
Contributor

There is already a Mycroft skill available, but it currently uses the commands API. Mycroft is working on a rewrite of the skill, to hopefully be done before the 0.12 release when the commands API disappears.

@flatsiedatsie
Copy link
Contributor

That's great!

@im-strongthany-zz
Copy link

Hello, I'll be (one of) the peeps taking a crack and re-writing this skill to work on the new version. Let me know if you have any questions(or tips!)

@mrstegeman
Copy link
Contributor

@im-strongthany Please ask away if you run into any snags, or just need some pointers. I’m also on Matrix, in #iot:mozilla.org (https://chat.mozilla.org).

@mrstegeman
Copy link
Contributor

@im-strongthany How are things progressing? We're planning to release 0.12 in a few weeks, which will drop the commands API that the skill currently uses, so I wanted to make sure you're on the right path.

@logankaser
Copy link

Is anyone still working on this? I'm just a lost soul building around Mycroft and wondering if WebThings is still planning on supporting Mycroft (or vice versa)

@flatsiedatsie
Copy link
Contributor

Not that I know of. Have you tried the Voco addon?

@mhalano
Copy link

mhalano commented Nov 19, 2021

If I wouldn't find this, I would open an issue. I bought some Mycroft during Kickstarter and I would like to use it to manage the devices using WebThings appliance as hub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

9 participants