Setting up AppDaemon w/ AIO installer

Hello, I am attempting to install AppDaemon and I’m running into issues. I’m using the AIO installer, letsencrypt, and duck DNS. I’m not entirely sure how to set up the config. I have tried many variations of the config. The only variation I’ve gotten to initialize before disconnecting is this one:

[AppDaemon]
ha_url = https://<myurl>.duckdns.org
ha_key = <mypw>
logfile = STDOUT
errorfile = STDERR
app_dir = 
threads = 10
# Apps
[hello_world]
module = hello
class = HelloWorld

I get the following message every connection attempt:

2017-02-24 17:57:49.119415 INFO Got initial state
2017-02-24 17:57:51.122074 INFO App initialization complete
2017-02-24 17:57:51.963484 WARNING Disconnected from Home Assistant, retrying in 5 seconds

So, I’m shaky on all the letsencrypt stuff. I’m pretty sure that is my problem. I tried adding:

cert_dir = /etc/letsencrypt/live/

I’ve tried other variations of that path with no luck. The install directions are not clear for a person who doesn’t know/understand encryption and its process.

What could I be doing wrong?

Btw, other variations of the ha_url return this error, so I’m pretty sure I have that correct:

2017-02-24 17:32:51.021405 WARNING Unable to connect to Home Assistant, retrying in 5 seconds`

Any help is appreciated.

What version of Home Assistant are you running?

I’m running 0.38.3.

I’ve been looking through appdaemon.py file and noticed a ‘debug’ option for logging. I’ve been trying to turn it on by modifying the config file. Is there anyway to force a reload on the py file after I make modifications?

You can run it with -D DEBUG as one of the parameters.

Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/appdaemon/appdaemon.py", line                                               1361, in run
    ws = create_connection("{}/api/websocket".format(url))
  File "/usr/local/lib/python3.4/dist-packages/websocket/_core.py", line 487                                              , in create_connection
    websock.connect(url, **options)
  File "/usr/local/lib/python3.4/dist-packages/websocket/_core.py", line 211                                              , in connect
    options.pop('socket', None))
  File "/usr/local/lib/python3.4/dist-packages/websocket/_http.py", line 71,                                               in connect
    sock = _open_socket(addrinfo_list, options.sockopt, options.timeout)
  File "/usr/local/lib/python3.4/dist-packages/websocket/_http.py", line 114                                              , in _open_socket
    sock.connect(address)
OSError: [Errno 113] No route to host

Could this have to do with the fact that I’m using letsencrypt? I’m not really sure what to put for the cert_dir. I know the location of the certs on the pi, but none of those directories worked. What exactly does the script look for when using the ‘cert_dir’?

After attempting different ha_url’s, I am convinced I have that correct. The current combination that I have results in the error above. Leading me to believe that this has to do with the self signed certs set up by Letsencrypt. So after some more digging, turns out I was using the wrong key in the config. It should be cert_path. So, i changed to what I believe is the correct path and now I’m getting ‘path does not exist’ errors. Problem is, the path does exist and I’m staring at the file.

cert_path = \etc\letsencrypt\live\<myurl>\fullchain.pem

This is the error now:

  File "/usr/local/lib/python3.4/dist-packages/appdaemon/appdaemon.py", line 1629, in main
    ha_config = ha.get_ha_config()
  File "/usr/local/lib/python3.4/dist-packages/appdaemon/homeassistant.py", line 233, in get_ha_config
    r = requests.get(apiurl, headers=headers, verify=conf.certpath)
  File "/usr/local/lib/python3.4/dist-packages/requests/api.py", line 70, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/local/lib/python3.4/dist-packages/requests/api.py", line 56, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.4/dist-packages/requests/sessions.py", line 488, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.4/dist-packages/requests/sessions.py", line 609, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.4/dist-packages/requests/adapters.py", line 497, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: [Errno 2] No such file or directory

Well, I’m still stuck on this. Turns out the last error was because I wasn’t using forward slashes. Now the current error I am getting is:

  File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py", line 345, in _make_request
    self._validate_conn(conn)
  File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py", line 844, in _validate_conn
    conn.connect()
  File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connection.py", line 326, in connect
    ssl_context=context)
  File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/util/ssl_.py", line 324, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "/usr/lib/python3.4/ssl.py", line 364, in wrap_socket
    _context=self)
  File "/usr/lib/python3.4/ssl.py", line 577, in __init__
    self.do_handshake()
  File "/usr/lib/python3.4/ssl.py", line 804, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)

or

  File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connection.py", line 141, in _new_conn
    (self.host, self.port), self.timeout, **extra_kw)
  File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/util/connection.py", line 83, in create_connection
    raise err
  File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/util/connection.py", line 73, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

I need some clarification on this. What is the typical name of a cert? Don’t most cert’s require a private key to go with them? I’m at a loss all because these certs do not make sense.

Your cert files should be stored like this:

/etc/letsencrypt/live/your.domain.com/fullchain.pem
/etc/letsencrypt/live/your.domain.com/privkey.pem

At first glance, you need to include the port number in the URL.

But do you need encrypted communication between appdaemon and HA. If you are running both on the same machine then this would do the trick

ha_url = http://localhost:8123

which would avoid your data going out over the internet., jand so be much faster and reliable.

Hi,

I’ve tried to install AppDaemon but just as @petro I’m not able to get it running.

I’m running ver 0.4 with AIO in a RPi3 with the latest updates on Raspbian using the url https://192.168.xx.xxx:8123 to access HA internally and https://xxx.duckdns.org from the outside (I cant access ussing xxx.duckdns.org from the inside), with the default port (8123) opened on my router and fowarded to the RPi3, the SSL is from letsEncrypt obtained just as in the @bruhautomation video and the port 443 is remaped to the 8123 on my router

Regarding the appdaemon.cfg file I have tried several config including the last one adviced form @gpbenton but each one leads to different errors reviewed trough the Debug command;

The one suggested from @gpbenton at some point says:

`2017-03-13 00:39:11.875061 INFO AppDaemon Version 1.5.2 starting
2017-03-13 00:39:11.875553 DEBUG get_ha_config()
2017-03-13 00:39:11.994014 WARNING Unable to connect to Home Assistant, retrying in 5 seconds
2017-03-13 00:39:11.994573 WARNING ------------------------------------------------------------
2017-03-13 00:39:11.995009 WARNING Unexpected error:
2017-03-13 00:39:11.995319 WARNING ------------------------------------------------------------
2017-03-13 00:39:12.005235 WARNING Traceback (most recent call last):
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py”, line 600, in urlopen
chunked=chunked)
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py”, line 345, in _make_request
self._validate_conn(conn)
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py”, line 844, in _validate_conn
conn.connect()
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connection.py”, line 342, in connect
_match_hostname(cert, self.assert_hostname or hostname)
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connection.py”, line 352, in _match_hostname
match_hostname(cert, asserted_hostname)
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.py”, line 154, in match_hostname
% (hostname, dnsnames[0]))
requests.packages.urllib3.packages.ssl_match_hostname._implementation.CertificateError: hostname ‘localhost’ doesn’t match ‘xxx.duckdns.org

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.4/dist-packages/requests/adapters.py”, line 423, in send
timeout=timeout
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py”, line 630, in urlopen
raise SSLError(e)
requests.packages.urllib3.exceptions.SSLError: hostname ‘localhost’ doesn’t match ‘xxx.duckdns.org

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.4/dist-packages/appdaemon/appdaemon.py”, line 1629, in main
ha_config = ha.get_ha_config()
File “/usr/local/lib/python3.4/dist-packages/appdaemon/homeassistant.py”, line 233, in get_ha_config
r = requests.get(apiurl, headers=headers, verify=conf.certpath)
File “/usr/local/lib/python3.4/dist-packages/requests/api.py”, line 70, in get
return request(‘get’, url, params=params, **kwargs)
File “/usr/local/lib/python3.4/dist-packages/requests/api.py”, line 56, in request
return session.request(method=method, url=url, **kwargs)
File “/usr/local/lib/python3.4/dist-packages/requests/sessions.py”, line 488, in request
resp = self.send(prep, **send_kwargs)
File “/usr/local/lib/python3.4/dist-packages/requests/sessions.py”, line 609, in send
r = adapter.send(request, **kwargs)
File “/usr/local/lib/python3.4/dist-packages/requests/adapters.py”, line 497, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: hostname ‘localhost’ doesn’t match ‘xxx.duckdns.org

wich I guess gives me the awnser of wich url do I need to use in the ha_url (which is the https://xxxduckdns.org)

So with that in mind if I use that domain I get the following errror;

2017-03-13 00:44:58.851278 INFO AppDaemon Version 1.5.2 starting
2017-03-13 00:44:58.851770 DEBUG get_ha_config()
2017-03-13 00:44:58.958068 WARNING Unable to connect to Home Assistant, retrying in 5 seconds
2017-03-13 00:44:58.958539 WARNING ------------------------------------------------------------
2017-03-13 00:44:58.958855 WARNING Unexpected error:
2017-03-13 00:44:58.959137 WARNING ------------------------------------------------------------
2017-03-13 00:44:58.968993 WARNING Traceback (most recent call last):
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connection.py”, line 141, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/util/connection.py”, line 83, in create_connection
raise err
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/util/connection.py”, line 73, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py”, line 600, in urlopen
chunked=chunked)
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py”, line 345, in _make_request
self._validate_conn(conn)
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py”, line 844, in _validate_conn
conn.connect()
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connection.py”, line 284, in connect
conn = self._new_conn()
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connection.py”, line 150, in _new_conn
self, “Failed to establish a new connection: %s” % e)
requests.packages.urllib3.exceptions.NewConnectionError: <requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x760cff50>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.4/dist-packages/requests/adapters.py”, line 423, in send
timeout=timeout
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py”, line 649, in urlopen
_stacktrace=sys.exc_info()[2])
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/util/retry.py”, line 376, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
requests.packages.urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host=‘xxx.duckdns.org’, port=443): Max retries exceeded with url: /api/config (Caused by NewConnectionError(‘<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x760cff50>: Failed to establish a new connection: [Errno 111] Connection refused’,))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.4/dist-packages/appdaemon/appdaemon.py”, line 1629, in main
ha_config = ha.get_ha_config()
File “/usr/local/lib/python3.4/dist-packages/appdaemon/homeassistant.py”, line 233, in get_ha_config
r = requests.get(apiurl, headers=headers, verify=conf.certpath)
File “/usr/local/lib/python3.4/dist-packages/requests/api.py”, line 70, in get
return request(‘get’, url, params=params, **kwargs)
File “/usr/local/lib/python3.4/dist-packages/requests/api.py”, line 56, in request
return session.request(method=method, url=url, **kwargs)
File “/usr/local/lib/python3.4/dist-packages/requests/sessions.py”, line 488, in request
resp = self.send(prep, **send_kwargs)
File “/usr/local/lib/python3.4/dist-packages/requests/sessions.py”, line 609, in send
r = adapter.send(request, **kwargs)
File “/usr/local/lib/python3.4/dist-packages/requests/adapters.py”, line 487, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host=‘xxx.duckdns.org’, port=443): Max retries exceeded with url: /api/config (Caused by NewConnectionError(‘<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x760cff50>: Failed to establish a new connection: [Errno 111] Connection refused’,))

2017-03-13 00:44:58.970163 WARNING ------------------------------------------------------------
^C2017-03-13 00:44:59.823788 INFO AppDaemon is shutting down
Traceback (most recent call last):
File “/usr/local/bin/appdaemon”, line 9, in
load_entry_point(‘appdaemon==1.5.2’, ‘console_scripts’, ‘appdaemon’)()
File “/usr/local/lib/python3.4/dist-packages/appdaemon/appdaemon.py”, line 1641, in main
time.sleep(5)
File “/usr/local/lib/python3.4/dist-packages/appdaemon/appdaemon.py”, line 162, in handle_sig
ws.close()
AttributeError: ‘NoneType’ object has no attribute ‘close’

In there, the problem I guess is that AD is trying to connect through the 443 port (probably trying to authenticate the cert),

And finally if I force the connection through the port 8123 using ha_url = https://xxx.duckdns.org:8123
I get a similar error as the above;

2017-03-13 00:49:22.761244 INFO AppDaemon Version 1.5.2 starting
2017-03-13 00:49:22.761744 DEBUG get_ha_config()
2017-03-13 00:49:22.780860 WARNING Unable to connect to Home Assistant, retrying in 5 seconds
2017-03-13 00:49:22.781326 WARNING ------------------------------------------------------------
2017-03-13 00:49:22.781650 WARNING Unexpected error:
2017-03-13 00:49:22.781943 WARNING ------------------------------------------------------------
2017-03-13 00:49:22.791080 WARNING Traceback (most recent call last):
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connection.py”, line 141, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/util/connection.py”, line 83, in create_connection
raise err
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/util/connection.py”, line 73, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py”, line 600, in urlopen
chunked=chunked)
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py”, line 345, in _make_request
self._validate_conn(conn)
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py”, line 844, in _validate_conn
conn.connect()
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connection.py”, line 284, in connect
conn = self._new_conn()
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connection.py”, line 150, in _new_conn
self, “Failed to establish a new connection: %s” % e)
requests.packages.urllib3.exceptions.NewConnectionError: <requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7612cf50>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.4/dist-packages/requests/adapters.py”, line 423, in send
timeout=timeout
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py”, line 649, in urlopen
_stacktrace=sys.exc_info()[2])
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/util/retry.py”, line 376, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
requests.packages.urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host=‘xxx.duckdns.org’, port=8123): Max retries exceeded with url: /api/config (Caused by NewConnectionError(‘<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7612cf50>: Failed to establish a new connection: [Errno 111] Connection refused’,))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.4/dist-packages/appdaemon/appdaemon.py”, line 1629, in main
ha_config = ha.get_ha_config()
File “/usr/local/lib/python3.4/dist-packages/appdaemon/homeassistant.py”, line 233, in get_ha_config
r = requests.get(apiurl, headers=headers, verify=conf.certpath)
File “/usr/local/lib/python3.4/dist-packages/requests/api.py”, line 70, in get
return request(‘get’, url, params=params, **kwargs)
File “/usr/local/lib/python3.4/dist-packages/requests/api.py”, line 56, in request
return session.request(method=method, url=url, **kwargs)
File “/usr/local/lib/python3.4/dist-packages/requests/sessions.py”, line 488, in request
resp = self.send(prep, **send_kwargs)
File “/usr/local/lib/python3.4/dist-packages/requests/sessions.py”, line 609, in send
r = adapter.send(request, **kwargs)
File “/usr/local/lib/python3.4/dist-packages/requests/adapters.py”, line 487, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host=‘xxx.duckdns.org’, port=8123): Max retries exceeded with url: /api/config (Caused by NewConnectionError(‘<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7612cf50>: Failed to establish a new connection: [Errno 111] Connection refused’,))

2017-03-13 00:49:22.791680 WARNING ------------------------------------------------------------
^C2017-03-13 00:49:23.384095 INFO AppDaemon is shutting down
Traceback (most recent call last):
File “/usr/local/bin/appdaemon”, line 9, in
load_entry_point(‘appdaemon==1.5.2’, ‘console_scripts’, ‘appdaemon’)()
File “/usr/local/lib/python3.4/dist-packages/appdaemon/appdaemon.py”, line 1641, in main
time.sleep(5)
File “/usr/local/lib/python3.4/dist-packages/appdaemon/appdaemon.py”, line 162, in handle_sig
ws.close()
AttributeError: ‘NoneType’ object has no attribute ‘close’

Probably this last 2 errors are “obvious” as I can’t reach the duckdns URL from the inside as stated before and therefore AD neither, but if I try to put ha_url = https://192.168.xx.xxx:8123 the cert can be validated (which I think is also obvious as the cert is not valid for the internal IP)

2017-03-13 01:14:33.496602 INFO AppDaemon Version 1.5.2 starting
2017-03-13 01:14:33.497734 DEBUG get_ha_config()
2017-03-13 01:14:33.547354 WARNING Unable to connect to Home Assistant, retrying in 5 seconds
2017-03-13 01:14:33.548256 WARNING ------------------------------------------------------------
2017-03-13 01:14:33.548855 WARNING Unexpected error:
2017-03-13 01:14:33.549396 WARNING ------------------------------------------------------------
2017-03-13 01:14:33.559228 WARNING Traceback (most recent call last):
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py”, line 600, in urlopen
chunked=chunked)
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py”, line 345, in _make_request
self._validate_conn(conn)
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py”, line 844, in validate_conn
conn.connect()
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connection.py”, line 326, in connect
ssl_context=context)
File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/util/ssl
.py", line 324, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File “/usr/lib/python3.4/ssl.py”, line 364, in wrap_socket
_context=self)
File “/usr/lib/python3.4/ssl.py”, line 577, in init
self.do_handshake()
File “/usr/lib/python3.4/ssl.py”, line 804, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.4/dist-packages/requests/adapters.py”, line 423, in send
timeout=timeout
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py”, line 630, in urlopen
raise SSLError(e)
requests.packages.urllib3.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.4/dist-packages/appdaemon/appdaemon.py”, line 1629, in main
ha_config = ha.get_ha_config()
File “/usr/local/lib/python3.4/dist-packages/appdaemon/homeassistant.py”, line 233, in get_ha_config
r = requests.get(apiurl, headers=headers, verify=conf.certpath)
File “/usr/local/lib/python3.4/dist-packages/requests/api.py”, line 70, in get
return request(‘get’, url, params=params, **kwargs)
File “/usr/local/lib/python3.4/dist-packages/requests/api.py”, line 56, in request
return session.request(method=method, url=url, **kwargs)
File “/usr/local/lib/python3.4/dist-packages/requests/sessions.py”, line 488, in request
resp = self.send(prep, **send_kwargs)
File “/usr/local/lib/python3.4/dist-packages/requests/sessions.py”, line 609, in send
r = adapter.send(request, **kwargs)
File “/usr/local/lib/python3.4/dist-packages/requests/adapters.py”, line 497, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)

2017-03-13 01:14:33.566658 WARNING ------------------------------------------------------------
^C2017-03-13 01:14:34.493885 INFO AppDaemon is shutting down
Traceback (most recent call last):
File “/usr/local/bin/appdaemon”, line 9, in
load_entry_point(‘appdaemon==1.5.2’, ‘console_scripts’, ‘appdaemon’)()
File “/usr/local/lib/python3.4/dist-packages/appdaemon/appdaemon.py”, line 1641, in main
time.sleep(5)
File “/usr/local/lib/python3.4/dist-packages/appdaemon/appdaemon.py”, line 162, in handle_sig
ws.close()
AttributeError: ‘NoneType’ object has no attribute ‘close’

So the only “problem” in which I can think is that as I installed AD in a different folder that HA and with a different user (because HA is installed through venv through the AIO and AD was installed from the “pi” user with pip3) AD its being unable to authenticate the SSL cert; If that’s the case does anyone knows how to fix this? Or can someone please help with another solution?

Thanks

If you are connecting internally, you will not be using encryption, so your url protocol should not include an s. So try

http://<your_internal_ip>:8123

(not https)

Edit:
I see now that your first post indicates that you are using https internally, which would mean you have different security certificates for local connections? At which point I’m stuck.

Thanks for your quick reply,
I actually forgot to mention that possibility that I already tried but also pumps an error saying “connection reset by peer” and in fact I’m not able never to connect HA from that URL (http://192.168.xx.xxx), the error is the following;

2017-03-13 01:57:10.900641 INFO AppDaemon Version 1.5.2 starting
2017-03-13 01:57:10.901131 DEBUG get_ha_config()
2017-03-13 01:57:10.918416 WARNING Unable to connect to Home Assistant, retrying in 5 seconds
2017-03-13 01:57:10.918898 WARNING ------------------------------------------------------------
2017-03-13 01:57:10.919208 WARNING Unexpected error:
2017-03-13 01:57:10.919488 WARNING ------------------------------------------------------------
2017-03-13 01:57:10.931111 WARNING Traceback (most recent call last):
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py”, line 600, in urlopen
chunked=chunked)
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py”, line 386, in _make_request
six.raise_from(e, None)
File “”, line 2, in raise_from
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py”, line 382, in _make_request
httplib_response = conn.getresponse()
File “/usr/lib/python3.4/http/client.py”, line 1172, in getresponse
response.begin()
File “/usr/lib/python3.4/http/client.py”, line 351, in begin
version, status, reason = self._read_status()
File “/usr/lib/python3.4/http/client.py”, line 313, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), “iso-8859-1”)
File “/usr/lib/python3.4/socket.py”, line 371, in readinto
return self._sock.recv_into(b)
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.4/dist-packages/requests/adapters.py”, line 423, in send
timeout=timeout
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py”, line 649, in urlopen
_stacktrace=sys.exc_info()[2])
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/util/retry.py”, line 347, in increment
raise six.reraise(type(error), error, _stacktrace)
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/packages/six.py”, line 685, in reraise
raise value.with_traceback(tb)
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py”, line 600, in urlopen
chunked=chunked)
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py”, line 386, in _make_request
six.raise_from(e, None)
File “”, line 2, in raise_from
File “/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/connectionpool.py”, line 382, in _make_request
httplib_response = conn.getresponse()
File “/usr/lib/python3.4/http/client.py”, line 1172, in getresponse
response.begin()
File “/usr/lib/python3.4/http/client.py”, line 351, in begin
version, status, reason = self._read_status()
File “/usr/lib/python3.4/http/client.py”, line 313, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), “iso-8859-1”)
File “/usr/lib/python3.4/socket.py”, line 371, in readinto
return self._sock.recv_into(b)
requests.packages.urllib3.exceptions.ProtocolError: (‘Connection aborted.’, ConnectionResetError(104, ‘Connection reset by peer’))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.4/dist-packages/appdaemon/appdaemon.py”, line 1629, in main
ha_config = ha.get_ha_config()
File “/usr/local/lib/python3.4/dist-packages/appdaemon/homeassistant.py”, line 233, in get_ha_config
r = requests.get(apiurl, headers=headers, verify=conf.certpath)
File “/usr/local/lib/python3.4/dist-packages/requests/api.py”, line 70, in get
return request(‘get’, url, params=params, **kwargs)
File “/usr/local/lib/python3.4/dist-packages/requests/api.py”, line 56, in request
return session.request(method=method, url=url, **kwargs)
File “/usr/local/lib/python3.4/dist-packages/requests/sessions.py”, line 488, in request
resp = self.send(prep, **send_kwargs)
File “/usr/local/lib/python3.4/dist-packages/requests/sessions.py”, line 609, in send
r = adapter.send(request, **kwargs)
File “/usr/local/lib/python3.4/dist-packages/requests/adapters.py”, line 473, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: (‘Connection aborted.’, ConnectionResetError(104, ‘Connection reset by peer’))

2017-03-13 01:57:10.932365 WARNING ------------------------------------------------------------
^C2017-03-13 01:57:11.560910 INFO AppDaemon is shutting down
Traceback (most recent call last):
File “/usr/local/bin/appdaemon”, line 9, in
load_entry_point(‘appdaemon==1.5.2’, ‘console_scripts’, ‘appdaemon’)()
File “/usr/local/lib/python3.4/dist-packages/appdaemon/appdaemon.py”, line 1641, in main
time.sleep(5)
File “/usr/local/lib/python3.4/dist-packages/appdaemon/appdaemon.py”, line 162, in handle_sig
ws.close()
AttributeError: ‘NoneType’ object has no attribute ‘close’

Reason why I think the correct way is using the duckdns address, just that AD is not being able to authenticate the cert.

But definetly I could be wrong

I never got this working with DNS. I gave up as no one was able to provide a solution. The nail in the coffin was a reply from a user stating “Must be a router setting”. I then asked what I should research up on for my router and got a ‘what router are you using’ response instead of a concrete “look up this” answer. From that point forward the thread went dark. I can tell you, as soon as I turned off the the DNS ability in Hass, AppDaemon worked as expected with my internal IP & port. I don’t use AppDaemon because of this. I need to be able to access Hass from an outside source. Until we can have both, AppDaemon loses. To be honest, I don’t understand why there isn’t an API inside the Hass environment.

The thread went dark because you didn’t help anyone to help you. Its different for every router.

Go and look for NAT Hairpinning that is the area we were suggesting you had an issue.

There is, it’s here:

I wrote AppDaemon to be more approachable however YMMV.

This typically means you are trying to connect to the wrong port. You are right though, ifg you have HA SSL secured, ytou must use the duckdns address, and your router needs to be able to understand that it needs to route the external IP back internally. Most routers will do this automatically.

Thanks.

And to address your curt response, I’d like to point out that this is the first mention of ‘hairpinning’ in the 2 threads I created.

This was our last correspondence:

petro15d
I understand what you are saying but I do not know how to execute that. What phrases should I google to find out how to create this route?

Reply

aimc15d
What type of router do you have?

Reply

petro15d
Its a linksys smart WIFI, one of those cloud based ones. It's got a nice UI but that's about it. I am limited with its functionality. I was toying with the idea of putting ddwrt on it but, ddwrt appears to not support my model number. I can port forward single ports and forward ranges. I see a section for static routing but I have never done that. I assume that's what I would do... just don't want to change settings before making sure that is the solution.

I’m sorry if I made you feel offended with my response to oliverhg1, but you need to understand that I did not get answers to fix the problem.

OK, sorry if I missed you postring your router type.

There is some info here that may be relevant:

To be clear, try the following steps to diagnose where the issue is.

  1. Verify that you can access home assistant from your browser externally (e.g. from a phone not on your wifi) using the duck DNS URL with no port
  2. Verify that you can access home assistant from on your network, using the DuckDNS URL with no port

If both of the above work, configure the Home Assistant URL in AppDaemon to use the duckDNS URL with no port and it should work OK.

If not then I am not sure what is going on.

Yeah, after doing some quick searches, its clear that any Linksys Smart Wifi router cannot handle NAT looping. Thanks for the help. Looks like ill investigate the API. Sorry for my behavior, I should have approached the situation differently instead of passive aggressively mentioning the past thread in this one.