rhasspy/hassio-addons

Assist Microphone Fails to start if Homeassistant SSL activated

Closed this issue · 4 comments

Hi,

I installed and configured the "Assist Microphone" AddOn. But if I try to start it, it fails and I get the following log:

    File "/usr/local/lib/python3.11/dist-packages/aiohttp/connector.py", line 980, in _wrap_create_connection
      return await self._loop.create_connection(*args, **kwargs)  # type: ignore[return-value]  # noqa
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/lib/python3.11/asyncio/base_events.py", line 1085, in create_connection
      raise exceptions[0]
    File "/usr/lib/python3.11/asyncio/base_events.py", line 1069, in create_connection
      sock = await self._connect_sock(
             ^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/lib/python3.11/asyncio/base_events.py", line 973, in _connect_sock
      await self.sock_connect(sock, address)
    File "/usr/lib/python3.11/asyncio/selector_events.py", line 634, in sock_connect
      return await fut
             ^^^^^^^^^
    File "/usr/lib/python3.11/asyncio/selector_events.py", line 674, in _sock_connect_cb
      raise OSError(err, f'Connect call failed {address}')
    ConnectionRefusedError: [Errno 111] Connect call failed ('172.30.32.1', 8123)
    The above exception was the direct cause of the following exception:
    Traceback (most recent call last):
    File "/usr/local/lib/python3.11/dist-packages/homeassistant_satellite/__main__.py", line 193, in main
      async for _timestamp, event_type, event_data in stream(
    File "/usr/local/lib/python3.11/dist-packages/homeassistant_satellite/remote.py", line 26, in stream
      async with session.ws_connect(url) as websocket:
    File "/usr/local/lib/python3.11/dist-packages/aiohttp/client.py", line 1141, in __aenter__
      self._resp = await self._coro
                   ^^^^^^^^^^^^^^^^
    File "/usr/local/lib/python3.11/dist-packages/aiohttp/client.py", line 779, in _ws_connect
      resp = await self.request(
             ^^^^^^^^^^^^^^^^^^^
    File "/usr/local/lib/python3.11/dist-packages/aiohttp/client.py", line 536, in _request
      conn = await self._connector.connect(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/local/lib/python3.11/dist-packages/aiohttp/connector.py", line 540, in connect
      proto = await self._create_connection(req, traces, timeout)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/local/lib/python3.11/dist-packages/aiohttp/connector.py", line 901, in _create_connection
      _, proto = await self._create_direct_connection(req, traces, timeout)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/local/lib/python3.11/dist-packages/aiohttp/connector.py", line 1206, in _create_direct_connection
      raise last_exc
    File "/usr/local/lib/python3.11/dist-packages/aiohttp/connector.py", line 1175, in _create_direct_connection
      transp, proto = await self._wrap_create_connection(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/local/lib/python3.11/dist-packages/aiohttp/connector.py", line 988, in _wrap_create_connection
      raise client_error(req.connection_key, exc) from exc
    aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host homeassistant:8123 ssl:default [Connect call failed ('172.30.32.1', 8123)]
    ERROR:__main__:Unexpected error
    Traceback (most recent call last):
    File "/usr/local/lib/python3.11/dist-packages/aiohttp/connector.py", line 980, in _wrap_create_connection
      return await self._loop.create_connection(*args, **kwargs)  # type: ignore[return-value]  # noqa
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/lib/python3.11/asyncio/base_events.py", line 1085, in create_connection
      raise exceptions[0]
    File "/usr/lib/python3.11/asyncio/base_events.py", line 1069, in create_connection
      sock = await self._connect_sock(
             ^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/lib/python3.11/asyncio/base_events.py", line 973, in _connect_sock
      await self.sock_connect(sock, address)
    File "/usr/lib/python3.11/asyncio/selector_events.py", line 634, in sock_connect
      return await fut
             ^^^^^^^^^
    File "/usr/lib/python3.11/asyncio/selector_events.py", line 674, in _sock_connect_cb
      raise OSError(err, f'Connect call failed {address}')
    ConnectionRefusedError: [Errno 111] Connect call failed ('172.30.32.1', 8123)
    The above exception was the direct cause of the following exception:
    Traceback (most recent call last):
    File "/usr/local/lib/python3.11/dist-packages/homeassistant_satellite/__main__.py", line 193, in main
      async for _timestamp, event_type, event_data in stream(
    File "/usr/local/lib/python3.11/dist-packages/homeassistant_satellite/remote.py", line 26, in stream
      async with session.ws_connect(url) as websocket:
    File "/usr/local/lib/python3.11/dist-packages/aiohttp/client.py", line 1141, in __aenter__
      self._resp = await self._coro
                   ^^^^^^^^^^^^^^^^
    File "/usr/local/lib/python3.11/dist-packages/aiohttp/client.py", line 779, in _ws_connect
      resp = await self.request(
             ^^^^^^^^^^^^^^^^^^^
    File "/usr/local/lib/python3.11/dist-packages/aiohttp/client.py", line 536, in _request
      conn = await self._connector.connect(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/local/lib/python3.11/dist-packages/aiohttp/connector.py", line 540, in connect
      proto = await self._create_connection(req, traces, timeout)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/local/lib/python3.11/dist-packages/aiohttp/connector.py", line 901, in _create_connection
      _, proto = await self._create_direct_connection(req, traces, timeout)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/local/lib/python3.11/dist-packages/aiohttp/connector.py", line 1206, in _create_direct_connection
      raise last_exc
    File "/usr/local/lib/python3.11/dist-packages/aiohttp/connector.py", line 1175, in _create_direct_connection
      transp, proto = await self._wrap_create_connection(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/local/lib/python3.11/dist-packages/aiohttp/connector.py", line 988, in _wrap_create_connection
      raise client_error(req.connection_key, exc) from exc
    aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host homeassistant:8123 ssl:default [Connect call failed ('172.30.32.1', 8123)]
    ERROR:__main__:Unexpected error
    Traceback (most recent call last):
    File "/usr/local/lib/python3.11/dist-packages/aiohttp/connector.py", line 980, in _wrap_create_connection
      return await self._loop.create_connection(*args, **kwargs)  # type: ignore[return-value]  # noqa

Because of voice assistant in the browser I was forced to enable SSL for homeassistant. Therefore my homeassistant does not listen on port 8123. Instead it listens on port 443.

    http:
      server_port: 443
      ssl_certificate: /ssl/fullchain.pem
      ssl_key: /ssl/privkey.pem

It would be nice if this would be detected or if I could at least configure that in the settings of the addon. It is reachable under home.my-domain.tld .

many thanks in advance

Same here.
I've found this in the repo : https://github.com/rhasspy/hassio-addons/blob/b00bdda10868369434329090b47cedcd21796b41/assist_microphone/rootfs/etc/s6-overlay/s6-rc.d/assist_microphone/run#L17C17-L17C17

Maybe we can add a port argument here, same as the host argument. I am unsure but it looks like homeassistant_sattelite could accept port argument

I checked, the args port is not yet mapped.

I've added it as issue on synesthesiam/homeassistant-satellite#8

Should be fixed in synesthesiam/homeassistant-satellite#10

Now i think we only need parameter here ?

For me it seems as if this issue is fixed, at least now I get a different error.
#47