Can anyone tell me what might be happening here?

Have been getting the following error every once in a while but can’t seem to recreate it. It just seems to happen randomly.

2018-09-26 07:45:06.395444 WARNING AppDaemon: ------------------------------------------------------------
2018-09-26 07:45:06.398501 WARNING AppDaemon: Unexpected error in worker for App good_morning_routine:
2018-09-26 07:45:06.402396 WARNING AppDaemon: Worker Ags: {'name': 'good_morning_routine', 'id': UUID('870de344-2db7-4275-9aee-27f02f5a284c'), 'type': 'attr', 'function': <bound method GoodMorningRoutine.good_morning_routine_cb of <good_morning_routine.GoodMorningRoutine object at 0x744a5cb0>>, 'attribute': 'state', 'entity': 'input_boolean.good_morning', 'new_state': 'on', 'old_state': 'off', 'kwargs': {'new': 'on', 'handle': UUID('be9d0385-620c-407c-a94f-ebe8ee2b594d')}}
2018-09-26 07:45:06.405408 WARNING AppDaemon: ------------------------------------------------------------
2018-09-26 07:45:06.420711 WARNING AppDaemon: Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/urllib3/connection.py", line 171, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw)
  File "/usr/lib/python3.6/site-packages/urllib3/util/connection.py", line 56, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "/usr/lib/python3.6/socket.py", line 745, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Try again
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/usr/lib/python3.6/site-packages/urllib3/connectionpool.py", line 343, in _make_request
    self._validate_conn(conn)
  File "/usr/lib/python3.6/site-packages/urllib3/connectionpool.py", line 849, in _validate_conn
    conn.connect()
  File "/usr/lib/python3.6/site-packages/urllib3/connection.py", line 314, in connect
    conn = self._new_conn()
  File "/usr/lib/python3.6/site-packages/urllib3/connection.py", line 180, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x725bde30>: Failed to establish a new connection: [Errno -3] Try again
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/requests/adapters.py", line 445, in send
    timeout=timeout
  File "/usr/lib/python3.6/site-packages/urllib3/connectionpool.py", line 638, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/lib/python3.6/site-packages/urllib3/util/retry.py", line 398, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='xxxxxx.duckdns.org', port=443): Max retries exceeded with url: /api/services/input_select/select_option (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x725bde30>: Failed to establish a new connection: [Errno -3] Try again',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/appdaemon/appdaemon.py", line 590, in worker
    self.sanitize_state_kwargs(app, args["kwargs"]))
  File "/config/appdaemon/apps/good_morning_routine.py", line 55, in good_morning_routine_cb
    self.select_option('input_select.house_mode', 'Home')
  File "/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassapi.py", line 22, in func_wrapper
    return func(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassapi.py", line 378, in select_option
    self.call_service("input_select/select_option", **rargs)
  File "/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassapi.py", line 22, in func_wrapper
    return func(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassapi.py", line 455, in call_service
    apiurl, headers=headers, json=kwargs, verify=certpath
  File "/usr/lib/python3.6/site-packages/requests/api.py", line 112, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/lib/python3.6/site-packages/requests/api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python3.6/site-packages/requests/sessions.py", line 512, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python3.6/site-packages/requests/sessions.py", line 622, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python3.6/site-packages/requests/adapters.py", line 513, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='xxxxxx.duckdns.org', port=443): Max retries exceeded with url: /api/services/input_select/select_option (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x725bde30>: Failed to establish a new connection: [Errno -3] Try again',))
2018-09-26 07:45:06.436577 WARNING AppDaemon: ------------------------------------------------------------
Fatal read error on socket transport
protocol: <asyncio.sslproto.SSLProtocol object at 0x724e0c30>
transport: <_SelectorSocketTransport fd=16 read=polling write=<idle, bufsize=0>>
Traceback (most recent call last):
  File "/usr/lib/python3.6/asyncio/selector_events.py", line 723, in _read_ready
    data = self._sock.recv(self.max_size)
TimeoutError: [Errno 110] Operation timed out

you have a good morning routine.
and if i read it well that routine tries to read the state from an input boolean.

but you have your connection to HA running over duckdns.

i expect that this is caused by a slow internet connection at some moments, making that the connection from AD to HA is timed out.

solution:
install a proxyserver to use your HA outside your network
remove SSL and duckdns from homeassistant and move that to the proxyserver.
then make a LOCAL connection from AD to HA and you are internet independant.

Auhh you know what I think I might have figured it out. With the new authentication stuff with HA I was trying somethings out with some settings. I am using hassio and already using nginx proxy but I had put my duckdns url into the ha_url variable in the app daemon config and never switched it back. I bet that was causing the issue. Will let you know if the problem persists. Thanks!

1 Like

Fairly new at HA, but would love to try a proxy server.
Is there a good guide in your opinion on how to set this up.
Thanks

do you use hassio or another way of setup?

If you use hassio I can write up something real quick. Its actually pretty easy.

1 Like

I am using hassio in docker on a NUC with Ubuntu Server 18.04

That would be great. Using hassio in docker on NUC with Ubuntu Server 18.04

Actually even easier this is why I set up this system in the first place and it looks like the developer of konnected already did a write up.

Stupid question from one who gets into a lot of trouble.
Is Nginx outside of the purview of the Ubuntu operating system and docker as well?
I have duckdns already setup, so installing the Nginx proxy will not cause problems for the way my system is setup.

if you have duckdns and SSL inside home assistant then you need to take it out there.
duckdns is a nameserver that translates your router ip to a name, so that doesnt change anything but ssl (letsencrypt) inside HA would cause trouble.